-
Notifications
You must be signed in to change notification settings - Fork 13
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
Pull exact #127
Pull exact #127
Conversation
src/WrappedVault.sol
Outdated
@@ -303,7 +305,7 @@ contract WrappedVault is Owned, ERC20, IWrappedVault { | |||
// Any unclaimed rewards can still be claimed | |||
rewardsPerToken.lastUpdated = start.toUint32(); | |||
|
|||
emit RewardsSet(reward, block.timestamp.toUint32(), rewardsInterval.end, rate, rewardsAfterFee, protocolFeeTaken, frontendFeeTaken); | |||
emit RewardsSet(reward, block.timestamp.toUint32(), rewardsInterval.end, (rate * (end - start)), rewardsAfterFee, protocolFeeTaken, frontendFeeTaken); |
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 think you meant to replace rewardsAfterFee
with (rate * (end - start))
rather than rate
?
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.
F
src/WrappedVault.sol
Outdated
@@ -244,14 +244,15 @@ contract WrappedVault is Owned, ERC20, IWrappedVault { | |||
|
|||
uint256 remainingRewards = rewardsInterval.rate * (rewardsInterval.end - newStart); | |||
uint256 rate = (rewardsAfterFee + remainingRewards) / (newEnd - newStart); |
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.
Since you no longer re-use rewardsAfterFee
below, you could eliminate its declaration above and inline its computation here:
uint256 rate = (rewardsAdded - frontendFeeTaken - protocolFeeTaken + remainingRewards) / (newEnd - newStart);
src/WrappedVault.sol
Outdated
@@ -292,6 +293,7 @@ contract WrappedVault is Owned, ERC20, IWrappedVault { | |||
uint256 rate = rewardsAfterFee / (end - start); |
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.
Assuming I'm correct about the event argument below, here you can also eliminate `rewardsAfterFee as an intermediate variable:
- uint256 rewardsAfterFee = totalRewards - frontendFeeTaken - protocolFeeTaken;
- uint256 rate = rewardsAfterFee / (end - start);
+ uint256 rate = (totalRewards - frontendFeeTaken - protocolFeeTaken) / (end - start);
No description provided.