diff --git a/contracts/interfaces/ILendingPool.sol b/contracts/interfaces/ILendingPool.sol index d445579a..64f726c0 100644 --- a/contracts/interfaces/ILendingPool.sol +++ b/contracts/interfaces/ILendingPool.sol @@ -5,7 +5,6 @@ pragma experimental ABIEncoderV2; import {ILendingPoolAddressesProvider} from './ILendingPoolAddressesProvider.sol'; import {DataTypes} from '../protocol/libraries/types/DataTypes.sol'; - interface ILendingPool { /** * @dev Emitted on deposit() @@ -195,12 +194,13 @@ interface ILendingPool { * @param to Address that will receive the underlying, same as msg.sender if the user * wants to receive it on his own wallet, or a different address if the beneficiary is a * different wallet + * @return The final amount withdrawn **/ function withdraw( address asset, uint256 amount, address to - ) external; + ) external returns (uint256); /** * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower @@ -235,13 +235,14 @@ interface ILendingPool { * @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 + * @return The final amount repaid **/ function repay( address asset, uint256 amount, uint256 rateMode, address onBehalfOf - ) external; + ) external returns (uint256); /** * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa diff --git a/contracts/protocol/lendingpool/LendingPool.sol b/contracts/protocol/lendingpool/LendingPool.sol index 525141a6..c7041409 100644 --- a/contracts/protocol/lendingpool/LendingPool.sol +++ b/contracts/protocol/lendingpool/LendingPool.sol @@ -138,12 +138,13 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage * @param to Address that will receive the underlying, same as msg.sender if the user * wants to receive it on his own wallet, or a different address if the beneficiary is a * different wallet + * @return The final amount withdrawn **/ function withdraw( address asset, uint256 amount, address to - ) external override whenNotPaused { + ) external override whenNotPaused returns (uint256) { DataTypes.ReserveData storage reserve = _reserves[asset]; address aToken = reserve.aTokenAddress; @@ -179,6 +180,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage IAToken(aToken).burn(msg.sender, to, amountToWithdraw, reserve.liquidityIndex); emit Withdraw(asset, msg.sender, to, amountToWithdraw); + + return amountToWithdraw; } /** @@ -229,13 +232,14 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage * @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 + * @return The final amount repaid **/ function repay( address asset, uint256 amount, uint256 rateMode, address onBehalfOf - ) external override whenNotPaused { + ) external override whenNotPaused returns (uint256) { DataTypes.ReserveData storage reserve = _reserves[asset]; (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(onBehalfOf, reserve); @@ -281,6 +285,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage IERC20(asset).safeTransferFrom(msg.sender, aToken, paybackAmount); emit Repay(asset, onBehalfOf, msg.sender, paybackAmount); + + return paybackAmount; } /**