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

Pull exact #127

Merged
merged 5 commits into from
Nov 13, 2024
Merged

Pull exact #127

merged 5 commits into from
Nov 13, 2024

Conversation

corddry
Copy link
Collaborator

@corddry corddry commented Nov 12, 2024

No description provided.

@@ -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);
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

F

@@ -244,14 +244,15 @@ contract WrappedVault is Owned, ERC20, IWrappedVault {

uint256 remainingRewards = rewardsInterval.rate * (rewardsInterval.end - newStart);
uint256 rate = (rewardsAfterFee + remainingRewards) / (newEnd - newStart);
Copy link
Collaborator

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);

@@ -292,6 +293,7 @@ contract WrappedVault is Owned, ERC20, IWrappedVault {
uint256 rate = rewardsAfterFee / (end - start);
Copy link
Collaborator

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);

src/WrappedVault.sol Outdated Show resolved Hide resolved
@corddry corddry merged commit 3d5f5ef into main Nov 13, 2024
1 check passed
@corddry corddry deleted the pull-exact branch November 13, 2024 15:02
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.

3 participants