# DrawCalculatorTimelock

The DrawCalculatorTimelock is responsible for pushing Draws to a DrawBuffer and routing claim requests from a PrizeDistributor to a DrawCalculator. The primary objective is to include a "cooldown" period for all new Draws. Allowing the correction of a maliciously set Draw in the unfortunate event an Owner is compromised.

## Write methods description

### initialize()

Allows to initialize the contract during the deployment.

Parameters:

<table><thead><tr><th width="187.33333333333331">Name</th><th width="171">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_owner</strong></td><td>address</td><td>Address of the DrawCalculator owner.</td></tr></tbody></table>

### setTimelock()

Set the `Timelock` struct. Only callable by the contract owner.

Parameters:

<table><thead><tr><th width="146.33333333333331">Name</th><th width="137">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_timelock</strong></td><td>Timelock</td><td>Timelock struct to set. Includes values: timestamp, drawId.</td></tr></tbody></table>

### lock()

Lock passed draw ID for `timelockDuration` seconds. Restricts new draws by forcing a push timelock.

Parameters:

<table><thead><tr><th width="219.33333333333331">Name</th><th width="206">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_drawId</strong></td><td>uint32</td><td>Draw ID to lock.</td></tr><tr><td><strong>_timestamp</strong></td><td>uint64</td><td>Epoch timestamp to unlock the draw.</td></tr></tbody></table>

Return:

<table><thead><tr><th width="213">Name</th><th width="172.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_locked</strong></td><td>bool</td><td><code>true</code> if operation was successful.</td></tr></tbody></table>

### transferOwnership()

Transfers ownership of the contract to a `_pendingOwner`. Can only be called by the current owner.

Parameters:

<table><thead><tr><th width="169.33333333333331">Name</th><th width="141">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_newOwner</strong></td><td>address</td><td>An account that will become the <code>_pendingOwner</code>.</td></tr></tbody></table>

### claimOwnership()

Allows the `pendingOwner` address to claim the owner role. This function is only callable by the `pendingOwner"`.

### renounceOwnership()

Leaves the contract without owner. It will not be possible to call the owner's functions anymore. Can only be called by the current owner. The method does not take any parameters. Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

### setManager()

Allows the owner to give the manager role to an address. The manager role has access to the functions with the modified `onlyManager` or `onlyManagerOrOwner`.

Parameters:

<table><thead><tr><th width="193.33333333333331">Name</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_newManager</strong></td><td>address</td><td>An account that will become the new manager.</td></tr></tbody></table>

## Read methods description

### getTimelock()

Read internal Timelock struct. Includes values: timestamp, drawId.

### hasElapsed()

Returns bool for `timelockDuration` elapsing.

Return:

<table><thead><tr><th width="136.33333333333331">Name</th><th width="108">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_elapsed</strong></td><td>bool</td><td><code>true</code> if <code>timelockDuration</code>, since last time lock has elapsed, <code>false</code> otherwise.</td></tr></tbody></table>

### owner()

Owner role that can be granted exclusive access to specific functions with the modifier `onlyOwner`.

### manager()

Manager role that can be granted exclusive access to specific functions with the modifier `onlyManager` or `onlyManagerOrOwner`.

### pendingOwner()

The address that can claim the owner role. It is used to transfer the owner.


---

# 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.asymetrix.io/resources/developers-docs/drawcalculatortimelock.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.
