Trying to introduce common deploy
This commit is contained in:
parent
505aa3f261
commit
cc10335d99
41
e2e-commons/envs/erc-to-erc.env
Normal file
41
e2e-commons/envs/erc-to-erc.env
Normal file
@ -0,0 +1,41 @@
|
||||
BRIDGE_MODE=ERC_TO_ERC
|
||||
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
|
||||
HOME_DEPLOYMENT_GAS_PRICE=10000000000
|
||||
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
|
||||
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
|
||||
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
|
||||
DEPLOY_REWARDABLE_TOKEN=false
|
||||
|
||||
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
|
||||
BRIDGEABLE_TOKEN_SYMBOL="TEST"
|
||||
BRIDGEABLE_TOKEN_DECIMALS="18"
|
||||
|
||||
HOME_RPC_URL=http://parity1:8545
|
||||
HOME_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_DAILY_LIMIT=30000000000000000000000000
|
||||
HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
|
||||
HOME_MIN_AMOUNT_PER_TX=10000000000000000
|
||||
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
|
||||
HOME_GAS_PRICE=1000000000
|
||||
HOME_REWARDABLE=false
|
||||
|
||||
FOREIGN_RPC_URL=http://parity2:8545
|
||||
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_DAILY_LIMIT=15000000000000000000000000
|
||||
FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
|
||||
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
|
||||
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
|
||||
FOREIGN_GAS_PRICE=10000000000
|
||||
FOREIGN_REWARDABLE=false
|
||||
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
|
||||
|
||||
REQUIRED_NUMBER_OF_VALIDATORS=1
|
||||
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
|
||||
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
|
||||
BLOCK_REWARD_ADDRESS=0x0000000000000000000000000000000000000000
|
||||
DPOS_STAKING_ADDRESS=0x0000000000000000000000000000000000000000
|
||||
ERC20_EXTENDED_BY_ERC677=false
|
39
e2e-commons/envs/erc-to-native.env
Normal file
39
e2e-commons/envs/erc-to-native.env
Normal file
@ -0,0 +1,39 @@
|
||||
BRIDGE_MODE=ERC_TO_NATIVE
|
||||
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
|
||||
HOME_DEPLOYMENT_GAS_PRICE=10000000000
|
||||
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
|
||||
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
|
||||
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
|
||||
|
||||
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
|
||||
BRIDGEABLE_TOKEN_SYMBOL="TEST"
|
||||
BRIDGEABLE_TOKEN_DECIMALS="18"
|
||||
|
||||
HOME_RPC_URL=http://parity1:8545
|
||||
HOME_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_DAILY_LIMIT=30000000000000000000000000
|
||||
HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
|
||||
HOME_MIN_AMOUNT_PER_TX=10000000000000000
|
||||
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
|
||||
HOME_GAS_PRICE=1000000000
|
||||
HOME_REWARDABLE=false
|
||||
|
||||
FOREIGN_RPC_URL=http://parity2:8545
|
||||
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_DAILY_LIMIT=15000000000000000000000000
|
||||
FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
|
||||
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
|
||||
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
|
||||
FOREIGN_GAS_PRICE=10000000000
|
||||
FOREIGN_REWARDABLE=false
|
||||
|
||||
BLOCK_REWARD_ADDRESS=0xF9698Eb93702dfdd0e2d802088d4c21822a8A977
|
||||
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
|
||||
|
||||
REQUIRED_NUMBER_OF_VALIDATORS=1
|
||||
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
|
||||
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
|
39
e2e-commons/envs/native-to-erc.env
Normal file
39
e2e-commons/envs/native-to-erc.env
Normal file
@ -0,0 +1,39 @@
|
||||
BRIDGE_MODE=NATIVE_TO_ERC
|
||||
DEPLOYMENT_ACCOUNT_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
|
||||
HOME_DEPLOYMENT_GAS_PRICE=10000000000
|
||||
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
|
||||
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
|
||||
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
|
||||
DEPLOY_REWARDABLE_TOKEN=false
|
||||
|
||||
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
|
||||
BRIDGEABLE_TOKEN_SYMBOL="TEST"
|
||||
BRIDGEABLE_TOKEN_DECIMALS="18"
|
||||
|
||||
HOME_RPC_URL=http://parity1:8545
|
||||
HOME_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
HOME_DAILY_LIMIT=30000000000000000000000000
|
||||
HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
|
||||
HOME_MIN_AMOUNT_PER_TX=10000000000000000
|
||||
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
|
||||
HOME_GAS_PRICE=1000000000
|
||||
HOME_REWARDABLE=false
|
||||
|
||||
FOREIGN_RPC_URL=http://parity2:8545
|
||||
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
|
||||
FOREIGN_DAILY_LIMIT=15000000000000000000000000
|
||||
FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
|
||||
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
|
||||
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
|
||||
FOREIGN_GAS_PRICE=10000000000
|
||||
FOREIGN_REWARDABLE=false
|
||||
|
||||
REQUIRED_NUMBER_OF_VALIDATORS=1
|
||||
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
|
||||
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
|
||||
BLOCK_REWARD_ADDRESS=0x0000000000000000000000000000000000000000
|
55
e2e-commons/scripts/deploy.sh
Executable file
55
e2e-commons/scripts/deploy.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
cd $(dirname $0)
|
||||
set -e # exit when any command fails
|
||||
|
||||
CONTRACTS_PATH="../../contracts"
|
||||
DEPLOY_PATH="$CONTRACTS_PATH/deploy"
|
||||
ENVS_PATH="../envs"
|
||||
|
||||
# shell.cp(path.join(envsDir, 'contracts.env'), path.join(deployContractsDir, '.env'))
|
||||
cp "$ENVS_PATH/native-to-erc.env" "$DEPLOY_PATH/.env"
|
||||
|
||||
# shell.cd(deployContractsDir)
|
||||
cd "$DEPLOY_PATH"
|
||||
|
||||
# shell.exec('node deploy.js')
|
||||
echo -e "\n############ Deploying native-to-erc ############"
|
||||
node deploy.js
|
||||
|
||||
# shell.cd(__dirname)
|
||||
cd - > /dev/null
|
||||
|
||||
# shell.exec('node deployERC20.js')
|
||||
echo -e "\n############ Deploying erc20 ############"
|
||||
node deployERC20.js
|
||||
|
||||
# shell.cd(deployContractsDir)
|
||||
cd "$DEPLOY_PATH"
|
||||
|
||||
# shell.rm('.env')
|
||||
rm .env
|
||||
|
||||
# shell.cp(path.join(envsDir, 'erc-contracts.env'), path.join(deployContractsDir, '.env'))
|
||||
cd - > /dev/null
|
||||
cp "$ENVS_PATH/erc-to-erc.env" "$DEPLOY_PATH/.env"
|
||||
cd "$DEPLOY_PATH"
|
||||
|
||||
# shell.exec('node deploy.js')
|
||||
echo -e "\n############ Deploying erc-to-erc ############"
|
||||
node deploy.js
|
||||
|
||||
# shell.rm('.env')
|
||||
rm .env
|
||||
|
||||
cd - > /dev/null
|
||||
# shell.cp(
|
||||
# path.join(envsDir, 'erc-native-contracts.env'),
|
||||
# path.join(deployContractsDir, '.env')
|
||||
# )
|
||||
cp "$ENVS_PATH/erc-to-native.env" "$DEPLOY_PATH/.env"
|
||||
cd "$DEPLOY_PATH"
|
||||
|
||||
echo -e "\n############ Deploying block reward ############"
|
||||
node src/utils/deployBlockReward.js
|
||||
echo -e "\n############ Deploying erc-to-native ############"
|
||||
node deploy.js
|
81
e2e-commons/scripts/deployERC20.js
Normal file
81
e2e-commons/scripts/deployERC20.js
Normal file
@ -0,0 +1,81 @@
|
||||
/* eslint import/no-unresolved: 0 node/no-missing-require: 0 */
|
||||
const path = require('path')
|
||||
const contractsPath = '../../contracts';
|
||||
require('dotenv').config({
|
||||
path: path.join(__dirname, contractsPath, '/deploy/.env')
|
||||
})
|
||||
const oracle_e2e_user = '0xbb140FbA6242a1c3887A7823F7750a73101383e3'
|
||||
const ui_e2e_user = '0x7FC1442AB55Da569940Eb750AaD2BAA63DA4010E'
|
||||
|
||||
const {
|
||||
deployContract,
|
||||
sendRawTxForeign,
|
||||
privateKeyToAddress
|
||||
} = require(`${contractsPath}/deploy/src/deploymentUtils`)
|
||||
const {
|
||||
web3Foreign,
|
||||
deploymentPrivateKey
|
||||
} = require(`${contractsPath}/deploy/src/web3`)
|
||||
const POA20 = require(`${contractsPath}/build/contracts/ERC677BridgeToken.json`)
|
||||
|
||||
const { DEPLOYMENT_ACCOUNT_PRIVATE_KEY } = process.env
|
||||
const DEPLOYMENT_ACCOUNT_ADDRESS = privateKeyToAddress(DEPLOYMENT_ACCOUNT_PRIVATE_KEY)
|
||||
|
||||
async function deployErc20() {
|
||||
try {
|
||||
let foreignNonce = await web3Foreign.eth.getTransactionCount(DEPLOYMENT_ACCOUNT_ADDRESS)
|
||||
console.log('\n[Foreign] Deploying POA20 Test token')
|
||||
const poa20foreign = await deployContract(POA20, ['POA ERC20 Test', 'POA20', 18], {
|
||||
from: DEPLOYMENT_ACCOUNT_ADDRESS,
|
||||
network: 'foreign',
|
||||
nonce: foreignNonce
|
||||
})
|
||||
foreignNonce++
|
||||
console.log('[Foreign] POA20 Test: ', poa20foreign.options.address)
|
||||
|
||||
const getMintData = (user) => poa20foreign.methods.mint(user, '1000000000000000000').encodeABI({ from: DEPLOYMENT_ACCOUNT_ADDRESS })
|
||||
|
||||
await sendRawTxForeign({
|
||||
data: getMintData(oracle_e2e_user),
|
||||
nonce: foreignNonce,
|
||||
to: poa20foreign.options.address,
|
||||
privateKey: deploymentPrivateKey,
|
||||
url: process.env.FOREIGN_RPC_URL
|
||||
})
|
||||
|
||||
foreignNonce++
|
||||
|
||||
const receipt = await sendRawTxForeign({
|
||||
data: getMintData(ui_e2e_user),
|
||||
nonce: foreignNonce,
|
||||
to: poa20foreign.options.address,
|
||||
privateKey: deploymentPrivateKey,
|
||||
url: process.env.FOREIGN_RPC_URL
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log('receipt is')
|
||||
console.log(receipt)
|
||||
|
||||
// while(true) {
|
||||
// const tx = await web3Foreign.eth.getTransaction(receipt.transactionHash);
|
||||
// console.log('tx is: ')
|
||||
// console.log(tx);
|
||||
// await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
// }
|
||||
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
deployErc20()
|
@ -38,5 +38,9 @@ while [ "$1" != "" ]; do
|
||||
docker-compose run e2e yarn workspace ui-e2e run deploy
|
||||
fi
|
||||
|
||||
if [ "$1" == "deploy" ]; then
|
||||
docker-compose run e2e e2e-commons/scripts/deploy.sh
|
||||
fi
|
||||
|
||||
shift # Shift all the parameters down by one
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user