Add version field on bridge, validators and token contracts
This commit is contained in:
parent
2c22760538
commit
af7cc8dcbb
|
@ -5,6 +5,7 @@ import "openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
|
|||
import "openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol";
|
||||
import "./IBurnableMintableERC677Token.sol";
|
||||
import "./ERC677Receiver.sol";
|
||||
import "./libraries/Version.sol";
|
||||
|
||||
|
||||
contract ERC677BridgeToken is
|
||||
|
@ -12,6 +13,9 @@ contract ERC677BridgeToken is
|
|||
DetailedERC20,
|
||||
BurnableToken,
|
||||
MintableToken {
|
||||
|
||||
Version.Version public getInterfacesVersion = Version.Version(1, 0, 0);
|
||||
|
||||
constructor(
|
||||
string _name,
|
||||
string _symbol,
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
pragma solidity 0.4.24;
|
||||
|
||||
|
||||
library Version {
|
||||
|
||||
struct Version {
|
||||
uint64 major;
|
||||
uint64 minor;
|
||||
uint64 patch;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,12 +2,16 @@ pragma solidity 0.4.24;
|
|||
import "../IBridgeValidators.sol";
|
||||
import "../upgradeability/EternalStorage.sol";
|
||||
import "../libraries/SafeMath.sol";
|
||||
import "../libraries/Version.sol";
|
||||
import "./Validatable.sol";
|
||||
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol";
|
||||
|
||||
|
||||
contract BasicBridge is EternalStorage, Validatable {
|
||||
using SafeMath for uint256;
|
||||
|
||||
Version.Version public getBridgeInterfacesVersion = Version.Version(1, 0, 0);
|
||||
|
||||
event GasPriceChanged(uint256 gasPrice);
|
||||
event RequiredBlockConfirmationChanged(uint256 requiredBlockConfirmations);
|
||||
event DailyLimitChanged(uint256 newLimit);
|
||||
|
|
|
@ -4,10 +4,14 @@ import "./Ownable.sol";
|
|||
import "../IBridgeValidators.sol";
|
||||
import "../libraries/SafeMath.sol";
|
||||
import "../upgradeability/EternalStorage.sol";
|
||||
import "../libraries/Version.sol";
|
||||
|
||||
|
||||
contract BridgeValidators is IBridgeValidators, EternalStorage, Ownable {
|
||||
using SafeMath for uint256;
|
||||
|
||||
Version.Version public getInterfacesVersion = Version.Version(1, 0, 0);
|
||||
|
||||
event ValidatorAdded (address indexed validator);
|
||||
event ValidatorRemoved (address indexed validator);
|
||||
event RequiredSignaturesChanged (uint256 requiredSignatures);
|
||||
|
|
|
@ -39,6 +39,10 @@ contract('ForeignBridge_ERC20_to_ERC20', async (accounts) => {
|
|||
const bridgeMode = '0xba4690f5' // 4 bytes of keccak256('erc-to-erc-core')
|
||||
const mode = await foreignBridge.bridgeMode();
|
||||
mode.should.be.equal(bridgeMode)
|
||||
const [major, minor, patch] = await foreignBridge.getBridgeInterfacesVersion()
|
||||
major.should.be.bignumber.gte(0)
|
||||
minor.should.be.bignumber.gte(0)
|
||||
patch.should.be.bignumber.gte(0)
|
||||
})
|
||||
})
|
||||
describe('#executeSignatures', async () => {
|
||||
|
|
|
@ -41,6 +41,10 @@ contract('HomeBridge_ERC20_to_ERC20', async (accounts) => {
|
|||
const bridgeMode = '0xba4690f5' // 4 bytes of keccak256('erc-to-erc-core')
|
||||
const mode = await homeContract.bridgeMode();
|
||||
mode.should.be.equal(bridgeMode)
|
||||
const [major, minor, patch] = await homeContract.getBridgeInterfacesVersion()
|
||||
major.should.be.bignumber.gte(0)
|
||||
minor.should.be.bignumber.gte(0)
|
||||
patch.should.be.bignumber.gte(0)
|
||||
})
|
||||
it('cant set maxPerTx > dailyLimit', async () => {
|
||||
false.should.be.equal(await homeContract.isInitialized())
|
||||
|
|
|
@ -57,6 +57,10 @@ contract('ForeignBridge', async (accounts) => {
|
|||
const bridgeMode = '0x92a8d7fe' // 4 bytes of keccak256('native-to-erc-core')
|
||||
const mode = await foreignBridge.bridgeMode();
|
||||
mode.should.be.equal(bridgeMode)
|
||||
const [major, minor, patch] = await foreignBridge.getBridgeInterfacesVersion()
|
||||
major.should.be.bignumber.gte(0)
|
||||
minor.should.be.bignumber.gte(0)
|
||||
patch.should.be.bignumber.gte(0)
|
||||
})
|
||||
})
|
||||
describe('#executeSignatures', async () => {
|
||||
|
|
|
@ -39,6 +39,10 @@ contract('HomeBridge', async (accounts) => {
|
|||
const bridgeMode = '0x92a8d7fe' // 4 bytes of keccak256('native-to-erc-core')
|
||||
const mode = await homeContract.bridgeMode();
|
||||
mode.should.be.equal(bridgeMode)
|
||||
const [major, minor, patch] = await homeContract.getBridgeInterfacesVersion()
|
||||
major.should.be.bignumber.gte(0)
|
||||
minor.should.be.bignumber.gte(0)
|
||||
patch.should.be.bignumber.gte(0)
|
||||
})
|
||||
it('cant set maxPerTx > dailyLimit', async () => {
|
||||
false.should.be.equal(await homeContract.isInitialized())
|
||||
|
|
|
@ -26,6 +26,10 @@ contract('ERC677BridgeToken', async (accounts) => {
|
|||
const mintingFinished = await token.mintingFinished();
|
||||
assert.equal(mintingFinished, false);
|
||||
|
||||
const [major, minor, patch] = await token.getInterfacesVersion()
|
||||
major.should.be.bignumber.gte(0)
|
||||
minor.should.be.bignumber.gte(0)
|
||||
patch.should.be.bignumber.gte(0)
|
||||
})
|
||||
describe('#mint', async() => {
|
||||
it('can mint by owner', async () => {
|
||||
|
|
|
@ -29,6 +29,10 @@ contract('BridgeValidators', async (accounts) => {
|
|||
accounts[2].should.be.equal(await bridgeValidators.owner())
|
||||
'2'.should.be.bignumber.equal(await bridgeValidators.validatorCount());
|
||||
(await bridgeValidators.deployedAtBlock()).should.be.bignumber.above(0)
|
||||
const [major, minor, patch] = await bridgeValidators.getInterfacesVersion()
|
||||
major.should.be.bignumber.gte(0)
|
||||
minor.should.be.bignumber.gte(0)
|
||||
patch.should.be.bignumber.gte(0)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue