Moved the mint action after the transfer

This commit is contained in:
The3D 2020-11-26 15:57:03 +01:00
parent e1f636ccd6
commit 47e80d7e4f

View File

@ -117,6 +117,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
reserve.updateState();
reserve.updateInterestRates(asset, aToken, amount, 0);
IERC20(asset).safeTransferFrom(msg.sender, aToken, amount);
bool isFirstDeposit = IAToken(aToken).mint(onBehalfOf, amount, reserve.liquidityIndex);
if (isFirstDeposit) {
@ -124,8 +126,6 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
emit ReserveUsedAsCollateralEnabled(asset, onBehalfOf);
}
IERC20(asset).safeTransferFrom(msg.sender, aToken, amount);
emit Deposit(asset, msg.sender, onBehalfOf, amount, referralCode);
}