From b83fad5a9014fe72ea661b0aff581680f11b2f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Fingen?= Date: Tue, 19 Nov 2024 16:57:58 +0000 Subject: [PATCH] fix: Emit both amounts coming from LQTYStaking and total ones on unstaking --- src/UserProxy.sol | 13 ++++++++++++- src/interfaces/IUserProxy.sol | 10 +++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/UserProxy.sol b/src/UserProxy.sol index 01df8665..5e2f795a 100644 --- a/src/UserProxy.sol +++ b/src/UserProxy.sol @@ -66,6 +66,9 @@ contract UserProxy is IUserProxy { onlyStakingV2 returns (uint256 lusdAmount, uint256 ethAmount) { + uint256 initialLUSDAmount = lusd.balanceOf(address(this)); + uint256 initialETHAmount = address(this).balance; + stakingV1.unstake(_amount); uint256 lqtyAmount = lqty.balanceOf(address(this)); @@ -78,7 +81,15 @@ contract UserProxy is IUserProxy { require(success, "UserProxy: eth-fail"); } - emit Unstake(_amount, _recipient, lusdAmount, ethAmount); + emit Unstake( + _recipient, + _amount, + lqtyAmount, + lusdAmount - initialLUSDAmount, + lusdAmount, + ethAmount - initialETHAmount, + ethAmount + ); } /// @inheritdoc IUserProxy diff --git a/src/interfaces/IUserProxy.sol b/src/interfaces/IUserProxy.sol index 4169e93f..638ee69d 100644 --- a/src/interfaces/IUserProxy.sol +++ b/src/interfaces/IUserProxy.sol @@ -9,7 +9,15 @@ import {PermitParams} from "../utils/Types.sol"; interface IUserProxy { event Stake(uint256 amount, address lqtyFrom); - event Unstake(uint256 lqtyUnstaked, address indexed lqtyRecipient, uint256 lusdAmount, uint256 ethAmount); + event Unstake( + address indexed lqtyRecipient, + uint256 lqtyUnstaked, + uint256 lqtySent, + uint256 lusdAmountReceived, + uint256 lusdAmountSent, + uint256 ethAmountReceived, + uint256 ethAmountSent + ); /// @notice Address of the LQTY token /// @return lqty Address of the LQTY token