-
Notifications
You must be signed in to change notification settings - Fork 98
[CurvePB] Improve CurvePoolBooster. #2762
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2762 +/- ##
==========================================
+ Coverage 39.31% 39.62% +0.30%
==========================================
Files 126 126
Lines 5802 5825 +23
Branches 1542 1546 +4
==========================================
+ Hits 2281 2308 +27
+ Misses 3519 3515 -4
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sparrowDom
left a comment
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.
Left a couple of comments otherwise looks good
| IERC20(rewardToken).safeTransfer(feeCollector, feeAmount); | ||
| emit FeeCollected(feeCollector, feeAmount); | ||
|
|
||
| return IERC20(rewardToken).balanceOf(address(this)); |
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 we did another balanceOf check here because of the worry that after transferring fees out, there might be reward tokens (like our OUSD & OETH) where after sending the feeAmount the remaining balance wouldn't equal: remainingBalance = previousBalance - feeAmount because of the potential rounding in the underlying token contracts.
I think we should call balanceOf again. Or add extra math that will deduct 1 WEI for any potential rounding issues.
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.
Oh and we should put comments explaining this in the file
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.
Indeed, good idea. Fixed in this commit: ffd591e
| function _handleFee() internal returns (uint256) { | ||
| // Cache current rewardToken balance | ||
| uint256 balance = IERC20(rewardToken).balanceOf(address(this)); | ||
| require(balance > 0, "No reward to manage"); |
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 know we previously had this require(balance > 0, "No reward to manage"); but I am not sure it is preferable that this function ever reverts. Because then the whole manageBribes from the BribesModule will revert. And all that is needed is that somehow yield forwarding is stopped or that contract for some other reason doesn't have the reward token balance.
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.
Yep. Fixed in this commit: 57f37c4
sparrowDom
left a comment
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.
LGTM
* Enhance CurvePoolBooster and Factory: Add CurvePoolBoosterPlain. * move curvePB to dedicated folder
Summary
manageTotalRewardAmount,manageNumberOfPeriods,manageRewardPerVote) into a singlemanageCampaignfunction that can update any combination of parameters in one cross-chain callpayable, removing the explicitbridgeFeeparameter and usingmsg.valuedirectlymanageCampaignaccepts atotalRewardAmountwith special semantics (0 = no update,type(uint256).max= use all contract balance, other = specific amount capped by balance)Changes
CurvePoolBooster.solcreateCampaignbridgeFeeparameter, now usesmsg.valuefor bridge feepayablemanageCampaign(new - replaces 3 functions)manageTotalRewardAmount,manageNumberOfPeriods, andmanageRewardPerVotemsg.valuefor bridge feecloseCampaignbridgeFeeparameter, now usesmsg.valuefor bridge feepayable_handleFee