Aave.

Beitrag

Teile dein Wissen.

Aaveator.
Jan 29, 2023
Experten Q&A

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
0
1
Teilen
Kommentare
.

Antworten

1
Aaveator.
Feb 2 2023, 16:23

You can do this two ways:

  1. Track the difference in totalATokenSupply factoring in any mints/burns from the current action

  2. totalDeposits * difference in liquidityIndex from previous action

More info.

0
Kommentare
.

Weißt du die Antwort?

Bitte melde dich an und teile sie.

Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.

213Beiträge230Antworten
Sui.X.Peera.

Verdiene deinen Anteil an 1000 Sui

Sammle Reputationspunkte und erhalte Belohnungen für deine Hilfe beim Wachstum der Sui-Community.