BaseBeefyCurveStrategy

Overview

The BaseBeefyCurveStrategy contract extends BaseBeefyStrategy to provide functionality for strategies that interact with both Beefy Finance and Curve protocols. It supplies underlying tokens into a Curve pool, then deposits the Curve LP tokens into a Beefy vault for additional yield.

State Variables

ICurveLpPool public curveLpPool;     // Main Curve pool for this strategy

Functions

Initialization Functions

initialize

function initialize(
    IMaxApyVault _vault,
    address[] calldata _keepers,
    bytes32 _strategyName,
    address _strategist,
    ICurveLpPool _curveLpPool,
    IBeefyVault _beefyVault
) public virtual initializer

Initializes the strategy with Curve and Beefy components.

Parameters:

  • _vault: MaxApy vault address

  • _keepers: Array of keeper addresses

  • _strategyName: Name of the strategy

  • _strategist: Strategist address

  • _curveLpPool: Curve LP pool address

  • _beefyVault: Beefy vault address

Core Functions

_invest

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

Invests assets by adding liquidity to Curve and depositing LP tokens to Beefy.

Parameters:

  • amount: Amount to invest

  • minOutputAfterInvestment: Minimum expected Beefy shares

Returns:

  • Amount of Beefy shares received

_divest

function _divest(uint256 amount) internal virtual override returns (uint256)

Withdraws assets from Beefy and removes liquidity from Curve.

Parameters:

  • amount: Amount of Beefy shares to withdraw

Returns:

  • Amount of underlying assets received

View Functions

previewLiquidate

function previewLiquidate(uint256 requestedAmount) public view virtual override returns (uint256)

Calculates expected output for withdrawal through both Beefy and Curve.

Parameters:

  • requestedAmount: Amount requested to withdraw

Returns:

  • Expected liquidated amount

Internal View Functions

_shareValue

function _shareValue(uint256 shares) internal view virtual override returns (uint256)

Calculates underlying value of shares considering both Beefy and Curve conversion.

Parameters:

  • shares: Amount of Beefy shares

Returns:

  • Underlying asset value

_sharesForAmount

function _sharesForAmount(uint256 amount) internal view virtual override returns (uint256)

Calculates Beefy shares needed for given amount, considering Curve conversion.

Parameters:

  • amount: Amount of underlying assets

Returns:

  • Required Beefy shares

_lpPrice

function _lpPrice() internal view returns (uint256)

Returns estimated price of Curve LP token.

Returns:

  • LP token price

Last updated