mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
removal of transferToReserve method
This commit is contained in:
parent
43ae2f36e7
commit
199d386b3e
|
@ -315,8 +315,13 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
|
|||
//minting AToken to user 1:1 with the specific exchange rate
|
||||
aToken.mintOnDeposit(msg.sender, _amount);
|
||||
|
||||
//transfer to the core contract
|
||||
core.transferToReserve{value: msg.value}(_reserve, msg.sender, _amount);
|
||||
//transfer to the pool
|
||||
if (!IERC20(_reserve).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(_amount);
|
||||
|
||||
//solium-disable-next-line
|
||||
emit Deposit(_reserve, msg.sender, _amount, _referralCode, block.timestamp);
|
||||
|
@ -623,13 +628,17 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
|
|||
}
|
||||
|
||||
//sending the total msg.value if the transfer is ETH.
|
||||
//the transferToReserve() function will take care of sending the
|
||||
//the universalTransferFromSenderToThis() function will take care of sending the
|
||||
//excess ETH back to the caller
|
||||
core.transferToReserve{ value: vars.isETH ? msg.value.sub(vars.originationFee) : 0 }(
|
||||
_reserve,
|
||||
msg.sender,
|
||||
vars.paybackAmountMinusFees
|
||||
);
|
||||
if (!IERC20(_reserve).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{
|
||||
value: vars.isETH ? msg.value.sub(vars.originationFee) : 0
|
||||
}(vars.paybackAmountMinusFees);
|
||||
|
||||
emit Repay(
|
||||
_reserve,
|
||||
|
|
|
@ -472,33 +472,6 @@ contract LendingPoolCore is VersionedInitializable {
|
|||
IERC20(_token).universalTransfer(_feeAddress, _amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev transfers an amount from a user to the destination reserve
|
||||
* @param _reserve the address of the reserve where the amount is being transferred
|
||||
* @param _user the address of the user from where the transfer is happening
|
||||
* @param _amount the amount being transferred
|
||||
**/
|
||||
function transferToReserve(address _reserve, address payable _user, uint256 _amount)
|
||||
external
|
||||
payable
|
||||
onlyLendingPool
|
||||
{
|
||||
IERC20 reserve = IERC20(_reserve);
|
||||
|
||||
if (!reserve.isETH()) {
|
||||
require(
|
||||
msg.value == 0,
|
||||
"User is sending ETH along with the ERC20 transfer."
|
||||
);
|
||||
} else {
|
||||
require(
|
||||
msg.value >= _amount,
|
||||
"The amount and the value sent to deposit do not match"
|
||||
);
|
||||
}
|
||||
reserve.universalTransferFrom(_user, address(this), _amount, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice data access functions
|
||||
**/
|
||||
|
|
|
@ -246,11 +246,16 @@ contract LendingPoolLiquidationManager is ReentrancyGuard, VersionedInitializabl
|
|||
//otherwise receives the underlying asset
|
||||
//burn the equivalent amount of atoken
|
||||
collateralAtoken.burnOnLiquidation(_user, maxCollateralToLiquidate);
|
||||
core.transferToUser(_collateral, msg.sender, maxCollateralToLiquidate);
|
||||
core.transferToUser(_collateral, msg.sender, maxCollateralToLiquidate); //TODO: update to universal transfer
|
||||
}
|
||||
|
||||
//transfers the principal currency to the pool
|
||||
core.transferToReserve{value: msg.value}(_reserve, msg.sender, vars.actualAmountToLiquidate);
|
||||
IERC20(_reserve).universalTransferFrom(
|
||||
msg.sender,
|
||||
addressesProvider.getLendingPool(),
|
||||
vars.actualAmountToLiquidate,
|
||||
true
|
||||
);
|
||||
|
||||
if (vars.feeLiquidated > 0) {
|
||||
//if there is enough collateral to liquidate the fee, first transfer burn an equivalent amount of
|
||||
|
|
Loading…
Reference in New Issue
Block a user