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

Similar question here, this a tokens are dynamic?, Day 1 i get a loan of 10 usdt and get 10 atoken of debt, day 365 i have 11.xxx atokens of debt (interest), how is possible earn more tokens without any transaction?

Hi @mikkelr , @curubas

aTokens and debtTokens are rebasing tokens, which means that they are growing in balance (not value). Worth to note that they are still ERC20 complaint, but behave in a particular way.

You can track changes on your balance using events (Transfer, Mint and Burn events) emitted when you make any operation with the Aave Pool.

The balance of aToken/debtToken is calculated multiplying the scaled balance by the corresponding index. In order to answer your question, you would need to know the value of the index at that specific point in time.

Linking FAQ of docs with a brief explanation.

1 Like