# DrawBeacon

Manages pushing draws onto DrawBuffer. The DrawBeacon has 1 major action: creating of a new draw. A user can create a new draw using the `startDraw()` method which will push the draw onto the DrawBuffer.

## Write methods description

### initialize()

Allows to initialize the contract during the deployment.&#x20;

Parameters:

<table><thead><tr><th width="233.33333333333331">Name</th><th width="98">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_owner</strong></td><td>address</td><td>Address of the DrawBeacon owner.</td></tr><tr><td><strong>_drawBuffer</strong></td><td>address</td><td>The address of the draw buffer to push draws to.</td></tr><tr><td><strong>_nextDrawId</strong></td><td>uint32</td><td>Draw ID at which the DrawBeacon should start. Can't be inferior to 1.</td></tr><tr><td><strong>_beaconPeriodStart</strong></td><td>uint64</td><td>The starting timestamp of the beacon period.</td></tr><tr><td><strong>_beaconPeriodSeconds</strong></td><td>uint32</td><td>The duration of the beacon period in seconds.</td></tr></tbody></table>

### setBeaconPeriodSeconds()

Allows the owner to set the beacon period in seconds.

Parameters:&#x20;

<table><thead><tr><th width="241">Name</th><th width="88.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_beaconPeriodSeconds</strong></td><td>uint32</td><td>The new beacon period in seconds.  Must be greater than zero.</td></tr></tbody></table>

### setDrawBuffer()

Set global DrawBuffer variable. All subsequent draw requests/completions will be pushed to the new DrawBuffer.

Parameters:

<table><thead><tr><th width="199.33333333333331">Name</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_newDrawBuffer</strong></td><td>address</td><td>DrawBuffer address.</td></tr></tbody></table>

### startDraw()

Starts the draw creation process. The previous beacon period must have ended.

### 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.

### transferOwnership()

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

Parameters:

<table><thead><tr><th width="173.33333333333331">Name</th><th width="116">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>

## Read methods description

### beaconPeriodEndAt()

Returns the timestamp at which the beacon period ends.

### beaconPeriodRemainingSeconds()

Returns the number of seconds remaining until the beacon period can be complete.

### calculateNextBeaconPeriodStartTime()

Calculates when the next beacon period will start.

Parameters:

<table><thead><tr><th width="149">Name</th><th width="140.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_time</strong></td><td>uint64</td><td>The timestamp to use as the current time.</td></tr></tbody></table>

### calculateNextBeaconPeriodStartTimeFromCurrentTime()

Calculates the next beacon start time, assuming all beacon periods have occurred between the last and now.

### canStartDraw()

Returns whether the draw can start. `true` if the beacon period is over, `false` otherwise.

### getBeaconPeriodSeconds()

Returns beacon period seconds.

### getBeaconPeriodStartedAt()

Returns the time when the beacon period started at.

### getDrawBuffer()

Returns the address of the DrawBuffer.

### getNextDrawId()

Returns the next draw to be processed.

### isBeaconPeriodOver()

Returns whether the beacon period is over. `true` if the beacon period is over, `false` otherwise.

### owner()

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

### pendingOwner()

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/drawbeacon.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.
