Added handleRepayment() function

This commit is contained in:
The3D 2021-03-01 17:47:27 +01:00
parent e735d40a3b
commit bc1a237f34
3 changed files with 17 additions and 1 deletions

View File

@ -82,12 +82,19 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/** /**
* @dev Transfers the underlying asset to `target`. Used by the LendingPool to transfer * @dev Transfers the underlying asset to `target`. Used by the LendingPool to transfer
* assets in borrow(), withdraw() and flashLoan() * assets in borrow(), withdraw() and flashLoan()
* @param user The recipient of the aTokens * @param user The recipient of the underlying
* @param amount The amount getting transferred * @param amount The amount getting transferred
* @return The amount transferred * @return The amount transferred
**/ **/
function transferUnderlyingTo(address user, uint256 amount) external returns (uint256); function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);
/**
* @dev Invoked to execute actions on the aToken side after a repayment.
* @param user The user executing the repayment
* @param amount The amount getting repaid
**/
function handleRepayment(address user, uint256 amount) external;
/** /**
* @dev Returns the address of the incentives controller contract * @dev Returns the address of the incentives controller contract
**/ **/

View File

@ -282,6 +282,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
IERC20(asset).safeTransferFrom(msg.sender, aToken, paybackAmount); IERC20(asset).safeTransferFrom(msg.sender, aToken, paybackAmount);
IAToken(aToken).handleRepayment(msg.sender, paybackAmount);
emit Repay(asset, onBehalfOf, msg.sender, paybackAmount); emit Repay(asset, onBehalfOf, msg.sender, paybackAmount);
return paybackAmount; return paybackAmount;

View File

@ -304,6 +304,13 @@ contract AToken is
return amount; return amount;
} }
/**
* @dev Invoked to execute actions on the aToken side after a repayment.
* @param user The user executing the repayment
* @param amount The amount getting repaid
**/
function handleRepayment(address user, uint256 amount) external override onlyLendingPool {}
/** /**
* @dev implements the permit function as for * @dev implements the permit function as for
* https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md * https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md