Skip to content

Commit

Permalink
Fix acceptAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed Jul 9, 2024
1 parent 7a2d7ac commit c863a65
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions l1-contracts/deploy-scripts/AcceptAdmin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import {Script} from "forge-std/Script.sol";

import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {IZkSyncHyperchain} from "contracts/state-transition/chain-interfaces/IZkSyncHyperchain.sol";
import {ChainAdmin} from "contracts/governance/ChainAdmin.sol";
import {IChainAdmin} from "contracts/governance/IChainAdmin.sol";
import {Utils} from "./Utils.sol";

contract AcceptAdmin is Script {
// This function should be called by the owner to accept the admin role
// This function should be called by the owner to accept the owner role
function acceptOwner(address governor, address target) public {
Ownable2Step adminContract = Ownable2Step(target);
Utils.executeUpgrade({
Expand All @@ -22,15 +24,15 @@ contract AcceptAdmin is Script {
}

// This function should be called by the owner to accept the admin role
function acceptAdmin(address admin, address target) public {
IZkSyncHyperchain adminContract = IZkSyncHyperchain(target);
Utils.executeUpgrade({
_governor: admin,
_salt: bytes32(0),
_target: target,
_data: abi.encodeCall(adminContract.acceptAdmin, ()),
_value: 0,
_delay: 0
});
function acceptAdmin(address payable _admin, address _target) public {
IZkSyncHyperchain hyperchain = IZkSyncHyperchain(_target);
ChainAdmin chainAdmin = ChainAdmin(_admin);

IChainAdmin.Call[] memory calls = new IChainAdmin.Call[](1);
calls[0] = IChainAdmin.Call({target: _target, value: 0, data: abi.encodeCall(hyperchain.acceptAdmin, ())});

vm.startBroadcast();
chainAdmin.multicall(calls, true);
vm.stopBroadcast();
}
}

0 comments on commit c863a65

Please sign in to comment.