Skip to content

Commit

Permalink
script: add revoke role script
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 committed Jun 25, 2024
1 parent 9bd0ac1 commit 42e42e5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ node_modules/
yarn-error.log
.yarn
.yarnrc.yml
script/data/*
script/data/*

dependencies
43 changes: 43 additions & 0 deletions script/20240516-revoke-roles/01_Revoke_Roles.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { Migration } from "script/Migration.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import { LibRNSDomain } from "src/libraries/LibRNSDomain.sol";
import { DefaultNetwork } from "foundry-deployment-kit/utils/DefaultNetwork.sol";

contract Migration__01_Revoke_Roles is Migration {
address duke = 0x0F68eDBE14C8f68481771016d7E2871d6a35DE11;
address multisig = 0x1FF1edE0242317b8C4229fC59E64DD93952019ef;

function run() external onlyOn(DefaultNetwork.RoninMainnet.key()) {
address[] memory contracts = new address[](5);
contracts[0] = loadContract(Contract.RNSDomainPrice.key());
contracts[1] = loadContract(Contract.RONRegistrarController.key());
contracts[2] = loadContract(Contract.NameChecker.key());
contracts[3] = loadContract(Contract.RNSUnified.key());
contracts[4] = loadContract(Contract.RNSAuction.key());

vm.startBroadcast(duke);

Ownable(loadContract(Contract.OwnedMulticaller.key())).transferOwnership(multisig);
Ownable(loadContract(Contract.RNSReverseRegistrar.key())).transferOwnership(multisig);
// Transfer .ron domain ownership to multisig
ERC721(loadContract(Contract.RNSUnified.key())).transferFrom(duke, multisig, LibRNSDomain.RON_ID);

for (uint256 i; i < contracts.length; i++) {
AccessControlEnumerable(contracts[i]).grantRole(0x0, multisig);
AccessControlEnumerable(contracts[i]).renounceRole(0x0, duke);

assertTrue(
AccessControlEnumerable(contracts[i]).getRoleMemberCount(0x0) > 0,
string.concat("Role is empty", "contract: ", vm.toString(contracts[i]))
);
}

vm.stopBroadcast();
}
}
1 change: 1 addition & 0 deletions script/Migration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ abstract contract Migration is BaseMigration {
function _sharedArguments() internal view virtual override returns (bytes memory rawArgs) {
ISharedArgument.SharedParameter memory param;

if (network() == DefaultNetwork.Local.key()) return rawArgs;
if (network() == DefaultNetwork.RoninTestnet.key()) {
address defaultAdmin = 0x968D0Cd7343f711216817E617d3f92a23dC91c07;
address defaultPauser = defaultAdmin;
Expand Down

0 comments on commit 42e42e5

Please sign in to comment.