-
Notifications
You must be signed in to change notification settings - Fork 84
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
Implement Curve Pool Booster. #2327
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2327 +/- ##
==========================================
- Coverage 51.94% 51.93% -0.01%
==========================================
Files 91 92 +1
Lines 4414 4513 +99
Branches 1162 1195 +33
==========================================
+ Hits 2293 2344 +51
- Misses 2118 2166 +48
Partials 3 3 ☔ View full report in Codecov by Sentry. |
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.
Minor event comments. I guess prod testing is the way to go here like you suggest.
} | ||
|
||
function sendETH(address receiver) external onlyOperator { | ||
payable(receiver).transfer(address(this).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.
Why is this necessary? to recover any accidentally sent tokens? If yes, can you change it to onlyGovernor
? Also, we typically have a transferTokens
method for ERC20 tokens as well
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.
to recover any accidentally sent tokens?
Not really. This contract will hold a bit of ETH, as we need to pay a bit when calling the CampaignRemoteManager (CCIP fees). So it is in the situation where the pool booster will not be used anymore (end of services) and the operator what to claim the remaining ETH.
And using a payable function is not the best (imo) because a surplus of ETH is sent back to this contract, not to the sender.
What do you think of keeping onlyOperator
modifier then?
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.
IMO it is fine, as there will only be small amount of ETH on the contract whose purpose is to fuel the gas for transactions and that is not part of the user funds.
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.
Yes, exactly, only to fuel gas transactions, nothing more.
|
||
emit FeeCollected(feeCollector, feeAmount); | ||
|
||
// Return the balance after fee |
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.
there are tokens (like ours) which don't have a perfect up to a WEI exact accounting when doing transfers and they might be doing some rounding. It could happen that when you transfer a feeAmount
away, that the actual balance remaining won't be balance - feeAmount
but rather balance - feeAmount - 1 WEI
For that reason I would rather return IERC20(rewardToken).balanceOf(address(this));
here
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.
Otherwise the whole transaction amount that was about to be transferred over to the other chain might fail
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.
Doing the IERC20(rewardToken).balanceOf(address(this)) is good.
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.
Done in this commit: 82770e6
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 it would be better to replace the return balance - feeAmount
with the IERC20(rewardToken).balanceOf(address(this));
. Since if feeAmount == 0
then we query the rewardsToken
contract for balance twice wasting some gas
contracts/test/strategies/curvePoolBooster.mainnet.fork-test.js
Outdated
Show resolved
Hide resolved
RequirementsPR is integrating with Easy ChecksAuthentication
Ethereum
Cryptographic code
Gas problems
Black magic
Overflow
Proxy
Events
Medium ChecksRounding and casts
Dependencies
External calls
Tests
Deploy
Downstream
ThinkingLogicLogic is simple as it is a simple interface to a campaignRemoteManager. The one downside is that there is some manual managing of campaignId setting, but there is no other way to do this one. And we will probably need to do it only once, or very rarely. Deployment ConsiderationsWe should be monitoring all the bridge transactions that happen as a result of transactions. Internal State
AttackBiggest risk here is bridge transactions failing as we will need to be able to detect that off-chain. FlavorCode is nice and simple. |
* feat: add closeCampaign function to CurvePoolBooster. * fix: remove immutable from campaignRemoteManager. * fix: adjust naming and prettier. * feat: configure deploymment with CreateX. * fix: use encodeFunctionData to encodeWithSignature. * feat: add arbitrum deployment file for CurvePoolBooster. * feat: create a funciton for encodedSalt. * feat: create multichainStrategist variable. * fix: change proxy owner. * try something. * fix: adjust with new CampaignRemoteManager. * fix merge conflit. * fix: add more tests.
Curve Pool Booster
This contract aims to take all funds available in the contract and create/manage bribes on VotemarketV2.
As VotemarketV2 is only available in L2s, this contract connects with VM using the CampaignRemoteManager.
The connection with VM on L2s uses CCIP, so we need to add a bit of ETH in every transaction we do. The remaining gas is sent back to the contract. That's why I suggest ETH remain in the contract instead of sending transactions from the relayer with ethers.
The relayer will be able to perform multiple actions:
Tests are pretty basic and don't test the whole process due to the complexity of testing cross-chain messaging. However, as this contract will hold a small amount of funds, I think it is ok to test it in prod.
Code Change Checklist
To be completed before internal review begins:
Internal review: