RewardController
Inherits: IRewardController, IncreAccessControl, Pausable, ReentrancyGuard
Author: webthethird
Base contract for storing and updating reward info for multiple reward tokens, each with
a gradually decreasing emission rate, based on an initial inflation rate, reduction factor, and time elapsed
a list of markets for which the reward token is distributed
a list of weights representing the percentage of rewards that go to each market
State Variables
MAX_INFLATION_RATE
Maximum inflation rate, applies to all reward tokens
MIN_REDUCTION_FACTOR
Minimum reduction factor, applies to all reward tokens
MAX_REWARD_TOKENS
Maximum number of reward tokens allowed
MAX_BASIS_POINTS
100% in basis points
rewardTokens
List of reward token addresses
Length must be <= MAX_REWARD_TOKENS
_rewardInfoByToken
Info for each registered reward token
_marketWeightsByToken
Mapping from reward token to reward weights for each market
Market reward weights are basis points, i.e., 100 = 1%, 10000 = 100%
Functions
getMaxInflationRate
Gets the maximum allowed inflation rate for a reward token
Returns
getMinReductionFactor
Gets the minimum allowed reduction factor for a reward token
Returns
getMaxRewardTokens
Gets the maximum allowed number of reward tokens
Returns
getRewardTokens
Returns the full list of reward tokens
Returns
getRewardTokenCount
Gets the number of reward tokens
Returns
getInitialTimestamp
Gets the timestamp when a reward token was registered
Parameters
Returns
getInitialInflationRate
Gets the inflation rate of a reward token (w/o factoring in reduction factor)
Parameters
Returns
getInflationRate
Gets the current inflation rate of a reward token (factoring in reduction factor)
inflationRate = initialInflationRate / reductionFactor^((block.timestamp - initialTimestamp) / secondsPerYear)
Parameters
Returns
getReductionFactor
Gets the reduction factor of a reward token
Parameters
Returns
getRewardWeight
Gets the reward weight of a given market for a reward token
Parameters
Returns
getRewardMarkets
Gets the list of all markets receiving a given reward token
Parameters
Returns
isTokenPaused
Gets whether a reward token is paused
Parameters
Returns
updateRewardWeights
Sets the market addresses and reward weights for a reward token
Only callable by Governance
Parameters
updateInitialInflationRate
Sets the initial inflation rate used to calculate emissions over time for a given reward token
Only callable by Governance
Parameters
updateReductionFactor
Sets the reduction factor used to reduce emissions over time for a given reward token
Only callable by Governance
Parameters
pause
Pause the contract
Can only be called by Emergency Admin
unpause
Unpause the contract
Can only be called by Emergency Admin
togglePausedReward
Pauses/unpauses the reward accrual for a particular reward token
Only callable by Emergency Admin
Parameters
_togglePausedReward
Pauses/unpauses the reward accrual for a particular reward token
Does not pause gradual reduction of inflation rate over time due to reduction factor
Parameters
_updateMarketRewards
Updates the reward accumulators for a given market
Executes when any of the following values are changed:
initial inflation rate per token,
reduction factor per token,
reward weights per market per token,
liquidity in the market
Parameters
_getNumMarkets
Gets the number of markets to be used for reward distribution
Markets are the perpetual markets (for the PerpRewardDistributor) or staked tokens (for the SafetyModule)
Returns
_getCurrentPosition
Returns the current position of the user in the market (i.e., perpetual market or staked token)
Parameters
Returns
_getMarketAddress
Gets the address of a market at a given index
Markets are the perpetual markets (for the PerpRewardDistributor) or staked tokens (for the SafetyModule)
Parameters
Returns
_getMarketIdx
Gets the index of an allowlisted market
Markets are the perpetual markets (for the PerpRewardDistributor) or staked tokens (for the SafetyModule)
Parameters
Returns
Structs
RewardInfo
Data structure containing essential info for each reward token
Properties
Last updated