Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge the develop branch to the master branch, preparation to v2.3.0 #186

Merged
merged 235 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
87b7a78
Add `mintReward()`, `stake()`, `withdraw()` into ERC677BridgeToken
varasev Dec 26, 2018
60644ad
Add `ERC677BridgeTokenRewardable` contract
varasev Dec 26, 2018
94947eb
Update BridgeValidator to support linked-list
fernandomg Dec 26, 2018
9f8b18c
Add/Update tests for BridgeValidator
fernandomg Dec 26, 2018
eb9e9bf
Fix tests that initialize `BridgeValidator`
fernandomg Dec 26, 2018
bc289bd
Add `DEPLOY_REWARDABLE_TOKEN` and `VALIDATOR_SET_ADDRESS` config options
varasev Dec 27, 2018
47f766b
Validate new config variables
varasev Dec 27, 2018
058335f
Add `_reward` param to `addValidator` method
fernandomg Dec 27, 2018
9d21972
Fix/Add `require`s for `validator` and `reward` addresses
fernandomg Dec 27, 2018
e25f0ff
Extend BridgeValidators interface and make F_ADDR public
fernandomg Dec 27, 2018
c43f117
Add/Extend BridgeValidators tests
fernandomg Dec 27, 2018
45a094f
Extend poa20 tests
varasev Dec 28, 2018
76d45e2
Add validatorList method
patitonar Jan 3, 2019
40b4f89
Merge branch 'master' into update-ERC677BridgeToken
varasev Jan 4, 2019
8a7cf85
Merge pull request #129 from varasev/update-ERC677BridgeToken
akolotov Jan 4, 2019
349bbbb
Update BridgeValidators version
patitonar Jan 7, 2019
363a304
Add removed nextValidator test
patitonar Jan 7, 2019
4e9db7b
Refactor BridgeValidators
patitonar Jan 7, 2019
5c553e0
Update ValidatorAdded event on RewardableValidators
patitonar Jan 7, 2019
1d7456c
Add end of list check on removeValidator
patitonar Jan 8, 2019
b743602
Refactor addValidator and RemoveValidator methods
patitonar Jan 8, 2019
6912fdc
Rename setValidator to setNextValidator
patitonar Jan 8, 2019
212d796
Add zero address check on getNextValidator usage
patitonar Jan 8, 2019
fa36918
Move validatorList method to RewardableValidators
patitonar Jan 8, 2019
a3b947a
Remove onlyOwner modifier on BaseBridgeValidators methods
patitonar Jan 9, 2019
5bf5440
Add zero address check for getNextValidator
patitonar Jan 9, 2019
f8bffb4
Merge pull request #130 from poanetwork/123-update-contracts-to-prope…
akolotov Jan 9, 2019
e008b24
Create FeeManager related contracts
fernandomg Dec 27, 2018
ceb8478
Implement Fee Distribution for ERC20 to Native mode
fernandomg Dec 27, 2018
5991ef3
Update fee contract implementation
patitonar Jan 4, 2019
9a34973
Fix onExecuteAffirmation
patitonar Jan 8, 2019
515f23a
Update delegateCall usage on calculateFee method
patitonar Jan 8, 2019
9bbaf56
Fix rewardableValidatorContract method on BaseFeeManager
patitonar Jan 9, 2019
97d3759
Remove unused files
patitonar Jan 9, 2019
8eb4809
Remove unused import
patitonar Jan 9, 2019
fbf81a8
Fixes on Fee related methods
patitonar Jan 10, 2019
16b3959
Add ERC-to-Native feeManager basic tests
patitonar Jan 10, 2019
c48b650
Merge branch 'develop' into 119-Epic-rewards-for-bridge-validators
patitonar Jan 10, 2019
6deecda
Merge branch '119-Epic-rewards-for-bridge-validators' into 122-create…
patitonar Jan 10, 2019
9ee9ce4
Fixes after merge
patitonar Jan 10, 2019
e752e94
Fix fee related methods
patitonar Jan 10, 2019
c7d62b4
Add fallback and submitSignature fee basic tests
patitonar Jan 10, 2019
8876e15
Refactor getFee
patitonar Jan 11, 2019
1993efc
Add onSignaturesCollected
patitonar Jan 11, 2019
faf9712
move reward logic to RewardableBridge
patitonar Jan 11, 2019
5170863
Update send usage on onSignatureFeeDistribution
patitonar Jan 11, 2019
98dfc8b
Replace delegatecall with callcode on calculateFee
patitonar Jan 11, 2019
d5b9bb5
Add fee tests for 5 validators
patitonar Jan 11, 2019
86de261
first version of BridgeMapper conract
bejavu Jan 14, 2019
6b9ce95
Update getFee to use callcode
patitonar Jan 14, 2019
687afe8
update BridgMapper contract
bejavu Jan 14, 2019
ee666a1
Update setFee modifier to onlyOwner
patitonar Jan 14, 2019
4b8f53a
Refactor BaseFeeManager fee direction
patitonar Jan 14, 2019
71870e0
Add random fee distribution on remaining fee difference
patitonar Jan 14, 2019
40e5b1d
Merge pull request #132 from poanetwork/122-create-feemanager-basic-c…
akolotov Jan 14, 2019
161c24f
both home and foreign bridge factory (wih deployment scripts)
bejavu Jan 15, 2019
182a483
Add rewardableInitialize on HomeBridgeErcToNative
patitonar Jan 15, 2019
38ebcf1
Add rewardable bridge options on deploy script for erc-to-native mode
patitonar Jan 15, 2019
b092a35
move `setOwner` to `initialize` instead of constractor inbridgeMapper
bejavu Jan 16, 2019
03fead7
rename FACTORY to ERC_TO_ERC_MULTIPLE
bejavu Jan 17, 2019
c1c0880
Update gas consumption on ERC-TO-NATIVE
patitonar Jan 17, 2019
7191c75
Refactor gas consumptions docs
patitonar Jan 17, 2019
7aee850
Fix ERC-TO-NATIVE foreign gas consumption doc
patitonar Jan 17, 2019
ca2c8a2
Merge remote-tracking branch 'origin/master' into Many2ManyERC20
bejavu Jan 20, 2019
dd6417f
change `bridgeFactory` requirments.
bejavu Jan 20, 2019
0576f18
Add internal setFee method on RewardableBridge
patitonar Jan 22, 2019
51a31be
Rename variable on erc-to-native home deploy script
patitonar Jan 22, 2019
228aaf1
Add HOME_REWARDABLE and FOREIGN_REWARDABLE env vars
patitonar Jan 22, 2019
bdc24f9
Add HOME_TRANSACTIONS_FEE and FOREIGN_TRANSACTIONS_FEE env vars
patitonar Jan 22, 2019
e0bf489
Improve validators and reward address log on deploy script
patitonar Jan 22, 2019
e56b51d
Update home bridge initialization log on erc-to-native deploy script
patitonar Jan 22, 2019
74743cb
Update HomeBridgeErcToNative gas usage docs
patitonar Jan 22, 2019
49fc67d
Merge pull request #134 from poanetwork/124-update-deploy-scripts
akolotov Jan 22, 2019
ef6c47d
Merge pull request #135 from poanetwork/update-gas-consumption-erc-to…
akolotov Jan 22, 2019
e8b358c
Merge remote-tracking branch 'origin/develop' into Many2ManyERC20
bejavu Jan 23, 2019
6d6b549
Add REWARD_MANAGEMENT.md
patitonar Jan 23, 2019
164c8e6
Add Native-to-Erc fee manager
patitonar Jan 21, 2019
112632a
Add tests for FeeManagerNativeToErc on Foreign bridge
patitonar Jan 22, 2019
348b168
Add tests for FeeManagerNativeToErc on Home bridge
patitonar Jan 22, 2019
8d995fb
Fix rewardableInitialize on NativeToErc contracts
patitonar Jan 23, 2019
41216b5
Add rewardable bridge options on deploy script for native-to-erc mode
patitonar Jan 23, 2019
f7d319d
Merge pull request #141 from poanetwork/add-fee-manager-docs
akolotov Jan 24, 2019
e8d414a
Merge pull request #142 from poanetwork/#127-implement-fee-manager-na…
akolotov Jan 28, 2019
ae7cad2
Update gas consumption NATIVE-TO-ERC
patitonar Jan 29, 2019
b070322
Merge pull request #144 from poanetwork/update-gas-consumption-native…
akolotov Jan 29, 2019
a90babf
Add getFeeManagerMode method
patitonar Feb 1, 2019
1931586
Merge pull request #150 from poanetwork/#148-fee-manager-mode-interface
akolotov Feb 1, 2019
e1787e6
Refactor fee into homeFee and foreignFee
patitonar Feb 1, 2019
34a4960
Update deploy script to use home and foreign fee on rewardableInitialize
patitonar Feb 1, 2019
8f13920
Update deploy/src/deploymentUtils.js
patitonar Feb 3, 2019
715f438
Update deploy/.env.example
patitonar Feb 3, 2019
2368356
Update deploy/.env.example
patitonar Feb 3, 2019
90a9f38
Update deploy/.env.example
patitonar Feb 3, 2019
8f8604b
Update deploy/.env.example
patitonar Feb 3, 2019
9960b72
Update deploy/.env.example
patitonar Feb 3, 2019
6d6c7b4
Update deploy/.env.example
patitonar Feb 3, 2019
f822d5f
* add initialize checkers to the factories and mapper contracts
bejavu Feb 3, 2019
63d1b17
Replace poa.infura.io with core.poa.network
vbaranov Feb 4, 2019
98a09a4
Merge pull request #152 from vbaranov/master
akolotov Feb 4, 2019
b209667
Update gas consumption
patitonar Feb 4, 2019
b54cd53
Update fee parameter docs
patitonar Feb 4, 2019
78d6c3b
Refactor RewardableBridge
patitonar Feb 4, 2019
5a69e97
Fix rewardableInitialize methods
patitonar Feb 4, 2019
f9e3193
Update gas consumption docs
patitonar Feb 4, 2019
0f15d7f
Merge pull request #151 from poanetwork/#149-separate-fee-home-foreig…
akolotov Feb 5, 2019
27db88f
Override `transfer` and `transferFrom` in `ERC677BridgeTokenRewardable`
varasev Feb 11, 2019
aa8776a
added an option to make a double proxy implementation so it will be a…
bejavu Feb 11, 2019
d6d8fe3
Merge pull request #153 from poanetwork/varasev-fix-rewardable-transfer
akolotov Feb 11, 2019
102fcf2
unify events of bridge maper
bejavu Feb 17, 2019
2bf00ce
prety env
bejavu Feb 17, 2019
02de67a
Upgrade node version to 10.15
patitonar Feb 18, 2019
fd75ff1
Merge pull request #154 from poanetwork/support-node-10
akolotov Feb 18, 2019
1c965cc
Merge branch 'develop' into Many2ManyERC20
LiorRabin Feb 19, 2019
e245268
Add both-directions fee manager for native-to-erc
patitonar Feb 19, 2019
bbbf609
Update tests for native-to-erc
patitonar Feb 19, 2019
f1b8a30
Refactor rewardable env variables
patitonar Feb 20, 2019
94f5d39
Update deploy script
patitonar Feb 20, 2019
289e09f
Fix native-to-erc deploy script
patitonar Feb 20, 2019
3997423
Update Reward Management doc
patitonar Feb 20, 2019
84dc9ac
unit tests & gas consumption (#1)
LiorRabin Feb 21, 2019
e414d66
Remove onRequestForSignature and onSignaturesCollected from FeeManager
patitonar Feb 25, 2019
67de488
Update gas consumption docs
patitonar Feb 25, 2019
06a396b
make the double-proxy work
Feb 26, 2019
70cc735
update home native-to-erc deploy script
patitonar Feb 27, 2019
f016a25
update foreign native-to-erc deploy script
patitonar Feb 27, 2019
b0d2e36
add .idea to .gitignore
patitonar Feb 27, 2019
afe5407
Update erc-to-erc deploy script
patitonar Feb 27, 2019
4cc175c
Update erc-to-native deploy script
patitonar Feb 27, 2019
b419821
Add promise-retry for state asserts on deploy scripts
patitonar Feb 28, 2019
4d50918
Rename ValidatorSet contract to Staking contract
varasev Mar 5, 2019
b043eb0
Fix misprint
varasev Mar 5, 2019
745edd9
Merge pull request #140 from ColuLocalNetwork/Many2ManyERC20
akolotov Mar 6, 2019
30e0ae8
Revert "140-erc-to-erc-multiple"
patitonar Mar 12, 2019
7055a60
Merge pull request #158 from poanetwork/revert-140-Many2ManyERC20
akolotov Mar 12, 2019
39316a0
Merge pull request #157 from poanetwork/varasev-rename-ValidatorSet-t…
akolotov Mar 12, 2019
d2bdf62
Add fee manager for erc-to-native in posdao chain
patitonar Mar 15, 2019
9a1ce93
Add FeeManagerErcToNativePOSDAO on deploy script
patitonar Mar 21, 2019
b117b21
Merge branch 'develop' into 119-Epic-rewards-for-bridge-validators
patitonar Mar 22, 2019
04ab82f
Add fee manager erc-to-erc
patitonar Mar 26, 2019
4cfb617
Add erc-to-erc fee manager unit tests
patitonar Mar 26, 2019
96d75f2
Add rewardable erc-to-erc executeAffirmation tests
patitonar Mar 29, 2019
0092b10
Fix truffle version
patitonar Mar 29, 2019
bf2222d
Add fee manager on erc-to-erc deploy script
patitonar Mar 29, 2019
595315d
Avoid calling blockReward if zero value from foreign transfer on erc-…
patitonar Apr 1, 2019
905bac8
call onExecuteAffirmation if non zero value
patitonar Apr 1, 2019
dc3052f
Add executeAffirmation test for zero value
patitonar Apr 1, 2019
9fa90ee
Merge pull request #165 from poanetwork/fix-zero-value-erc-to-native
akolotov Apr 1, 2019
88a503b
Use ERC677BridgeTokenRewardable if rewards distributed on erc-to-erc
patitonar Apr 1, 2019
5400cd9
Add erc-to-erc reward management schema
patitonar Apr 1, 2019
4def1fd
Merge branch '119-Epic-rewards-for-bridge-validators' into 160-fee-er…
patitonar Apr 3, 2019
0ae69e6
Fix package-lock.json
patitonar Apr 3, 2019
05d5a2b
Fix merge conflicts
patitonar Apr 3, 2019
745eeb0
Add validatorList on BaseBridgeValidators
patitonar Apr 11, 2019
d2f6b0a
Update addValidator method and ValidatorAdded event
patitonar Apr 12, 2019
7581f12
Increase validator interface version
patitonar Apr 15, 2019
3971866
Merge pull request #167 from poanetwork/add-validator-list-method-bri…
akolotov Apr 15, 2019
4c8e664
Emit event on fee distribution from transfer
patitonar Apr 15, 2019
aa5721a
update FOREIGN_DAILY_LIMIT & FOREIGN_MAX_AMOUNT_PER_TX for bridge modes
andogro Apr 15, 2019
93fca5b
review comments
andogro Apr 15, 2019
8ed024e
Merge pull request #172 from andogro/ag-deploy-update
akolotov Apr 16, 2019
8f551d1
Merge pull request #171 from poanetwork/add-transfer-fee-events
akolotov Apr 16, 2019
9be3f38
Move validator events to BaseBridgeValidators
patitonar Apr 16, 2019
2bc4bd7
Merge branch '119-Epic-rewards-for-bridge-validators' into 160-fee-er…
patitonar Apr 16, 2019
16be3f8
Add event on fee distribution
patitonar Apr 16, 2019
cf81b76
Refactor BaseFeeManager
patitonar Apr 16, 2019
95f2362
Fix _initialize on HomeBridgeErcToErc
patitonar Apr 16, 2019
63fbd12
Move ValidatorsFeeManager constants
patitonar Apr 16, 2019
ffdd595
Merge pull request #169 from poanetwork/update-rewardable-validator
akolotov Apr 16, 2019
8ab76b9
Add POSDAOHomeBridgeErcToErc
patitonar Apr 17, 2019
851c0b9
Fix erc_to_erc home deploy script
patitonar Apr 17, 2019
fd5086b
Fee distribution events moved to the RewardableBridge contract
akolotov Apr 18, 2019
1ca930a
Update erc-to-erc rewards schemas
patitonar Apr 18, 2019
e605559
Add getAmountToBurn on erc-to-native fee manager
patitonar Apr 18, 2019
4326644
tests cover emmiting fee dsitribution event for submitSignature call …
akolotov Apr 19, 2019
b6df9b3
syncronize node.js version in TravisCI with the requirements
akolotov Apr 19, 2019
c9b8a68
Merge pull request #176 from akolotov/119-Epic-rewards-for-bridge-val…
akolotov Apr 22, 2019
d5c7c5a
Fix erc-to-erc reward schema text
patitonar Apr 22, 2019
3592024
Merge branch '119-Epic-rewards-for-bridge-validators' into 160-fee-er…
patitonar Apr 22, 2019
6b25ffb
Update fee events logic on HomeBridgeErcToErc
patitonar Apr 22, 2019
f7cb8d2
Update getAmountToBurn method signature
patitonar Apr 22, 2019
7ee814e
Merge pull request #166 from poanetwork/160-fee-erc-erc-posdao-chain
akolotov Apr 22, 2019
1f57b24
Merge branch '119-Epic-rewards-for-bridge-validators' into #159-fee-e…
patitonar Apr 22, 2019
04069bb
Update FeeManagerErcToNativePOSDAO to extend BlockRewardFeeManager
patitonar Apr 22, 2019
39c7d39
Fix FeeManagerErcToNativePOSDAO unit tests
patitonar Apr 22, 2019
a448e3d
Add HOME_FEE_MANAGER_TYPE env var
patitonar Apr 22, 2019
3ba8ea1
Merge branch '119-Epic-rewards-for-bridge-validators' into #138-fee-m…
patitonar Apr 22, 2019
e3d7fb9
Merge fix
patitonar Apr 22, 2019
3f3457c
Update FeeManagerNativeToErcBothDirections to extend ValidatorsFeeMan…
patitonar Apr 22, 2019
19fa684
Merge pull request #155 from poanetwork/#138-fee-manager-POA-bridge
akolotov Apr 23, 2019
cad1cc5
Update .env.example
patitonar Apr 23, 2019
91eeb64
Merge branch '119-Epic-rewards-for-bridge-validators' into #159-fee-e…
patitonar Apr 23, 2019
c7c84cf
Merge pull request #164 from poanetwork/#159-fee-erc-native-posdao-chain
akolotov Apr 23, 2019
082d47b
Merge branch '119-Epic-rewards-for-bridge-validators' into support-nu…
patitonar Apr 23, 2019
bb33eec
Merge fix
patitonar Apr 23, 2019
c28b5d5
handle JSON RPC errors returned by the web3 provider
akolotov Apr 24, 2019
106de64
calculate gas limit for deployment transactions instead of dealing wi…
akolotov Apr 24, 2019
df9cd28
Add ForeignBridgeExtendedErcToErc
patitonar Apr 29, 2019
3e7c9e6
Add ForeignBridgeExtendedErcToErc unit tests
patitonar Apr 29, 2019
c4645db
Add ERC20_EXTENDED_BY_ERC677 parameter for erc-to-erc deploy
patitonar Apr 29, 2019
6d67fe5
Add ForeignBridgeExtendedErcToErc to erc-to-erc deployment script
patitonar Apr 29, 2019
5d54ffb
Refactor ForeignBridgeErc677ToErc677
patitonar Apr 30, 2019
17b907a
Add FOREIGN_MAX_AMOUNT_PER_TX check for all modes in loadEnv
patitonar Apr 30, 2019
c65f123
Fix erc-to-erc foreign deploy script
patitonar Apr 30, 2019
de9ff59
Fix erc-to-erc foreign unit tests
patitonar Apr 30, 2019
d92dd65
Fix initializeValidators logs
patitonar May 2, 2019
f022bed
Fix sendTx method used on deploy script utils
patitonar May 2, 2019
9aed1f1
Merge pull request #156 from poanetwork/support-null-status-deploy-sc…
akolotov May 2, 2019
d0ad22e
more common ERC677 type is used in ERC677Bridge
akolotov May 2, 2019
5d315c9
Merge pull request #177 from poanetwork/175-ERC677-support-foreign-er…
akolotov May 2, 2019
be3e9e7
DEPLOYMENT_GAS_LIMIT_EXTRA is used to calculate a transaction gas limit
akolotov May 3, 2019
f9db683
documentation update to reflect usage of DEPLOYMENT_GAS_LIMIT_EXTRA
akolotov May 3, 2019
d51914d
Update ERC677BridgeTokenRewardable.sol
varasev May 3, 2019
1d61c2c
Merge pull request #178 from akolotov/develop
akolotov May 3, 2019
786529a
Merge branch 'develop' into 119-Epic-rewards-for-bridge-validators
patitonar May 3, 2019
fb6b0d7
Fix merge
patitonar May 3, 2019
f30a1da
flattening sources of the new set of contracts
akolotov May 3, 2019
92be48b
Fix merge deploy script
patitonar May 3, 2019
9a049e8
Merge remote-tracking branch 'upstream/119-Epic-rewards-for-bridge-va…
akolotov May 3, 2019
d69f8f4
flattening of the new contract related to erc677-to-erc677 bridge mode
akolotov May 3, 2019
492f6d0
Merge pull request #179 from akolotov/119-Epic-rewards-for-bridge-val…
akolotov May 3, 2019
964d104
Apply contract changes from `develop-for-classic`
patitonar May 8, 2019
d5139e1
Upgrade truffle version
patitonar May 8, 2019
a682bd6
compile contracts for byzantium and spuriousDragon
patitonar May 8, 2019
de536a3
Remove unused migrations files
patitonar May 8, 2019
b736613
Update deploy script to use correct evm build
patitonar May 8, 2019
20e7cef
Add specific script for gas report on tests
patitonar May 8, 2019
f937e50
Update test dependencies
patitonar May 8, 2019
9538a78
remove web3-utils
patitonar May 9, 2019
6bad8be
Fix unit tests
patitonar May 14, 2019
34d48ef
Add linter for unit tests
patitonar May 14, 2019
2cdff96
Fix used HomeBridgeNativeToErc contract on deploy script
patitonar May 14, 2019
28aac26
Merge pull request #181 from poanetwork/180-support-multiple-evm-vers…
akolotov May 21, 2019
a7c0752
new contracts should be flatten after #181
akolotov May 21, 2019
f5b5538
Merge pull request #184 from akolotov/119-Epic-rewards-for-bridge-val…
akolotov May 22, 2019
dcef430
Merge pull request #143 from poanetwork/119-Epic-rewards-for-bridge-v…
akolotov May 22, 2019
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
deploy
27 changes: 27 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": [
"plugin:node/recommended",
"airbnb-base",
"plugin:prettier/recommended"
],
"plugins": ["node"],
"env": {
"node" : true,
"mocha" : true
},
"globals" : {
"artifacts": false,
"contract": false,
"assert": false,
"web3": false
},
"rules": {
"no-plusplus": "off",
"no-await-in-loop": "off",
"no-shadow": "off",
"prefer-destructuring": "off",
"no-use-before-define": ["error", { "functions": false }],
"no-restricted-syntax": "off",
"node/no-unpublished-require": "off"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
build
flats
.node*
.idea
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.15
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120
}
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: required
group: beta
language: node_js
node_js:
- "9"
- "10"
cache:
yarn: true
env:
Expand All @@ -14,4 +14,5 @@ matrix:
allow_failures:
- env: SOLIDITY_COVERAGE=true
script:
- yarn lint:js
- yarn test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8
FROM node:10

WORKDIR /contracts

Expand Down
179 changes: 6 additions & 173 deletions GAS_CONSUMPTION.md
Original file line number Diff line number Diff line change
@@ -1,174 +1,7 @@
## Gas Consumption
## Gas Consumption by Bridge Mode

### `NATIVE-TO-ERC` Bridge Mode

#### Deployment
##### Home
Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
EternalStorageProxy|deployment|378510|378510|378510
BridgeValidators|deployment|1144207|1144207|1144207
EternalStorageProxy|upgradeTo|35871|30924|30913
BridgeValidators|initialize|187738|280847|253949
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
EternalStorageProxy|deployment|378510|378510|378510
HomeBridgeNativeToErc|deployment|3327263|3327263|3327263
EternalStorageProxy|upgradeTo|35871|30924|30913
HomeBridgeNativeToErc|initialize|190051|190947|190755
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
Total| |5739327|5823438|5796326

##### Foreign
Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
ERC677BridgeToken|deployment|1498202|1499226|1498829
EternalStorageProxy|deployment|378510|378510|378510
BridgeValidators|deployment|1144207|1144207|1144207
EternalStorageProxy|upgradeTo|35871|30924|30913
BridgeValidators|initialize|187738|280847|253949
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
EternalStorageProxy|deployment|378510|378510|378510
ForeignBridgeNativeToErc|deployment|2768705|2768705|2768705
EternalStorageProxy|upgradeTo|35871|30924|30913
ForeignBridgeNativeToErc|initialize|213493|213557|213549
ERC677BridgeToken|setBridgeContract|29432|44432|39432
ERC677BridgeToken|transferOwnership|30860|30924|30913
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
Total| |6762705|6862072|6829736

#### Usage

##### Validators

Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
To sign at the Home (each validator)|
HomeBridgeNativeToErc|submitSignature|159362|275135|220127
To relay signatures from the Home to the Foreign (one validator)|
ForeignBridgeNativeToErc|executeSignatures|89201|146127|120917
To sign and relay from the Foreign to the Home (each validator)|
HomeBridgeNativeToErc|executeAffirmation|64314|107669|83596

##### Users

Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
To request transfer from the Home to the Foreign|
HomeBridgeNativeToErc|fallback|46982|46982|46982
To request transfer from the Foreign to the Home|
ERC677BridgeToken|transferAndCall|58370|166206|92399


### `ERC-TO-ERC` Bridge Mode

#### Deployment
##### Home
Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
EternalStorageProxy|deployment|378510|378510|378510
BridgeValidators|deployment|1144207|1144207|1144207
EternalStorageProxy|upgradeTo|35871|30924|30913
BridgeValidators|initialize|187738|280847|253949
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
EternalStorageProxy|deployment|378510|378510|378510
HomeBridgeErcToErc|deployment|3528509|3528509|3528509
EternalStorageProxy|upgradeTo|35871|30924|30913
ERC677BridgeToken|deployment|1498202|1499226|1498829
ERC677BridgeToken|setBridgeContract|29432|44432|39432
ERC677BridgeToken|transferOwnership|30860|30924|30913
HomeBridgeErcToErc|initialize|212299|213195|213003
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
Total| |7521315|7621514|7588994

##### Foreign
Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
EternalStorageProxy|deployment|378510|378510|378510
BridgeValidators|deployment|1144207|1144207|1144207
EternalStorageProxy|upgradeTo|35871|30924|30913
BridgeValidators|initialize|187738|280847|253949
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
EternalStorageProxy|deployment|378510|378510|378510
ForeignBridgeErcToErc|deployment|2449436|2449436|2449436
EternalStorageProxy|upgradeTo|35871|30924|30913
ForeignBridgeErcToErc|initialize|150614|150614|150614
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
Total| |4822063|4905278|4878358

#### Usage

##### Validators

Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
To sign at the Home (each validator)|
HomeBridgeErcToErc|submitSignature|159386|275159|220171
To relay signatures from the Home to the Foreign (one validator)|
ForeignBridgeErcToErc|executeSignatures|73779|115769|93027
To sign and relay from the Foreign to the Home (each validator)|
HomeBridgeErcToErc|executeAffirmation|79336|134607|108215

##### Users

Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
To request transfer from the Home to the Foreign|
ERC677BridgeToken|transferAndCall|58370|166206|92399
To request transfer from the Foreign to the Home|
ERC677BridgeToken|transfer|37691|86589|55000


### `ERC-TO-NATIVE` Bridge Mode

#### Deployment
##### Home
Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
EternalStorageProxy|deployment|378510|378510|378510
BridgeValidators|deployment|1144207|1144207|1144207
EternalStorageProxy|upgradeTo|35871|30924|30913
BridgeValidators|initialize|187738|280847|253949
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
EternalStorageProxy|deployment|378510|378510|378510
HomeBridgeErcToNative|deployment|3757420|3757420|3757420
EternalStorageProxy|upgradeTo|35871|30924|30913
HomeBridgeErcToNative|initialize|196910|213930|210795
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
Total| |6176343|6276578|6246523

##### Foreign
Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
EternalStorageProxy|deployment|378510|378510|378510
BridgeValidators|deployment|1144207|1144207|1144207
EternalStorageProxy|upgradeTo|35871|30924|30913
BridgeValidators|initialize|187738|280847|253949
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
EternalStorageProxy|deployment|378510|378510|378510
ForeignBridgeErcToNative|deployment|2449564|2449564|2449564
EternalStorageProxy|upgradeTo|35871|30924|30913
ForeignBridgeErcToNative|initialize|150614|150614|150614
EternalStorageProxy|transferProxyOwnership|30653|30653|30653
Total| |

#### Usage

##### Validators

Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
To sign at the Home (each validator)|
HomeBridgeErcToNative|submitSignature|159428|275201|220206
To relay signatures from the Home to the Foreign (one validator)|
ForeignBridgeErcToNative|executeSignatures|73779|115769|92985
To sign and relay from the Foreign to the Home (each validator)|
HomeBridgeErcToNative|executeAffirmation|64380|140744|97562

##### Users

Contract | Method | Min | Max | Avg
---- | ---- | ---- | ---- | ----
To request transfer from the Home to the Foreign|
HomeBridgeErcToNative|fallback|80174|80174|80174
To request transfer from the Foreign to the Home|
ERC677BridgeToken|transfer|37691|86589|55000
- [NATIVE-TO-ERC](docs/NATIVE-TO-ERC.md)
- [NATIVE-TO-ERC-WITH-REWARD](docs/NATIVE-TO-ERC-WITH-REWARD.md)
- [ERC-TO-ERC](docs/ERC-TO-ERC.md)
- [ERC-TO-NATIVE](docs/ERC-TO-NATIVE.md)
- [ERC-TO-NATIVE-WITH-REWARD](docs/ERC-TO-NATIVE-WITH-REWARD.md)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ docker-compose down
### Gas Consumption
The [GAS_CONSUMPTION](GAS_CONSUMPTION.md) file includes Min, Max, and Avg gas consumption figures for contracts associated with each bridge mode.

### Reward Management
The [REWARD_MANAGEMENT](REWARD_MANAGEMENT.md) file includes information on how rewards are distributed among the validators on each bridge mode.

### Testing environment
To test the bridge scripts in ERC20-to-ERC20 mode on a testnet like Sokol or Kovan, you must deploy an ERC20 token to the foreign network.
This can be done by running the following command:
Expand Down
53 changes: 53 additions & 0 deletions REWARD_MANAGEMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Reward Management

## NATIVE-TO-ERC
Configuration:
```
HOME_REWARDABLE=ONE_DIRECTION
FOREIGN_REWARDABLE=ONE_DIRECTION
```
### Home to Foreign transfer
Fees are calculated and distributed on Foreign network. Validators will receive ERC20 tokens.
![native-erc-hometoforeign](https://user-images.githubusercontent.com/4614574/51607402-4bda6180-1ef3-11e9-91e3-50fe5d35d296.png)

### Foreign to Home transfer
Fees are calculated and distributed on Home network. Validators will receive native coins.
![native-erc-foreigntohome](https://user-images.githubusercontent.com/4614574/51607428-5d236e00-1ef3-11e9-8083-3669899c7252.png)

## NATIVE-TO-ERC - Fees collected on Home network only
Configuration:
```
HOME_REWARDABLE=BOTH_DIRECTIONS
FOREIGN_REWARDABLE=false
```
### Home to Foreign transfer
Fees are calculated and distributed on Home network. Validators will receive native coins.
![native-erc-homefee-hometoforeign](https://user-images.githubusercontent.com/4614574/53118155-43456d00-352b-11e9-80db-53e31494e09b.png)

### Foreign to Home transfer
Fees are calculated and distributed on Home network. Validators will receive native coins.
![native-erc-homefee-foreigntohome](https://user-images.githubusercontent.com/4614574/53118176-4b9da800-352b-11e9-8118-123f30e37d61.png)

## ERC-TO-NATIVE
Configuration:
```
HOME_REWARDABLE=BOTH_DIRECTIONS
FOREIGN_REWARDABLE=false
```
### Foreign to Home transfer
Fees are calculated and distributed on Home network. Validators will receive native coins.
![erc-native-foreigntohome](https://user-images.githubusercontent.com/4614574/51607498-9065fd00-1ef3-11e9-8212-fc1ba16ae91a.png)

### Home to Foreign transfer
Fees are calculated and distributed on Home network. Validators will receive native coins.
![erc-native-hometoforeign](https://user-images.githubusercontent.com/4614574/51607508-96f47480-1ef3-11e9-93a1-0f1111793f2a.png)

## ERC-TO-ERC

### Foreign to Home transfer
Fees are calculated and distributed on Home network. Validators will receive ERC20 tokens.
![ERC-ERC-ForeignToHome (1)](https://user-images.githubusercontent.com/4614574/56502412-98c8d680-64e8-11e9-8eea-5bcd545d74d9.png)

### Home to Foreign transfer
Fees are calculated and distributed on Home network. Validators will receive ERC20 tokens.
![ERC-ERC-HomeToForeign (1)](https://user-images.githubusercontent.com/4614574/56502454-b8f89580-64e8-11e9-84ae-d9a1c229e0c4.png)
2 changes: 1 addition & 1 deletion contracts/ERC677BridgeToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract ERC677BridgeToken is
}

function isContract(address _addr)
private
internal
view
returns (bool)
{
Expand Down
79 changes: 79 additions & 0 deletions contracts/ERC677BridgeTokenRewardable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
pragma solidity 0.4.24;

import "./ERC677BridgeToken.sol";


contract ERC677BridgeTokenRewardable is ERC677BridgeToken {

address public blockRewardContract;
address public stakingContract;

constructor(
string _name,
string _symbol,
uint8 _decimals
) public ERC677BridgeToken(_name, _symbol, _decimals) {}

function setBlockRewardContract(address _blockRewardContract) onlyOwner public {
require(_blockRewardContract != address(0) && isContract(_blockRewardContract));
blockRewardContract = _blockRewardContract;
}

function setStakingContract(address _stakingContract) onlyOwner public {
require(_stakingContract != address(0) && isContract(_stakingContract));
stakingContract = _stakingContract;
}

modifier onlyBlockRewardContract() {
require(msg.sender == blockRewardContract);
_;
}

modifier onlyStakingContract() {
require(msg.sender == stakingContract);
_;
}

function mintReward(address[] _receivers, uint256[] _rewards) external onlyBlockRewardContract {
for (uint256 i = 0; i < _receivers.length; i++) {
uint256 amount = _rewards[i];

if (amount == 0) continue;

address to = _receivers[i];

// Mint `amount` for `to`
totalSupply_ = totalSupply_.add(amount);
balances[to] = balances[to].add(amount);
emit Mint(to, amount);
emit Transfer(address(0), to, amount);
}
}

function stake(address _staker, uint256 _amount) external onlyStakingContract {
// Transfer `_amount` from `_staker` to `stakingContract`
require(_amount <= balances[_staker]);
balances[_staker] = balances[_staker].sub(_amount);
balances[stakingContract] = balances[stakingContract].add(_amount);
emit Transfer(_staker, stakingContract, _amount);
}

function withdraw(address _staker, uint256 _amount) external onlyStakingContract {
// Transfer `_amount` from `stakingContract` to `_staker`
require(_amount <= balances[stakingContract]);
balances[stakingContract] = balances[stakingContract].sub(_amount);
balances[_staker] = balances[_staker].add(_amount);
emit Transfer(stakingContract, _staker, _amount);
}

function transfer(address _to, uint256 _value) public returns(bool) {
require(_to != stakingContract);
return super.transfer(_to, _value);
}

function transferFrom(address _from, address _to, uint256 _value) public returns(bool) {
require(_to != stakingContract);
return super.transferFrom(_from, _to, _value);
}

}
Loading