Timelock
The Timelock contract introduces a mandatory delay between proposal scheduling and execution in the governance system. It ensures that all governance actions are publicly visible for a minimum time before they can take effect.
Inherits: AccessControl, IERC721Receiver, IERC1155Receiver
State Variables
minDelay
The minimum delay required between scheduling and executing an operation.
uint256 public minDelay;
View Functions
isOperation
Returns whether an operation has been scheduled.
function isOperation(bytes32 id) public view virtual returns (bool registered);
isOperationPending
Returns whether an operation is pending (scheduled but not yet executed or cancelled).
function isOperationPending(bytes32 id) public view virtual returns (bool pending);
isOperationReady
Returns whether an operation is ready for execution (delay has passed).
function isOperationReady(bytes32 id) public view virtual returns (bool ready);
isOperationDone
Returns whether an operation has been executed.
function isOperationDone(bytes32 id) public view virtual returns (bool done);
getMinDelay
Returns the minimum delay required for operations.
function getMinDelay() external view returns (uint256 duration);
hashOperation
Computes the operation hash for a single operation. Useful for tracking operation status.
function hashOperation(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt
) public pure virtual returns (bytes32 hash);
hashOperationBatch
Computes the operation hash for a batch operation. Useful for tracking operation status.
function hashOperationBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) public pure virtual returns (bytes32 hash);
Events
CallScheduled
Emitted when an operation is scheduled.
event CallScheduled(
bytes32 indexed id,
uint256 indexed index,
address target,
uint256 value,
bytes data,
bytes32 predecessor,
uint256 delay
);
CallExecuted
Emitted when an operation is executed.
event CallExecuted(
bytes32 indexed id,
uint256 indexed index,
address target,
uint256 value,
bytes data
);
Cancelled
Emitted when an operation is cancelled.
event Cancelled(bytes32 indexed id);
MinDelayChange
Emitted when the minimum delay is changed.
event MinDelayChange(uint256 oldDuration, uint256 newDuration);