diff --git a/src/deploy/deploy-home/.env.development b/src/deploy/deploy-home/.env.development index 390b68f..e0d21e7 100644 --- a/src/deploy/deploy-home/.env.development +++ b/src/deploy/deploy-home/.env.development @@ -10,3 +10,6 @@ VALIDATOR_ADDRESS_3=0x6352e3e6038e05b9da00c84ae851308f9774f883 #VALIDATOR_ADDRESS_4=0x4db6b4bd0a3fdc03b027a60f1c48f05c572312aa THRESHOLD=1 + +MIN_TX_LIMIT=10000000000000000 +MAX_TX_LIMIT=100000000000000000000 diff --git a/src/deploy/deploy-home/.env.staging b/src/deploy/deploy-home/.env.staging index 6a2c8f4..cff5763 100644 --- a/src/deploy/deploy-home/.env.staging +++ b/src/deploy/deploy-home/.env.staging @@ -11,3 +11,6 @@ VALIDATOR_ADDRESS_3=0xcccc27ae510b63E30eC3C68AAD7DdD2578bD62ed #VALIDATOR_ADDRESS_4=0xdddd9300e32fe162bA420f7313651Fd901C2ed71 THRESHOLD=1 + +MIN_TX_LIMIT=10000000000000000 +MAX_TX_LIMIT=100000000000000000000 diff --git a/src/deploy/deploy-home/contracts/Bridge.sol b/src/deploy/deploy-home/contracts/Bridge.sol index 255b65d..c57e09b 100644 --- a/src/deploy/deploy-home/contracts/Bridge.sol +++ b/src/deploy/deploy-home/contracts/Bridge.sol @@ -47,7 +47,10 @@ contract Bridge { uint public epoch; uint public nextEpoch; - constructor(uint threshold, address[] memory validators, address _tokenContract) public { + uint minTxLimit; + uint maxTxLimit; + + constructor(uint threshold, address[] memory validators, address _tokenContract, uint[2] memory limits) public { require(validators.length > 0); require(threshold < validators.length); @@ -59,6 +62,9 @@ contract Bridge { states[1] = State(validators, threshold, 0, 0); + minTxLimit = limits[0]; + maxTxLimit = limits[1]; + emit NewEpoch(0, 1); } @@ -95,7 +101,7 @@ contract Bridge { } function exchange(uint value) public ready { - require(value >= 10 ** 10); + require(value >= minTxLimit && value >= 10 ** 10 && value <= maxTxLimit); tokenContract.transferFrom(msg.sender, address(this), value); emit ExchangeRequest(value); diff --git a/src/deploy/deploy-home/migrations/1_deployment.js b/src/deploy/deploy-home/migrations/1_deployment.js index b3b67f0..b9376ff 100644 --- a/src/deploy/deploy-home/migrations/1_deployment.js +++ b/src/deploy/deploy-home/migrations/1_deployment.js @@ -5,7 +5,7 @@ const addresses = Object.entries(process.env) .map(([ , value ]) => value) const { - THRESHOLD, HOME_TOKEN_ADDRESS + THRESHOLD, HOME_TOKEN_ADDRESS, MIN_TX_LIMIT, MAX_TX_LIMIT } = process.env module.exports = deployer => { @@ -13,6 +13,7 @@ module.exports = deployer => { Bridge, THRESHOLD, addresses, - HOME_TOKEN_ADDRESS + HOME_TOKEN_ADDRESS, + [ MIN_TX_LIMIT, MAX_TX_LIMIT ] ) }