Skip to content

Commit

Permalink
Add security council role with delay and update role management in ti…
Browse files Browse the repository at this point in the history
…melock wallet factory migration script.
  • Loading branch information
ylv-io committed Feb 12, 2025
1 parent 904f375 commit 10fa4b6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
39 changes: 39 additions & 0 deletions script/migrations/160-timelock_wallet_factory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,44 @@ contract DeployScript is MigrationHelper {
),
address(newImpl)
);

bytes4[] memory selectors = new bytes4[](3);
selectors[0] = KintoAppRegistry.updateSystemApps.selector;
selectors[1] = KintoAppRegistry.updateSystemContracts.selector;
selectors[2] = KintoAppRegistry.updateReservedContracts.selector;

// set functions for L1 council
_handleOps(
abi.encodeWithSelector(
AccessManager.setTargetFunctionRole.selector, registry, selectors, SECURITY_COUNCIL_ROLE
),
address(accessManager)
);

// grant role to the L1 council
_handleOps(
abi.encodeWithSelector(
AccessManager.grantRole.selector,
SECURITY_COUNCIL_ROLE,
L1_SECURITY_COUNCIL,
uint32(SECURITY_COUNCIL_DELAY)
),
address(accessManager)
);

// Label the role
_handleOps(
abi.encodeWithSelector(AccessManager.labelRole.selector, SECURITY_COUNCIL_ROLE, "SECURITY_COUNCIL_ROLE"),
address(accessManager)
);

(immediate, delay) =
accessManager.canCall(L1_SECURITY_COUNCIL, registry, KintoAppRegistry.updateSystemApps.selector);
assertFalse(immediate);
assertEq(delay, SECURITY_COUNCIL_DELAY);

(isMember, currentDelay) = accessManager.hasRole(SECURITY_COUNCIL_ROLE, L1_SECURITY_COUNCIL);
assertTrue(isMember);
assertEq(currentDelay, SECURITY_COUNCIL_DELAY);
}
}
4 changes: 3 additions & 1 deletion script/migrations/const.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ contract Constants is CommonBase {

address internal constant WUSDM = 0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812; // wUSDM

uint64 internal constant SECURITY_COUNCIL_ROLE = uint64(uint256(keccak256("SECURITY_COUNCIL_ROLE")));
uint32 internal constant SECURITY_COUNCIL_DELAY = 7 days;
uint64 internal constant NIO_GOVERNOR_ROLE = uint64(uint256(keccak256("NIO_GOVERNOR_ROLE")));
uint64 internal constant UPGRADER_ROLE = uint64(uint256(keccak256("UPGRADER_ROLE")));
uint32 internal constant NIO_EXECUTION_DELAY = 3 days;
uint64 internal constant UPGRADER_ROLE = uint64(uint256(keccak256("UPGRADER_ROLE")));
uint32 internal constant ACCESS_REGISTRY_DELAY = 16 hours;
uint32 internal constant UPGRADE_DELAY = 7 days;
uint256 internal constant RATE_LIMIT_PERIOD = 1 minutes;
Expand Down

0 comments on commit 10fa4b6

Please sign in to comment.