# Timelock

Each Union contract allows the Timelock address to modify it. The Timelock contract can modify system parameters, logic, and contracts in a 'time-delayed, opt-out' upgrade pattern.

The Timelock has a hard-coded, minimum delay of 2 days. 2 days is the least amount of notice possible for a governance action. Each proposed action will be published at a minimum of 2 days in the future from the time of announcement. Major upgrades, such as changing the risk system, may have a 14-day delay.

## Functions

### isOperation() -> bool

Returns whether an id correspond to a registered operation. This includes both Pending, Ready and Done operations.

### isOperationPending() -> bool

Returns whether an operation is pending or not.

### isOperationReady() -> bool

Returns whether an operation is ready or not.

### isOperationDone() -> bool

Returns whether an operation is done or not.

### getTimestamp() -> uint256

Returns the timestamp at with an operation becomes ready (0 for unset operations, 1 for done operations).

### getMinDelay() -> uint256

Returns the minimum delay for an operation to become valid.

### schedule( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 delay )

Schedule an operation containing a single transaction.

### scheduleBatch( address\[] calldata targets, uint256\[] calldata values, bytes\[] calldata datas, bytes32 predecessor, bytes32 salt, uint256 delay )

Schedule an operation containing a batch of transactions.

### cancel(bytes32 id)

Cancel an operation.

### execute( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt )

Execute an (ready) operation containing a single transaction.

### executeBatch( address\[] calldata targets, uint256\[] calldata values, bytes\[] calldata datas, bytes32 predecessor, bytes32 salt )

Execute an (ready) operation containing a batch of transactions.

## Events

### CallScheduled( bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data, bytes32 predecessor, uint256 delay )

Emitted when a call is scheduled as part of operation id.

### CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data)

Emitted when a call is performed as part of operation id.

### Cancelled(bytes32 indexed id)

Emitted when operation id is cancelled.

### MinDelayChange(uint256 oldDuration, uint256 newDuration)

Emitted when the minimum delay for future operations is modified.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.union.finance/developers/governance/itimelock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
