ConvexdETHFrxETHStrategy
Overview
The ConvexdETHFrxETHStrategy contract is a specialized strategy that supplies ETH into the dETH-frxETH pool in Curve, then stakes the curve LP tokens in Convex to maximize yield. It handles the complex interactions between Curve pools and Convex staking.
Constants
State Variables
Functions
Initialization Functions
constructor
Empty constructor marked as initializer.
initialize
Initializes the strategy with required components.
Parameters:
_vault
: MaxApy vault address_keepers
: Array of keeper addresses_strategyName
: Name of the strategy_strategist
: Strategist address_curveLpPool
: Address of main Curve pool (dETH-frxETH)_curveEthFrxEthPool
: Address of Curve's ETH-frxETH pool_router
: Router address for swaps
Configuration Functions
setRouter
Updates the router used for token swaps.
Parameters:
_newRouter
: New router address
Internal Core Functions
_invest
Invests ETH into the Convex pool through a series of steps:
Unwraps WETH
Swaps ETH for frxETH
Adds liquidity to dETH-frxETH pool
Stakes LP tokens in Convex
Parameters:
amount
: Amount to investminOutputAfterInvestment
: Minimum expected LP tokens Returns:Amount of tokens received in underlying terms
_divest
Withdraws assets from Convex and Curve pools:
Withdraws from Convex
Removes liquidity from Curve
Swaps frxETH back to ETH
Wraps ETH to WETH
Parameters:
amount
: LP tokens to divest Returns:Amount of WETH received
_unwindRewards
Claims and converts reward tokens to underlying asset:
Claims CRV and CVX rewards
Swaps CRV for WETH
Swaps CVX for WETH
Parameters:
rewardPool
: Convex rewards pool to claim from
View Functions
previewLiquidate
Simulates withdrawal including potential losses.
Parameters:
requestedAmount
: Amount to withdraw Returns:Expected output amount after losses
Internal View Functions
_lpPrice
Calculates the estimated price for the strategy's Convex LP token.
Returns:
Estimated LP token price
_crv
Returns the CRV token address.
Returns:
CRV token address
_cvx
Returns the CVX token address.
Returns:
CVX token address
Receive Function
Enables the contract to receive ETH.
Simulation Functions
_simulateHarvest
Internal simulation function that calculates expected outcomes of harvesting operations including:
Investment/divestment amounts
Profit/loss calculations
Debt management
Balance changes
Last updated