Skip to content
Lattice

TimelockController

Git Source

Inherits: ITimelockController

Title: TimelockController

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/TimelockController.sol)

A Diamond-compatible facet that schedules and executes governance actions after a minimum delay. All state lives in ERC-7201 namespaced storage via TimelockControllerLib; authentication uses AccessControlLib roles.

This is a thin, stateless façade. Deploy it as a Diamond facet or inherit it (together with AccessControl) in a standalone contract.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.1.0

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) public view virtual returns (bool);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>bool

isOperationPending

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

function isOperationPending(bytes32 id) public view virtual 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) public view virtual returns (bool);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>bool

isOperationDone

Returns whether an operation has been executed.

function isOperationDone(bytes32 id) public view virtual 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) public view virtual returns (ITimelockController.OperationState);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>ITimelockController.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) public view virtual returns (uint256);

Parameters

NameTypeDescription
idbytes32

Returns

NameTypeDescription
<none>uint256

getMinDelay

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

function getMinDelay() public view virtual 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)
        public
        pure
        virtual
        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
    ) public pure virtual 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
    ) public virtual;

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
    ) public virtual;

Parameters

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

cancel

Cancel an operation.

function cancel(bytes32 id) public virtual;

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)
        public
        payable
        virtual;

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
    ) public payable virtual;

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) public virtual;

Parameters

NameTypeDescription
newDelayuint256The new minimum delay.

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect TimelockController methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: CANCELLER_ROLE() 0xb08e51c0 EXECUTOR_ROLE() 0x07bd0265 PROPOSER_ROLE() 0x8f61f4f5 cancel(bytes32) 0xc4d252f5 execute(address,uint256,bytes,bytes32,bytes32) 0x134008d3 executeBatch(address[],uint256[],bytes[],bytes32,bytes32) 0xe38335e5 getMinDelay() 0xf27a0c92 getOperationState(bytes32) 0x7958004c getTimestamp(bytes32) 0xd45c4435 hashOperation(address,uint256,bytes,bytes32,bytes32) 0x8065657f hashOperationBatch(address[],uint256[],bytes[],bytes32,bytes32) 0xb1c5f427 isOperation(bytes32) 0x31d50750 isOperationDone(bytes32) 0x2ab0f529 isOperationPending(bytes32) 0x584b153e isOperationReady(bytes32) 0x13bc9f20 schedule(address,uint256,bytes,bytes32,bytes32,uint256) 0x01d5062a scheduleBatch(address[],uint256[],bytes[],bytes32,bytes32,uint256) 0x8f2a0bb0 updateDelay(uint256) 0x64d62353

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes