Aave.

Допис

Діліться своїми знаннями.

Aaveator.
Jan 29, 2023
Питання та відповіді експертів

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
Поділитися
Коментарі
.

Відповіді

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
Коментарі
.

Ви знаєте відповідь?

Будь ласка, увійдіть та поділіться нею.

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

213Пости230Відповіді
Sui.X.Peera.

Зароби свою частку з 1000 Sui

Заробляй бали репутації та отримуй винагороди за допомогу в розвитку спільноти Sui.