Skip to main content

Timelock

The Timelock contract controls each protocol contract and facilitates secure and transparent updates to governance parameters, logic, and contracts. It operates through a "time-delayed, opt-out" upgrade pattern, allowing stakeholders ample time to review proposed changes and react accordingly. The Timelock contract, which has a hard-coded minimum delay, queues and executes proposals that have successfully passed a governance vote, ensuring trust and transparency in the decision-making process.

Constant Functions

delay

function delay() external returns (uint256)

The duration of time after which a transaction is available to be executed.

queuedTransactions

function queuedTransactions(
bytes32 hash
) external returns (bool)

Get the details about a queued transaction.

Parameters

NameTypeDescription
hashbytes32The hash of the transaction to check.

GRACE_PERIOD

function GRACE_PERIOD() external returns (uint256)

The duration of time from the moment the transaction is available to be executed till it expires.

Non-Constant Functions

acceptAdmin

function acceptAdmin() public

Allows the pending admin to accept the admin role.

cancelTransaction

function cancelTransaction(
address target,
uint256 value,
string signature,
bytes data,
uint256 eta
) public

Cancel a queued transaction.

Parameters

NameTypeDescription
targetaddressThe target address of the contract which will be called.
valueuint256The amount of ETH to send with the transaction.
signaturestringThe signature of the function to be called.
databytesThe data that will be passed to the function.
etauint256The timestamp of when the transaction will be available for execution.

executeTransaction

function executeTransaction(
address target,
uint256 value,
string signature,
bytes data,
uint256 eta
) public returns (bytes)

Execute a queued transaction.

Parameters

NameTypeDescription
targetaddressThe target address of the contract which will be called.
valueuint256The amount of ETH to send with the transaction.
signaturestringThe signature of the function to be called.
databytesThe data that will be passed to the function.
etauint256The timestamp of when the transaction will be available for execution.

queueTransaction

function queueTransaction(
address target,
uint256 value,
string signature,
bytes data,
uint256 eta
) public returns (bytes32)

Queue a transaction for future execution.

Parameters

NameTypeDescription
targetaddressThe target address of the contract which will be called.
valueuint256The amount of ETH to send with the transaction.
signaturestringThe signature of the function to be called.
databytesThe data that will be passed to the function.
etauint256The timestamp of when the transaction will be available for execution.

setDelay

function setDelay(
uint256 delay_
) public

Set the delay for the timelock.

Parameters

NameTypeDescription
delay_uint256The new delay that will be set.

setPendingAdmin

function setPendingAdmin(
address pendingAdmin_
) public

Set the address of the pending admin.

Parameters

NameTypeDescription
pendingAdmin_addressThe new pending admin that will be set.

Events

CancelTransaction

event CancelTransaction(
bytes32 txHash,
address target,
uint256 value,
string signature,
bytes data,
uint256 eta
)

Emitted when timelock admin cancel the transaction.

Parameters

NameTypeDescription
txHashbytes32The hash of the transaction that was canceled.
targetaddressThe target address of the contract which will be called.
valueuint256The amount of ETH to send with the transaction.
signaturestringThe signature of the function to be called.
databytesThe data that will be passed to the function.
etauint256The timestamp of when the transaction will be available for execution.

ExecuteTransaction

event ExecuteTransaction(
bytes32 txHash,
address target,
uint256 value,
string signature,
bytes data,
uint256 eta
)

Emitted when transaction is executed.

Parameters

NameTypeDescription
txHashbytes32The hash of the transaction that was executed.
targetaddressThe target contract address that contains the logic that was executed.
valueuint256The amount of ether transferred to the target contract.
signaturestringThe signature of the function executed.
databytesThe data passed to the function that was executed.
etauint256The timestamp after which the transaction was able to be executed.

NewAdmin

event NewAdmin(
address newAdmin
)

Emitted when there is a change in admin.

Parameters

NameTypeDescription
newAdminaddressThe new admin that was set.

NewDelay

event NewDelay(
uint256 newDelay
)

Emitted when new delay is set.

Parameters

NameTypeDescription
newDelayuint256The new delay that was set.

NewPendingAdmin

event NewPendingAdmin(
address newPendingAdmin
)

Emitted when pending admin is set.

Parameters

NameTypeDescription
newPendingAdminaddressThe new pending admin that was set.

QueueTransaction

event QueueTransaction(
bytes32 txHash,
address target,
uint256 value,
string signature,
bytes data,
uint256 eta
)

Emitted when transaction is queued.

Parameters

NameTypeDescription
txHashbytes32The hash of the transaction that was queued.
targetaddressThe target contract address that contains the logic to be executed.
valueuint256The amount of ether to transfer to the target contract.
signaturestringThe signature of the function to be executed.
databytesThe data to be passed to the function to be executed.
etauint256The timestamp after which the transaction can be executed.