Skip to content

Commit

Permalink
update proxy admin
Browse files Browse the repository at this point in the history
  • Loading branch information
olga24912 committed Sep 11, 2024
1 parent 6dccd82 commit cae93b7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions eth-custodian/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ task('eth-deploy-proxy', 'Deploy Eth Custodian Proxy')
await deployEthProxy(ethereumConfig);
});

task('update-admin-proxy', 'Update admin for Eth Custodian Proxy')
.addParam('configName', 'File name without extension for the config')
.addParam('newAdmin', 'Eth address of new admin')
.setAction(async taskArgs => {
const { updateAdminProxy } = require('./scripts/update_admin_proxy');
const ethereumConfig = require(`./scripts/json/${taskArgs.configName}.json`);
await updateAdminProxy(ethereumConfig, taskArgs.newAdmin);
});

task('nominate-admin', 'Nominate new admin for Eth Custodian')
.addParam('newAdmin', 'Eth address of new admin')
.setAction(async taskArgs => {
Expand Down
30 changes: 30 additions & 0 deletions eth-custodian/scripts/update_admin_proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const hre = require('hardhat');

async function updateAdminProxy(ethereumConfig, newAdmin) {
const privateKey = hre.network.config.accounts[0];
const signerWallet = new hre.ethers.Wallet(privateKey, hre.ethers.provider);

console.log(`Update admin proxy with the account: ${signerWallet.address}`);

const ethCustodianProxyContractFactory = await hre.ethers.getContractFactory('EthCustodianProxy');
const ethCustodianProxy = await ethCustodianProxyContractFactory.attach(ethereumConfig.proxyAddress);

console.log(`EthCustodian Proxy address: ${await ethCustodianProxy.getAddress()}`);

let tx_grant_admin = await ethCustodianProxy
.connect(signerWallet)
.grantRole("0x0000000000000000000000000000000000000000000000000000000000000000", newAdmin);
console.log(`Grant Admin Role for ${newAdmin} Tx Hash: ${tx_grant_admin.hash}`);

let tx_grant_pausable = await ethCustodianProxy
.connect(signerWallet)
.grantRole("0x1e1db0d9c63b4a23ec134ff71a2f56610c32f638cbff81e96e14734c4daf0b4d", newAdmin);
console.log(`Grant Pausable Admin Role for ${newAdmin} Tx Hash: ${tx_grant_pausable.hash}`);

let tx_revoke_pausable = await ethCustodianProxy
.connect(signerWallet)
.revokeRole("0x1e1db0d9c63b4a23ec134ff71a2f56610c32f638cbff81e96e14734c4daf0b4d", signerWallet.address);
console.log(`Revoke Pausable Admin Role for ${signerWallet.address} Tx Hash: ${tx_revoke_pausable.hash}`);
}

exports.updateAdminProxy = updateAdminProxy;

0 comments on commit cae93b7

Please sign in to comment.