diff --git a/l1-contracts/scripts/register-hyperchain.ts b/l1-contracts/scripts/register-hyperchain.ts index d516f03c1..755352f9b 100644 --- a/l1-contracts/scripts/register-hyperchain.ts +++ b/l1-contracts/scripts/register-hyperchain.ts @@ -107,6 +107,7 @@ async function main() { } await deployer.registerHyperchain(baseTokenAddress, cmd.validiumMode, null, gasPrice, useGovernance); + await deployer.transferAdminFromDeployerToGovernance(); }); await program.parseAsync(process.argv); diff --git a/l1-contracts/src.ts/deploy.ts b/l1-contracts/src.ts/deploy.ts index cad6d572d..77dfba303 100644 --- a/l1-contracts/src.ts/deploy.ts +++ b/l1-contracts/src.ts/deploy.ts @@ -820,6 +820,23 @@ export class Deployer { } } + public async transferAdminFromDeployerToGovernance() { + const stm = this.stateTransitionManagerContract(this.deployWallet); + const diamondProxyAddress = await stm.getHyperchain(this.chainId); + const hyperchain = IZkSyncHyperchainFactory.connect(diamondProxyAddress, this.deployWallet); + + const receipt = await (await hyperchain.setPendingAdmin(this.addresses.Governance)).wait(); + if (this.verbose) { + console.log(`Governance set as pending admin, gas used: ${receipt.gasUsed.toString()}`); + } + + await this.executeUpgrade(hyperchain.address, 0, hyperchain.interface.encodeFunctionData("acceptAdmin"), false); + + if (this.verbose) { + console.log("Pending admin successfully accepted"); + } + } + public async registerToken(tokenAddress: string, useGovernance: boolean = false) { const bridgehub = this.bridgehubContract(this.deployWallet);