Skip to content

Commit

Permalink
Fix deployment scripts when using web3 1.2.9 (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev authored Jul 1, 2020
1 parent de50e60 commit f074379
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 42 deletions.
4 changes: 2 additions & 2 deletions deploy/src/amb_erc20_to_native/initializeForeign.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ async function initializeMediator({
.initialize(
bridgeContract,
mediatorContract,
[FOREIGN_DAILY_LIMIT.toString(10), FOREIGN_MAX_AMOUNT_PER_TX.toString(10), FOREIGN_MIN_AMOUNT_PER_TX.toString(10)],
[HOME_DAILY_LIMIT.toString(10), HOME_MAX_AMOUNT_PER_TX.toString(10)],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString(), FOREIGN_MIN_AMOUNT_PER_TX.toString()],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString()],
requestGasLimit,
foreignToHomeDecimalShift,
owner,
Expand Down
10 changes: 5 additions & 5 deletions deploy/src/amb_erc20_to_native/initializeHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ async function initializeMediator({
.initialize(
bridgeContract,
mediatorContract,
[HOME_DAILY_LIMIT.toString(10), HOME_MAX_AMOUNT_PER_TX.toString(10), HOME_MIN_AMOUNT_PER_TX.toString(10)],
[FOREIGN_DAILY_LIMIT.toString(10), FOREIGN_MAX_AMOUNT_PER_TX.toString(10)],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
requestGasLimit,
foreignToHomeDecimalShift,
owner,
Expand Down Expand Up @@ -118,14 +118,14 @@ async function rewardableInitializeMediator({
.rewardableInitialize(
bridgeContract,
mediatorContract,
[HOME_DAILY_LIMIT.toString(10), HOME_MAX_AMOUNT_PER_TX.toString(10), HOME_MIN_AMOUNT_PER_TX.toString(10)],
[FOREIGN_DAILY_LIMIT.toString(10), FOREIGN_MAX_AMOUNT_PER_TX.toString(10)],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
requestGasLimit,
foreignToHomeDecimalShift,
owner,
blockRewardContract,
rewardAddressList,
[homeToForeignFee.toString(10), foreignToHomeFee.toString()]
[homeToForeignFee.toString(), foreignToHomeFee.toString()]
)
.encodeABI()
}
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/amb_erc677_to_erc677/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ async function initialize({
bridgeContract,
mediatorContract,
erc677token,
[dailyLimit, maxPerTx, minPerTx],
[executionDailyLimit, executionMaxPerTx],
[dailyLimit.toString(), maxPerTx.toString(), minPerTx.toString()],
[executionDailyLimit.toString(), executionMaxPerTx.toString()],
requestGasLimit,
foreignToHomeDecimalShift,
owner
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/amb_native_to_erc20/initializeForeign.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ async function initializeMediator({
.initialize(
bridgeContract,
mediatorContract,
[dailyLimit, maxPerTx, minPerTx],
[executionDailyLimit, executionMaxPerTx],
[dailyLimit.toString(), maxPerTx.toString(), minPerTx.toString()],
[executionDailyLimit.toString(), executionMaxPerTx.toString()],
requestGasLimit,
foreignToHomeDecimalShift,
owner,
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/amb_native_to_erc20/initializeHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ async function initializeMediator({
.initialize(
bridgeContract,
mediatorContract,
[dailyLimit, maxPerTx, minPerTx],
[executionDailyLimit, executionMaxPerTx],
[dailyLimit.toString(), maxPerTx.toString(), minPerTx.toString()],
[executionDailyLimit.toString(), executionMaxPerTx.toString()],
requestGasLimit,
foreignToHomeDecimalShift,
owner,
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/erc_to_erc/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ async function initializeBridge({ validatorsBridge, bridge, nonce }) {
ERC20_TOKEN_ADDRESS,
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS,
FOREIGN_GAS_PRICE,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString(), FOREIGN_MIN_AMOUNT_PER_TX.toString()],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString()],
FOREIGN_BRIDGE_OWNER,
foreignToHomeDecimalShift
)
Expand Down
10 changes: 5 additions & 5 deletions deploy/src/erc_to_erc/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ async function initializeBridge({ validatorsBridge, bridge, erc677token, initial
initializeHomeBridgeData = await bridge.methods
.rewardableInitialize(
validatorsBridge.options.address,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
HOME_GAS_PRICE,
HOME_REQUIRED_BLOCK_CONFIRMATIONS,
erc677token.options.address,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_BRIDGE_OWNER,
feeManager.options.address,
[homeFeeInWei, foreignFeeInWei],
[homeFeeInWei.toString(), foreignFeeInWei.toString()],
BLOCK_REWARD_ADDRESS,
foreignToHomeDecimalShift
)
Expand All @@ -119,11 +119,11 @@ async function initializeBridge({ validatorsBridge, bridge, erc677token, initial
initializeHomeBridgeData = await bridge.methods
.initialize(
validatorsBridge.options.address,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
HOME_GAS_PRICE,
HOME_REQUIRED_BLOCK_CONFIRMATIONS,
erc677token.options.address,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_BRIDGE_OWNER,
foreignToHomeDecimalShift
)
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/erc_to_native/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ async function initializeBridge({ validatorsBridge, bridge, nonce, homeBridgeAdd
ERC20_TOKEN_ADDRESS,
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS,
FOREIGN_GAS_PRICE,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString(), FOREIGN_MIN_AMOUNT_PER_TX.toString()],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString()],
FOREIGN_BRIDGE_OWNER,
foreignToHomeDecimalShift,
homeBridgeAddress
Expand Down
10 changes: 5 additions & 5 deletions deploy/src/erc_to_native/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ async function initializeBridge({ validatorsBridge, bridge, initialNonce }) {
initializeHomeBridgeData = await bridge.methods
.rewardableInitialize(
validatorsBridge.options.address,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
HOME_GAS_PRICE,
HOME_REQUIRED_BLOCK_CONFIRMATIONS,
BLOCK_REWARD_ADDRESS,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_BRIDGE_OWNER,
feeManager.options.address,
[homeFeeInWei, foreignFeeInWei],
[homeFeeInWei.toString(), foreignFeeInWei.toString()],
foreignToHomeDecimalShift
)
.encodeABI()
Expand All @@ -123,11 +123,11 @@ async function initializeBridge({ validatorsBridge, bridge, initialNonce }) {
initializeHomeBridgeData = await bridge.methods
.initialize(
validatorsBridge.options.address,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
HOME_GAS_PRICE,
HOME_REQUIRED_BLOCK_CONFIRMATIONS,
BLOCK_REWARD_ADDRESS,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_BRIDGE_OWNER,
foreignToHomeDecimalShift
)
Expand Down
1 change: 1 addition & 0 deletions deploy/src/loadContracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function getContracts(evmVersion) {
? require(`../../build/${buildPath}/ClassicHomeBridgeNativeToErc.json`)
: require(`../../build/${buildPath}/HomeBridgeNativeToErc.json`),
BlockReward: require(`../../build/${buildPath}/BlockReward.json`),
BlockRewardMock: require(`../../build/${buildPath}/BlockRewardMock.json`),
HomeAMB: require(`../../build/${buildPath}/HomeAMB.json`),
ForeignAMB: require(`../../build/${buildPath}/ForeignAMB`),
HomeAMBErc677ToErc677: require(`../../build/${buildPath}/HomeAMBErc677ToErc677.json`),
Expand Down
8 changes: 4 additions & 4 deletions deploy/src/native_to_erc/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ async function initializeBridge({ validatorsBridge, bridge, erc677bridgeToken, i
.rewardableInitialize(
validatorsBridge.options.address,
erc677bridgeToken.options.address,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString(), FOREIGN_MIN_AMOUNT_PER_TX.toString()],
FOREIGN_GAS_PRICE,
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString()],
FOREIGN_BRIDGE_OWNER,
feeManager.options.address,
homeFeeInWei,
Expand Down Expand Up @@ -135,10 +135,10 @@ async function initializeBridge({ validatorsBridge, bridge, erc677bridgeToken, i
.initialize(
validatorsBridge.options.address,
erc677bridgeToken.options.address,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString(), FOREIGN_MIN_AMOUNT_PER_TX.toString()],
FOREIGN_GAS_PRICE,
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString()],
FOREIGN_BRIDGE_OWNER,
foreignToHomeDecimalShift,
homeBridgeAddress
Expand Down
10 changes: 5 additions & 5 deletions deploy/src/native_to_erc/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ async function initializeBridge({ validatorsBridge, bridge, initialNonce }) {
initializeHomeBridgeData = await bridge.methods
.rewardableInitialize(
validatorsBridge.options.address,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
HOME_GAS_PRICE,
HOME_REQUIRED_BLOCK_CONFIRMATIONS,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_BRIDGE_OWNER,
feeManager.options.address,
[homeFeeInWei, foreignFeeInWei],
[homeFeeInWei.toString(), foreignFeeInWei.toString()],
foreignToHomeDecimalShift
)
.encodeABI()
Expand All @@ -121,10 +121,10 @@ async function initializeBridge({ validatorsBridge, bridge, initialNonce }) {
initializeHomeBridgeData = await bridge.methods
.initialize(
validatorsBridge.options.address,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
HOME_GAS_PRICE,
HOME_REQUIRED_BLOCK_CONFIRMATIONS,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_BRIDGE_OWNER,
foreignToHomeDecimalShift
)
Expand Down
8 changes: 4 additions & 4 deletions deploy/src/stake_token_mediators/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ async function initializeHome(homeMediator, foreignMediator) {
HOME_AMB_BRIDGE,
foreignMediator,
HOME_STAKE_TOKEN_ADDRESS,
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX, HOME_MIN_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString(), HOME_MIN_AMOUNT_PER_TX.toString()],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString()],
HOME_MEDIATOR_REQUEST_GAS_LIMIT,
foreignToHomeDecimalShift,
HOME_BRIDGE_OWNER,
Expand Down Expand Up @@ -127,8 +127,8 @@ async function initializeForeign(foreignMediator, homeMediator) {
FOREIGN_AMB_BRIDGE,
homeMediator,
FOREIGN_STAKE_TOKEN_ADDRESS,
[FOREIGN_DAILY_LIMIT, FOREIGN_MAX_AMOUNT_PER_TX, FOREIGN_MIN_AMOUNT_PER_TX],
[HOME_DAILY_LIMIT, HOME_MAX_AMOUNT_PER_TX],
[FOREIGN_DAILY_LIMIT.toString(), FOREIGN_MAX_AMOUNT_PER_TX.toString(), FOREIGN_MIN_AMOUNT_PER_TX.toString()],
[HOME_DAILY_LIMIT.toString(), HOME_MAX_AMOUNT_PER_TX.toString()],
FOREIGN_MEDIATOR_REQUEST_GAS_LIMIT,
foreignToHomeDecimalShift,
FOREIGN_BRIDGE_OWNER
Expand Down
4 changes: 2 additions & 2 deletions deploy/src/utils/deployBlockReward.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Web3Utils = require('web3-utils')
const { web3Home, deploymentPrivateKey, HOME_RPC_URL } = require('../web3')
const { deployContract, privateKeyToAddress, sendRawTxHome } = require('../deploymentUtils')
const {
homeContracts: { BlockReward }
homeContracts: { BlockRewardMock }
} = require('../loadContracts')
const env = require('../loadEnv')

Expand All @@ -12,7 +12,7 @@ const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVAT

async function deployBlockReward() {
let homeNonce = await web3Home.eth.getTransactionCount(DEPLOYMENT_ACCOUNT_ADDRESS)
const blockReward = await deployContract(BlockReward, [], {
const blockReward = await deployContract(BlockRewardMock, [], {
from: DEPLOYMENT_ACCOUNT_ADDRESS,
network: 'home',
nonce: homeNonce
Expand Down

0 comments on commit f074379

Please sign in to comment.