As AAVE protocol V2 documentation says:

aTokens are interest-bearing tokens that are minted and burned upon deposit and withdraw. The aTokens' value is pegged to the value of the corresponding deposited asset at a 1:1 ratio, and can be safely stored, transferred or traded. All interest collected by the aTokens reserves are distributed to aTokens holders directly by continuously increasing their wallet balance.

After depositing some amount of an ERC-20 token such as DAI, I need to know the current aToken balance of a user for the same asset (DAI in this case), so that I would be able to calculate user investment's profit.
It is also mentioned in the documents that there is an IProtocolDataProvider interface with a getUserReserveData method which gives asset address as well as the user address as arguments and returns currentATokenBalance as part of the return value. However, I could not find the aforementioned smart contract file in AAVE protocol V2's GitHub. Did it change silently overnight and documents are not getting the new updates yet? Am I doing the right thing for getting a user's current aToken balance? If not, what is the correct way of doing that?


After a few hours of research, I found out that they slightly renamed it to AaveProtocolDataProvider and moved it into new path: @aave/protocol-v2/contracts/misc/AaveProtocolDataProvider.sol
Besides that, the balance of any aToken can be acquired directly by calling its balanceOf method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.