add check of 0 amountToReceive

This commit is contained in:
andyk 2020-09-07 13:00:28 +03:00
parent f1d3b8c9d6
commit 5e3b6869b5

View File

@ -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,