Skip to main content

ITimelockQueue

Git Source

Title: ITimelockQueue

Interface for contracts that queue, execute, and cancel timelocked actions.

Implementations are expected to enforce action-specific authorization and execution checks in the concrete contract. Standard queued-action state checks, timestamp checks, and terminal payload clearing are handled by the abstract implementation.

Functions

timelockDelay

Current timelock delay in seconds.

function timelockDelay() external view returns (uint48);

nextActionId

Next queued action ID.

function nextActionId() external view returns (uint64);

getQueuedAction

Get a queued action.

Reverts if the action does not exist.

function getQueuedAction(uint64 actionId_) external view returns (QueuedAction memory action_);

Parameters

NameTypeDescription
actionId_uint64The queued action ID.

Returns

NameTypeDescription
action_QueuedActionThe queued action.

executeQueuedAction

Execute a queued action after its timelock has elapsed.

Implementations must revert from implementation-specific hooks if the caller, target, selector, or payload should not be executed. Standard action state and timestamp checks revert from the abstract implementation.

function executeQueuedAction(uint64 actionId_) external;

Parameters

NameTypeDescription
actionId_uint64The queued action ID.

cancelQueuedAction

Cancel a queued action.

Implementations must revert from implementation-specific hooks if the caller is not authorized to cancel the queued action.

function cancelQueuedAction(uint64 actionId_) external;

Parameters

NameTypeDescription
actionId_uint64The queued action ID.

Events

TimelockActionQueued

Emitted when an action is queued.

event TimelockActionQueued(
uint64 indexed actionId,
address indexed target,
bytes4 indexed selector,
address proposer,
bytes32 payloadHash,
uint48 executableAt,
uint48 expiresAt
);

Parameters

NameTypeDescription
actionIduint64The queued action ID.
targetaddressThe contract expected to receive the queued action.
selectorbytes4The function selector for the queued action.
proposeraddressThe account that queued the action.
payloadHashbytes32Hash of the encoded action payload.
executableAtuint48Timestamp at which the action can first be executed.
expiresAtuint48Timestamp after which the action can no longer be executed.

TimelockActionExecuted

Emitted when a queued action is executed.

event TimelockActionExecuted(
uint64 indexed actionId, address indexed target, bytes4 indexed selector, address executor
);

Parameters

NameTypeDescription
actionIduint64The queued action ID.
targetaddressThe contract that received the queued action.
selectorbytes4The function selector for the queued action.
executoraddressThe account that executed the action.

TimelockActionCancelled

Emitted when a queued action is cancelled.

event TimelockActionCancelled(
uint64 indexed actionId, address indexed target, bytes4 indexed selector, address canceller
);

Parameters

NameTypeDescription
actionIduint64The queued action ID.
targetaddressThe contract that would have received the queued action.
selectorbytes4The function selector for the queued action.
cancelleraddressThe account that cancelled the action.

TimelockDelaySet

Emitted when the timelock delay is changed.

event TimelockDelaySet(uint48 delay);

Parameters

NameTypeDescription
delayuint48The new timelock delay in seconds.

Errors

ITimelockQueue_ActionNotFound

Thrown when a queued action does not exist.

error ITimelockQueue_ActionNotFound(uint64 actionId);

Parameters

NameTypeDescription
actionIduint64The queued action ID.

ITimelockQueue_ActionAlreadyExecuted

Thrown when a queued action has already been executed.

error ITimelockQueue_ActionAlreadyExecuted(uint64 actionId);

Parameters

NameTypeDescription
actionIduint64The queued action ID.

ITimelockQueue_ActionCancelled

Thrown when a queued action has been cancelled.

error ITimelockQueue_ActionCancelled(uint64 actionId);

Parameters

NameTypeDescription
actionIduint64The queued action ID.

ITimelockQueue_ActionNotReady

Thrown when a queued action is executed before its timelock has elapsed.

error ITimelockQueue_ActionNotReady(uint64 actionId, uint48 executableAt);

Parameters

NameTypeDescription
actionIduint64The queued action ID.
executableAtuint48Timestamp at which the action can first be executed.

ITimelockQueue_ActionExpired

Thrown when a queued action is executed after its execution window.

error ITimelockQueue_ActionExpired(uint64 actionId, uint48 expiresAt);

Parameters

NameTypeDescription
actionIduint64The queued action ID.
expiresAtuint48Timestamp after which the action can no longer be executed.

ITimelockQueue_ActionInvalid

Thrown when a queued action has an unsupported target or selector.

error ITimelockQueue_ActionInvalid(address target, bytes4 selector);

Parameters

NameTypeDescription
targetaddressThe queued target address.
selectorbytes4The queued function selector.

ITimelockQueue_TimelockDelayInvalid

Thrown when a proposed timelock delay is outside the accepted range.

error ITimelockQueue_TimelockDelayInvalid(uint48 delay, uint48 minimum, uint48 maximum);

Parameters

NameTypeDescription
delayuint48The proposed delay.
minimumuint48The minimum accepted delay.
maximumuint48The maximum accepted delay.

Structs

QueuedAction

Queued timelock action.

struct QueuedAction {
address target;
bytes4 selector;
address proposer;
uint48 queuedAt;
uint48 executableAt;
uint48 expiresAt;
bool executed;
bool cancelled;
bytes payload;
}

Properties

NameTypeDescription
targetaddressThe contract expected to receive the queued action.
selectorbytes4The function selector for the queued action.
proposeraddressThe account that queued the action.
queuedAtuint48Timestamp at which the action was queued.
executableAtuint48Timestamp at which the action can first be executed.
expiresAtuint48Timestamp after which the action can no longer be executed.
executedboolWhether the action has been executed.
cancelledboolWhether the action has been cancelled.
payloadbytesEncoded parameters for the action.