What is the easiest way to get profit generated by an address in Aave v3?

Expert

Hi, we are currently integrating Aave into our dApp.

My question:

What is the easiest way to get profit generated by an address in AAVE V3 ?

Answers 1

As for now the eaiest way is:

principalBalance = AToken.getPreviousIndex(user) * AToken.scaledBalanceOf(user)

currentBalance = AToken.balanceOf(user) = AToken.scaledBalanceOf(user) * Pool.getReserveNormalizedIncome(underlyingAsset)