mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
add check of 0 amountToReceive
This commit is contained in:
parent
f1d3b8c9d6
commit
5e3b6869b5
|
@ -509,9 +509,11 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
|||
);
|
||||
|
||||
uint256 amountToReceive = IERC20(toAsset).balanceOf(receiverAddress);
|
||||
IERC20(toAsset).transferFrom(receiverAddress, address(toReserveAToken), amountToReceive);
|
||||
toReserveAToken.mint(msg.sender, amountToReceive);
|
||||
toReserve.updateInterestRates(toAsset, address(toReserveAToken), amountToReceive, 0);
|
||||
if (amountToReceive != 0) {
|
||||
IERC20(toAsset).transferFrom(receiverAddress, address(toReserveAToken), amountToReceive);
|
||||
toReserveAToken.mint(msg.sender, amountToReceive);
|
||||
toReserve.updateInterestRates(toAsset, address(toReserveAToken), amountToReceive, 0);
|
||||
}
|
||||
|
||||
(, , , , uint256 healthFactor) = GenericLogic.calculateUserAccountData(
|
||||
msg.sender,
|
||||
|
|
Loading…
Reference in New Issue
Block a user