# DrawCalculator

The DrawCalculator calculates the amount of user picks based on the user average weighted balance (during each draw period).

## Write methods description

### initialize()

Allows to initialize the contract during the deployment.

Parameters:

<table><thead><tr><th width="243.33333333333331">Name</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_ticket</strong></td><td>address</td><td>Address of the ticket.</td></tr><tr><td><strong>_drawBuffer</strong></td><td>address</td><td>Address of the DrawBuffer.</td></tr><tr><td><strong>_prizeDistributionBuffer</strong></td><td>address</td><td>Address of the PrizeDistributionBuffer.</td></tr></tbody></table>

## Read methods description

### calculateNumberOfUserPicks()

Calculates the picks amount for a user for multiple draws. Typically called by a PrizeDistributor.

Parameters:

<table><thead><tr><th width="154.33333333333331">Name</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_user</strong></td><td>address</td><td>User for which to calculate picks amount.</td></tr><tr><td><strong>_drawIds</strong></td><td>uint32[]</td><td><code>drawId</code> array for which to calculate picks amount for.</td></tr></tbody></table>

Return:

<table><thead><tr><th width="132.33333333333331">Name</th><th width="133">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_picks</strong></td><td>uint256[]</td><td>List of number of user picks ordered by drawId.</td></tr></tbody></table>

### drawBuffer()

Address of the DrawBuffer connected to the DrawCalculator.

### getDrawBuffer()

Address of the DrawBuffer connected to the DrawCalculator.

### getNormalizedBalancesForDrawIds()

Returns a user's balances expressed as a fraction of the total supply over time.

Parameters:

<table><thead><tr><th width="150.33333333333331">Name</th><th width="167">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_user</strong></td><td>address</td><td>The user's address.</td></tr><tr><td><strong>_drawIds</strong></td><td>uint32[]</td><td>The <code>_drawIds</code> to consider.</td></tr></tbody></table>

Return:

<table><thead><tr><th width="196.33333333333331">Name</th><th width="234">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>_balances</strong></td><td>uint256[]</td><td>Array of balances.</td></tr></tbody></table>

### getPrizeDistributionBuffer()

Read global prizeDistributionBuffer variable.

### prizeDistributionBuffer()

&#x20;Read global prizeDistributionBuffer variable.

### ticket()

Address of the Ticket associated with DrawCalculator.


---

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