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 |
Integration Guide
0. Prerequisites
Your user(s) should already have a position in the protocol. Depending on the market and incentives that are enabled, they should already have a deposit, borrow, or both, in one of the incentivised assets.
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.
1. Check the user(s) reward balance
Call the getRewardsBalance()
method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array.
2. Claim the accrued rewards
2.1 Claim rewards from the user
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.
2.2 Claim rewards on behalf of the user
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()
.
3. Consider the token that is rewarded
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.
4. Calculating Incentives APY
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.You can get price for reward token as well as reserve token from
AavePriceOracle
Methods
claimRewards()
function claimRewards(address[] calldata assets, uint256 amount, address to)
Claims the accrued rewards for the assets
, accumulating any pending rewards.
Parameter Name | Type | Description |
| address[] | addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also |
| uint256 | amount to claim, expressed in wei |
| address | address where the claimed rewards will be sent |
claimRewardsOnBehalf()
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
.
The user
must have previously called setClaimer()
, setting the msg.sender
as the approved claimer.
Parameter Name | Type | Description |
| address[] | addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also |
| uint256 | amount to claim, expressed in wei |
| address | address of the user who has pending rewards to claim |
| address | address where the claimed rewards will be sent |
setClaimer()
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 |
| address | address of the user who has pending rewards |
| address | address of the new authorised claimer |
View Methods
getAssetData()
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 |
| address | address of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also |
getClaimer()
function getClaimer(address user)
Returns the authorised claimer of user
's accrued rewards. See also setClaimer().
Parameter Name | Type | Description |
| address | address of the authorised claimer |
getRewardsBalance()
function getRewardsBalance(address[] assets, address user)
Returns the total rewards of user
for assets.
Parameter Name | Type | Description |
| address[] | addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also |
| address | address of the user who has pending rewards to claim |
getUserAssetData()
function getUserAssetData(address user, address asset)
Returns the data of user
on a distribution from asset
Parameter Name | Type | Description |
| address | address of the user |
| address | address of the asset that accrue rewards, i.e. aTokens or debtTokens.
To get a list of associated tokens per asset, see also |
getUserUnclaimedRewards()
function getUserUnclaimedRewards(address user)
Returns the unclaimed accumulated rewards of user
for their last action in the protocol.
Parameter Name | Type | Description |
| address | address of the user |
getDistributionEnd()
function getDistributionEnd()
Returns the end of the distribution period
Last updated