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

Relative daily limit #306

Open
wants to merge 86 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
520d563
use hex-identifiers directly
maxaleks Oct 9, 2019
8f7bbb8
fix linter errors
maxaleks Oct 10, 2019
9a20b50
update comments
maxaleks Oct 10, 2019
31b7923
convert missed hex-identifiers
maxaleks Oct 10, 2019
01a0d49
add relative daily limit for erc-to-native
maxaleks Oct 11, 2019
689299f
add relative daily limit for native-to-erc
maxaleks Oct 14, 2019
e9dedf3
fix dependencies
maxaleks Oct 14, 2019
281f71d
add relative daily limit for erc-to-erc
maxaleks Oct 14, 2019
0516397
add relative daily limit for amb-erc-to-erc
maxaleks Oct 14, 2019
1e93d13
Merge branch 'develop' into relative-daily-limit
maxaleks Oct 14, 2019
d96b4d7
fix linter errors
maxaleks Oct 15, 2019
f2ab1d4
use hexadecimal values
maxaleks Oct 15, 2019
a23ab52
use relative daily limit env variable only for token bridges
maxaleks Oct 15, 2019
ecc6fca
rename vars in deployment scripts
maxaleks Oct 15, 2019
57a128f
change the function for calculating the limit
maxaleks Oct 15, 2019
0138dcd
fix linter errors
maxaleks Oct 15, 2019
d442a8c
add relative execution daily limit
maxaleks Oct 22, 2019
f26aca2
add executionMinPerTx to initialize methods
maxaleks Oct 22, 2019
77a19d9
update deployment scripts
maxaleks Oct 22, 2019
9be85c3
use relative daily limit only for withdrawal
maxaleks Oct 23, 2019
23b1fa3
rename array
maxaleks Oct 24, 2019
14f17e9
fix
maxaleks Oct 24, 2019
f718acb
Extend initialize methods
maxaleks Oct 25, 2019
4e0ecc0
fix
maxaleks Oct 25, 2019
37a9da0
rename limits arrays
maxaleks Oct 25, 2019
dea4748
fix linter errors
maxaleks Oct 25, 2019
44fb7a8
fix checks
maxaleks Oct 28, 2019
06a3cf0
set relative daily limit once a day
maxaleks Oct 29, 2019
f7850fa
remove checks for relative limit
maxaleks Oct 29, 2019
4de7b72
update amd_erc677_to_erc677 tests to work with relative limit
maxaleks Oct 31, 2019
1c1eaf7
update foreign erc_to_erc tests
maxaleks Oct 31, 2019
95b1a92
update home erc_to_erc tests
maxaleks Nov 1, 2019
4ae56b2
fix check in contracts
maxaleks Nov 1, 2019
cc9fcfa
update foreign erc_to_native tests
maxaleks Nov 1, 2019
54f4519
update home erc_to_native tests
maxaleks Nov 3, 2019
846e09c
update foreign native_to_erc tests
maxaleks Nov 4, 2019
25f9516
fix limit update
maxaleks Nov 4, 2019
d3620fb
update home native_to_erc tests
maxaleks Nov 5, 2019
26046a1
add a multiplier to the daily limit calculation
maxaleks Nov 5, 2019
730653e
Merge branch 'develop' into relative-daily-limit
maxaleks Nov 5, 2019
2bb04fc
fix contracts after merge
maxaleks Nov 5, 2019
a744087
fix tests after merge
maxaleks Nov 5, 2019
0f1ae3f
add tests for relative daily limit calculation
maxaleks Nov 6, 2019
a4ad5ee
fix initialize method conflict
maxaleks Nov 7, 2019
3a69ab3
update deployment scripts
maxaleks Nov 7, 2019
b4fe09d
update flatten script
maxaleks Nov 7, 2019
e225c6c
update readme
maxaleks Nov 7, 2019
d7834d0
remove unnecessary checks in tests
maxaleks Nov 7, 2019
64c4366
fix typos
maxaleks Nov 8, 2019
7e8009b
remove redundant check in relative daily limit calculation
maxaleks Nov 8, 2019
89aadfd
add tests for setTargetLimit and setThreshold
maxaleks Nov 8, 2019
c2c9f22
allow to set max per tx to 0
maxaleks Nov 25, 2019
506bdec
fix linter errors
maxaleks Nov 25, 2019
7fac22c
Merge branch 'develop' into relative-daily-limit
maxaleks Dec 2, 2019
28f4c0a
move limits logic to external contract
maxaleks Dec 9, 2019
9797e06
support absolute and relative limit in one implementation (remove dup…
maxaleks Dec 10, 2019
4409193
remove extensions of methods
maxaleks Dec 10, 2019
f66b675
change modifiers
maxaleks Dec 10, 2019
d16f62c
rename limits contract
maxaleks Dec 10, 2019
9f9140c
fix contracts
maxaleks Dec 11, 2019
9aff13d
fix amb tests
maxaleks Dec 12, 2019
8e313ca
remove duplicate amb tests
maxaleks Dec 12, 2019
1ece9a1
fix conttracts
maxaleks Dec 13, 2019
5c3041c
add internal setLimits method
maxaleks Dec 15, 2019
bdc4aa0
ffix foreign erc-to-erc tests
maxaleks Dec 15, 2019
abcd4a7
fix tests
maxaleks Dec 15, 2019
07d1850
return the old order of parameters
maxaleks Dec 16, 2019
eefae4d
fix home erc-to-erc tests
maxaleks Dec 16, 2019
853e101
fix foreign erc-to-native tests
maxaleks Dec 16, 2019
1001737
add payable modifier for methods of limits contract
maxaleks Dec 17, 2019
0178a79
fix home erc-to-native tests
maxaleks Dec 17, 2019
9f924cf
fix foreign native-to-erc tests
maxaleks Dec 17, 2019
18040de
fix home native-to-erc tests
maxaleks Dec 17, 2019
d8a049e
fix erc677 bridge token tests
maxaleks Dec 17, 2019
d41a9d2
update flatten script
maxaleks Dec 18, 2019
f878a3d
update deployment scripts
maxaleks Dec 18, 2019
94484a4
update tests
maxaleks Dec 18, 2019
79752d6
Merge branch 'develop' into relative-daily-limit
maxaleks Dec 18, 2019
08ce571
Merge branch 'develop' into relative-daily-limit
maxaleks Dec 18, 2019
ec03614
fix linter errors
maxaleks Dec 19, 2019
cf360d5
Merge branch 'develop' into relative-daily-limit
maxaleks Dec 27, 2019
d171071
fix merge
maxaleks Dec 27, 2019
4aa2b66
Update explorer verifier script to include limit contracts
patitonar Dec 27, 2019
d929f43
fix params in deploymentt scripts
maxaleks Dec 27, 2019
b4c7dce
Merge branch 'develop' into relative-daily-limit
maxaleks Dec 27, 2019
a5f2403
return mistakenly deleted method
maxaleks Jan 8, 2020
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
48 changes: 48 additions & 0 deletions contracts/upgradeable_contracts/RelativeDailyLimit.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./BasicTokenBridge.sol";

contract RelativeDailyLimit is BasicTokenBridge {
using SafeMath for uint256;

event TargetLimitChanged(uint256 newLimit);
event ThresholdChanged(uint256 newThreshold);

bytes32 internal constant TARGET_LIMIT = keccak256(abi.encodePacked("targetLimit"));
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
bytes32 internal constant THRESHOLD = keccak256(abi.encodePacked("threshold"));

function dailyLimit() public view returns (uint256) {
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
uint256 balance = _getTokenBalance();
uint256 minBalance = targetLimit().mul(threshold()).div(100);
uint256 limit;
if (balance < minBalance) {
limit = 100;
} else if (balance >= minBalance && balance < threshold()) {
limit = targetLimit().mul(threshold()).div(balance);
} else {
limit = targetLimit();
}
return balance.mul(limit).div(100);
}

function targetLimit() public view returns (uint256) {
return uintStorage[TARGET_LIMIT];
}

function threshold() public view returns (uint256) {
return uintStorage[THRESHOLD];
}

function setTargetLimit(uint256 _targetLimit) external onlyOwner {
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
uintStorage[TARGET_LIMIT] = _targetLimit;
emit TargetLimitChanged(_targetLimit);
}

function setThreshold(uint256 _threshold) external onlyOwner {
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
uintStorage[THRESHOLD] = _threshold;
emit ThresholdChanged(_threshold);
}

function _getTokenBalance() internal view returns (uint256);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./ForeignAMBErc677ToErc677.sol";
import "../RelativeDailyLimit.sol";

contract ForeignAMBErc677ToErc677RelativeDailyLimit is ForeignAMBErc677ToErc677, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return erc677token().balanceOf(address(this));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./HomeAMBErc677ToErc677.sol";
import "../RelativeDailyLimit.sol";

contract HomeAMBErc677ToErc677RelativeDailyLimit is HomeAMBErc677ToErc677, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return erc677token().totalSupply();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./BasicForeignBridgeErcToErc.sol";
import "../RelativeDailyLimit.sol";

contract BasicForeignBridgeErcToErcRelativeDailyLimit is BasicForeignBridgeErcToErc, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return erc20token().balanceOf(address(this));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity 0.4.24;

import "./ForeignBridgeErc677ToErc677.sol";
import "./BasicForeignBridgeErcToErcRelativeDailyLimit.sol";

// solhint-disable-next-line no-empty-blocks
contract ForeignBridgeErc677ToErc677RelativeDailyLimit is
BasicForeignBridgeErcToErcRelativeDailyLimit,
ForeignBridgeErc677ToErc677 {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity 0.4.24;

import "./ForeignBridgeErcToErc.sol";
import "./BasicForeignBridgeErcToErcRelativeDailyLimit.sol";

// solhint-disable-next-line no-empty-blocks
contract ForeignBridgeErcToErcRelativeDailyLimit is
BasicForeignBridgeErcToErcRelativeDailyLimit,
ForeignBridgeErcToErc {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./HomeBridgeErcToErcPOSDAO.sol";
import "./HomeBridgeErcToErcRelativeDailyLimit.sol";

// solhint-disable-next-line no-empty-blocks
contract HomeBridgeErcToErcPOSDAORelativeDailyLimit is
HomeBridgeErcToErcRelativeDailyLimit,
HomeBridgeErcToErcPOSDAO {}

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./HomeBridgeErcToErc.sol";
import "../RelativeDailyLimit.sol";

contract HomeBridgeErcToErcRelativeDailyLimit is HomeBridgeErcToErc, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return erc677token().totalSupply();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./ForeignBridgeErcToNative.sol";
import "../RelativeDailyLimit.sol";

contract ForeignBridgeErcToNativeRelativeDailyLimit is ForeignBridgeErcToNative, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return erc20token().balanceOf(address(this));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./HomeBridgeErcToNative.sol";
import "../RelativeDailyLimit.sol";

contract HomeBridgeErcToNativeRelativeDailyLimit is HomeBridgeErcToNative, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
uint256 totalMinted = blockRewardContract().mintedTotallyByBridge(address(this));
uint256 totalBurnt = totalBurntCoins();
return totalMinted.sub(totalBurnt);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./ClassicHomeBridgeNativeToErc.sol";
import "../RelativeDailyLimit.sol";

contract ClassicHomeBridgeNativeToErcRelativeDailyLimit is ClassicHomeBridgeNativeToErc, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return address(this).balance;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./ForeignBridgeNativeToErc.sol";
import "../RelativeDailyLimit.sol";

contract ForeignBridgeNativeToErcRelativeDailyLimit is ForeignBridgeNativeToErc, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return erc677token().totalSupply();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity 0.4.24;

import "./HomeBridgeNativeToErc.sol";
import "../RelativeDailyLimit.sol";

contract HomeBridgeNativeToErcRelativeDailyLimit is HomeBridgeNativeToErc, RelativeDailyLimit {
function _getTokenBalance() internal view returns (uint256) {
return address(this).balance;
}
}
3 changes: 3 additions & 0 deletions deploy/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ FOREIGN_REWARDABLE=false
#E.g. VALIDATORS_REWARD_ACCOUNTS=0x 0x 0x
VALIDATORS_REWARD_ACCOUNTS=0x

# Relative or fixed daily limit
RELATIVE_DAILY_LIMIT=false

# Fee to be taken for every transaction directed from the Home network to the Foreign network
# E.g. 0.1% fee
HOME_TRANSACTIONS_FEE=0.001
Expand Down
14 changes: 11 additions & 3 deletions deploy/src/amb_erc677_to_erc677/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ const Web3Utils = require('web3-utils')
const { web3Foreign, FOREIGN_RPC_URL } = require('../web3')
const { deployContract, privateKeyToAddress, upgradeProxy } = require('../deploymentUtils')
const {
foreignContracts: { EternalStorageProxy, ForeignAMBErc677ToErc677: ForeignBridge }
foreignContracts: {
EternalStorageProxy,
ForeignAMBErc677ToErc677: ForeignBridge,
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
ForeignAMBErc677ToErc677RelativeDailyLimit: ForeignBridgeRelativeDailyLimit,
}
} = require('../loadContracts')
const { DEPLOYMENT_ACCOUNT_PRIVATE_KEY } = require('../loadEnv')
const {
DEPLOYMENT_ACCOUNT_PRIVATE_KEY,
RELATIVE_DAILY_LIMIT,
} = require('../loadEnv')

const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVATE_KEY)

Expand All @@ -21,7 +28,8 @@ async function deployForeign() {
console.log('[Foreign] ForeignBridge Storage: ', foreignBridgeStorage.options.address)

console.log('\n[Foreign] Deploying foreignBridge implementation\n')
const foreignBridgeImplementation = await deployContract(ForeignBridge, [], {
const ForeignBridgeContract = RELATIVE_DAILY_LIMIT ? ForeignBridgeRelativeDailyLimit : ForeignBridge
const foreignBridgeImplementation = await deployContract(ForeignBridgeContract, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
network: 'foreign',
nonce
Expand Down
7 changes: 5 additions & 2 deletions deploy/src/amb_erc677_to_erc677/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ const {
DEPLOYMENT_ACCOUNT_PRIVATE_KEY,
DEPLOY_REWARDABLE_TOKEN,
BLOCK_REWARD_ADDRESS,
DPOS_STAKING_ADDRESS
DPOS_STAKING_ADDRESS,
RELATIVE_DAILY_LIMIT,
} = require('../loadEnv')

const {
homeContracts: {
EternalStorageProxy,
HomeAMBErc677ToErc677: HomeBridge,
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
HomeAMBErc677ToErc677RelativeDailyLimit: HomeBridgeRelativeDailyLimit,
ERC677BridgeToken,
ERC677BridgeTokenRewardable
}
Expand All @@ -43,7 +45,8 @@ async function deployHome() {
console.log('[Home] HomeBridge Storage: ', homeBridgeStorage.options.address)

console.log('\n[Home] Deploying homeBridge implementation\n')
const homeBridgeImplementation = await deployContract(HomeBridge, [], {
const HomeBridgeContract = RELATIVE_DAILY_LIMIT ? HomeBridgeRelativeDailyLimit : HomeBridge
const homeBridgeImplementation = await deployContract(HomeBridgeContract, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
nonce
})
Expand Down
15 changes: 12 additions & 3 deletions deploy/src/erc_to_erc/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const {
EternalStorageProxy,
BridgeValidators,
ForeignBridgeErcToErc: ForeignBridge,
ForeignBridgeErc677ToErc677
ForeignBridgeErcToErcRelativeDailyLimit: ForeignBridgeRelativeDailyLimit,
ForeignBridgeErc677ToErc677,
ForeignBridgeErc677ToErc677: ForeignBridgeErc677ToErc677RelativeDailyLimit,
}
} = require('../loadContracts')

Expand All @@ -38,7 +40,8 @@ const {
FOREIGN_MIN_AMOUNT_PER_TX,
FOREIGN_DAILY_LIMIT,
ERC20_EXTENDED_BY_ERC677,
FOREIGN_TO_HOME_DECIMAL_SHIFT
FOREIGN_TO_HOME_DECIMAL_SHIFT,
RELATIVE_DAILY_LIMIT,
} = env

const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVATE_KEY)
Expand Down Expand Up @@ -169,7 +172,13 @@ async function deployForeign() {
console.log('[Foreign] ForeignBridge Storage: ', foreignBridgeStorage.options.address)

console.log('\ndeploying foreignBridge implementation\n')
const bridgeContract = ERC20_EXTENDED_BY_ERC677 ? ForeignBridgeErc677ToErc677 : ForeignBridge
let ForeignBridgeErc677ToErc677Contract = ForeignBridgeErc677ToErc677
let ForeignBridgeContract = ForeignBridge
if (RELATIVE_DAILY_LIMIT) {
ForeignBridgeErc677ToErc677Contract = ForeignBridgeErc677ToErc677RelativeDailyLimit
ForeignBridgeContract = ForeignBridgeRelativeDailyLimit
}
const bridgeContract = ERC20_EXTENDED_BY_ERC677 ? ForeignBridgeErc677ToErc677Contract : ForeignBridgeContract
const foreignBridgeImplementation = await deployContract(bridgeContract, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
network: 'foreign',
Expand Down
13 changes: 11 additions & 2 deletions deploy/src/erc_to_erc/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const {
RewardableValidators,
FeeManagerErcToErcPOSDAO,
HomeBridgeErcToErc: HomeBridge,
HomeBridgeErcToErcRelativeDailyLimit: HomeBridgeRelativeDailyLimit,
HomeBridgeErcToErcPOSDAO,
HomeBridgeErcToErcPOSDAORelativeDailyLimit: HomeBridgeErcToErcPOSDAORelativeDailyLimit,
ERC677BridgeToken,
ERC677BridgeTokenRewardable
}
Expand Down Expand Up @@ -53,7 +55,8 @@ const {
HOME_REWARDABLE,
HOME_TRANSACTIONS_FEE,
FOREIGN_TRANSACTIONS_FEE,
FOREIGN_TO_HOME_DECIMAL_SHIFT
FOREIGN_TO_HOME_DECIMAL_SHIFT,
RELATIVE_DAILY_LIMIT,
} = env

const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVATE_KEY)
Expand Down Expand Up @@ -209,8 +212,14 @@ async function deployHome() {
console.log('[Home] HomeBridge Storage: ', homeBridgeStorage.options.address)

console.log('\ndeploying homeBridge implementation\n')
let HomeBridgeErcToErcPOSDAOContract = HomeBridgeErcToErcPOSDAO
let HomeBridgeContract = HomeBridge
if (RELATIVE_DAILY_LIMIT) {
HomeBridgeErcToErcPOSDAOContract = HomeBridgeErcToErcPOSDAORelativeDailyLimit
HomeBridgeContract = HomeBridgeRelativeDailyLimit
}
const bridgeContract =
isRewardableBridge && BLOCK_REWARD_ADDRESS !== ZERO_ADDRESS ? HomeBridgeErcToErcPOSDAO : HomeBridge
isRewardableBridge && BLOCK_REWARD_ADDRESS !== ZERO_ADDRESS ? HomeBridgeErcToErcPOSDAOContract : HomeBridgeContract
const homeBridgeImplementation = await deployContract(bridgeContract, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
nonce
Expand Down
13 changes: 10 additions & 3 deletions deploy/src/erc_to_native/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const {
} = require('../deploymentUtils')
const { web3Foreign, deploymentPrivateKey, FOREIGN_RPC_URL } = require('../web3')
const {
foreignContracts: { EternalStorageProxy, BridgeValidators, ForeignBridgeErcToNative: ForeignBridge }
foreignContracts: {
EternalStorageProxy,
BridgeValidators,
ForeignBridgeErcToNative: ForeignBridge,
ForeignBridgeErcToNativeRelativeDailyLimit: ForeignBridgeRelativeDailyLimit,
}
} = require('../loadContracts')

const VALIDATORS = env.VALIDATORS.split(' ')
Expand All @@ -30,7 +35,8 @@ const {
FOREIGN_MAX_AMOUNT_PER_TX,
HOME_DAILY_LIMIT,
HOME_MAX_AMOUNT_PER_TX,
FOREIGN_TO_HOME_DECIMAL_SHIFT
FOREIGN_TO_HOME_DECIMAL_SHIFT,
RELATIVE_DAILY_LIMIT,
} = env

const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVATE_KEY)
Expand Down Expand Up @@ -144,7 +150,8 @@ async function deployForeign() {
console.log('[Foreign] ForeignBridge Storage: ', foreignBridgeStorage.options.address)

console.log('\ndeploying foreignBridge implementation\n')
const foreignBridgeImplementation = await deployContract(ForeignBridge, [], {
const ForeignBridgeContract = RELATIVE_DAILY_LIMIT ? ForeignBridgeRelativeDailyLimit : ForeignBridge
const foreignBridgeImplementation = await deployContract(ForeignBridgeContract, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
network: 'foreign',
nonce
Expand Down
8 changes: 5 additions & 3 deletions deploy/src/erc_to_native/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const {
RewardableValidators,
FeeManagerErcToNative,
HomeBridgeErcToNative: HomeBridge,
HomeBridgeErcToNativeRelativeDailyLimit: HomeBridgeRelativeDailyLimit,
FeeManagerErcToNativePOSDAO
}
} = require('../loadContracts')
Expand All @@ -43,7 +44,8 @@ const {
HOME_TRANSACTIONS_FEE,
FOREIGN_TRANSACTIONS_FEE,
HOME_FEE_MANAGER_TYPE,
FOREIGN_TO_HOME_DECIMAL_SHIFT
FOREIGN_TO_HOME_DECIMAL_SHIFT,
RELATIVE_DAILY_LIMIT,
} = env

const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVATE_KEY)
Expand Down Expand Up @@ -210,9 +212,9 @@ async function deployHome() {
})
nonce++
console.log('[Home] HomeBridge Storage: ', homeBridgeStorage.options.address)

console.log('\ndeploying homeBridge implementation\n')
const homeBridgeImplementation = await deployContract(HomeBridge, [], {
const HomeBridgeContract = RELATIVE_DAILY_LIMIT ? HomeBridgeRelativeDailyLimit : HomeBridge
const homeBridgeImplementation = await deployContract(HomeBridgeContract, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
nonce
})
Expand Down
Loading