get user balance & withdraw amount
Last updated
Last updated
Check user's balance of ATokens corresponding to the asset their wish to withdraw. His aToken balance will dictate how much of the underlying is made available for withdrawal.
scaledBalanceOf
returns the user's aToken balance scaled against the liquidity index at the time of supply.
This scaled balance is multiplied against the current liquidity index, which was updated in updateState
.
For in-depth explanation of this behaviour, see: AToken-balanceOf
Supplied assets accrue supply interest, as accounted for by the scaling against current liquidity index
If the supplied input is the maximum uint256 value, the withdrawal amount is set to the user's balance of ATokens => withdraw everything
Otherwise, withdraw the amount as dictated by user input.