Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use governance as hyperchain governor upon init #501

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l1-contracts/scripts/register-hyperchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async function main() {
}

await deployer.registerHyperchain(baseTokenAddress, cmd.validiumMode, null, gasPrice, useGovernance);
await deployer.transferAdminFromDeployerToGovernance();
});

await program.parseAsync(process.argv);
Expand Down
17 changes: 17 additions & 0 deletions l1-contracts/src.ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading