Aave.

Bài viết

Chia sẻ kiến thức của bạn.

Aaveator.
Jan 29, 2023
Hỏi đáp Chuyên Gia

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
Chia sẻ
Bình luận
.

Câu trả lời

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
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.

Chúng tôi sử dụng cookie để đảm bảo bạn có trải nghiệm tốt nhất trên trang web của chúng tôi.
Thêm thông tin