Comment on page
Liquidity Mining
Liquidity mining/incentives was implemented in the Main Aave market via AIP-16, enabling incentives for both depositing and borrowing. Incentives are also currently implemented on the Polygon market & Avalanche market, using the same implementation details as described on this page.
Market | Code | Address |
Main Market | ||
Polygon Market | ||
Avalanche |
To check if an asset is current incentivised, use the
getAssetData()
method, passing in the associated aToken or debtToken address of the incentivised asset. To get a list of associated tokens per asset, see also getReserveTokensAddresses()
in the Protocol Data Provider.Call the
getRewardsBalance()
method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array.Call the
claimRewards()
method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array. The msg.sender
must match the user's address that has accrued the rewards.A claimer must have been set via the
setClaimer()
method, enabling the caller to claim on the user's behalf.Call the
claimRewardsOnBehalf()
method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array. The msg.sender
must have been previously set via setClaimer()
.For the main market, stkAAVE is rewarded and automatically accrues interest based on the Staking AAVE parameters once claimed. There is an associated 10 day cool down period to convert stkAAVE to AAVE, with a 2 day redeem period to do so. Ensure that this information is presented to the user and handled correctly.
For the Polygon market, WMATIC is rewarded with no 'lock up' period. Ensure that you account for the difference between WMATIC and the native MATIC, specifically that WMATIC needs to be unwrapped to MATIC. This can be done by calling
withdraw()
on the WMATIC contract.APY = normalizedEmissionPerSecond * rewardTokenPriceInEth * SECONDS_PER_YEAR / normalizedTotalTokenSupply
Note:
normalizedEmissionPerSecond = emissionPerSecond/RWARD_TOKEN_DECIMALS
- Reward Token is AAVE for mainnet and Matic for polygon.
normalizedTotalTokenSupply = tokenTotalSupplyNormalized * tokenPriceInEth
,where token is the incentivized a/s/v token and token price is same as underlying asset's price.
function claimRewards(address[] calldata assets, uint256 amount, address to)
Claims the accrued rewards for the
assets
, accumulating any pending rewards.Parameter Name | Type | Description |
assets | address[] | addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider. |
amount | uint256 | amount to claim, expressed in wei |
to | address | address where the claimed rewards will be sent |
function claimRewardsOnBehalf(address[] calldata assets, uint256 amount, address user, address to)
Claims the accrued rewards for the
assets
, accumulating any pending rewards, on behalf of user
.Parameter Name | Type | Description |
assets | address[] | addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider. |
amount | uint256 | amount to claim, expressed in wei |
user | address | address of the user who has pending rewards to claim |
to | address | address where the claimed rewards will be sent |
function setClaimer(address user, address caller)
Sets an authorised
caller
to claim all rewards on behalf of the user
. This can only be set via Governance.Parameter Name | Type | Description |
user | address | address of the user who has pending rewards |
caller | address | address of the new authorised claimer |
getAssetData()
is currently available only on ethereum markets. In case you are working on Polygon markets (main or mumbai), please read data from the public mapping assets
directly 😅function getAssetData(address asset)
Returns the asset index, the emissions per second (i.e. current rewards rate), and the last updated timestamp.
Parameter Name | Type | Description |
asset | address | address of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider. |
function getClaimer(address user)
Parameter Name | Type | Description |
user | address | address of the authorised claimer |
function getRewardsBalance(address[] assets, address user)
Returns the total rewards of
user
for assets.
Parameter Name | Type | Description |
assets | address[] | addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider. |
user | address | address of the user who has pending rewards to claim |
function getUserAssetData(address user, address asset)
Returns the data of
user
on a distribution from asset
Parameter Name | Type | Description |
user | address | address of the user |
asset | address | address of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider. |
function getUserUnclaimedRewards(address user)
Returns the unclaimed accumulated rewards of
user
for their last action in the protocol.Parameter Name | Type | Description |
user | address | address of the user |
function getDistributionEnd()
Returns the end of the distribution period
Last modified 1yr ago