2019-07-15 19:07:11 +03:00
|
|
|
const HOME_ERC_TO_NATIVE_ABI = require('../contracts/build/contracts/HomeBridgeErcToNative').abi
|
2019-08-01 16:10:22 +03:00
|
|
|
const FOREIGN_ERC_TO_NATIVE_ABI = require('../contracts/build/contracts/ForeignBridgeErcToNative').abi
|
2019-07-15 19:07:11 +03:00
|
|
|
const ERC20_ABI = require('../contracts/build/contracts/ERC20').abi
|
2021-05-08 18:50:46 +03:00
|
|
|
const BLOCK_REWARD_ABI = require('../contracts/build/contracts/BlockRewardMock').abi
|
2019-07-15 19:07:11 +03:00
|
|
|
const BRIDGE_VALIDATORS_ABI = require('../contracts/build/contracts/BridgeValidators').abi
|
|
|
|
const REWARDABLE_VALIDATORS_ABI = require('../contracts/build/contracts/RewardableValidators').abi
|
2019-10-21 15:57:28 +03:00
|
|
|
const HOME_AMB_ABI = require('../contracts/build/contracts/HomeAMB').abi
|
|
|
|
const FOREIGN_AMB_ABI = require('../contracts/build/contracts/ForeignAMB').abi
|
|
|
|
const BOX_ABI = require('../contracts/build/contracts/Box').abi
|
2020-05-18 23:36:52 +03:00
|
|
|
const HOME_AMB_ERC_TO_ERC_ABI = require('../contracts/build/contracts/HomeAMBErc677ToErc677').abi
|
|
|
|
const FOREIGN_AMB_ERC_TO_ERC_ABI = require('../contracts/build/contracts/ForeignAMBErc677ToErc677').abi
|
2019-07-11 16:46:52 +03:00
|
|
|
|
|
|
|
const { BRIDGE_MODES } = require('./constants')
|
|
|
|
|
2020-06-10 16:22:01 +03:00
|
|
|
const OLD_AMB_USER_REQUEST_FOR_SIGNATURE_ABI = [
|
|
|
|
{
|
|
|
|
anonymous: false,
|
|
|
|
inputs: [
|
|
|
|
{
|
|
|
|
indexed: false,
|
|
|
|
name: 'encodedData',
|
|
|
|
type: 'bytes'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
name: 'UserRequestForSignature',
|
|
|
|
type: 'event'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
const OLD_AMB_USER_REQUEST_FOR_AFFIRMATION_ABI = [
|
|
|
|
{
|
|
|
|
anonymous: false,
|
|
|
|
inputs: [
|
|
|
|
{
|
|
|
|
indexed: false,
|
|
|
|
name: 'encodedData',
|
|
|
|
type: 'bytes'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
name: 'UserRequestForAffirmation',
|
|
|
|
type: 'event'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2019-07-11 16:46:52 +03:00
|
|
|
function getBridgeABIs(bridgeMode) {
|
|
|
|
let HOME_ABI = null
|
|
|
|
let FOREIGN_ABI = null
|
2021-05-08 18:50:46 +03:00
|
|
|
if (bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) {
|
2019-07-11 16:46:52 +03:00
|
|
|
HOME_ABI = HOME_ERC_TO_NATIVE_ABI
|
|
|
|
FOREIGN_ABI = FOREIGN_ERC_TO_NATIVE_ABI
|
2019-10-21 15:57:28 +03:00
|
|
|
} else if (bridgeMode === BRIDGE_MODES.ARBITRARY_MESSAGE) {
|
|
|
|
HOME_ABI = HOME_AMB_ABI
|
|
|
|
FOREIGN_ABI = FOREIGN_AMB_ABI
|
2020-05-18 23:36:52 +03:00
|
|
|
} else if (bridgeMode === BRIDGE_MODES.AMB_ERC_TO_ERC) {
|
|
|
|
HOME_ABI = HOME_AMB_ERC_TO_ERC_ABI
|
|
|
|
FOREIGN_ABI = FOREIGN_AMB_ERC_TO_ERC_ABI
|
2019-07-11 16:46:52 +03:00
|
|
|
} else {
|
|
|
|
throw new Error(`Unrecognized bridge mode: ${bridgeMode}`)
|
|
|
|
}
|
|
|
|
|
|
|
|
return { HOME_ABI, FOREIGN_ABI }
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getBridgeABIs,
|
|
|
|
HOME_ERC_TO_NATIVE_ABI,
|
|
|
|
FOREIGN_ERC_TO_NATIVE_ABI,
|
|
|
|
ERC20_ABI,
|
|
|
|
BLOCK_REWARD_ABI,
|
|
|
|
BRIDGE_VALIDATORS_ABI,
|
2019-07-26 11:30:35 +03:00
|
|
|
REWARDABLE_VALIDATORS_ABI,
|
2019-10-21 15:57:28 +03:00
|
|
|
HOME_AMB_ABI,
|
|
|
|
FOREIGN_AMB_ABI,
|
2020-06-10 16:22:01 +03:00
|
|
|
OLD_AMB_USER_REQUEST_FOR_AFFIRMATION_ABI,
|
|
|
|
OLD_AMB_USER_REQUEST_FOR_SIGNATURE_ABI,
|
2021-05-08 18:50:46 +03:00
|
|
|
BOX_ABI
|
2019-07-11 16:46:52 +03:00
|
|
|
}
|