Common bridge addresses, common second user, renamed constants.json to config

This commit is contained in:
rzadp 2019-06-04 13:27:21 +02:00
parent 23d109b84c
commit 22937a9b0e
6 changed files with 37 additions and 25 deletions

@ -3,8 +3,24 @@
"address": "0x7FC1442AB55Da569940Eb750AaD2BAA63DA4010E",
"privateKey": "0x460635eb4ac4287de2d2393985e19b4a9f948ac533453a1044ab8d50330b0df9"
},
"secondUser": {
"address": "0xcca2fb44C8C36E51f743269d6F484Fd027B9F9Aa",
"privateKey": "0xcf954e07e6a439faf392eb474e95ddb444c2ca444847f2ad6ecc79e1a585e2b8"
},
"validator": {
"address": "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b",
"privateKey": "0x8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
},
"ercToErcBridge": {
"home": "0x1feB40aD9420b186F019A717c37f5546165d411E",
"foreign": "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127"
},
"ercToNativeBidge": {
"home": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda",
"foreign": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda"
},
"nativeToErcBridge": {
"home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624",
"foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769"
}
}

3
oracle-e2e/config.json Normal file

@ -0,0 +1,3 @@
{
"contractsPath": "../contracts"
}

@ -1,7 +0,0 @@
{
"temp": {
"address": "0xcca2fb44C8C36E51f743269d6F484Fd027B9F9Aa",
"privateKey": "0xcf954e07e6a439faf392eb474e95ddb444c2ca444847f2ad6ecc79e1a585e2b8"
},
"contractsPath": "../contracts"
}

@ -2,8 +2,8 @@ const path = require('path')
const Web3 = require('web3')
const assert = require('assert')
const promiseRetry = require('promise-retry')
const { user } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../constants.json')
const { user, ercToErcBridge } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
@ -11,8 +11,8 @@ const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545'))
const HOME_BRIDGE_ADDRESS = '0x1feB40aD9420b186F019A717c37f5546165d411E'
const FOREIGN_BRIDGE_ADDRESS = '0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127'
const HOME_BRIDGE_ADDRESS = ercToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign
const { toBN } = foreignWeb3.utils

@ -2,8 +2,8 @@ const path = require('path')
const Web3 = require('web3')
const assert = require('assert')
const promiseRetry = require('promise-retry')
const { user } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../constants.json')
const { user, ercToNativeBidge } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
@ -11,8 +11,8 @@ const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545'))
const HOME_BRIDGE_ADDRESS = '0x488Af810997eD1730cB3a3918cD83b3216E6eAda'
const FOREIGN_BRIDGE_ADDRESS = '0x488Af810997eD1730cB3a3918cD83b3216E6eAda'
const HOME_BRIDGE_ADDRESS = ercToNativeBidge.home
const FOREIGN_BRIDGE_ADDRESS = ercToNativeBidge.foreign
const { toBN } = foreignWeb3.utils

@ -2,8 +2,8 @@ const path = require('path')
const Web3 = require('web3')
const assert = require('assert')
const promiseRetry = require('promise-retry')
const { user, validator } = require('../../e2e-commons/constants.json')
const { temp, contractsPath } = require('../constants.json')
const { user, validator, nativeToErcBridge, secondUser } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, '/build/contracts')
@ -11,17 +11,17 @@ const abisDir = path.join(__dirname, '..', contractsPath, '/build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545'))
const HOME_BRIDGE_ADDRESS = '0x32198D570fffC7033641F8A9094FFDCaAEF42624'
const FOREIGN_BRIDGE_ADDRESS = '0x2B6871b9B02F73fa24F4864322CdC78604207769'
const HOME_BRIDGE_ADDRESS = nativeToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = nativeToErcBridge.foreign
const { toBN } = foreignWeb3.utils
homeWeb3.eth.accounts.wallet.add(user.privateKey)
homeWeb3.eth.accounts.wallet.add(validator.privateKey)
homeWeb3.eth.accounts.wallet.add(temp.privateKey)
homeWeb3.eth.accounts.wallet.add(secondUser.privateKey)
foreignWeb3.eth.accounts.wallet.add(user.privateKey)
foreignWeb3.eth.accounts.wallet.add(validator.privateKey)
foreignWeb3.eth.accounts.wallet.add(temp.privateKey)
foreignWeb3.eth.accounts.wallet.add(secondUser.privateKey)
const tokenAbi = require(path.join(abisDir, 'ERC677BridgeToken.json')).abi
const token = new foreignWeb3.eth.Contract(tokenAbi, '0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B')
@ -106,7 +106,7 @@ describe('native to erc', () => {
const originalBalance = toBN(await token.methods.balanceOf(user.address).call())
// empty validator funds
await sendAllBalance(homeWeb3, validator.address, temp.address)
await sendAllBalance(homeWeb3, validator.address, secondUser.address)
// send transaction to home chain
const depositTx = await homeWeb3.eth.sendTransaction({
@ -128,7 +128,7 @@ describe('native to erc', () => {
assert(originalBalance.eq(balance), "Token balance shouldn't have changed")
// send funds back to validator
const sendBalanceBackTx = await sendAllBalance(homeWeb3, temp.address, validator.address)
const sendBalanceBackTx = await sendAllBalance(homeWeb3, secondUser.address, validator.address)
// expect Deposit event to be processed
await promiseRetry(
@ -162,7 +162,7 @@ describe('native to erc', () => {
const originalBalance = toBN(await token.methods.balanceOf(user.address).call())
// empty foreign validator funds
await sendAllBalance(foreignWeb3, validator.address, temp.address)
await sendAllBalance(foreignWeb3, validator.address, secondUser.address)
const foreignBlockNumber = await foreignWeb3.eth.getBlockNumber()
// send transaction to home chain
@ -200,7 +200,7 @@ describe('native to erc', () => {
assert(lastForeignBlockNumber === foreignBlockNumber, "Shouldn't have emitted a new block")
// send funds back to validator
await sendAllBalance(foreignWeb3, temp.address, validator.address)
await sendAllBalance(foreignWeb3, secondUser.address, validator.address)
// check that account has tokens in the foreign chain
await promiseRetry(async retry => {