RewardFaucet
The contract allows for scheduling reward distributions at specific time intervals. However, the contract only assists in the distribution, and in some cases, rewards may be deferred, for instance, due to infrequent interactions with the core contract - RewardDistributor.
Code
View functions
totalTokenRewards
function totalTokenRewards(address token) external view returns (uint256)
Parameters:tokens
- The address of the distributed token.
Returns the total amount of tokens planned for future distribution.
getTokenWeekAmounts
function getTokenWeekAmounts(address token, uint256 pointOfWeek) external view returns (uint256)
Parameters:token
- The address of the reward token to be distributedpointOfWeek
- The timestamp representing a specific week (can by any point of the week)
Returns the reward amount for a specified week (represented by a point within the week)
Note! Week begins on each Thursday 00:00.
getUpcomingRewardsForNWeeks
function getUpcomingRewardsForNWeeks(address token, uint256 weeksCount) external view returns (uint256[] memory)
Parameters:token
- The address of the reward token to be distributedweeksCount
- The number of weeks to check rewards for
Returns rewards for a specified number of weeks starting from the current week.
Creating Scheduled Distribution
depositEqualWeeksPeriod
function depositEqualWeeksPeriod(
address token,
uint256 amount,
uint256 weeksCount
) external;
Deposit rewards evenly across a specified period starting from the current week. The current week amount will be immediately transferred into RewardDistributor contract.
Parameters:token
- The address of the token to be deposited as a rewardamount
- The total amount of token
to be deposited as a reward over the entire periodweeksCount
- The number of weeks, including the current one, over which the rewards will be distributed
depositExactWeek
function depositToken(
address token,
uint256 amount,
uint256 weekTimeStamp
) external;
Deposits rewards into a specific week (starting from current) Parameters:token
- The address of the token to be deposited as a rewardamount
- The amount of token
to be deposited as a rewardweekTimeStamp
- The timestamp of the week for which rewards are being distributed
Note! If a week is separated from previous reward weeks, or rewards were not claimed in previous weeks in the RewardDistributor contract, users may need to manually call the distributePastRewards()
function to ensure that the rewards are added to the RewardDistributor contract.
distributePastRewards
function distributePastRewards(address token) external;
Collects all rewards for 10 past weeks and sends them to RewardDistributor Parameters:token
- the token address to collect rewards
movePastRewards
function movePastRewards(address user, uint256 pastWeekTimestamp) external;
Manually moves unclaimed past rewards to the next week to enable distribution Parameters:token
- The reward token address to be moved pastWeekTimestamp
- The timestamp representing a point in the past week (must be at least 10 weeks ago)