diff --git a/eth-custodian/Makefile b/eth-custodian/Makefile index 25c0f0b..937462e 100644 --- a/eth-custodian/Makefile +++ b/eth-custodian/Makefile @@ -26,6 +26,7 @@ ERC20_DECIMALS= NEAR_RECIPIENT=${NEAR_ACCOUNT} ETH_CUSTODIAN_PROXY= +CONFIG_NAME=ethereum-config compile: mkdir -p build/proofs && yarn hardhat compile @@ -40,10 +41,10 @@ eth-deploy-contracts: yarn hardhat run --network ${NETWORK} scripts/eth_deploy_contracts.js eth-deploy-proxy: - yarn hardhat run --network ${NETWORK} scripts/eth_deploy_proxy.js + yarn hardhat --network ${NETWORK} eth-deploy-proxy --config-name ${CONFIG_NAME} eth-upgrade-proxy: - yarn hardhat run --network ${NETWORK} scripts/eth_upgrade_proxy.js + yarn hardhat run --network ${NETWORK} scripts/eth_upgrade_proxy.js update-admin-legacy: yarn hardhat --network ${NETWORK} update-admin-legacy --new-admin ${ETH_CUSTODIAN_PROXY} diff --git a/eth-custodian/hardhat.config.js b/eth-custodian/hardhat.config.js index 1a4a905..8c39f00 100644 --- a/eth-custodian/hardhat.config.js +++ b/eth-custodian/hardhat.config.js @@ -29,6 +29,14 @@ task('update-admin-legacy', 'Nominate new admin for Eth Custodian') await updateAdminLegacy(hre.ethers.provider, taskArgs.newAdmin); }); +task('eth-deploy-proxy', 'Deploy Eth Custodian Proxy') + .addParam('configName', 'File name without extension for the config') + .setAction(async taskArgs => { + const { deployEthProxy } = require('./scripts/eth_deploy_proxy'); + const ethereumConfig = require(`./scripts/json/${taskArgs.configName}.json`); + await deployEthProxy(ethereumConfig); + }); + task('nominate-admin', 'Nominate new admin for Eth Custodian') .addParam('newAdmin', 'Eth address of new admin') .setAction(async taskArgs => { diff --git a/eth-custodian/scripts/eth_deploy_proxy.js b/eth-custodian/scripts/eth_deploy_proxy.js index 4765fe8..31d9084 100644 --- a/eth-custodian/scripts/eth_deploy_proxy.js +++ b/eth-custodian/scripts/eth_deploy_proxy.js @@ -1,8 +1,6 @@ const hre = require('hardhat'); -const ethereumConfig = require('./json/ethereum-config.json'); - -async function main() { +async function deployEthProxy(ethereumConfig) { const [deployerAccount] = await hre.ethers.getSigners(); console.log(`Deploying proxy with the account: ${deployerAccount.address}`); @@ -20,11 +18,4 @@ async function main() { console.log(`Next, proxy must be made the admin of EthCustodian. The existing admin needs to first call nominateAdmin and then acceptAdmin on EthCustodian passing the proxy address`); } -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error); - process.exit(1); - }); +exports.deployEthProxy = deployEthProxy; diff --git a/eth-custodian/scripts/json/ethereum-config-mainnet.json b/eth-custodian/scripts/json/ethereum-config-mainnet.json index e627789..9e5c026 100644 --- a/eth-custodian/scripts/json/ethereum-config-mainnet.json +++ b/eth-custodian/scripts/json/ethereum-config-mainnet.json @@ -1,8 +1,9 @@ { "proverAddress": "0x051ad3f020274910065dcb421629cd2e6e5b46c4", - "clientAddress": "0x0151568af92125fb289f1dd81d9d8f7484efc362", + "clientAddress": "0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873", "ethConnectorAddress": "0x6BFaD42cFC4EfC96f529D786D643Ff4A8B89FA52", "nearEvmAccount": "aurora", - "bridgeFactoryAccount": "factory.bridge.near" + "bridgeFactoryAccount": "factory.bridge.near", + "proxyAddress": "TODO" }