The RewardsController is designed to store and distribute rewards to accounts that interact with the Markets ' different variable and fixed pools.
It calculates the total amount of rewards to distribute and determines the allocation between the pools based on a dynamic distribution model . Accounts can claim their rewards through the contract, and their claimable rewards can be queried at any time using the claimable function.
Public State Variables
UTILIZATION_CAP
Copy function UTILIZATION_CAP () external view returns ( uint256 ) Max utilization supported by the sigmoid function not to cause a division by zero.
Copy function distribution (contract Market ) external view returns ( uint8 availableRewardsCount , uint256 baseUnit) Tracks the reward distribution data for a given market.
Copy function marketList ( uint256 ) external view returns (contract Market ) Retrieves Markets with distributions set.
Copy function rewardEnabled (contract ERC20 ) external view returns ( bool ) Tracks enabled asset rewards.
Stores registered asset rewards.
accountOperation
Gets the account data of a given account, Market, operation and reward asset.
Parameters
The account to get the operation data from.
The market in which the operation was made.
True if the operation was a borrow, false if it was a deposit.
Returns
accrued The accrued amount.
Gets the claimable amount of rewards for a given account and reward asset.
Parameters
The account to get the claimable amount for.
Returns
The claimable amount for the given account.
allMarketsOperations
Gets all market and operations.
Returns
RewardsController.MarketOperation[]
The list of market operations.
Retrieves all rewards addresses.
Returns
All enabled reward addresses
availableRewardsCount
Gets the amount of reward assets that are being distributed for a Market.
Parameters
Market to get the number of available rewards to distribute.
Returns
The amount reward assets set to a Market.
Gets the claimable amount of rewards for a given account, Market operations and reward asset.
Parameters
RewardsController.MarketOperation[]
The list of Market operations to get the accrued and pending rewards from.
The account to get the claimable amount for.
Returns
The claimable amount for the given account.
distributionTime
Gets the distribution start, end and lastUpdate value of a given market and reward.
Parameters
The market to get the distribution times.
Returns
The distribution start, end and lastUpdate time.
previewAllocation
Retrieves projected distribution indexes and new undistributed amount for a given deltaTime.
Parameters
The market to calculate the indexes for.
The reward asset to calculate the indexes for.
The elapsed time since the last update.
Returns
The index for the borrow operation.
The index for the deposit operation.
The new undistributed rewards of the distribution.
Gets the configuration of a given distribution.
Parameters
The market to get the distribution configuration for.
Returns
The distribution configuration.
Gets the reward indexes and last amount of undistributed rewards for a given market and reward asset.
Parameters
The market to get the reward indexes for.
The reward asset to get the reward indexes for.
Returns
borrowIndex The index for the floating and fixed borrow operation.
depositIndex The index for the floating deposit operation.
lastUndistributed The last amount of undistributed rewards.
Claims msg.sender rewards for the given operations and reward assets to the given account.
Parameters
RewardsController.MarketOperation[]
The operations to claim rewards for.
The address to send the rewards to.
The list of rewards assets to claim.
Returns
The list of rewards assets.
The list of claimed amounts.
Claims all msg.sender rewards to the given account.
Parameters
The address to send the rewards to.
Returns
The list of rewards assets.
The list of claimed amounts.
Enables or updates the reward distribution for the given markets and rewards.
Parameters
RewardsController.Config[]
The configurations to update each RewardData with.
Hook to be called by the Market to update the index of the account that made a rewarded borrow.
Parameters
The account to which the index is updated.
Hook to be called by the Market to update the index of the account that made a rewarded deposit.
Parameters
The account to which the index is updated.
Withdraws the contract's balance of the given asset to the given address. Only to be called by ADMIN role accounts.
Parameters
The address to withdraw the asset to.