IRewardsDistributor
Defines the basic interface for a Rewards Distributor.
AssetConfigUpdated
event AssetConfigUpdated(address asset, address reward, uint256 oldEmission, uint256 newEmission, uint256 oldDistributionEnd, uint256 newDistributionEnd, uint256 assetIndex)
Emitted when the configuration of the rewards of an asset is updated.
Parameters
asset
address
The address of the incentivized asset
reward
address
The address of the reward token
oldEmission
uint256
The old emissions per second value of the reward distribution
newEmission
uint256
The new emissions per second value of the reward distribution
oldDistributionEnd
uint256
The old end timestamp of the reward distribution
newDistributionEnd
uint256
The new end timestamp of the reward distribution
assetIndex
uint256
The index of the asset distribution
Accrued
event Accrued(address asset, address reward, address user, uint256 assetIndex, uint256 userIndex, uint256 rewardsAccrued)
Emitted when rewards of an asset are accrued on behalf of a user.
Parameters
asset
address
The address of the incentivized asset
reward
address
The address of the reward token
user
address
The address of the user that rewards are accrued on behalf of
assetIndex
uint256
The index of the asset distribution
userIndex
uint256
The index of the asset distribution on behalf of the user
rewardsAccrued
uint256
The amount of rewards accrued
setDistributionEnd
function setDistributionEnd(address asset, address reward, uint32 newDistributionEnd) external
Sets the end date for the distribution
Parameters
asset
address
The asset to incentivize
reward
address
The reward token that incentives the asset
newDistributionEnd
uint32
The end date of the incentivization, in unix time format
setEmissionPerSecond
function setEmissionPerSecond(address asset, address[] rewards, uint88[] newEmissionsPerSecond) external
Sets the emission per second of a set of reward distributions
Parameters
asset
address
The asset is being incentivized
rewards
address[]
List of reward addresses are being distributed
newEmissionsPerSecond
uint88[]
List of new reward emissions per second
getDistributionEnd
function getDistributionEnd(address asset, address reward) external view returns (uint256)
Gets the end date for the distribution
Parameters
asset
address
The incentivized asset
reward
address
The reward token of the incentivized asset
Return Values
[0]
uint256
The timestamp with the end of the distribution, in unix time format
getUserAssetIndex
function getUserAssetIndex(address user, address asset, address reward) external view returns (uint256)
Returns the index of a user on a reward distribution
Parameters
user
address
Address of the user
asset
address
The incentivized asset
reward
address
The reward token of the incentivized asset
Return Values
[0]
uint256
The current user asset index, not including new distributions
getRewardsData
function getRewardsData(address asset, address reward) external view returns (uint256, uint256, uint256, uint256)
Returns the configuration of the distribution reward for a certain asset
Parameters
asset
address
The incentivized asset
reward
address
The reward token of the incentivized asset
Return Values
[0]
uint256
The index of the asset distribution
[1]
uint256
The emission per second of the reward distribution
[2]
uint256
The timestamp of the last update of the index
[3]
uint256
The timestamp of the distribution end
getAssetIndex
function getAssetIndex(address asset, address reward) external view returns (uint256, uint256)
Calculates the next value of an specific distribution index, with validations.
Parameters
asset
address
The incentivized asset
reward
address
The reward token of the incentivized asset
Return Values
[0]
uint256
The old index of the asset distribution
[1]
uint256
The new index of the asset distribution
getRewardsByAsset
function getRewardsByAsset(address asset) external view returns (address[])
Returns the list of available reward token addresses of an incentivized asset
Parameters
asset
address
The incentivized asset
Return Values
[0]
address[]
List of rewards addresses of the input asset
getRewardsList
function getRewardsList() external view returns (address[])
Returns the list of available reward addresses
Return Values
[0]
address[]
List of rewards supported in this contract
getUserAccruedRewards
function getUserAccruedRewards(address user, address reward) external view returns (uint256)
Returns the accrued rewards balance of a user, not including virtually accrued rewards since last distribution.
Parameters
user
address
The address of the user
reward
address
The address of the reward token
Return Values
[0]
uint256
Unclaimed rewards, not including new distributions
getUserRewards
function getUserRewards(address[] assets, address user, address reward) external view returns (uint256)
Returns a single rewards balance of a user, including virtually accrued and unrealized claimable rewards.
Parameters
assets
address[]
List of incentivized assets to check eligible distributions
user
address
The address of the user
reward
address
The address of the reward token
Return Values
[0]
uint256
The rewards amount
getAllUserRewards
function getAllUserRewards(address[] assets, address user) external view returns (address[], uint256[])
Returns a list all rewards of a user, including already accrued and unrealized claimable rewards
Parameters
assets
address[]
List of incentivized assets to check eligible distributions
user
address
The address of the user
Return Values
[0]
address[]
The list of reward addresses
[1]
uint256[]
The list of unclaimed amount of rewards
getAssetDecimals
function getAssetDecimals(address asset) external view returns (uint8)
Returns the decimals of an asset to calculate the distribution delta
Parameters
asset
address
The address to retrieve decimals
Return Values
[0]
uint8
The decimals of an underlying asset
EMISSION_MANAGER
function EMISSION_MANAGER() external view returns (address)
Returns the address of the emission manager
Return Values
[0]
address
The address of the EmissionManager
getEmissionManager
function getEmissionManager() external view returns (address)
Returns the address of the emission manager.
Deprecated: This getter is maintained for compatibility purposes. Use the EMISSION_MANAGER()
function instead.
Return Values
[0]
address
The address of the EmissionManager