Common token and parity rpc

This commit is contained in:
rzadp 2019-06-04 13:43:53 +02:00
parent ff20521cce
commit fddeb6869f
5 changed files with 27 additions and 21 deletions

@ -13,14 +13,18 @@
}, },
"ercToErcBridge": { "ercToErcBridge": {
"home": "0x1feB40aD9420b186F019A717c37f5546165d411E", "home": "0x1feB40aD9420b186F019A717c37f5546165d411E",
"foreign": "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127" "foreign": "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127",
"homeToken": "0x792455a6bCb62Ed4C4362D323E0590654CA4765c",
"foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f"
}, },
"ercToNativeBidge": { "ercToNativeBridge": {
"home": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda", "home": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda",
"foreign": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda" "foreign": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda",
"foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f"
}, },
"nativeToErcBridge": { "nativeToErcBridge": {
"home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624", "home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624",
"foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769" "foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769",
"foreignToken": "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"
} }
} }

@ -1,3 +1,5 @@
{ {
"contractsPath": "../contracts" "contractsPath": "../contracts",
"homeRPC": "http://parity1:8545",
"foreignRPC": "http://parity2:8545"
} }

@ -3,13 +3,13 @@ const Web3 = require('web3')
const assert = require('assert') const assert = require('assert')
const promiseRetry = require('promise-retry') const promiseRetry = require('promise-retry')
const { user, ercToErcBridge } = require('../../e2e-commons/constants.json') const { user, ercToErcBridge } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json') const { contractsPath, homeRPC, foreignRPC } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils') const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts') const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545')) const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545')) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC))
const HOME_BRIDGE_ADDRESS = ercToErcBridge.home const HOME_BRIDGE_ADDRESS = ercToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign const FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign
@ -22,11 +22,11 @@ foreignWeb3.eth.accounts.wallet.add(user.privateKey)
const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi
const erc20Token = new foreignWeb3.eth.Contract( const erc20Token = new foreignWeb3.eth.Contract(
tokenAbi, tokenAbi,
'0x3C665A31199694Bf723fD08844AD290207B5797f' ercToErcBridge.foreignToken
) )
const erc677Token = new homeWeb3.eth.Contract( const erc677Token = new homeWeb3.eth.Contract(
tokenAbi, tokenAbi,
'0x792455a6bCb62Ed4C4362D323E0590654CA4765c' ercToErcBridge.homeToken
) )
describe('erc to erc', () => { describe('erc to erc', () => {

@ -2,17 +2,17 @@ const path = require('path')
const Web3 = require('web3') const Web3 = require('web3')
const assert = require('assert') const assert = require('assert')
const promiseRetry = require('promise-retry') const promiseRetry = require('promise-retry')
const { user, ercToNativeBidge } = require('../../e2e-commons/constants.json') const { user, ercToNativeBridge } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json') const { contractsPath, homeRPC, foreignRPC } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils') const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts') const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545')) const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545')) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC))
const HOME_BRIDGE_ADDRESS = ercToNativeBidge.home const HOME_BRIDGE_ADDRESS = ercToNativeBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToNativeBidge.foreign const FOREIGN_BRIDGE_ADDRESS = ercToNativeBridge.foreign
const { toBN } = foreignWeb3.utils const { toBN } = foreignWeb3.utils
@ -22,7 +22,7 @@ foreignWeb3.eth.accounts.wallet.add(user.privateKey)
const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi
const erc20Token = new foreignWeb3.eth.Contract( const erc20Token = new foreignWeb3.eth.Contract(
tokenAbi, tokenAbi,
'0x3C665A31199694Bf723fD08844AD290207B5797f' ercToNativeBridge.foreignToken
) )
describe('erc to native', () => { describe('erc to native', () => {

@ -3,13 +3,13 @@ const Web3 = require('web3')
const assert = require('assert') const assert = require('assert')
const promiseRetry = require('promise-retry') const promiseRetry = require('promise-retry')
const { user, validator, nativeToErcBridge, secondUser } = require('../../e2e-commons/constants.json') const { user, validator, nativeToErcBridge, secondUser } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json') const { contractsPath, homeRPC, foreignRPC } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils') const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, '/build/contracts') const abisDir = path.join(__dirname, '..', contractsPath, '/build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545')) const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545')) const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC))
const HOME_BRIDGE_ADDRESS = nativeToErcBridge.home const HOME_BRIDGE_ADDRESS = nativeToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = nativeToErcBridge.foreign const FOREIGN_BRIDGE_ADDRESS = nativeToErcBridge.foreign
@ -24,7 +24,7 @@ foreignWeb3.eth.accounts.wallet.add(validator.privateKey)
foreignWeb3.eth.accounts.wallet.add(secondUser.privateKey) foreignWeb3.eth.accounts.wallet.add(secondUser.privateKey)
const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi
const token = new foreignWeb3.eth.Contract(tokenAbi, '0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B') const token = new foreignWeb3.eth.Contract(tokenAbi, nativeToErcBridge.foreignToken)
const sleep = timeout => new Promise(res => setTimeout(res, timeout)) const sleep = timeout => new Promise(res => setTimeout(res, timeout))