Skip to main content

IRewardsDistributor

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​

NameTypeDescription
assetaddressThe address of the incentivized asset
rewardaddressThe address of the reward token
oldEmissionuint256The old emissions per second value of the reward distribution
newEmissionuint256The new emissions per second value of the reward distribution
oldDistributionEnduint256The old end timestamp of the reward distribution
newDistributionEnduint256The new end timestamp of the reward distribution
assetIndexuint256The 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​

NameTypeDescription
assetaddressThe address of the incentivized asset
rewardaddressThe address of the reward token
useraddressThe address of the user that rewards are accrued on behalf of
assetIndexuint256The index of the asset distribution
userIndexuint256The index of the asset distribution on behalf of the user
rewardsAccrueduint256The amount of rewards accrued

setDistributionEnd​

function setDistributionEnd(address asset, address reward, uint32 newDistributionEnd) external

Sets the end date for the distribution

Parameters​

NameTypeDescription
assetaddressThe asset to incentivize
rewardaddressThe reward token that incentives the asset
newDistributionEnduint32The 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​

NameTypeDescription
assetaddressThe asset is being incentivized
rewardsaddress[]List of reward addresses are being distributed
newEmissionsPerSeconduint88[]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​

NameTypeDescription
assetaddressThe incentivized asset
rewardaddressThe reward token of the incentivized asset

Return Values​

NameTypeDescription
[0]uint256The 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​

NameTypeDescription
useraddressAddress of the user
assetaddressThe incentivized asset
rewardaddressThe reward token of the incentivized asset

Return Values​

NameTypeDescription
[0]uint256The 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​

NameTypeDescription
assetaddressThe incentivized asset
rewardaddressThe reward token of the incentivized asset

Return Values​

NameTypeDescription
[0]uint256The index of the asset distribution
[1]uint256The emission per second of the reward distribution
[2]uint256The timestamp of the last update of the index
[3]uint256The 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​

NameTypeDescription
assetaddressThe incentivized asset
rewardaddressThe reward token of the incentivized asset

Return Values​

NameTypeDescription
[0]uint256The old index of the asset distribution
[1]uint256The 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​

NameTypeDescription
assetaddressThe incentivized asset

Return Values​

NameTypeDescription
[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​

NameTypeDescription
[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​

NameTypeDescription
useraddressThe address of the user
rewardaddressThe address of the reward token

Return Values​

NameTypeDescription
[0]uint256Unclaimed 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​

NameTypeDescription
assetsaddress[]List of incentivized assets to check eligible distributions
useraddressThe address of the user
rewardaddressThe address of the reward token

Return Values​

NameTypeDescription
[0]uint256The 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​

NameTypeDescription
assetsaddress[]List of incentivized assets to check eligible distributions
useraddressThe address of the user

Return Values​

NameTypeDescription
[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​

NameTypeDescription
assetaddressThe address to retrieve decimals

Return Values​

NameTypeDescription
[0]uint8The decimals of an underlying asset

EMISSION_MANAGER​

function EMISSION_MANAGER() external view returns (address)

Returns the address of the emission manager

Return Values​

NameTypeDescription
[0]addressThe 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​

NameTypeDescription
[0]addressThe address of the EmissionManager