- Added return of withdraw amount to withdraw()

This commit is contained in:
eboado 2020-11-26 11:02:26 +01:00
parent 3206c5297f
commit e418bcc01e
2 changed files with 8 additions and 2 deletions

View File

@ -194,12 +194,13 @@ interface ILendingPool {
* @param to Address that will receive the underlying, same as msg.sender if the user * @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 * wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet * different wallet
* @return The final amount withdrawn
**/ **/
function withdraw( function withdraw(
address asset, address asset,
uint256 amount, uint256 amount,
address to address to
) external; ) external returns (uint256);
/** /**
* @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
@ -234,6 +235,7 @@ interface ILendingPool {
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the * @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 * 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 * other borrower whose debt should be removed
* @return The final amount repaid
**/ **/
function repay( function repay(
address asset, address asset,

View File

@ -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 * @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 * wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet * different wallet
* @return The final amount withdrawn
**/ **/
function withdraw( function withdraw(
address asset, address asset,
uint256 amount, uint256 amount,
address to address to
) external override whenNotPaused { ) external override whenNotPaused returns (uint256) {
DataTypes.ReserveData storage reserve = _reserves[asset]; DataTypes.ReserveData storage reserve = _reserves[asset];
address aToken = reserve.aTokenAddress; address aToken = reserve.aTokenAddress;
@ -179,6 +180,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
IAToken(aToken).burn(msg.sender, to, amountToWithdraw, reserve.liquidityIndex); IAToken(aToken).burn(msg.sender, to, amountToWithdraw, reserve.liquidityIndex);
emit Withdraw(asset, msg.sender, to, amountToWithdraw); emit Withdraw(asset, msg.sender, to, amountToWithdraw);
return amountToWithdraw;
} }
/** /**
@ -229,6 +232,7 @@ 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 * @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 * 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 * other borrower whose debt should be removed
* @return The final amount repaid
**/ **/
function repay( function repay(
address asset, address asset,