-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
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); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this 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) = |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
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 ownUserProxy
address.Plus, the event
WithdrawLQTY
suffered from an issue which has already been fixed for the corresponding event inUserProxy
, 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 parameterwithdrawnLQTY
didn't reflect this truncation.As we don't really need to have duplicate events (
UserProxy
&Governance
) anyway, we eliminate them fromUserProxy
but expose the details toGovernance
, so that it may emit more useful events of its own.Fixes IR-11.