-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into arbitrary-message-bridging-#73
# Conflicts: # contracts/upgradeable_contracts/erc20_to_erc20/HomeBridgeErcToErc.sol # contracts/upgradeable_contracts/erc20_to_native/HomeBridgeErcToNative.sol # contracts/upgradeable_contracts/native_to_erc20/ForeignBridgeNativeToErc.sol # contracts/upgradeable_contracts/native_to_erc20/HomeBridgeNativeToErc.sol # deploy/src/loadEnv.js # flatten.sh
- Loading branch information
Showing
83 changed files
with
12,977 additions
and
4,072 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pragma solidity 0.4.24; | ||
|
||
|
||
interface IRewardableValidators { | ||
function isValidator(address _validator) public view returns(bool); | ||
function requiredSignatures() public view returns(uint256); | ||
function owner() public view returns(address); | ||
function validatorList() public view returns (address[]); | ||
function getValidatorRewardAddress(address _validator) public view returns(address); | ||
function validatorCount() public view returns (uint256); | ||
function getNextValidator(address _address) public view returns (address); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.