Post
Share your knowledge.
How can I calculate newInterest each time ReserveDataUpdated is emitted?
Hello! I am building an Aave v2 subgraph and I am trying to figure out how I can calculate newInterest
each time ReserveDataUpdated
is emitted? Does anyone know how I could use the liquidityIndex to figure this out?
I understand that interest in a market = currentATokenBalance - scaledATokenBalance
Trying to calculate accrued interest for an entire pool. So the link you send is to calculate all of the interest accrued and not realized (aka depositors have not withdrawn that interest yet)?
What I am trying to calculate is new interest that has accrued in an asset pool since the last transaction in that pool. We are trying to get timeseries data in our subgraph for new daily revenues.
- Aave v2
- Aave Pool
Answers
1You can do this two ways:
-
Track the difference in
totalATokenSupply
factoring in any mints/burns from the current action -
totalDeposits
* difference inliquidityIndex
from previous action
More info.
Do you know the answer?
Please log in and share it.
Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.
- Error "No matching key" when trying to unstake USDC on BNB chain32
- How to tell the code to, rather than "deposit 1 eth worth of WBTC" deposit "500$ worth of WBTC"?22
- How to interpret configuration field in a response from the getReserveData view function in Aave v2?21
- Getting a return value of '25 - INVALID BURN AMOUNT'21
- Is there any way to stake in the security module on Görli?23