> For the complete documentation index, see [llms.txt](https://docs.fathom.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fathom.fi/dao/interfaces/staking/rewardscalculator.md).

# RewardsCalculator

The `RewardsCalculator` contract, a component of the Fathom DAO Staking, is designed to handle and calculate rewards distribution for staking activities. It leverages a detailed schedule system to determine rewards over different time frames, ensuring flexibility and accuracy in reward calculations. It also includes functionality to handle errors related to inputs and state conditions rigorously, thus maintaining the integrity and robustness of the rewards distribution mechanism.

### Storage Variables

#### **`MAXIMUM_PERCENT_TO_TREASURY`**

* **Type:** `uint256`
* **Visibility:** `public constant`
* **Description:** Represents the maximum allowable percentage of rewards that can be allocated to the treasury, set at 10,000 to represent 100% using a base-10000 system for precision.

### Read Functions

#### **`validateStreamParameters`**

* **Arguments:**
  * `address streamOwner` - The owner of the reward stream.
  * `address rewardToken` - The token used for rewards.
  * `uint256 percentToTreasury` - The percentage of rewards directed to the treasury.
  * `uint256 maxDepositAmount` - The maximum deposit amount allowed.
  * `uint256 minDepositAmount` - The minimum deposit amount required.
  * `uint256[] scheduleTimes` - An array of times defining the reward schedule.
  * `uint256[] scheduleRewards` - Corresponding rewards for each scheduled time.
  * `uint256 tau` - A specific parameter used in reward calculations.
* **Return Values:** None. Reverts on validation failure with specific errors.

#### **`getRewardsAmount`**

* **Arguments:**
  * `Schedule calldata schedule` - The reward schedule details.
  * `uint256 lastUpdate` - The last update time for calculating incremental rewards.
* **Return Values:**
  * `uint256` - The amount of rewards calculated based on the schedule and time updates.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.fathom.fi/dao/interfaces/staking/rewardscalculator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
