# PoolRewards

## PoolRewards

Distributes VSP rewards based on the user's Vesper pool balance and the supply of rewards available to that pool.

### VERSION

```solidity
string VERSION
```

### initialize

```solidity
function initialize(address _pool, address[] _rewardTokens) public
```

*Called by proxy to initialize this contract.*

| Name           | Type       | Description                     |
| -------------- | ---------- | ------------------------------- |
| \_pool         | address    | Vesper pool address             |
| \_rewardTokens | address\[] | Array of reward token addresses |

### notifyRewardAmount

```solidity
function notifyRewardAmount(address[] _rewardTokens, uint256[] _rewardAmounts, uint256[] _rewardDurations) external virtual
```

Notify that reward is added. Only authorized caller can call this function.

*Also updates reward rate and reward earning period.*

| Name              | Type       | Description                                                  |
| ----------------- | ---------- | ------------------------------------------------------------ |
| \_rewardTokens    | address\[] | Tokens being rewarded                                        |
| \_rewardAmounts   | uint256\[] | Rewards amount for token on same index in rewardTokens array |
| \_rewardDurations | uint256\[] | Duration for which reward will be distributed                |

### notifyRewardAmount

```solidity
function notifyRewardAmount(address _rewardToken, uint256 _rewardAmount, uint256 _rewardDuration) external virtual
```

### addRewardToken

```solidity
function addRewardToken(address _newRewardToken) external
```

Add new reward token in existing rewardsToken array

### claimReward

```solidity
function claimReward(address _account) external virtual
```

Claim earned rewards.

*This function claims rewards for all tokens being rewarded*

### updateReward

```solidity
function updateReward(address _account) external
```

Updated reward for given account.

### claimable

```solidity
function claimable(address _account) external view virtual returns (address[] _rewardTokens, uint256[] _claimableAmounts)
```

Returns claimable reward amount.

| Name               | Type       | Description                                                |
| ------------------ | ---------- | ---------------------------------------------------------- |
| \_rewardTokens     | address\[] | Array of tokens being rewarded                             |
| \_claimableAmounts | uint256\[] | Array of claimable for token on same index in rewardTokens |

### getRewardTokens

```solidity
function getRewardTokens() external view returns (address[])
```

Provides easy access to all rewardTokens

### lastTimeRewardApplicable

```solidity
function lastTimeRewardApplicable(address _rewardToken) public view returns (uint256)
```

Returns timestamp of last reward update

### rewardForDuration

```solidity
function rewardForDuration() external view returns (address[] _rewardTokens, uint256[] _rewardForDuration)
```

#### rewardPerToken

```solidity
function rewardPerToken() external view returns (address[] _rewardTokens, uint256[] _rewardPerTokenRate)
```

Rewards rate per pool token

| Name                 | Type       | Description                                                   |
| -------------------- | ---------- | ------------------------------------------------------------- |
| \_rewardTokens       | address\[] | Array of tokens being rewarded                                |
| \_rewardPerTokenRate | uint256\[] | Array of Rewards rate for token on same index in rewardTokens |


---

# 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.vesper.finance/vesper-developers/vesper-contracts-api-reference/pool-contracts/poolrewards.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.
