# FeeDistributor

## Overview

The `FeeDistributor.vy` contract allows users to claim APW locking rewards.

## FeeDistributor Methods

### claim

Claim fees for `_addr.`

```solidity
def claim(_addr: address = msg.sender) -> uint256
```

<table><thead><tr><th width="246.33333333333331">Input Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>_addr</code></td><td>address</td><td>The user address to claim for.</td></tr></tbody></table>

<table><thead><tr><th width="246.33333333333331">Return Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount</code></td><td>uint256</td><td>The amount claimed.</td></tr></tbody></table>

{% hint style="info" %}
Each call to claim look at a maximum of 50 user veAPW points. For accounts with many veAPW related actions, this function may need to be called more than once to claim all available fees. In the `Claimed` event that fires, if `claim_epoch` is less than `max_epoch`, the account may claim again.
{% endhint %}

### claim\_many

Make multiple fee claims in a single call.

```solidity
def claim_many(_receivers: address[20]) -> bool
```

<table><thead><tr><th width="246.33333333333331">Input Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>_receivers</code></td><td>address[20]</td><td>List of addresses to claim for. Claiming terminates at the first <code>ZERO_ADDRESS.</code></td></tr></tbody></table>

<table><thead><tr><th width="246.33333333333331">Return Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td>bool</td><td>True if execution succeeded.</td></tr></tbody></table>

{% hint style="info" %}
Used to claim for many accounts at once, or to make multiple claims for the same address when that address has significant veAPW history.
{% endhint %}

### checkpoint\_token

Updates the token checkpoint.

```solidity
def checkpoint_token()
```

{% hint style="info" %}
Calculates the total number of tokens to be distributed in a given week. During setup for the initial distribution this function is only callable by the contract owner. Beyond initial distro, it can be enabled for anyone to call.
{% endhint %}

### checkpoint\_total\_supply

Update the veAPW total supply checkpoint.

```solidity
def checkpoint_total_supply()
```

{% hint style="info" %}
The checkpoint is also updated by the first claimant each new epoch week. This function may be called independently of a claim, to reduce claiming gas costs.
{% endhint %}

## View Methods

### ve\_for\_at

Get the veAPW balance for `_user` at `_timestamp`

```solidity
def ve_for_at(_user: address, _timestamp: uint256) -> uint256
```

<table><thead><tr><th width="246.33333333333331">Input Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>_user</code></td><td>address</td><td>The address to query balance for.</td></tr><tr><td><code>_timestamp</code></td><td>uint256</td><td>The epoch time to query balance at.</td></tr></tbody></table>

<table><thead><tr><th width="246.33333333333331">Return Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>balance</code></td><td>uint256</td><td>The veAPW balance.</td></tr></tbody></table>
