ConvexUSDCCrvUSDStrategy
Overview
The ConvexUSDCCrvUSDStrategy contract is a strategy that supplies USDC into the crvUSD-USDC pool in Curve on Polygon, then stakes the curve LP tokens in Convex to maximize yield. It handles multiple token conversions and uses TWAP oracles for price calculations.
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
: Curve LP pool address_router
: Router address for swaps
Configuration Functions
setRouter
Updates the router used for token swaps.
Parameters:
_newRouter
: New router address
Core Functions
_invest
Invests assets through:
Swapping base asset to USDC
Adding liquidity to crvUSD-USDC pool
Staking LP tokens in Convex
Parameters:
amount
: Amount to investminOutputAfterInvestment
: Minimum expected LP tokens
Returns:
Amount of tokens received
_divest
Withdraws assets through:
Withdrawing from Convex
Removing liquidity from Curve
Swapping USDC to base asset
Parameters:
amount
: LP tokens to divest
Returns:
Amount received after withdrawals and swaps
_unwindRewards
Claims and converts rewards:
Claims CRV rewards
Swaps CRV through TriCrypto pool
Swaps crvUSD through multiple hops
Parameters:
rewardPool
: Convex rewards pool
View Functions
previewLiquidate
Simulates withdrawal including potential losses.
Parameters:
requestedAmount
: Amount to withdraw
Returns:
Expected output amount
Internal View Functions
_lpValue
Calculates underlying value of LP tokens using TWAP.
Parameters:
lp
: LP token amount
Returns:
Underlying value
_lpForAmount
Calculates LP tokens needed for amount using TWAP.
Parameters:
amount
: Asset amount
Returns:
Required LP tokens
_lpPrice
Calculates LP token price.
Returns:
LP token price
_estimateAmountOut
Calculates swap output using TWAP oracle.
Parameters:
tokenIn
: Input tokentokenOut
: Output tokenamountIn
: Input amountsecondsAgo
: TWAP period
Returns:
Estimated output amount
_crv
Returns CRV token address.
_crvUsdBalance
Returns strategy's crvUSD balance.
_simulateHarvest
Simulates harvest operation and reverts with simulation data.
Last updated