mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
refactor: replaced balanceOf() with scaledBalanceOf()
This commit is contained in:
parent
235f2d80ec
commit
9d12200b8c
|
@ -943,7 +943,11 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
|
||||
address aToken = reserve.aTokenAddress;
|
||||
|
||||
uint256 userBalance = IAToken(aToken).balanceOf(msg.sender);
|
||||
reserve.updateState();
|
||||
|
||||
uint256 liquidityIndex = reserve.liquidityIndex;
|
||||
|
||||
uint256 userBalance = IAToken(aToken).scaledBalanceOf(msg.sender).rayMul(liquidityIndex);
|
||||
|
||||
uint256 amountToWithdraw = amount;
|
||||
|
||||
|
@ -953,11 +957,9 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
|
||||
ValidationLogic.validateWithdraw(reserve, amountToWithdraw, userBalance);
|
||||
|
||||
reserve.updateState();
|
||||
|
||||
reserve.updateInterestRates(asset, aToken, 0, amountToWithdraw);
|
||||
|
||||
IAToken(aToken).burn(msg.sender, to, amountToWithdraw, reserve.liquidityIndex);
|
||||
IAToken(aToken).burn(msg.sender, to, amountToWithdraw, liquidityIndex);
|
||||
|
||||
if (userConfig.isUsingAsCollateral(reserve.id)) {
|
||||
if (userConfig.isBorrowingAny()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user