mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
optimize 0 ETH
This commit is contained in:
parent
d099d3c20e
commit
951bc6ebf6
|
@ -572,7 +572,7 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
require(
|
require(
|
||||||
!vars.isETH || msg.value >= vars.paybackAmount,
|
(!vars.isETH && msg.value == 0) || msg.value >= vars.paybackAmount,
|
||||||
"Invalid msg.value sent for the repayment"
|
"Invalid msg.value sent for the repayment"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -587,12 +587,6 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!vars.isETH) { // TODO: review needed, maybe we should not care
|
|
||||||
require(
|
|
||||||
msg.value == 0,
|
|
||||||
"User is sending ETH along with the ERC20 transfer. Check the value attribute of the transaction"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
IERC20(_reserve).universalTransferFrom(
|
IERC20(_reserve).universalTransferFrom(
|
||||||
_onBehalfOf,
|
_onBehalfOf,
|
||||||
addressesProvider.getTokenDistributor(),
|
addressesProvider.getTokenDistributor(),
|
||||||
|
@ -626,12 +620,6 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
|
||||||
|
|
||||||
//if the user didn't repay the origination fee, transfer the fee to the fee collection address
|
//if the user didn't repay the origination fee, transfer the fee to the fee collection address
|
||||||
if (vars.originationFee > 0) {
|
if (vars.originationFee > 0) {
|
||||||
if (!vars.isETH) { // TODO: review needed, maybe we should not care
|
|
||||||
require(
|
|
||||||
msg.value == 0,
|
|
||||||
"User is sending ETH along with the ERC20 transfer. Check the value attribute of the transaction"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
IERC20(_reserve).universalTransferFrom(
|
IERC20(_reserve).universalTransferFrom(
|
||||||
_onBehalfOf,
|
_onBehalfOf,
|
||||||
addressesProvider.getTokenDistributor(),
|
addressesProvider.getTokenDistributor(),
|
||||||
|
@ -640,12 +628,6 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vars.isETH) { //TODO: review needed, most probably we can remove it
|
|
||||||
require(
|
|
||||||
msg.value == 0,
|
|
||||||
"User is sending ETH along with the ERC20 transfer."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
IERC20(_reserve).universalTransferFromSenderToThis(vars.paybackAmountMinusFees, false);
|
IERC20(_reserve).universalTransferFromSenderToThis(vars.paybackAmountMinusFees, false);
|
||||||
|
|
||||||
if (vars.isETH) {
|
if (vars.isETH) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user