RewardsDistributor
`RewardsDistributor`
Contract used to configure, track and distribute rewards to users based on their actions (borrows and supplies) in the protocol. Users can receive additional rewards through a RewardsDistributor
. Each RewardsDistributor
proxy is initialized with a specific reward token and Comptroller
, which can then distribute the reward token to users that supply or borrow in the associated pool. Authorized users can set the reward token borrow and supply speeds for each market in the pool. This sets a fixed amount of reward token to be released each block for borrowers and suppliers, which is distributed based on a user’s percentage of the borrows or supplies respectively. The owner can also set up reward distributions to contributor addresses (distinct from suppliers and borrowers) by setting their contributor reward token speed, which similarly allocates a fixed amount of reward token per block.
The owner has the ability to transfer any amount of reward tokens held by the contract to any other address. Rewards are not distributed automatically and must be claimed by a user calling claimRewardToken()
. Users should be aware that it is up to the owner and other centralized entities to ensure that the RewardsDistributor
holds enough tokens to distribute the accumulated rewards of users and contributors.
Solidity API
INITIAL_INDEX
The initial REWARD TOKEN index for a market
rewardTokenSupplyState
The REWARD TOKEN market supply state for each market
rewardTokenSupplierIndex
The REWARD TOKEN borrow index for each market for each supplier as of the last time they accrued REWARD TOKEN
rewardTokenAccrued
The REWARD TOKEN accrued but not yet transferred to each user
rewardTokenBorrowSpeeds
The rate at which rewardToken is distributed to the corresponding borrow market (per block)
rewardTokenSupplySpeeds
The rate at which rewardToken is distributed to the corresponding supply market (per block)
rewardTokenBorrowState
The REWARD TOKEN market borrow state for each market
rewardTokenContributorSpeeds
The portion of REWARD TOKEN that each contributor receives per block
lastContributorBlock
Last block at which a contributor's REWARD TOKEN rewards have been allocated
rewardTokenBorrowerIndex
The REWARD TOKEN borrow index for each market for each borrower as of the last time they accrued REWARD TOKEN
initialize
RewardsDistributor initializer
Parameters
distributeBorrowerRewardToken
Calculate reward token accrued by a borrower and possibly transfer it to them Borrowers will begin to accrue after the first interaction with the protocol.
Parameters
grantRewardToken
Transfer REWARD TOKEN to the recipient
Parameters
setRewardTokenSpeeds
Set REWARD TOKEN borrow and supply speeds for the specified markets
Parameters
setLastRewardingBlocks
Set REWARD TOKEN last rewarding block for the specified markets
Parameters
setContributorRewardTokenSpeed
Set REWARD TOKEN speed for a single contributor
Parameters
claimRewardToken
Claim all the rewardToken accrued by holder in all markets
Parameters
setMaxLoopsLimit
Set the limit for the loops can iterate to avoid the DOS
Parameters
updateContributorRewards
Calculate additional accrued REWARD TOKEN for a contributor since last accrual
Parameters
claimRewardToken
Claim all the rewardToken accrued by holder in the specified markets
Parameters
Last updated