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

Convex frxETH/WETH strategy #1846

Open
wants to merge 159 commits into
base: master
Choose a base branch
from
Open

Conversation

naddison36
Copy link
Collaborator

@naddison36 naddison36 commented Sep 28, 2023

This implementation of the Convex frxETH/WETH strategy uses Curve solidity libraries to abstract whether the Curve pool has two or three coins.

The other implementation clones BaseCurveStrategy to BaseTwoAssetCurveStrategy and ConvexStrategy to ConvexTwoAssetStrategy. #1842

Changes Summary

  • Removed unused imports from the Harvester contracts
  • I've moved the curve mocks into a mocks/curve folder
  • Curve pool and gauge mocks now burn the LP token on remove liquidity instead of transferring it back to the pool
  • Added calc_token_amount and fee functions to the abstract Curve Metapool. Also added remove_liquidity_imbalance with receiver override.
  • Changes to other strategies to fit strategy behaviour
    • Aave - added Withdrawal event to withdrawAll
    • Compound - added Withdrawal event to withdrawAll
    • Generalized 4626 - only emit Withdrawal event if there was a withdraw amount in withdrawAll
  • OSUD AMO and 3Pool strategies updated to new BaseConvexStrategy
  • Moved Curve interfaces in the strategies folder into a curve subfolder
  • Add new Curve pool libraries that abstract the number of coins in a pool
  • deployWithConfirmation in utils/deploy.js now supports linked libraries
  • Moved replaceContractAt and hardhatSetBalance from utils/deploy.js to utils/hardhat.js
  • Added reusable unit tests for governable, harvester and strategy behaviours
  • Added ConvexFrxEthWethStrategyProxy that delegates to ConvexStrategy and is linked to the CurveTwoCoinLib library
  • Added 078_convex_frax_strategy deploy script for the new Convex strategy that uses the frxETH/WETH Curve pool

Design decisions

https://www.notion.so/originprotocol/Design-of-frxETH-WETH-Strategy-7cf0ddf4f14746a2a433b15cd7aa67a5

Contracts

The new strategy is in green

oethContracts

ConvexStrategyHierarchy

ConvexStrategySquashed

Value Flow

oethValueFlows-convex-frxeth-weth

Tests

Unit tests

yarn test ./test/strategies/convexFrxEthWeth.js

Fork tests

yarn test:fork ./test/strategies/convex-frxeth.fork-test.js

Deploy

The contracts/deploy/078_convex_frax_strategy.js script will deploy the new strategy and propose the required governance acrtions.

Review

If you made a contract change, make sure to complete the checklist below before merging it in master.

Refer to our documentation for more details about contract security best practices.

Contract change checklist:

  • Code reviewed by 2 reviewers.
  • Copy & paste code review security checklist below this checklist.
  • Unit tests pass
  • Slither tests pass with no warning
  • Echidna tests pass if PR includes changes to OUSD contract (not automated, run manually on local)

@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa September 28, 2023 11:13 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-ousd-nicka-conv-xveop4 September 28, 2023 11:13 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa September 29, 2023 02:52 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-ousd-nicka-conv-xveop4 September 29, 2023 02:52 Inactive
@naddison36 naddison36 force-pushed the nicka/convex-frxeth-weth-minimal branch from 6a0a4cb to c646b8e Compare September 29, 2023 05:24
@rafaelugolini rafaelugolini temporarily deployed to preview-ousd-nicka-conv-xveop4 September 29, 2023 09:15 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa September 29, 2023 09:15 Inactive
@github-actions
Copy link

github-actions bot commented Sep 29, 2023

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against f98accd

@naddison36 naddison36 changed the title Convex frxETH/WETH strategy using Curve abstraction libraries WIP: Convex frxETH/WETH strategy using Curve abstraction libraries Oct 3, 2023
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa October 3, 2023 01:55 Inactive
@naddison36 naddison36 changed the base branch from nicka/convex-frxeth-weth-minimal to master October 3, 2023 02:06
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa November 1, 2023 03:29 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa November 3, 2023 14:52 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa November 6, 2023 04:33 Inactive
@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-conv-zbl8aa November 6, 2023 04:37 Inactive
Base automatically changed from nicka/behaviour-tests to master November 8, 2023 00:57
@sparrowDom sparrowDom removed the request for review from smitch88 January 18, 2024 12:35
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.

None yet

4 participants