YearnUSDTStrategy
Overview
The YearnUSDTStrategy contract is a strategy that supplies USDT into a Yearn V2 Vault to earn yield. It handles conversions between the underlying asset and USDT through Curve's 3pool and includes safety margins for liquidations.
Constants
Functions
Initialization Functions
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_yVault
: Yearn V2 vault address
View Functions
previewLiquidate
Simulates withdrawal with 1% safety margin.
Parameters:
requestedAmount
: Amount to withdraw
Returns:
liquidatedAmount
: Expected output amount
previewLiquidateExact
Calculates input needed with 2% buffer.
Parameters:
liquidatedAmount
: Desired output amount
Returns:
requestedAmount
: Required input amount
Internal Core Functions
_invest
Invests assets by:
Swapping underlying to USDT through Curve
Depositing USDT into Yearn vault
Parameters:
amount
: Amount to investminOutputAfterInvestment
: Minimum expected shares
Returns:
depositedAmount
: Amount of tokens received
_divest
Withdraws assets by:
Withdrawing USDT from Yearn vault
Swapping USDT to underlying through Curve
Parameters:
shares
: Amount of shares to withdraw
Returns:
withdrawn
: Amount of assets received
Internal View Functions
_shareValue
Calculates underlying value including Curve conversion.
Parameters:
shares
: Share amount
Returns:
Underlying value
_sharesForAmount
Calculates shares needed including Curve conversion.
Parameters:
amount
: Asset amount
Returns:
Required shares
Key Features:
Uses Curve's 3pool for token conversions
Sets 1M USD maximum trade size
Sets minimum trade size to 0.01 token units
Includes safety margins for withdrawals
Handles conversions between USDT and underlying asset
Last updated