ITimelockController
Title: ITimelockController
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/TimelockController.sol)
Interface for the TimelockController module, which schedules and executes governance actions after a minimum delay.
Mirrors the OpenZeppelin v5 TimelockController interface.
Functions
PROPOSER_ROLE
The role identifier for proposers (and cancellers) — keccak256("PROPOSER_ROLE").
function PROPOSER_ROLE() external pure returns (bytes32);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
EXECUTOR_ROLE
The role identifier for executors — keccak256("EXECUTOR_ROLE").
function EXECUTOR_ROLE() external pure returns (bytes32);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
CANCELLER_ROLE
The role identifier for cancellers — keccak256("CANCELLER_ROLE").
function CANCELLER_ROLE() external pure returns (bytes32);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
isOperation
Returns whether an id corresponds to a registered operation.
function isOperation(bytes32 id) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
isOperationPending
Returns whether an operation is pending (Waiting or Ready).
function isOperationPending(bytes32 id) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
isOperationReady
Returns whether an operation is ready for execution.
Reads the timelock's own schedule only. In a diamond that also hosts the Governor, an operation the
Governor queued still reports Ready after its proposal is Expired, and execute/executeBatch then
refuse it; check IGovernor.state(proposalId) before executing.
function isOperationReady(bytes32 id) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
isOperationDone
Returns whether an operation has been executed.
function isOperationDone(bytes32 id) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
getOperationState
Returns the state of an operation.
Reads the timelock's own schedule only. In a diamond that also hosts the Governor, an operation the
Governor queued still reports Ready after its proposal is Expired, and execute/executeBatch then
refuse it; check IGovernor.state(proposalId) before executing.
function getOperationState(bytes32 id) external view returns (OperationState);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | OperationState |
getTimestamp
Returns the timestamp at which an operation becomes ready.
Returns 0 for Unset, 1 (DONE_TIMESTAMP) for Done, and the scheduled timestamp otherwise.
function getTimestamp(bytes32 id) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getMinDelay
Returns the minimum delay required before an operation can be executed.
function getMinDelay() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
hashOperation
Returns the identifier of an operation containing a single transaction.
function hashOperation(address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt)
external
pure
returns (bytes32);Parameters
| Name | Type | Description |
|---|---|---|
| target | address | |
| value | uint256 | |
| data | bytes | |
| predecessor | bytes32 | |
| salt | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
hashOperationBatch
Returns the identifier of an operation containing a batch of transactions.
function hashOperationBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) external pure returns (bytes32);Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| payloads | bytes[] | |
| predecessor | bytes32 | |
| salt | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
schedule
Schedule an operation containing a single transaction.
function schedule(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) external;Parameters
| Name | Type | Description |
|---|---|---|
| target | address | The target contract. |
| value | uint256 | The ETH value. |
| data | bytes | The call data. |
| predecessor | bytes32 | An optional preceding operation that must be done first. |
| salt | bytes32 | An optional salt for uniqueness. |
| delay | uint256 | The delay before execution is allowed (must be >= minDelay). |
scheduleBatch
Schedule an operation containing a batch of transactions.
function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) external;Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| payloads | bytes[] | |
| predecessor | bytes32 | |
| salt | bytes32 | |
| delay | uint256 |
cancel
Cancel an operation.
function cancel(bytes32 id) external;Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 | The operation id. |
execute
Execute a (ready) operation containing a single transaction. In a diamond that also hosts the Governor, an operation the Governor queued is refused once its proposal is Expired.
function execute(address target, uint256 value, bytes calldata payload, bytes32 predecessor, bytes32 salt)
external
payable;Parameters
| Name | Type | Description |
|---|---|---|
| target | address | |
| value | uint256 | |
| payload | bytes | |
| predecessor | bytes32 | |
| salt | bytes32 |
executeBatch
Execute a (ready) operation containing a batch of transactions. In a diamond that also hosts the Governor, an operation the Governor queued is refused once its proposal is Expired.
function executeBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) external payable;Parameters
| Name | Type | Description |
|---|---|---|
| targets | address[] | |
| values | uint256[] | |
| payloads | bytes[] | |
| predecessor | bytes32 | |
| salt | bytes32 |
updateDelay
Changes the minimum timelock duration for future operations.
Must be called by the timelock itself (via a scheduled + executed operation).
function updateDelay(uint256 newDelay) external;Parameters
| Name | Type | Description |
|---|---|---|
| newDelay | uint256 | The new minimum delay. |
Events
CallScheduled
Emitted when a call is scheduled as part of an operation.
event CallScheduled(
bytes32 indexed id,
uint256 indexed index,
address target,
uint256 value,
bytes data,
bytes32 predecessor,
uint256 delay
);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 | The unique operation id. |
| index | uint256 | The index of the call within a batch (0 for single calls). |
| target | address | The target contract address. |
| value | uint256 | The ETH value sent with the call. |
| data | bytes | The call data. |
| predecessor | bytes32 | The predecessor operation id (0 for no predecessor). |
| delay | uint256 | The delay before the call can be executed. |
CallExecuted
Emitted when a call is executed as part of an operation.
event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 | The unique operation id. |
| index | uint256 | The index of the call within a batch (0 for single calls). |
| target | address | The target contract address. |
| value | uint256 | The ETH value sent with the call. |
| data | bytes | The call data. |
CallSalt
Emitted when a salt is used in an operation, providing extra entropy.
event CallSalt(bytes32 indexed id, bytes32 salt);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 | The unique operation id. |
| salt | bytes32 | The salt value used. |
Cancelled
Emitted when an operation is cancelled.
event Cancelled(bytes32 indexed id);Parameters
| Name | Type | Description |
|---|---|---|
| id | bytes32 | The unique operation id. |
MinDelayChange
Emitted when the minimum delay for future operations is modified.
event MinDelayChange(uint256 oldDuration, uint256 newDuration);Parameters
| Name | Type | Description |
|---|---|---|
| oldDuration | uint256 | The previous minimum delay. |
| newDuration | uint256 | The new minimum delay. |
Errors
TimelockInvalidOperationLength
Thrown when the number of targets, payloads, and values do not match in a batch.
error TimelockInvalidOperationLength(uint256 targets, uint256 payloads, uint256 values);Parameters
| Name | Type | Description |
|---|---|---|
| targets | uint256 | The number of target addresses provided. |
| payloads | uint256 | The number of payloads provided. |
| values | uint256 | The number of values provided. |
TimelockInsufficientDelay
Thrown when the proposed delay is less than the current minimum delay.
error TimelockInsufficientDelay(uint256 delay, uint256 minDelay);Parameters
| Name | Type | Description |
|---|---|---|
| delay | uint256 | The proposed delay. |
| minDelay | uint256 | The current minimum delay. |
TimelockUnexpectedOperationState
Thrown when an operation is not in the expected state.
error TimelockUnexpectedOperationState(bytes32 operationId, bytes32 expectedStates);Parameters
| Name | Type | Description |
|---|---|---|
| operationId | bytes32 | The operation id. |
| expectedStates | bytes32 | A bitmap of acceptable OperationState values. |
TimelockUnexecutedPredecessor
Thrown when a predecessor operation has not been executed yet.
error TimelockUnexecutedPredecessor(bytes32 predecessorId);Parameters
| Name | Type | Description |
|---|---|---|
| predecessorId | bytes32 | The predecessor operation id. |
TimelockUnauthorizedCaller
Thrown when the caller is not authorized to perform the requested action.
error TimelockUnauthorizedCaller(address caller);Parameters
| Name | Type | Description |
|---|---|---|
| caller | address | The caller address. |
TimelockCallFailed
Thrown when an executed call reverts with no return data.
error TimelockCallFailed();Enums
OperationState
The state of a scheduled operation.
Unset=0 (never scheduled), Waiting=1 (scheduled but not yet ready), Ready=2 (past the delay, not yet executed), Done=3 (executed).
enum OperationState {
Unset,
Waiting,
Ready,
Done
}Variants
| Name | Description |
|---|---|
| Unset | |
| Waiting | |
| Ready | |
| Done |