-
Notifications
You must be signed in to change notification settings - Fork 229
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
Create Governance based bridge contracts #3
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b034402
1. Add ERC677 support
rstormsf 4d8c1e1
merge
rstormsf 7897740
Provide flat contracts
rstormsf cb33ddb
Fix #9. Extend tracebility of deposits transactions
rstormsf 54e34c5
Apply comments enhancements
rstormsf a3e884c
Add daily Limits
rstormsf 48c782f
Add hasEnoughSignatures back to working condition
rstormsf 7d1df24
remove homeGasPrice from HomeBridge
rstormsf f99f21a
Fix hasEnoughSignatures method.
rstormsf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,15 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.ts] | ||
indent_style = tab | ||
|
||
[{package.json,.travis.yml}] | ||
indent_style = space | ||
indent_size = 4 |
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,15 @@ | ||
# Dependencies | ||
```bash | ||
npm install | ||
``` | ||
|
||
# To Deploy | ||
Check `truffle.js` for networks and their ports | ||
```bash | ||
NETWORK=sokol npm run deploy | ||
``` | ||
|
||
# To Flatten | ||
```bash | ||
npm run flatten | ||
``` |
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,10 @@ | ||
pragma solidity ^0.4.19; | ||
|
||
|
||
contract BridgeDeploymentAddressStorage { | ||
uint256 public deployedAtBlock; | ||
|
||
function BridgeDeploymentAddressStorage() public { | ||
deployedAtBlock = block.number; | ||
} | ||
} |
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,52 +1,58 @@ | ||
pragma solidity ^0.4.18; | ||
|
||
import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; | ||
|
||
contract BridgeValidators is Ownable { | ||
|
||
// Event created on validator gets added | ||
event ValidatorAdded (address validator); | ||
event ValidatorRemoved (address validator); | ||
uint8 requiredValidators = 0; | ||
uint256 public validatorCount = 0; | ||
|
||
mapping (address => bool) public validators; | ||
|
||
function BridgeValidators(uint8 _requiredValidators,address[] _initialValidators) public { | ||
require(_requiredValidators != 0); | ||
require(_initialValidators.length >= _requiredValidators); | ||
setRequiredValidators(_requiredValidators); | ||
for (uint i = 0; i < _initialValidators.length; i++) { | ||
require(!isValidator(_initialValidators[i]) && _initialValidators[i] != address(0)); | ||
addValidator(_initialValidators[i]); | ||
} | ||
validatorCount = _initialValidators.length; | ||
} | ||
|
||
function addValidator(address _validator) public onlyOwner { | ||
assert(validators[_validator] != true); | ||
validatorCount++; | ||
validators[_validator] = true; | ||
ValidatorAdded(_validator); | ||
} | ||
|
||
function removeValidator(address _validator) public onlyOwner { | ||
require(validatorCount > requiredValidators); | ||
validators[_validator] = false; | ||
validatorCount--; | ||
ValidatorRemoved(_validator); | ||
} | ||
|
||
function setRequiredValidators(uint8 _requiredValidators) public onlyOwner { | ||
require(validatorCount >= _requiredValidators); | ||
requiredValidators = _requiredValidators; | ||
} | ||
|
||
function isValidator(address _validator) public view returns(bool) { | ||
return (validators[_validator] == true); | ||
} | ||
|
||
function onlyValidator(address _validator) public view returns(bool) { | ||
return validators[_validator] == true; | ||
} | ||
import "zeppelin-solidity/contracts/ownership/Ownable.sol"; | ||
import "./IBridgeValidators.sol"; | ||
|
||
|
||
contract BridgeValidators is Ownable, IBridgeValidators { | ||
|
||
// Event created on validator gets added | ||
event ValidatorAdded (address validator); | ||
event ValidatorRemoved (address validator); | ||
uint8 requiredValidators = 0; | ||
uint256 public validatorCount = 0; | ||
|
||
mapping (address => bool) public validators; | ||
|
||
function BridgeValidators(uint8 _requiredValidators, address[] _initialValidators) public Ownable() { | ||
require(_requiredValidators != 0); | ||
require(_initialValidators.length >= _requiredValidators); | ||
validatorCount = _initialValidators.length; | ||
for (uint i = 0; i < _initialValidators.length; i++) { | ||
require(!isValidator(_initialValidators[i]) && _initialValidators[i] != address(0)); | ||
addValidator(_initialValidators[i]); | ||
} | ||
setRequiredValidators(_requiredValidators); | ||
} | ||
|
||
function addValidator(address _validator) public onlyOwner { | ||
assert(validators[_validator] != true); | ||
validatorCount++; | ||
validators[_validator] = true; | ||
ValidatorAdded(_validator); | ||
} | ||
|
||
function removeValidator(address _validator) public onlyOwner { | ||
require(validatorCount > requiredValidators); | ||
validators[_validator] = false; | ||
validatorCount--; | ||
ValidatorRemoved(_validator); | ||
} | ||
|
||
function setRequiredValidators(uint8 _requiredValidators) public onlyOwner { | ||
require(validatorCount >= _requiredValidators); | ||
requiredValidators = _requiredValidators; | ||
} | ||
|
||
function isValidator(address _validator) public view returns(bool) { | ||
return validators[_validator] == true; | ||
} | ||
|
||
function requiredSignatures() public view returns(uint8) { | ||
return requiredValidators; | ||
} | ||
|
||
function currentOwner() public view returns(address) { | ||
return owner; | ||
} | ||
} |
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,10 @@ | ||
pragma solidity 0.4.19; | ||
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; | ||
|
||
|
||
contract ERC677 is ERC20 { | ||
event Transfer(address indexed from, address indexed to, uint value, bytes data); | ||
|
||
function transferAndCall(address, uint, bytes) public returns (bool); | ||
|
||
} |
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,6 @@ | ||
pragma solidity ^0.4.19; | ||
|
||
|
||
contract ERC677Receiver { | ||
function onTokenTransfer(address _from, uint _value, bytes _data) external returns(bool); | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To not forget: create an issue to implement functionality that the bridge calls
isValidator
before sending a transaction.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omni/poa-bridge#28