aToken balance bookkeeping

I am trying to understand the interest bearing token implementation. Would be grateful if someone could help me understand the following scenario.

AAVE clearly states that aTokens are ERC20 compliant. But there is one thing I cannot wrap my head around.

Say you have 2 lenders, A and B. They both supply 10 DAI, but at various times with different reserve conditions. If you only track the transfer events emitted by the reserve contract, you will find that both have a balance of 10 aDAI. But when they burn their 10 aDAI, A and B will receive different amounts of DAI. as I understand it, the aToken maps 1:1 to the underlying asset, but the balance of the aToken holder keeps increasing.

Does that mean that if I want to answer the question, how much has address A earned from being a lender at a specific point in time, it is not enough to track the Transfer events (as it would be with other ERC20 tokens), but I need ti know the time of becoming a lender and then tracking the interest rate for each state change in the reserve contract and cumulative sum over time for each token holder?

Thank you in advance

1 Like