ConvexUSDTCrvUSDStrategy
Overview
The ConvexUSDTCrvUSDStrategy contract is a strategy that supplies USDT into the crvUSD-USDT pool in Curve on Polygon, then stakes the curve LP tokens in Convex to maximize yield. It manages conversions between USDT and other tokens using Curve's AtriCrypto zapper.
Constants
address public constant crvUsd = CRV_USD_POLYGON; // CRVUSD token address
address public constant wpol = WPOL_POLYGON; // Wrapped MATIC address
address public constant crv = CRV_POLYGON; // CRV token address
address public constant usdt = USDT_POLYGON; // USDT token address
uint256 public constant CRVUSD_USDT_CONVEX_POOL_ID = CRVUSD_USDT_CONVEX_POOL_ID_POLYGON; // Convex pool ID
IConvexBoosterPolygon public constant convexBooster = IConvexBoosterPolygon(CONVEX_BOOSTER_POLYGON); // Convex booster
ICurveAtriCryptoZapper constant zapper = ICurveAtriCryptoZapper(CURVE_AAVE_ATRICRYPTO_ZAPPER_POLYGON); // Curve zapper
State Variables
IRouter public router; // Router for swaps
ICurveLpPool public curveLpPool; // Main Curve pool
Functions
Initialization Functions
constructor
constructor() initializer
Empty constructor marked as initializer.
initialize
function initialize(
IMaxApyVault _vault,
address[] calldata _keepers,
bytes32 _strategyName,
address _strategist,
ICurveLpPool _curveLpPool,
IRouter _router
) public initializer
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
Core Functions
_invest
function _invest(uint256 amount, uint256 minOutputAfterInvestment) internal override returns (uint256)
Invests assets through:
Converting USDCe to USDT via zapper
Adding USDT to crvUSD-USDT pool
Staking LP tokens in Convex
Parameters:
amount
: Amount to investminOutputAfterInvestment
: Minimum expected LP tokens
Returns:
Amount of tokens received
_divest
function _divest(uint256 amount) internal override returns (uint256)
Withdraws assets through:
Withdrawing from Convex
Removing liquidity from Curve
Converting USDT to USDCe via zapper
Parameters:
amount
: LP tokens to divest
Returns:
Amount received after withdrawals and conversions
_unwindRewards
function _unwindRewards(IConvexRewardsPolygon rewardPool) internal override
Claims and converts rewards:
Claims CRV rewards
Swaps CRV through multiple hops
Converts crvUSD through Curve pool
Parameters:
rewardPool
: Convex rewards pool
Internal View Functions
_convertUsdtToUsdce
function _convertUsdtToUsdce(uint256 usdtAmount) internal view returns (uint256)
Converts USDT to USDCe using zapper.
Parameters:
usdtAmount
: USDT amount
Returns:
Equivalent USDCe amount
_convertUsdceToUsdt
function _convertUsdceToUsdt(uint256 usdceAmount) internal view returns (uint256)
Converts USDCe to USDT using zapper.
Parameters:
usdceAmount
: USDCe amount
Returns:
Equivalent USDT amount
_lpValue
function _lpValue(uint256 lp) internal view override returns (uint256)
Calculates underlying value of LP tokens.
Parameters:
lp
: LP token amount
Returns:
USDCe value
_lpForAmount
function _lpForAmount(uint256 amount) internal view override returns (uint256)
Calculates LP tokens needed for amount.
Parameters:
amount
: USDCe amount
Returns:
Required LP tokens
_estimatedTotalAssets
function _estimatedTotalAssets() internal view override returns (uint256)
Calculates total strategy value including conversions.
Returns:
Total value in USDCe
_lpPrice
function _lpPrice() internal view override returns (uint256)
Returns Curve LP token price.
_crv
function _crv() internal pure override returns (address)
Returns CRV token address.
_crvUsdBalance
function _crvUsdBalance() internal view returns (uint256)
Returns strategy's crvUSD balance.
_simulateHarvest
function _simulateHarvest() public override
Simulates harvest operation and reverts with simulation data.
Last updated