Skip to content

Commit

Permalink
Merge pull request #79 from liquity/D-A1
Browse files Browse the repository at this point in the history
fix: Emit both amounts coming from LQTYStaking and total ones on unst…
  • Loading branch information
bingen authored Nov 21, 2024
2 parents d6d3edf + f22ce5c commit 1926488
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/UserProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ contract UserProxy is IUserProxy {
onlyStakingV2
returns (uint256 lusdAmount, uint256 ethAmount)
{
uint256 initialLQTYAmount = lqty.balanceOf(address(this));
uint256 initialLUSDAmount = lusd.balanceOf(address(this));
uint256 initialETHAmount = address(this).balance;

stakingV1.unstake(_amount);

uint256 lqtyAmount = lqty.balanceOf(address(this));
Expand All @@ -75,7 +79,15 @@ contract UserProxy is IUserProxy {
require(success, "UserProxy: eth-fail");
}

emit Unstake(_amount, _recipient, lusdAmount, ethAmount);
emit Unstake(
_recipient,
lqtyAmount - initialLQTYAmount,
lqtyAmount,
lusdAmount - initialLUSDAmount,
lusdAmount,
ethAmount - initialETHAmount,
ethAmount
);
}

/// @inheritdoc IUserProxy
Expand Down
10 changes: 9 additions & 1 deletion src/interfaces/IUserProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 lqtyReceived,
uint256 lqtySent,
uint256 lusdAmountReceived,
uint256 lusdAmountSent,
uint256 ethAmountReceived,
uint256 ethAmountSent
);

/// @notice Address of the LQTY token
/// @return lqty Address of the LQTY token
Expand Down

0 comments on commit 1926488

Please sign in to comment.