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); uint256 amountToReceive = IERC20(toAsset).balanceOf(receiverAddress);
IERC20(toAsset).transferFrom(receiverAddress, address(toReserveAToken), amountToReceive); if (amountToReceive != 0) {
toReserveAToken.mint(msg.sender, amountToReceive); IERC20(toAsset).transferFrom(receiverAddress, address(toReserveAToken), amountToReceive);
toReserve.updateInterestRates(toAsset, address(toReserveAToken), amountToReceive, 0); toReserveAToken.mint(msg.sender, amountToReceive);
toReserve.updateInterestRates(toAsset, address(toReserveAToken), amountToReceive, 0);
}
(, , , , uint256 healthFactor) = GenericLogic.calculateUserAccountData( (, , , , uint256 healthFactor) = GenericLogic.calculateUserAccountData(
msg.sender, msg.sender,