Change admin role allocation in TimelockControler constructor (#3722)
Co-authored-by: Francisco <frangio.1@gmail.com>
This commit is contained in:
@ -153,7 +153,7 @@ Operations status can be queried using the functions:
|
||||
[[timelock-admin]]
|
||||
===== Admin
|
||||
|
||||
The admins are in charge of managing proposers and executors. For the timelock to be self-governed, this role should only be given to the timelock itself. Upon deployment, both the timelock and the deployer have this role. After further configuration and testing, the deployer can renounce this role such that all further maintenance operations have to go through the timelock process.
|
||||
The admins are in charge of managing proposers and executors. For the timelock to be self-governed, this role should only be given to the timelock itself. Upon deployment, the admin role can be granted to any address (in addition to the timelock itself). After further configuration and testing, this optional admin should renounce its role such that all further maintenance operations have to go through the timelock process.
|
||||
|
||||
This role is identified by the *TIMELOCK_ADMIN_ROLE* value: `0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5`
|
||||
|
||||
|
||||
@ -62,31 +62,37 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver
|
||||
event MinDelayChange(uint256 oldDuration, uint256 newDuration);
|
||||
|
||||
/**
|
||||
* @dev Initializes the contract with a given `minDelay`, and a list of
|
||||
* initial proposers and executors. The proposers receive both the
|
||||
* proposer and the canceller role (for backward compatibility). The
|
||||
* executors receive the executor role.
|
||||
* @dev Initializes the contract with the following parameters:
|
||||
*
|
||||
* NOTE: At construction, both the deployer and the timelock itself are
|
||||
* administrators. This helps further configuration of the timelock by the
|
||||
* deployer. After configuration is done, it is recommended that the
|
||||
* deployer renounces its admin position and relies on timelocked
|
||||
* operations to perform future maintenance.
|
||||
* - `minDelay`: initial minimum delay for operations
|
||||
* - `proposers`: accounts to be granted proposer and canceller roles
|
||||
* - `executors`: accounts to be granted executor role
|
||||
* - `admin`: optional account to be granted admin role; disable with zero address
|
||||
*
|
||||
* IMPORTANT: The optional admin can aid with initial configuration of roles after deployment
|
||||
* without being subject to delay, but this role should be subsequently renounced in favor of
|
||||
* administration through timelocked proposals. Previous versions of this contract would assign
|
||||
* this admin to the deployer automatically and should be renounced as well.
|
||||
*/
|
||||
constructor(
|
||||
uint256 minDelay,
|
||||
address[] memory proposers,
|
||||
address[] memory executors
|
||||
address[] memory executors,
|
||||
address admin
|
||||
) {
|
||||
_setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE);
|
||||
_setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE);
|
||||
_setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE);
|
||||
_setRoleAdmin(CANCELLER_ROLE, TIMELOCK_ADMIN_ROLE);
|
||||
|
||||
// deployer + self administration
|
||||
_setupRole(TIMELOCK_ADMIN_ROLE, _msgSender());
|
||||
// self administration
|
||||
_setupRole(TIMELOCK_ADMIN_ROLE, address(this));
|
||||
|
||||
// optional admin
|
||||
if (admin != address(0)) {
|
||||
_setupRole(TIMELOCK_ADMIN_ROLE, admin);
|
||||
}
|
||||
|
||||
// register proposers and cancellers
|
||||
for (uint256 i = 0; i < proposers.length; ++i) {
|
||||
_setupRole(PROPOSER_ROLE, proposers[i]);
|
||||
|
||||
Reference in New Issue
Block a user