RewardsCalculator
https://github.com/Into-the-Fathom/fathom-dao-smart-contracts/tree/master/contracts/dao/staking/packages
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
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
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
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.
Last updated