RewardsController
Last updated
Was this helpful?
Last updated
Was this helpful?
The RewardsController is designed to store and distribute rewards to accounts that interact with the ' different variable and fixed pools.
It calculates the total amount of rewards to distribute and determines the allocation between the pools based on a . Accounts can claim their rewards through the contract, and their claimable rewards can be queried at any time using the claimable
function.
Max utilization supported by the sigmoid function not to cause a division by zero.
Tracks the reward distribution data for a given market.
Retrieves Markets with distributions set.
Tracks enabled asset rewards.
Stores registered asset rewards.
Gets the account data of a given account, Market, operation and reward asset.
Parameters
account
address
The account to get the operation data from.
market
contract Market
The market in which the operation was made.
operation
bool
True if the operation was a borrow, false if it was a deposit.
reward
contract ERC20
The reward asset.
Returns
_0
uint256
accrued The accrued amount.
_1
uint256
index The account index.
Gets the claimable amount of rewards for a given account and reward asset.
Parameters
account
address
The account to get the claimable amount for.
reward
contract ERC20
The reward asset.
Returns
unclaimedRewards
uint256
The claimable amount for the given account.
Gets all market and operations.
Returns
marketOps
RewardsController.MarketOperation[]
The list of market operations.
Retrieves all rewards addresses.
Returns
_0
contract ERC20[]
All enabled reward addresses
Gets the amount of reward assets that are being distributed for a Market.
Parameters
market
contract Market
Market to get the number of available rewards to distribute.
Returns
_0
uint256
The amount reward assets set to a Market.
Gets the claimable amount of rewards for a given account, Market operations and reward asset.
Parameters
marketOps
RewardsController.MarketOperation[]
The list of Market operations to get the accrued and pending rewards from.
account
address
The account to get the claimable amount for.
reward
contract ERC20
The reward asset.
Returns
unclaimedRewards
uint256
The claimable amount for the given account.
Gets the distribution start
, end
and lastUpdate
value of a given market and reward.
Parameters
market
contract Market
The market to get the distribution times.
reward
contract ERC20
The reward asset.
Returns
_0
uint32
The distribution start
, end
and lastUpdate
time.
Retrieves projected distribution indexes and new undistributed amount for a given deltaTime
.
Parameters
market
contract Market
The market to calculate the indexes for.
reward
contract ERC20
The reward asset to calculate the indexes for.
deltaTime
uint256
The elapsed time since the last update.
Returns
borrowIndex
uint256
The index for the borrow operation.
depositIndex
uint256
The index for the deposit operation.
newUndistributed
uint256
The new undistributed rewards of the distribution.
Gets the configuration of a given distribution.
Parameters
market
contract Market
The market to get the distribution configuration for.
reward
contract ERC20
The reward asset.
Returns
_0
RewardsController.Config
The distribution configuration.
Gets the reward indexes and last amount of undistributed rewards for a given market and reward asset.
Parameters
market
contract Market
The market to get the reward indexes for.
reward
contract ERC20
The reward asset to get the reward indexes for.
Returns
_0
uint256
borrowIndex The index for the floating and fixed borrow operation.
_1
uint256
depositIndex The index for the floating deposit operation.
_2
uint256
lastUndistributed The last amount of undistributed rewards.
Claims msg.sender
rewards for the given operations and reward assets to the given account.
Parameters
marketOps
RewardsController.MarketOperation[]
The operations to claim rewards for.
to
address
The address to send the rewards to.
rewardsList
contract ERC20[]
The list of rewards assets to claim.
Returns
_0
contract ERC20[]
The list of rewards assets.
claimedAmounts
uint256[]
The list of claimed amounts.
Claims all msg.sender
rewards to the given account.
Parameters
to
address
The address to send the rewards to.
Returns
rewardsList
contract ERC20[]
The list of rewards assets.
claimedAmounts
uint256[]
The list of claimed amounts.
Enables or updates the reward distribution for the given markets and rewards.
Parameters
configs
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
account
address
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
account
address
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
asset
contract ERC20
The asset to withdraw.
to
address
The address to withdraw the asset to.