BaseSommerlierStrategy

The BaseSommelierStrategy contract is a specialized implementation specifically designed for interacting with Sommelier Cellars. It extends the contract's functionality to handle the specific requirements of Sommelier Cellars.

This contract's main purpose is to enable the MaxAPY Protocol to invest funds in Sommelier Cellars and earn yield. It provides functions for depositing underlying assets into the Cellar Vault, withdrawing funds, and managing the strategy's position.

The BaseSommelierStrategy contract overrides and extends certain functions from the BaseStrategy contract to adapt to the specific needs of interacting with Sommelier Cellars, such as calculating share values, estimating total assets, and handling investments and divestments.

By leveraging the yield-generating capabilities of Sommelier Cellars, the BaseSommelierStrategy the contract allows the maxAPY Protocol to optimize user returns and expand the range of yield-generating opportunities available.

Functions

initialize()

function initialize(
    IMaxApyVaultV2 _vault,
    address[] calldata _keepers,
    bytes32 _strategyName,
    address _strategist,
    ICellar _cellar
) public virtual initializer

Initializes the BaseSommelierStrategy with the specified vault, keepers, strategy name, strategist, and Sommelier Cellar.

Parameters:

_vault: The address of the MaxApy Vault associated with the strategy

_keepers: The addresses of the keepers to be added as valid keepers to the strategy

_strategyName: The name of the strategy

_cellar: The address of the Sommelier Turbo-stETH cellar


_invest()

function _invest(uint256 amount, uint256 minOutputAfterInvestment)
    internal
    virtual
    returns (uint256 depositedAmount)

Invests amount of underlying, depositing it in the Cellar Vault.

Parameters:

amount: The amount of underlying to be deposited in the vault

minOutputAfterInvestment: Minimum expected output after _invest() (designated in Cellar receipt tokens)

Returns:

depositedAmount: The amount of shares received, in terms of underlying


_divest()

function _divest(uint256 shares) internal virtual returns (uint256 withdrawn)

Divests amount shares from Cellar Vault.

Parameters:

shares: The amount of shares to divest

Returns:

withdrawn: The total amount divested, in terms of underlying asset


_shareValue()

function _shareValue(uint256 shares) internal view returns (uint256 _assets)

Determines the current value of shares.

Parameters:

shares: The number of shares to calculate the value for

Returns:

_assets: The estimated amount of underlying computed from the shares


_sharesForAmount()

function _sharesForAmount(uint256 amount) internal view returns (uint256 _shares)

Determines how many shares a depositor of amount of underlying would receive.

Parameters:

amount: The amount of underlying assets

Returns:

_shares: The estimated amount of shares computed in exchange for the underlying amount


_shareBalance()

function _shareBalance() internal view returns (uint256 _balance)

Returns the current strategy's amount of Cellar vault shares.

Returns:

_balance: The strategy's balance of Cellar Vault shares


_estimatedTotalAssets()

function _estimatedTotalAssets() internal view virtual override returns (uint256)

Returns the real-time estimation of the value in assets held by the strategy.

Returns:

The strategy's total assets (idle + investment positions)

Last updated