SommelierMorphoEthMaximizerStrategy
Overview
The SommelierMorphoEthMaximizerStrategy contract is a specialized strategy that supplies an underlying token into a Sommelier Vault to earn yield. This strategy is adapted from the yearn-steth-acc repository and optimizes ETH returns through Morpho integration.
Constants
address constant wstEth = WSTETH_MAINNET; // Wrapped stETH token address
IUniswapV3Router constant router = IUniswapV3Router(UNISWAP_V3_ROUTER_MAINNET); // Uniswap V3 router
State Variables
No additional state variables beyond those inherited from BaseSommelierStrategy.
Functions
Initialization Functions
initialize
function initialize(
IMaxApyVault _vault,
address[] calldata _keepers,
bytes32 _strategyName,
address _strategist,
ICellar _cellar
) public override initializer
Initializes the strategy with Sommelier components.
Parameters:
_vault
: MaxApy vault address_keepers
: Array of keeper addresses_strategyName
: Name of the strategy_strategist
: Strategist address_cellar
: Sommelier Turbo-stETH cellar address
Core Functions
liquidateExact
function liquidateExact(uint256 amountNeeded) external virtual override checkRoles(VAULT_ROLE) returns (uint256 loss)
Withdraws exactly amountNeeded to vault. Can only be called by vault.
Parameters:
amountNeeded
: Amount of underlying asset to withdraw
Returns:
loss
: Amount of loss realized during withdrawal
Internal Core Functions
_divest
function _divest(uint256 shares) internal override returns (uint256 withdrawn)
Withdraws assets from Cellar Vault, handling potential losses.
Parameters:
shares
: Amount of cellar shares to divest
Returns:
withdrawn
: Amount of assets received after withdrawal
_swapWstEth
function _swapWstEth(uint256 amountIn) internal returns (uint256)
Swaps wstETH to underlying WETH using Uniswap V3.
Parameters:
amountIn
: Amount of wstETH to swap
Returns:
Amount of WETH received
Internal View Functions
_wstEthBalance
function _wstEthBalance() internal view returns (uint256)
Retrieves the contract's wstETH balance.
Returns:
Current wstETH balance
Key Features
Integrates with Sommelier's Turbo-stETH cellar for yield optimization
Handles wstETH/ETH conversions through Uniswap V3
Implements safety checks for pause conditions and minimum trade sizes
Manages exact liquidations for vault withdrawals
Monitors and handles potential losses during withdrawals
Last updated