mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
refactor: changed function definitions order for more clarity
This commit is contained in:
parent
0b89528871
commit
b294a96ef4
|
@ -111,6 +111,35 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
_executeDeposit(asset, amount, onBehalfOf, referralCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Deposit with transfer approval of asset to be deposited done via permit function
|
||||
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
|
||||
* @param asset The address of the underlying asset to deposit
|
||||
* @param amount The amount to be deposited
|
||||
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
|
||||
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
|
||||
* is a different wallet
|
||||
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
|
||||
* 0 if the action is executed directly by the user, without any middle-man
|
||||
* @param deadline validity deadline of permit and so depositWithPermit signature
|
||||
* @param permitV V parameter of ERC712 permit sig
|
||||
* @param permitR R parameter of ERC712 permit sig
|
||||
* @param permitS S parameter of ERC712 permit sig
|
||||
**/
|
||||
function depositWithPermit(
|
||||
address asset,
|
||||
uint256 amount,
|
||||
address onBehalfOf,
|
||||
uint16 referralCode,
|
||||
uint256 deadline,
|
||||
uint8 permitV,
|
||||
bytes32 permitR,
|
||||
bytes32 permitS
|
||||
) external override {
|
||||
IERC20WithPermit(asset).permit(msg.sender, address(this), amount, deadline, permitV, permitR, permitS);
|
||||
_executeDeposit(asset, amount, onBehalfOf, referralCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
|
||||
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
|
||||
|
@ -188,6 +217,36 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
return _executeRepay(asset, amount, rateMode, onBehalfOf);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Repay with transfer approval of asset to be repaid done via permit function
|
||||
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
|
||||
* @param asset The address of the borrowed underlying asset previously borrowed
|
||||
* @param amount The amount to repay
|
||||
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
|
||||
* @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
|
||||
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
|
||||
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
|
||||
* other borrower whose debt should be removed
|
||||
* @param deadline validity deadline of permit and so depositWithPermit signature
|
||||
* @param permitV V parameter of ERC712 permit sig
|
||||
* @param permitR R parameter of ERC712 permit sig
|
||||
* @param permitS S parameter of ERC712 permit sig
|
||||
* @return The final amount repaid
|
||||
**/
|
||||
function repayWithPermit(
|
||||
address asset,
|
||||
uint256 amount,
|
||||
uint256 rateMode,
|
||||
address onBehalfOf,
|
||||
uint256 deadline,
|
||||
uint8 permitV,
|
||||
bytes32 permitR,
|
||||
bytes32 permitS
|
||||
) external override returns (uint256) {
|
||||
IERC20WithPermit(asset).permit(msg.sender, address(this), amount, deadline, permitV, permitR, permitS);
|
||||
return _executeRepay(asset, amount, rateMode, onBehalfOf);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa
|
||||
* @param asset The address of the underlying asset borrowed
|
||||
|
@ -237,65 +296,6 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
emit Swap(asset, msg.sender, rateMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Deposit with transfer approval of asset to be deposited done via permit function
|
||||
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
|
||||
* @param asset The address of the underlying asset to deposit
|
||||
* @param amount The amount to be deposited
|
||||
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
|
||||
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
|
||||
* is a different wallet
|
||||
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
|
||||
* 0 if the action is executed directly by the user, without any middle-man
|
||||
* @param deadline validity deadline of permit and so depositWithPermit signature
|
||||
* @param permitV V parameter of ERC712 permit sig
|
||||
* @param permitR R parameter of ERC712 permit sig
|
||||
* @param permitS S parameter of ERC712 permit sig
|
||||
**/
|
||||
function depositWithPermit(
|
||||
address asset,
|
||||
uint256 amount,
|
||||
address onBehalfOf,
|
||||
uint16 referralCode,
|
||||
uint256 deadline,
|
||||
uint8 permitV,
|
||||
bytes32 permitR,
|
||||
bytes32 permitS
|
||||
) external override {
|
||||
IERC20WithPermit(asset).permit(msg.sender, address(this), amount, deadline, permitV, permitR, permitS);
|
||||
_executeDeposit(asset, amount, onBehalfOf, referralCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Repay with transfer approval of asset to be repaid done via permit function
|
||||
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
|
||||
* @param asset The address of the borrowed underlying asset previously borrowed
|
||||
* @param amount The amount to repay
|
||||
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
|
||||
* @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
|
||||
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
|
||||
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
|
||||
* other borrower whose debt should be removed
|
||||
* @param deadline validity deadline of permit and so depositWithPermit signature
|
||||
* @param permitV V parameter of ERC712 permit sig
|
||||
* @param permitR R parameter of ERC712 permit sig
|
||||
* @param permitS S parameter of ERC712 permit sig
|
||||
* @return The final amount repaid
|
||||
**/
|
||||
function repayWithPermit(
|
||||
address asset,
|
||||
uint256 amount,
|
||||
uint256 rateMode,
|
||||
address onBehalfOf,
|
||||
uint256 deadline,
|
||||
uint8 permitV,
|
||||
bytes32 permitR,
|
||||
bytes32 permitS
|
||||
) external override returns (uint256) {
|
||||
IERC20WithPermit(asset).permit(msg.sender, address(this), amount, deadline, permitV, permitR, permitS);
|
||||
return _executeRepay(asset, amount, rateMode, onBehalfOf);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
|
||||
* - Users can be rebalanced if the following conditions are satisfied:
|
||||
|
|
Loading…
Reference in New Issue
Block a user