Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Emit both amounts coming from LQTYStaking and total ones on unst… #79

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/UserProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,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 @@ -78,7 +82,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
Loading