ENS OZ Governor
Overview
function name() public pure override returns (string memory) { return "UPGRADE_DNSSEC_SUPPORT"; }function description() public pure override returns (string memory) { return "Call setController on the Root contract at root.ens.eth, passing in the address of the new DNS registrar"; }function deploy() public override { // Deploy a mock upgrade contract to set controller if not already deployed if (!addresses.isAddressSet("ENS_DNSSEC")) { // In a real case, this function would be responsible for // deploying the DNSSEC contract instead of using a mock address dnsSec = address(new MockUpgrade()); addresses.addAddress("ENS_DNSSEC", dnsSec, true); } }function build() public override buildModifier(addresses.getAddress("ENS_TIMELOCK")) { /// STATICCALL -- non-mutative and hence not recorded for the run stage // Get ENS root address IControllable control = IControllable(addresses.getAddress("ENS_ROOT")); // Get deployed dnsSec address address dnsSec = addresses.getAddress("ENS_DNSSEC"); /// CALLS -- mutative and recorded // Set controller to newly deployed dnsSec contract control.setController(dnsSec, true); }function run() public override { // Create and select the mainnet fork for proposal execution. setPrimaryForkId(vm.createFork("mainnet")); vm.selectFork(primaryForkId); uint256[] memory chainIds = new uint256[](1); chainIds[0] = 1; // Set the addresses object by reading addresses from the JSON file. setAddresses( new Addresses( vm.envOr("ADDRESSES_PATH", string("./addresses")), chainIds ) ); // Set Governor Bravo. This address is used for proposal simulation and checking the on-chain proposal state. setGovernor(addresses.getAddress("ENS_GOVERNOR")); // Call the run function of the parent contract 'Proposal.sol'. super.run(); }function validate() public view override { // Get ENS root address IControllable control = IControllable(addresses.getAddress("ENS_ROOT")); // Get deployed dnsSec address address dnsSec = addresses.getAddress("ENS_DNSSEC"); // Ensure dnsSec is set as the controller for the ENS root contract assertEq(control.controllers(dnsSec), true); }
Running the Proposal
Last updated