Skip to content
Lattice

ITimelockController

Git Source

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

NameTypeDescription
<none>bytes32

EXECUTOR_ROLE

The role identifier for executors — keccak256("EXECUTOR_ROLE").

function EXECUTOR_ROLE() external pure returns (bytes32);

Returns

NameTypeDescription
<none>bytes32

CANCELLER_ROLE

The role identifier for cancellers — keccak256("CANCELLER_ROLE").

function CANCELLER_ROLE() external pure returns (bytes32);

Returns

NameTypeDescription
<none>bytes32

isOperation

Returns whether an id corresponds to a registered operation.

function isOperation(bytes32 id) external view returns (bool);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>bool

isOperationPending

Returns whether an operation is pending (Waiting or Ready).

function isOperationPending(bytes32 id) external view returns (bool);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>bool

isOperationDone

Returns whether an operation has been executed.

function isOperationDone(bytes32 id) external view returns (bool);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>uint256

getMinDelay

Returns the minimum delay required before an operation can be executed.

function getMinDelay() external view returns (uint256);

Returns

NameTypeDescription
<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

NameTypeDescription
targetaddress
valueuint256
databytes
predecessorbytes32
saltbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
targetsaddress[]
valuesuint256[]
payloadsbytes[]
predecessorbytes32
saltbytes32

Returns

NameTypeDescription
<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

NameTypeDescription
targetaddressThe target contract.
valueuint256The ETH value.
databytesThe call data.
predecessorbytes32An optional preceding operation that must be done first.
saltbytes32An optional salt for uniqueness.
delayuint256The 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

NameTypeDescription
targetsaddress[]
valuesuint256[]
payloadsbytes[]
predecessorbytes32
saltbytes32
delayuint256

cancel

Cancel an operation.

function cancel(bytes32 id) external;

Parameters

NameTypeDescription
idbytes32The 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

NameTypeDescription
targetaddress
valueuint256
payloadbytes
predecessorbytes32
saltbytes32

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

NameTypeDescription
targetsaddress[]
valuesuint256[]
payloadsbytes[]
predecessorbytes32
saltbytes32

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

NameTypeDescription
newDelayuint256The 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

NameTypeDescription
idbytes32The unique operation id.
indexuint256The index of the call within a batch (0 for single calls).
targetaddressThe target contract address.
valueuint256The ETH value sent with the call.
databytesThe call data.
predecessorbytes32The predecessor operation id (0 for no predecessor).
delayuint256The 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

NameTypeDescription
idbytes32The unique operation id.
indexuint256The index of the call within a batch (0 for single calls).
targetaddressThe target contract address.
valueuint256The ETH value sent with the call.
databytesThe call data.

CallSalt

Emitted when a salt is used in an operation, providing extra entropy.

event CallSalt(bytes32 indexed id, bytes32 salt);

Parameters

NameTypeDescription
idbytes32The unique operation id.
saltbytes32The salt value used.

Cancelled

Emitted when an operation is cancelled.

event Cancelled(bytes32 indexed id);

Parameters

NameTypeDescription
idbytes32The unique operation id.

MinDelayChange

Emitted when the minimum delay for future operations is modified.

event MinDelayChange(uint256 oldDuration, uint256 newDuration);

Parameters

NameTypeDescription
oldDurationuint256The previous minimum delay.
newDurationuint256The 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

NameTypeDescription
targetsuint256The number of target addresses provided.
payloadsuint256The number of payloads provided.
valuesuint256The number of values provided.

TimelockInsufficientDelay

Thrown when the proposed delay is less than the current minimum delay.

error TimelockInsufficientDelay(uint256 delay, uint256 minDelay);

Parameters

NameTypeDescription
delayuint256The proposed delay.
minDelayuint256The current minimum delay.

TimelockUnexpectedOperationState

Thrown when an operation is not in the expected state.

error TimelockUnexpectedOperationState(bytes32 operationId, bytes32 expectedStates);

Parameters

NameTypeDescription
operationIdbytes32The operation id.
expectedStatesbytes32A bitmap of acceptable OperationState values.

TimelockUnexecutedPredecessor

Thrown when a predecessor operation has not been executed yet.

error TimelockUnexecutedPredecessor(bytes32 predecessorId);

Parameters

NameTypeDescription
predecessorIdbytes32The predecessor operation id.

TimelockUnauthorizedCaller

Thrown when the caller is not authorized to perform the requested action.

error TimelockUnauthorizedCaller(address caller);

Parameters

NameTypeDescription
calleraddressThe 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

NameDescription
Unset
Waiting
Ready
Done