Common url and network ID

This commit is contained in:
rzadp 2019-06-04 14:02:45 +02:00
parent c86e956fa0
commit 03ab7b44b6
7 changed files with 36 additions and 35 deletions

@ -11,22 +11,31 @@
"address": "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b",
"privateKey": "0x8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
},
"nativeToErcBridge": {
"home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624",
"foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769",
"foreignToken": "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B",
"ui": "http://localhost:3000"
},
"ercToErcBridge": {
"home": "0x1feB40aD9420b186F019A717c37f5546165d411E",
"foreign": "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127",
"homeToken": "0x792455a6bCb62Ed4C4362D323E0590654CA4765c",
"foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f"
"foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f",
"ui": "http://localhost:3001"
},
"ercToNativeBridge": {
"home": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda",
"foreign": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda",
"foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f"
"foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f",
"ui": "http://localhost:3002"
},
"nativeToErcBridge": {
"home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624",
"foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769",
"foreignToken": "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B"
"homeRPC": {
"URL": "http://parity1:8545",
"ID": "77"
},
"homeRPCURL": "http://parity1:8545",
"foreignRPCURL": "http://parity2:8545"
"foreignRPC": {
"URL": "http://parity2:8545",
"ID": "42"
}
}

@ -2,14 +2,14 @@ const path = require('path')
const Web3 = require('web3')
const assert = require('assert')
const promiseRetry = require('promise-retry')
const { user, ercToErcBridge, homeRPCURL, foreignRPCURL } = require('../../e2e-commons/constants.json')
const { user, ercToErcBridge, homeRPC, foreignRPC } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPCURL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPCURL))
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL))
const HOME_BRIDGE_ADDRESS = ercToErcBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign

@ -2,14 +2,14 @@ const path = require('path')
const Web3 = require('web3')
const assert = require('assert')
const promiseRetry = require('promise-retry')
const { user, ercToNativeBridge, homeRPCURL, foreignRPCURL } = require('../../e2e-commons/constants.json')
const { user, ercToNativeBridge, homeRPC, foreignRPC } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPCURL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPCURL))
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL))
const HOME_BRIDGE_ADDRESS = ercToNativeBridge.home
const FOREIGN_BRIDGE_ADDRESS = ercToNativeBridge.foreign

@ -2,20 +2,18 @@ const path = require('path')
const Web3 = require('web3')
const assert = require('assert')
const promiseRetry = require('promise-retry')
const { user, validator, nativeToErcBridge, secondUser, homeRPCURL, foreignRPCURL } = require('../../e2e-commons/constants.json')
const { user, validator, nativeToErcBridge, secondUser, homeRPC, foreignRPC } = require('../../e2e-commons/constants.json')
const { contractsPath } = require('../config.json')
const { generateNewBlock } = require('../../e2e-commons/utils')
const abisDir = path.join(__dirname, '..', contractsPath, '/build/contracts')
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPCURL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPCURL))
const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL))
const { toBN } = foreignWeb3.utils
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(secondUser.privateKey)

@ -1,7 +1,7 @@
const key = require('selenium-webdriver').Key;
const Page = require('./Page.js').Page;
const By = require('selenium-webdriver/lib/by').By;
const {homeNetworkID, foreignNetworkID} = require('./config.json')
const {homeRPC, foreignRPC} = require('../e2e-commons/constants.json')
const IDMetaMask = "nkbihfbeogaeaoehlefnkodbefgpgknn";
const URL = "chrome-extension://" + IDMetaMask + "//popup.html";
const buttonSubmit = By.className("confirm btn-green");
@ -127,12 +127,12 @@ class MetaMask extends Page {
async addNetwork(provider) {
let url;
switch (provider) {
case homeNetworkID: {
case homeRPC.ID: {
url = "http://localhost:8541";
networks.push(177);
break;
}
case foreignNetworkID: {
case foreignRPC.ID: {
url = "http://localhost:8542";
networks.push(142);
break;

@ -1,9 +1,6 @@
const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const fs = require('fs-extra');
const {user} = require('../e2e-commons/constants.json')
const config = require('./config.json')
const configFile = './config.json';
const {user, nativeToErcBridge, ercToErcBridge, ercToNativeBridge, homeRPC, foreignRPC} = require('../e2e-commons/constants.json')
class Utils {
@ -11,7 +8,7 @@ class Utils {
return {
account: user.address,
privateKey: user.privateKey,
networkID: config.homeNetworkID
networkID: homeRPC.homeNetworkID
}
}
@ -19,20 +16,20 @@ class Utils {
return {
account: user.address,
privateKey: user.privateKey,
networkID: config.foreignNetworkID
networkID: foreignRPC.foreignNetworkID
}
}
static async getStartURL() {
return config.startUrl;
return nativeToErcBridge.ui;
}
static async getErc20StartURL() {
return config.erc20Url;
return ercToErcBridge.ui;
}
static async getErc20NativeStartURL() {
return config.erc20NativeUrl;
return ercToNativeBridge.ui;
}
static async startBrowserWithMetamask() {

@ -1,7 +1,4 @@
{
"startUrl" : "http://localhost:3000",
"erc20Url" : "http://localhost:3001",
"erc20NativeUrl" : "http://localhost:3002",
"homeNetworkID": "77",
"foreignNetworkID": "42"
}