Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
e6eccb1
[REFACTORY]
sgoia May 10, 2021
a83fc8b
[NEW / ADD + UPDATE + REFACTORY]
sgoia May 10, 2021
1fb8f03
[REFACTORY + UPDATE]
sgoia May 10, 2021
d6ef675
[UPDATE]
sgoia May 10, 2021
491b76f
Merge branch 'master' of https://github.com/bepronetwork/bepro-js int…
sgoia May 10, 2021
ceb8537
[last merge BUGFIX]
sgoia May 10, 2021
ca5bb54
[dummy] build files commit
sgoia May 13, 2021
0deac69
Merge branch 'master' of https://github.com/bepronetwork/bepro-js int…
sgoia May 13, 2021
ee5d753
[BUGFIX]
sgoia May 14, 2021
d754eef
Merge branch 'master' of https://github.com/bepronetwork/bepro-js int…
sgoia May 18, 2021
24b3ad0
[FIX]
sgoia May 19, 2021
07db2ae
[REFACTORY]
sgoia May 20, 2021
c3ae951
[HOTFIX]
sgoia May 20, 2021
5ea6f16
first commit
Ruiub3i May 24, 2021
12520e1
Update Application.js
Ruiub3i May 24, 2021
c13ef36
add build to pre-commit
Ruiub3i May 25, 2021
e734a45
Merge branch 'master' of https://github.com/betprotocol/bepro-js
Ruiub3i May 25, 2021
197c177
add build to pre-commit
Ruiub3i May 25, 2021
7847e7f
add new documentation
Ruiub3i May 25, 2021
6359308
add new documentation
Ruiub3i May 25, 2021
9b3d6c4
Merge branch 'master' of https://github.com/bepronetwork/bepro-js int…
sgoia May 25, 2021
282edb4
document IContract.js
moshmage May 10, 2021
822603d
documents Network.js
moshmage May 11, 2021
3d04ea8
fix a missing comma on Network.js
moshmage May 11, 2021
afffcad
nudges network, real5r and icontract
moshmage May 11, 2021
f882853
I got tired of making a commit for each file ^^'
moshmage May 11, 2021
fa1513f
introduce a typedef example
moshmage May 11, 2021
9b3ed8c
check if we need {} on the return statement
moshmage May 11, 2021
3666348
add typedef to the more lengthy return types
moshmage May 12, 2021
efdf077
adds logo to the jsdoc
moshmage May 12, 2021
51c8dd8
changes the description of getProducts because its name is misleading
moshmage May 12, 2021
0cf3865
rebase with master
moshmage May 12, 2021
ab83f53
adds gh-pages and npmignore
moshmage May 12, 2021
793bc49
adds build and docs folder to git ignore
moshmage May 12, 2021
db61802
try stuff
moshmage May 12, 2021
9476676
trigger a new build on the pr
moshmage May 12, 2021
01cbc6d
breaks github actions into build and deploy workflows
moshmage May 12, 2021
dec28f5
fixes eslint because eslint was merged without being tested, clearly
moshmage May 14, 2021
0bd4a34
typedefs all the class constructors
moshmage May 18, 2021
ef22e5c
adds publish-package.yml workflow that will npm publish when a releas…
moshmage May 25, 2021
450f144
add npm run build do publish workflow so we have something to publish
moshmage May 26, 2021
8c359a1
Merge pull request #47 from moshmage/fix/model-docs
Ruiub3i May 26, 2021
79d0bf6
update tests
Ruiub3i May 26, 2021
5af956b
add post-install script that checks for build folder and builds the l…
moshmage May 26, 2021
b55a382
Merge pull request #65 from moshmage/hotfix/add-postinstall-script
Ruiub3i May 26, 2021
ff2d12f
adding string support for DexStorage based on IPFS
Ruiub3i May 26, 2021
db05212
adding string support for DexStorage based on IPFS
Ruiub3i May 26, 2021
3ec317f
adding string support for DexStorage based on IPFS
Ruiub3i May 26, 2021
8e1600a
add ipfs
Ruiub3i May 27, 2021
61afdae
add ipfs
Ruiub3i May 27, 2021
46476ba
remove build
Ruiub3i May 27, 2021
c5eadb1
remove build & docs
Ruiub3i May 27, 2021
010a792
Merge branch 'master' into ipfs-integration
Ruiub3i May 27, 2021
037119e
remove build & docs
Ruiub3i May 27, 2021
9ce9e88
Merge branch 'ipfs-integration' of https://github.com/betprotocol/bep…
Ruiub3i May 27, 2021
cd8ab2a
remove unit tests cache
Ruiub3i May 27, 2021
78f1b14
Merge pull request #66 from bepronetwork/ipfs-integration
Ruiub3i May 27, 2021
17ca82c
update modules
Ruiub3i May 27, 2021
8c46042
remove console logs
Ruiub3i May 27, 2021
42fe019
Merge branch 'master' of https://github.com/bepronetwork/bepro-js int…
sgoia May 27, 2021
b264996
[FIX]
sgoia May 28, 2021
5a2bff8
fix build
Ruiub3i May 28, 2021
f0170c1
remove xunit
Ruiub3i May 28, 2021
b27df53
remove logs from ganache
Ruiub3i May 28, 2021
a848b8d
add exit to mocha
Ruiub3i May 28, 2021
499eeeb
[REFACTORY]
sgoia May 28, 2021
630769f
update circleci config
Ruiub3i May 28, 2021
f558da3
update circleci config
Ruiub3i May 28, 2021
db47998
update circleci config
Ruiub3i May 28, 2021
b344b7f
update circleci config
Ruiub3i May 28, 2021
a896777
Merge pull request #68 from bepronetwork/fix-build
Ruiub3i May 28, 2021
8ec8b66
[REFACTORY]
sgoia May 28, 2021
7f4c69d
add unit tests
Ruiub3i May 28, 2021
9ea2f83
Merge pull request #45 from sgoia/i19-rm-getcontract-func
Ruiub3i May 28, 2021
848540d
remove exchange
Ruiub3i May 28, 2021
c9c1d2a
remove exchange
Ruiub3i May 28, 2021
01ed0ec
update
Ruiub3i May 28, 2021
9db29bc
remove logs
Ruiub3i May 28, 2021
511d61b
Merge pull request #70 from bepronetwork/fix-build
Ruiub3i May 28, 2021
51eee58
add voting Smart Contract
Ruiub3i May 29, 2021
85fcaf8
fix: quick jsdocs updates
Jun 1, 2021
f73f6ed
Merge pull request #73 from nodexchange/bugfix/issue-71-links-and-nam…
Ruiub3i Jun 1, 2021
6788047
remove logs again
Ruiub3i Jun 1, 2021
d146892
add network features
Ruiub3i Jun 1, 2021
9d9a7a2
add network features
Ruiub3i Jun 1, 2021
6a2428c
update bepro network unit tests
Ruiub3i Jun 1, 2021
14b5b47
remove duplicate
Ruiub3i Jun 1, 2021
96fe030
remove duplicate
Ruiub3i Jun 1, 2021
f344219
add direct import structure to require
Ruiub3i Jun 1, 2021
45dcdc0
1.2.6
Ruiub3i Jun 1, 2021
11ba221
force new build
Ruiub3i Jun 1, 2021
3bcd1ca
update
Ruiub3i Jun 1, 2021
8be02ab
Merge pull request #74 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
4313f53
network update documentation
Ruiub3i Jun 1, 2021
ce0a1e4
update
Ruiub3i Jun 1, 2021
6518598
Merge pull request #75 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
aa3cedc
update
Ruiub3i Jun 1, 2021
7e896d1
add new build
Ruiub3i Jun 1, 2021
fa224c1
Merge pull request #76 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
601bfc8
update
Ruiub3i Jun 1, 2021
ee7e22b
Merge pull request #77 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
b529d02
network update
Ruiub3i Jun 1, 2021
c2407be
Merge pull request #78 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
20e521c
network update
Ruiub3i Jun 1, 2021
d2b3d0b
network update
Ruiub3i Jun 1, 2021
938346f
Merge pull request #79 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
d032184
small change to ERC721Factory
Ruiub3i Jun 1, 2021
3204a64
1.2.7
Ruiub3i Jun 1, 2021
364dd6c
new npm version
Ruiub3i Jun 1, 2021
5f4bdc3
Merge pull request #80 from bepronetwork/new_build
Ruiub3i Jun 1, 2021
0135d91
standar object update
Ruiub3i Jun 3, 2021
18c109b
Fix Network __assert when test = false
andrefcgoncalves Jun 3, 2021
ccd27c6
fix
Ruiub3i Jun 4, 2021
893bb55
Merge pull request #83 from andrefcgoncalves/master
Ruiub3i Jun 4, 2021
9a4e56e
Update Network.js
Ruiub3i Jun 4, 2021
cf5bc4e
update network object
Ruiub3i Jun 8, 2021
d384472
update npm package version
Ruiub3i Jun 8, 2021
4b74021
Merge branch 'master' of https://github.com/betprotocol/bepro-js
Ruiub3i Jun 8, 2021
a86ed6e
update npm package version
Ruiub3i Jun 8, 2021
889d2f1
change open issue
Ruiub3i Jun 9, 2021
17f1c82
Merge pull request #84 from bepronetwork/new_build
Ruiub3i Jun 9, 2021
4616162
update contract network after red4sec review
Ruiub3i Jun 10, 2021
742979f
Merge branch 'master' of https://github.com/betprotocol/bepro-js
Ruiub3i Jun 10, 2021
818c66e
add waiting time for proposemerges
Ruiub3i Jun 11, 2021
23c8b9f
update
Ruiub3i Jun 15, 2021
5ce5134
add voting contract unit tests (basic)
Ruiub3i Jun 17, 2021
4b9e399
add correct comments
Ruiub3i Jun 17, 2021
70cfe91
add auto compile truffle
Ruiub3i Jun 17, 2021
ec85a07
update network object
Ruiub3i Jun 18, 2021
dc8168c
update Network getIssueById info
Ruiub3i Jun 18, 2021
426efe5
update
Ruiub3i Jun 18, 2021
58fdadb
add login to sub objects
Ruiub3i Jun 19, 2021
d38ed53
1.2.8
Ruiub3i Jun 19, 2021
b0559ce
change to cid
Ruiub3i Jun 22, 2021
f4c10ec
add web3 getWeb3()
Ruiub3i Jun 26, 2021
025609d
update
Ruiub3i Jun 26, 2021
35ea6f0
update network contract with latest red4sec udpate
Ruiub3i Jun 28, 2021
46c3ceb
add new get
Ruiub3i Jul 27, 2021
b7292ef
add oracles staked function
Ruiub3i Jul 28, 2021
d58f220
add oracles staked function
Ruiub3i Jul 28, 2021
2e8e097
add oracles staked function
Ruiub3i Jul 28, 2021
bfd9a63
add oracles staked function
Ruiub3i Jul 28, 2021
7831bae
new update on tokens unlock function
Ruiub3i Jul 29, 2021
80f5839
add redeem
Ruiub3i Jul 29, 2021
b92ff19
add delegate public
Ruiub3i Jul 29, 2021
b90f97b
add dispute function to js
Ruiub3i Jul 31, 2021
475cb31
isIsue in draft update
Ruiub3i Aug 1, 2021
2af0a7e
correct logic isIssueInDraft
Ruiub3i Aug 1, 2021
3eb5bbc
correct logic isIssueInDraft
Ruiub3i Aug 1, 2021
41a1a0a
update
Ruiub3i Aug 1, 2021
92b3392
update functions
Ruiub3i Aug 2, 2021
d356f60
update
Ruiub3i Aug 3, 2021
11111d7
add new amounts on proposeMerge
Ruiub3i Aug 3, 2021
dfa9345
add new amounts on proposeMerge
Ruiub3i Aug 3, 2021
26b4374
chang error message
Ruiub3i Aug 4, 2021
0b96730
chang error message
Ruiub3i Aug 4, 2021
ac52c82
solve PRAmounts call
Ruiub3i Aug 4, 2021
73e4764
update last version of Network.sol
Ruiub3i Aug 5, 2021
5c26d1b
add get functions
Ruiub3i Aug 5, 2021
e1bc3dc
update truffle bins
Ruiub3i Aug 5, 2021
cc9312c
add deps
Ruiub3i Aug 5, 2021
b0e47ac
update es2015
Ruiub3i Aug 5, 2021
f1f412b
update gas amounts
Ruiub3i Aug 5, 2021
7a21cf1
update gas amounts
Ruiub3i Aug 6, 2021
be4c378
update
Ruiub3i Aug 6, 2021
ce68241
add change council amount function
moshmage Aug 20, 2021
de4bdf1
wrong Number function used, should have used toSmartContractDecimals
moshmage Aug 20, 2021
f8faa50
remove default value from function call and properly type the entry p…
moshmage Aug 20, 2021
a2fe2b9
Merge pull request #92 from moshmage/chore/add-change-council
moshmage Aug 20, 2021
ee811b9
update settler amount
Ruiub3i Aug 23, 2021
2e1f026
solve council situation
Ruiub3i Aug 23, 2021
0322ef5
update
Ruiub3i Aug 23, 2021
ab1e78b
update network contract.sol
Ruiub3i Sep 2, 2021
7331104
test fix
Ruiub3i Sep 14, 2021
23dda7c
test fix 2
Ruiub3i Sep 14, 2021
c7e67bd
test fix 3
Ruiub3i Sep 14, 2021
65bca2e
test fix 3
Ruiub3i Sep 14, 2021
c02987a
more information
Ruiub3i Sep 14, 2021
04fc8d2
Merge pull request #97 from bepronetwork/hot-fix-staking
Ruiub3i Sep 14, 2021
f12b47c
add issue resolved flag
Ruiub3i Sep 17, 2021
c992eb5
add issue resolved flag
Ruiub3i Sep 17, 2021
ced6849
Merge branch 'master' of https://github.com/betprotocol/bepro-js
Ruiub3i Sep 17, 2021
2b30592
add await bug
Ruiub3i Sep 20, 2021
abd29b4
solve staking mechanism, add network factory smart contract
Ruiub3i Sep 22, 2021
9d6161a
update gas prices
Ruiub3i Sep 24, 2021
abfe476
recognize as Finished
Ruiub3i Sep 27, 2021
d0385b8
update call for bepro-js
Ruiub3i Sep 27, 2021
10258dd
update call for bepro-js
Ruiub3i Sep 28, 2021
35eb4c9
add updates based on certik audit
Ruiub3i Oct 8, 2021
0ba7a65
add loadData
Ruiub3i Oct 13, 2021
2c4ae65
add loadData
Ruiub3i Oct 13, 2021
d70cf6a
remove array from events
Ruiub3i Oct 20, 2021
d3201fd
Merge branch 'master' into real-fvr
Quicksaver Nov 4, 2021
cc64577
Unlock node version and commit yarn.lock
Quicksaver Nov 4, 2021
0699718
Ignore OS files
Quicksaver Nov 4, 2021
bbd1160
Revert gasPrices
Quicksaver Nov 4, 2021
eb493f2
Export contracts
Quicksaver Nov 4, 2021
ff91e9c
Update Network.sol
Ruiub3i Nov 4, 2021
3c20030
Upgrade babel and eslint
Quicksaver Nov 9, 2021
340d587
Add missing dependency
Quicksaver Nov 9, 2021
86cc1b2
Fix build
Quicksaver Nov 10, 2021
f1e4a0f
Ignore built flag
Quicksaver Nov 10, 2021
99adac8
Merge pull request #1 from bepronetwork/master
Quicksaver Nov 10, 2021
1d39526
Merge branch 'real-fvr-luis' of https://github.com/RealFevr/bepro-js …
Quicksaver Nov 10, 2021
3c9889b
Only start web3Connection if needed, but ensure it does
Quicksaver Nov 10, 2021
01c8aed
Initialize ERC20 in MarketplaceRealFvr only if necessary
Quicksaver Nov 10, 2021
759b45e
Nomenclature consistency
Quicksaver Nov 10, 2021
f93ae03
Proper estimate gas + allow for gasFactor multiplier
Quicksaver Nov 10, 2021
28ae667
Accept any web3 provider with assumed connection
Quicksaver Nov 11, 2021
e2ca377
Cleanup
Quicksaver Nov 11, 2021
109e8c2
Bugfix use correct decimals in buy method
Quicksaver Nov 11, 2021
a5832f4
Bugfix estimateGas
Quicksaver Nov 11, 2021
6dad431
Add balanceOf to ERC721Collectibles
Quicksaver Nov 11, 2021
04b5f60
Merge pull request #2 from RealFevr/real-fvr-luis
Quicksaver Nov 15, 2021
4ffa921
Cleanup Readme
Quicksaver Nov 15, 2021
d8cc91d
Update README.md
Quicksaver Nov 15, 2021
2687599
Update README.md
Quicksaver Nov 15, 2021
8429021
Fix production build and upgrade dependencies
Quicksaver Nov 17, 2021
86ec55d
Implement nextGasLimit and nextGasPrice
Quicksaver Nov 24, 2021
cdc2578
Add ability to override gasAmount per transaction
Quicksaver Nov 26, 2021
10b49ef
Lint
Quicksaver Nov 26, 2021
6189049
Attempt compatibility with walletconnect web3 provider assuming value…
Quicksaver Dec 2, 2021
02c10a0
Apply previous bugfix to estimateGas as well
Quicksaver Dec 2, 2021
29a2786
One more try at walletconnect compat
Quicksaver Dec 2, 2021
49ce509
Revert "One more try at walletconnect compat"
Quicksaver Dec 2, 2021
66850dc
Revert "Apply previous bugfix to estimateGas as well"
Quicksaver Dec 2, 2021
7549ee9
Revert "Attempt compatibility with walletconnect web3 provider assumi…
Quicksaver Dec 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
15 changes: 1 addition & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
executors:
node:
docker:
- image: circleci/node:8.12.0
- image: cimg/node:16.2.0
- image: trufflesuite/ganache-cli
# environment:
# FOOD: $BAR
Expand All @@ -30,9 +30,6 @@ commands:
- run:
name: install [email protected] globally
command: sudo npm install -g --unsafe-perm=true [email protected]
- run:
name: install repo's node modules
command: npm install
- save_cache:
key: *node_cache_key
paths:
Expand All @@ -44,16 +41,6 @@ jobs:
steps:
- prepare_code
- run: mkdir ~/reports
- run:
name: tests
command: npm run test
environment:
MOCHA_FILE: ~/reports/results.xml
when: always
- store_test_results:
path: ~/reports
- store_artifacts:
path: ~/reports

workflows:
code-checks:
Expand Down
17 changes: 0 additions & 17 deletions .eslintrc

This file was deleted.

26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": [
"airbnb-base"
],

"globals": {
"window": true
},

"parser": "@babel/eslint-parser",

"root": true,

"rules": {
"camelcase": 0,
"max-len": ["warn", 120, 2, {
"ignoreUrls": true,
"ignoreComments": false,
"ignoreRegExpLiterals": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}],
"no-prototype-builtins": 0,
"no-underscore-dangle": 0
}
}
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.12.0]
node-version: [14.17.0]
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ matrix.node-version }}
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: GitHub pages

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Fool GH Pages?
run: mkdir docs

- name: Build
uses: andstor/jsdoc-action@v1
with:
source_dir: ./src
recurse: true
config_file: docs-src/jsdoc.json
template: better-docs

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs
24 changes: 24 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Package

on:
release:
types:
- created

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 8

- name: build
run: npm run build

- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}

9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
node_modules
/node_modules
node_modules/
.env
package-lock.json
.idea
xunit.xml
build/
/docs
.DS_Store

/built
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
/node_modules
.env
.circleci/
.github/
_book/
docs/
.idea

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.12.0
v14.17.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y -q --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 8.12.0
ENV NODE_VERSION 14.17.0

# Install nvm with node and npm
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.24.1/install.sh | bash \
Expand Down
135 changes: 109 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@


![alt tag](https://uploads-ssl.webflow.com/5fc917a7914bf7aa30cae033/5ff4e84c73f45881c8b9cd85_Logo-purple-dark-background-p-500.png)
=========
# ![alt tag](https://uploads-ssl.webflow.com/5fc917a7914bf7aa30cae033/5ff4e84c73f45881c8b9cd85_Logo-purple-dark-background-p-500.png)

![Python](https://img.shields.io/badge/python-v2.7+-blue.svg)
![Build Status](https://github.com/bepronetwork/bepro-js/actions/workflows/build.yml/badge.svg
)
![Build Status](https://github.com/bepronetwork/bepro-js/actions/workflows/build.yml/badge.svg)
![Dependencies](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)
[![GitHub issues](https://img.shields.io/github/issues/bepronetwork/bepro-js.svg)](https://GitHub.com/bepronetwork/bepro-js/issues/)
![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)


## Introductions

Build the future of DeFi Gaming

## Installation
Expand All @@ -27,6 +23,7 @@ $ npm i bepro-js
Before try to install, make sure your working directory has `Python 2` and the recommended `NVM` version setted on. To do, so:

1. Setting of Python 2:

```bash
// Install it via bash terminal globally
$ sudo apt install python2
Expand All @@ -53,12 +50,13 @@ $ npm config set python python
```

2. Setting of Node:

```bash
// Install NVM recommended version for bepro-js
$ nvm install 8.12.0
$ nvm install 14.17.0

// Set it on the working directory
$ nvm alias default v8.12.0
$ nvm alias default v14.17.0

// Use the settled as default
$ nvm use default
Expand All @@ -81,28 +79,29 @@ Now, your work directory is able to install and run bepro-js.
sudo curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
```

**Notice**:If you already have Docker installed, this script can cause trouble. If you installed the current Docker package using this script and are using it again to update Docker. Or use official installation instructions: [Mac](https://docs.docker.com/docker-for-mac/install/), [Windows](https://docs.docker.com/docker-for-windows/install/), [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/), [Other](https://docs.docker.com/install/#supported-platforms).
**Notice**: If you already have Docker installed, this script can cause trouble. If you installed the current Docker package using this script and are using it again to update Docker. Or use official installation instructions: [Mac](https://docs.docker.com/docker-for-mac/install/), [Windows](https://docs.docker.com/docker-for-windows/install/), [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/), [Other](https://docs.docker.com/install/#supported-platforms).

##### Docker Compose:

For linux:

```shell script
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
```

For Mac or Windows take a look on: [official guides](https://docs.docker.com/compose/install/#install-compose).

### Running containers

You can use docker-compose directly, or the nifty ``make`` that comes bundled.

You can use docker-compose directly, or the nifty `make` that comes bundled.

#### Build images

```shell script
make build
```

#### Starting containers in background:
#### Starting containers in background:

```shell script
make up
Expand Down Expand Up @@ -132,39 +131,123 @@ make down
docker-compose up
```

## Documentation

Full API docs can be found at https://bepronetwork.github.io/bepro-js/

## Usage

https://bepronetwork.github.io/bepro-js/
### Initialization

```javascript
#### Via WEB3_LINK from any Web3 Provider

/* Note : WEB3_LINK should be get from Infura/Quicknode or any other Web3 Provider - ETH, BSC, Moonbeam and others are supported */
Note: `WEB3_LINK` should be get from Infura/Quicknode or any other Web3 Provider - ETH, BSC, Moonbeam and others are supported

```javascript
import {
Application, DexStorage, ERC20Contract, StakingContract,
ERC20TokenLock, ERC721Collectibles, ERC721Standard
} from 'bepro-js';

/* 1.1 - Instantiate the App for Metamask functionality (MAINNET) */
let app = new Application({
opt: { web3Connection: 'WEB3_LINK' },
});

/* 1.2 - Instantiate StakingContract Object or any other in a similar way (Staking, ERC20 etc..) */
// - MAINNET
let staking = new StakingContract({
contractAddress: null, /* Contract Address (optional) */
opt: { web3Connection: 'WEB3_LINK' },
});

// - TEST net e.g. Rinkeby
let stakingTest = new StakingContract({
test: true,
contractAddress: null, /* Contract Address (optional) */
});

/* 2 - Connect the App/Contract to the Metamask Web3 Injected wallet*/
await app.login();
await staking.login();
/* or instantiate with the provided web3Connection, for tests it was already done at object creation */
await app.start();
await staking.start();
```

import moment from 'moment';
import { Application } from 'bepro-js';
#### Via leveraged Web3 Provider

/* 1 - Instantiate the App with the Infura/Web3 Connection */
let app = new Application({opt : {web3Connection : 'WEB3_LINK'}});
Application can be initialized with a web3 provider directly, but all connection login is assumed to be on the consumer side in this case; i.e. no need to call start() or login(), that logic should be handled separately within the provider itself or by the consumer.

/* 2 - Connect the App to the Metamask Web3 Injected wallet*/
await app.login();
/* or instantiate with the provided web3Connection */
await app.start()
```javascript
// Use Metamask's provider, could be any other compatible Web3 Provider object from any other lib
let app = new Application({ opt: { provider: window.ethereum } });
```

/* 3 - Generate a Object (Staking, ERC20 etc..) */
let staking = app.getStakingContract({contractAddress : /* Contract Address (optional) */});
### Asserting and Deploying contracts

```javascript
/* 4 - Assert all object data */
await staking.__assert();
await stakingTest.__assert();
/* or deploy the contract*/
await staking.deploy();
await stakingTest.deploy();
```

### Accessing methods

```javascript
/* 5 - Access other Methods */
await staking.availableTokens();
await stakingTest.availableTokens();
```

### Gas Fees

Transaction fees are automatically calculated via web3's own estimation methods.

In order to overestimate and avoid out-of-gas transaction errors if necessary, we can pass a second argument with certain parameters to most Contract methods that involve `send` transactions (those requiring gas):

```javascript
staking.subscribeProduct(
{ address, product_id, amount },
{
gasAmount: 201654, // override the estimated gas fee for this method
gasFactor: 1.2, // applied to every calculated or given gas amount, including the gasAmount from this object if passed
gasPrice: '5000000000', // override the network's default gas price
},
);
```

In particular, `gasFactor` is a parameter that can be passed when instantiating the contract, so that gas estimations for every method called on that contract instance will have that factor applied:

```javascript
let staking = new StakingContract({
contractAddress,
gasFactor: 1.25 // default 1
opt: { provider },
});

// The following will have a gasFactor of 1.25
staking.subscribeProduct({ address, product_id, amount });

// We can still override it per-method, and pass other parameters as well.
staking.subscribeProduct(
{ address, product_id, amount },
{
gasAmount: 201654,
gasFactor: 1.2,
},
);
```

Estimated gas fees leverage the following web3 functionalities:
- [chain's getGasPrice()](https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#getgasprice)
- [contract method's estimateGas()](https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html?highlight=estimateGas#methods-mymethod-estimategas)

## Contribution

Contributions are welcomed but we ask to red existing code guidelines, specially the code format. Please review [Contributor guidelines][1]

## License
Expand Down
Loading