SommelierTurboDivEthStrategy
Overview
The SommelierTurboDivEthStrategy contract is a specialized strategy that supplies tokens into a Sommelier Vault while managing liquidity through Balancer pools. It handles conversions between ETH and rETH using Balancer's stable pools.
Constants
address public constant rEth = RETH_MAINNET; // Ethereum mainnet's rETH Token
address public constant balancerLpPool = 0x1E19CF2D73a72Ef1332C882F20534B6519Be0276; // Balancer rETH-WETH pool
bytes32 public constant balancerPoolId = 0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112; // Pool ID
IBalancerVault public constant balancerVault = IBalancerVault(BALANCER_VAULT_MAINNET); // Balancer VaultFunctions
Constructor
constructor() initializerEmpty constructor marked as initializer.
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_cellar: Sommelier cellar address
Core Functions
liquidateExact
Withdraws exactly amountNeeded to vault.
Parameters:
amountNeeded: Amount to withdraw
Returns:
loss: Amount of realized loss
View Functions
previewLiquidateExact
Calculates input needed for exact output.
Parameters:
liquidatedAmount: Desired output amount
Returns:
requestedAmount: Required input amount
maxLiquidate
Returns maximum withdrawable amount after losses.
Returns:
Maximum withdrawable amount
maxLiquidateExact
Returns maximum withdrawable amount before losses.
Returns:
Maximum withdrawable amount before losses
Internal Core Functions
_invest
Invests assets in Cellar Vault through Balancer.
Parameters:
amount: Amount to investminOutputAfterInvestment: Minimum expected shares
Returns:
depositedAmount: Amount of tokens received
_divest
Withdraws assets from Cellar Vault through Balancer.
Parameters:
shares: Amount of shares to withdraw
Returns:
withdrawn: Amount of assets received
_liquidatePosition
Liquidates position up to requested amount.
Parameters:
amountNeeded: Amount to liquidate
Returns:
liquidatedAmount: Amount actually liquidatedloss: Amount of losses incurred
Internal View Functions
_shareValue
Calculates underlying value of shares.
Parameters:
shares: Amount of shares
Returns:
_assets: Asset value
_sharesForAmount
Calculates shares needed for amount.
Parameters:
amount: Amount of assets
Returns:
_shares: Required shares
_shareBalance
Returns strategy's Cellar share balance.
Returns:
Current share balance
_lpValue
Calculates value of LP tokens.
Parameters:
amount: LP token amount
Returns:
Underlying value
_lpPrice
Returns Balancer LP token price.
Returns:
LP token price
_lpBalance
Returns Balancer LP token balance.
Returns:
LP token balance
_estimatedTotalAssets
Calculates total assets under management.
Returns:
Total assets value
_getAssets
Returns ordered array of pool assets.
Returns:
Array of pool assets
Internal Helper Functions
_joinPool
Adds single-sided liquidity to Balancer pool.
Parameters:
_wethIn: Amount of WETH to add
Returns:
Amount of LP tokens minted
_exitPool
Removes liquidity from Balancer pool.
Parameters:
_lpTokens: Amount of LP tokens to remove
Returns:
Amount of WETH received
Last updated