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

feat: more useful staking events in Governance #98

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

danielattilasimon
Copy link
Contributor

@danielattilasimon danielattilasimon commented Dec 5, 2024

Previously, the details of V1 rewards were emitted by UserProxy. This made it harder to query all the information pertaining to the V1 staking that goes through V2, because each user has their own UserProxy address.

Plus, the event WithdrawLQTY suffered from an issue which has already been fixed for the corresponding event in UserProxy, which is that a user can attempt to withdraw more than their V1 staking LQTY balance, in which case the withdrawal gets truncated, but the parameter withdrawnLQTY didn't reflect this truncation.

As we don't really need to have duplicate events (UserProxy & Governance) anyway, we eliminate them from UserProxy but expose the details to Governance, so that it may emit more useful events of its own.

Fixes IR-11.

Previously, the details of V1 rewards were emitted by `UserProxy`.
This made it harder to query all the information pertaining to the
V1 staking that goes through V2, because each user has their own
`UserProxy` address.

Plus, the event `WithdrawLQTY` suffered from an issue which has
already been fixed for the corresponding event in `UserProxy`,
which is that a user can attempt to withdraw more than their V1
staking LQTY balance, in which case the withdrawal gets truncated,
but the parameter `withdrawnLQTY` didn't reflect this truncation.

As we don't really need to have duplicate events (`UserProxy` &
`Governance`) anyway, we eliminate them from `UserProxy` but
expose the details to `Governance`, so that it may emit more
useful events of its own.

if (_doSendRewards) {
(lusdAmount, ethAmount) = _sendRewards(_recipient, initialLUSDAmount, initialETHAmount);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing duplicate _sendRewards() (it's already called by stake() above.

Copy link
Contributor

@bingen bingen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

uint256 lusdReceived;
uint256 ethReceived;

(lqtyReceived, lqtySent, lusdReceived, lusdSent, ethReceived, ethSent) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess lqty values will always be zero here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lqtyReceived yes, but lqtySent may be positive if someone has previously sent LQTY to the UserProxy address, which UserProxy.unstake() would send to _rewardRecipient. This is documented in IGovernance.sol.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered returning the value of lqtySent, but in the end I didn't do it because it wouldn't normally be useful.

@danielattilasimon danielattilasimon merged commit 5b6db05 into main Dec 10, 2024
3 checks passed
@danielattilasimon danielattilasimon deleted the staking-events branch January 19, 2025 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants