burn ATokens
Last updated
Last updated
burn
calls _burnScaled
Amount of tokens burnt is scaled against current liquidity index
amount = 100
liquidity index = 1.1
amountScaled
= 100 / 1.1 = 90
This is to account for interest accrued.
If you are confused regarding balanceIncrease
and _userState
see: mint
_burnScaled
has an interesting approach, in that it looks to mint or burn the difference between unbooked interest accrued and the burn amount.
unbooked interest accrued: interest accumulated since last update that has not been minted
If balanceIncrease > amount
interest accrued since last update is larger than burn amount
mint the difference to the user as aTokens
If balanceIncrease <= amount
burn amount exceeds interest accrued
burn the difference from the user