Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

RewardsController

All reward types enabled in SparkLend are managed by RewardsDistributor. This is the contract used to check rewards data, user’s rewards balance and for claiming the rewards.

Source Code

Structs

AssetData

NameType
rewardsmapping(address ⇒ RewardData)
availableRewardsmapping(uint128 ⇒ address)
availableRewardsCountuint128
decimalsuint8

RewardData

NameType
emissionPerSeconduint88
indexuint104
lastUpdateTimestampuint32
distributionEnduint32
usersDatamapping(address => UserData)

View Methods

getRewardsData

getRewardsData (asset, reward)

Get the data of the reward emitted for the asset.

Call Params
NameTypeDescription
assetaddressaddress of the a/s/v Tokens for which incentive information is requested
rewardaddressaddress of the reward token
Return Value
TypeDescription
uint256index of the reward token
uint256total reward tokens awarded per second for the given asset pool
uint256unix timestamp of last time the emissions were updated
uint256unix timestamp of when the emissions will end

getRewardsByAsset

getRewardsByAsset (asset)

Get list of rewards activated for the asset

Call Params

NameTypeDescription
assetaddressaddress of the a/s/vTokens for which incentive rewards list is requested

Return Value

TypeDescription
address[]list of reward token addresses activated for the given asset

Write Methods

claimRewards

claimRewards (assets, amount, to, reward)

Claims single reward type specified by reward for the list of assets. Rewards are received by to address.

Call Params

NameTypeDescription
assetsaddress[]address list of assets for which rewards are being claimed. Pass a/s/vToken addresses
amountuint256amount to claim, expressed in wei. Pass MAX_UINT to claim entire unclaimed reward balance
toaddressaddress which will receive the reward tokens
rewardaddressaddress of the reward token being claimed. e.g. wstETH

claimRewardsOnBehalf

claimRewardsOnBehalf (assets, amount, user, to, reward)

Claims single reward type specified by reward for the given list of assets on behalf of the user. Rewards are received by to address.

Call Params

NameTypeDescription
assetsaddress[]address list of assets for which rewards are being claimed. Pass a/s/vToken addresses
amountuint256amount to claim, expressed in wei. Pass MAX_UINT to claim entire unclaimed reward balance
useraddressaddress of user who’s rewards are being claimed
toaddressaddress which will receive the reward tokens
rewardaddressaddress of the reward token being claimed. e.g. wstETH

claimRewardsToSelf

claimRewardsToSelf (assets, amount, reward)

Claims single reward type accrued by the msg.sender specified by reward for the given list of assets. Rewards are received by msg.sender .

Call Params

NameTypeDescription
assetsaddress[]address list of assets for which rewards are being claimed. Pass a/s/vToken addresses
amountuint256amount to claim, expressed in wei. Pass MAX_UINT to claim entire unclaimed reward balance
rewardaddressaddress of the reward token being claimed. e.g. wstETH

claimAllRewards

claimAllRewards (assets, to)

Claims all rewards for the list of assets. Rewards are received by to address.

Call Params

NameTypeDescription
assetsaddress[]address list of assets for which rewards are being claimed. Pass a/s/vToken addresses
toaddressaddress which will receive the reward tokens

claimAllRewardsOnBehalf

claimAllRewardsOnBehalf (assets, user, to)

Claims all rewards for the given list of assets on behalf of the user. Rewards are received by to address.

Call Params

NameTypeDescription
assetsaddress[]address list of assets for which rewards are being claimed. Pass a/s/vToken addresses
useraddressaddress of user who’s rewards are being claimed
toaddressaddress which will receive the reward tokens

claimAllRewardsToSelf

claimAllRewardsToSelf (assets)

Claims all rewards accrued by msg.sender for the given list of assets. Rewards are received by msg.sender .

Call Params

NameTypeDescription
assetsaddress[]address list of assets for which rewards are being claimed. Pass a/s/vToken addresses