From 70a6ec844b6fbe2a23d35259953e87e0b630345c Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Tue, 14 Mar 2023 09:05:19 +0100 Subject: [PATCH] fix: Return final withdraw amount in L2Pool withdraw fn --- contracts/interfaces/IL2Pool.sol | 3 ++- contracts/protocol/pool/L2Pool.sol | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contracts/interfaces/IL2Pool.sol b/contracts/interfaces/IL2Pool.sol index 2192e874e..8cbe6c7bf 100644 --- a/contracts/interfaces/IL2Pool.sol +++ b/contracts/interfaces/IL2Pool.sol @@ -39,8 +39,9 @@ interface IL2Pool { * @dev the shortenedAmount is cast to 256 bits at decode time, if type(uint128).max the value will be expanded to * type(uint256).max * @dev assetId is the index of the asset in the reservesList. + * @return The final amount withdrawn */ - function withdraw(bytes32 args) external; + function withdraw(bytes32 args) external returns (uint256); /** * @notice Calldata efficient wrapper of the borrow function, borrowing on behalf of the caller diff --git a/contracts/protocol/pool/L2Pool.sol b/contracts/protocol/pool/L2Pool.sol index a360abc67..8206601d8 100644 --- a/contracts/protocol/pool/L2Pool.sol +++ b/contracts/protocol/pool/L2Pool.sol @@ -40,10 +40,10 @@ contract L2Pool is Pool, IL2Pool { } /// @inheritdoc IL2Pool - function withdraw(bytes32 args) external override { + function withdraw(bytes32 args) external override returns (uint256) { (address asset, uint256 amount) = CalldataLogic.decodeWithdrawParams(_reservesList, args); - withdraw(asset, amount, msg.sender); + return withdraw(asset, amount, msg.sender); } /// @inheritdoc IL2Pool