# 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

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

## Functions

### Initialization Functions

### initialize

```solidity
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

```solidity
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

```solidity
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

```solidity
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

```solidity
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

```solidity
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

```solidity
function _lpPrice() internal view returns (uint256)
```

Returns estimated price of Curve LP token.

Returns:

* LP token price


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devs.maxapy.io/maxapy-erc4626/base-strategies/basebeefycurvestrategy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
