RewardsController
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
Max utilization supported by the sigmoid function not to cause a division by zero.
distribution
Tracks the reward distribution data for a given market.
marketList
Retrieves Markets with distributions set.
rewardEnabled
Tracks enabled asset rewards.
rewardList
Stores registered asset rewards.
View Methods
accountOperation
Gets the account data of a given account, Market, operation and reward asset.
Parameters
Returns
allClaimable
Gets the claimable amount of rewards for a given account and reward asset.
Parameters
Returns
allMarketsOperations
Gets all market and operations.
Returns
allRewards
Retrieves all rewards addresses.
Returns
availableRewardsCount
Gets the amount of reward assets that are being distributed for a Market.
Parameters
Returns
claimable
Gets the claimable amount of rewards for a given account, Market operations and reward asset.
Parameters
Returns
distributionTime
Gets the distribution start
, end
and lastUpdate
value of a given market and reward.
Parameters
Returns
previewAllocation
Retrieves projected distribution indexes and new undistributed amount for a given deltaTime
.
Parameters
Returns
rewardConfig
Gets the configuration of a given distribution.
Parameters
Returns
rewardIndexes
Gets the reward indexes and last amount of undistributed rewards for a given market and reward asset.
Parameters
Returns
Write Methods
claim
Claims msg.sender
rewards for the given operations and reward assets to the given account.
Parameters
Returns
claimAll
Claims all msg.sender
rewards to the given account.
Parameters
Returns
config
Enables or updates the reward distribution for the given markets and rewards.
Parameters
handleBorrow
Hook to be called by the Market to update the index of the account that made a rewarded borrow.
Parameters
handleDeposit
Hook to be called by the Market to update the index of the account that made a rewarded deposit.
Parameters
withdraw
Withdraws the contract's balance of the given asset to the given address. Only to be called by ADMIN role accounts.
Parameters
Last updated