block-quote On this pagechevron-down
copy Copy chevron-down
file-lock maxAPY ERC4626chevron-right Strategies chevron-right Polygon - USDC.e chevron-right Yearn YearnAaveV3USDTLenderStrategy The YearnAaveV3USDTLenderStrategy contract is a strategy that supplies USDT into a Yearn V3 Vault for AAVE v3 lending. It manages conversions between USDCe and USDT through Curve's AtriCrypto zapper and includes safety margins for liquidations.
Copy ICurveAtriCryptoZapper constant zapper = ICurveAtriCryptoZapper ( CURVE_AAVE_ATRICRYPTO_ZAPPER_POLYGON ); // Curve zapper
address public constant usdt = USDT_POLYGON ; // USDT address Initialization Functions
Copy function initialize (
IMaxApyVault _vault ,
address [] calldata _keepers ,
bytes32 _strategyName ,
address _strategist ,
IYVaultV3 _yVault
) public virtual override initializer Initializes the strategy and sets up trading limits.
Parameters:
_vault: MaxApy vault address
_keepers: Array of keeper addresses
_strategyName: Name of the strategy
_strategist: Strategist address
_yVault: Yearn V3 vault address
Withdraws exact amount to vault with loss calculation.
Parameters:
amountNeeded: Amount to withdraw
Returns:
loss: Amount of realized loss
previewLiquidate
Simulates withdrawal including losses and conversion rates.
Parameters:
requestedAmount: Amount to withdraw
Returns:
liquidatedAmount: Expected output amount
previewLiquidateExact
Calculates input needed with 1% safety margin.
Parameters:
liquidatedAmount: Desired output amount
Returns:
requestedAmount: Required input amount
Returns maximum withdrawable amount after losses.
Returns:
Maximum withdrawable amount
maxLiquidateExact
Returns maximum withdrawable amount with safety margin.
Returns:
Maximum withdrawable amount before losses
Internal Core Functions
Invests assets by:
Converting USDCe to USDT through zapper
Depositing USDT into Yearn vault
Parameters:
minOutputAfterInvestment: Minimum expected shares
Returns:
depositedAmount: Amount of tokens received
Withdraws assets by:
Redeeming from Yearn vault
Converting USDT to USDCe through zapper
Parameters:
shares: Amount of shares to withdraw
Returns:
withdrawn: Amount of assets received
Internal View Functions
Calculates underlying value including conversion rate.
Parameters:
Returns:
_sharesForAmount
Calculates shares needed including spot price conversion.
Parameters:
Returns:
Calculates spot price conversion without slippage.
Parameters:
i: Direction (1: USDC->USDT, 2: USDT->USDC)
amount: Amount to convert
Returns:
Converted amount at spot price