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

Implement Curve Pool Booster. #2327

Merged
merged 71 commits into from
Jan 30, 2025
Merged

Implement Curve Pool Booster. #2327

merged 71 commits into from
Jan 30, 2025

Conversation

clement-ux
Copy link
Contributor

@clement-ux clement-ux commented Dec 16, 2024

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:

  • Create a campaign
  • Increase the amount for the remaining time for a campaign
  • Increase campaign duration
  • Adjust campaign price
  • Close campaign
  • Set campaign ID (as it uses cross-chain communication, a bribe is not created instantly, so we need to check logs and add it manually afterward).

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.

This contract should be deployed on BOTH mainnet and targetedChainId to completely manage the bribe.
See this #2327 (comment).

Code Change Checklist

To be completed before internal review begins:

  • The contract code is complete
  • Executable deployment file
  • Fork tests that test after the deployment file runs
  • Unit tests *if needed
  • The owner has done a full checklist review of the code + tests

Internal review:

  • Two approvals by internal reviewers

Copy link

github-actions bot commented Dec 16, 2024

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against a67c6c4

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 99 lines in your changes missing coverage. Please review.

Project coverage is 50.80%. Comparing base (532dabf) to head (a67c6c4).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ontracts/contracts/strategies/CurvePoolBooster.sol 0.00% 99 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2327      +/-   ##
==========================================
- Coverage   51.54%   50.80%   -0.74%     
==========================================
  Files          91       92       +1     
  Lines        4414     4513      +99     
  Branches     1162     1195      +33     
==========================================
+ Hits         2275     2293      +18     
- Misses       2136     2217      +81     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@clement-ux clement-ux changed the title [WIP] Implement Curve Pool Booster. Implement Curve Pool Booster. Dec 18, 2024
@clement-ux clement-ux marked this pull request as ready for review December 18, 2024 10:48
Copy link
Member

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

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

Copy link
Contributor Author

@clement-ux clement-ux Dec 19, 2024

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

@clement-ux clement-ux changed the title Implement Curve Pool Booster. [WIP] Implement Curve Pool Booster. Dec 30, 2024
Copy link

Code

sparrowDom
sparrowDom previously approved these changes Jan 24, 2025
Copy link
Collaborator

@naddison36 naddison36 left a comment

Choose a reason for hiding this comment

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

I'm confused to how the Pool Boosting will work on Arbitrum.

contracts/deploy/mainnet/120_pool_booster_curve_arb.js Outdated Show resolved Hide resolved
contracts/deploy/mainnet/120_pool_booster_curve_arb.js Outdated Show resolved Hide resolved
@clement-ux
Copy link
Contributor Author

clement-ux commented Jan 28, 2025

I'm confused to how the Pool Boosting will work on Arbitrum.

Pool Boosting isn't designed to work on Arbitrum. I know it is weird, but let me explain.
This contract will be deployed at the same address as the one in mainnet for two main reasons:

  • Preventing someone else to deploy it and thus manage our bribe in our stead.
  • Claiming unused tokens when campaign ends.

So at the end, on Arbitrum this contract will only use the rescueToken function and isn't planned to do more.
At least for the moment.

We could have develop two different contracts, to manage bribe on mainnet and L2 at the same time. But using create2 requires to have same bytecode for both to have cross-chain replication. For the futur we could use Create3 method.

@naddison36
Copy link
Collaborator

I'm confused to how the Pool Boosting will work on Arbitrum.

Pool Boosting isn't designed to work on Arbitrum. I know it is weird, but let me explain. This contract will be deployed at the same address as the one in mainnet for two main reasons:

  • Preventing someone else to deploy it and thus manage our bribe in our stead.
  • Claiming unused tokens when campaign ends.

So at the end, on Arbitrum this contract will only use the rescueToken function and isn't planned to do more. At least for the moment.

We could have develop two different contracts, to manage bribe on mainnet and L2 at the same time. But using create2 requires to have same bytecode for both to have cross-chain replication. For the future we could use Create3 method.

ok, that explains it. Thanks

naddison36
naddison36 previously approved these changes Jan 28, 2025
* fix: adjust deployName.

* fix: deploy 119 and 120.
// If there is a fee, transfer it to the feeCollector
if (feeAmount > 0) {
// Transfer the fee to the feeCollector
IERC20(rewardToken).transfer(feeCollector, feeAmount);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will we ever bribe with USDT? If so, we'll need to use safeTransfer.
If not, the Slither error can be fixed by adding this before the transfer
// slither-disable-next-line unchecked-transfer unused-return

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in this commit: 6997f35.

@naddison36 naddison36 merged commit aca54e1 into master Jan 30, 2025
13 of 19 checks passed
@naddison36 naddison36 deleted the clement/pool-booster-curve branch January 30, 2025 23:29
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.

5 participants