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

[WIP] Optimized harvest() #3

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

antonyip
Copy link

@antonyip antonyip commented Sep 12, 2021

Changes made to harvest()

  1. Set a minimum requirement limit to tokens that will be called with the ERC20 deposit function.
  2. Batched Deposit Functions
  3. Added Variables to tokens limit
  4. Created functions to change the token limits after deploying to mainnet
    uint256 public minBaseRewardsPoolBalance = 1**18; // changeMe!
    uint256 public minCvxCrvRewardsPoolBalance = 1**18; // changeMe!
    uint256 public minCvxRewardsPoolBalance = 1**18; // changeMe!
    uint256 public minThreeCrvBalance = 1**18; // changeMe!
    uint256 public cvxCrvToGovernanceSaver = 0;
    uint256 public minCvxCrvToGovernanceSaver = 1**18; // changeMe!
    uint256 public cvxCrvToStrategistSaver = 0;
    uint256 public minCvxCrvToStrategistSaver = 1**18; // changeMe!
    uint256 public cvxCrvToTreeSaver = 0;
    uint256 public minCvxCrvToTreeSaver = 1**18; // changeMe!
    uint256 public cvxToGovernanceSaver = 0;
    uint256 public minCvxToGovernanceSaver = 1**18; // changeMe!
    uint256 public cvxToStrategistSaver = 0;
    uint256 public minCvxToStrategistSaver = 1**18; // changeMe!
    uint256 public cvxToTreeSaver = 0;
    uint256 public minCvxToTreeSaver = 1**18; // changeMe!
  1. Removed some un-used variables as the new variables and functions could not fit within EIP-170 - This means that the storage slots will not match up correctly and your old contracts cannot be upgraded directly.
  2. ...

Contract

The optimized contract can be found at MyContract2.sol

Gas Test

Gas calculation can be found inside ./analysis/gascosts.txt

Tests

Please take a look at /tests/example/test_are_you_trying.py

Call Stack analysis can be found in analysis folder.

  • original_clean.txt is the harvest3 call stack from the original contract
  • optimized_clean_var1**8 is the harvest3 call stack from the optimized contract

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.

1 participant