# Architecture

The MaxAPY Protocol's architecture is designed to be modular and extensible, allowing for easy integration with various DeFi protocols and the development of new yield-generating strategies. The main components of the architecture are the Vault contract and the Strategy contracts.

## MaxApyVaultV2

The `MaxApyVaultV2` contract serves as the central hub for user interactions and fund management. It is an ERC4626-compatible vault that accepts user deposits, manages the allocation of funds to various strategies, and handles the distribution of profits back to users. The vault incorporates features such as deposit limits, fees, and emergency shutdown mechanisms to ensure the security and stability of user funds.

## BaseStrategy

The `BaseStrategy` contract is the foundation upon which all strategies in the MaxAPY Protocol are built. It defines the core functionality and interfaces that strategies must adhere to, including depositing and withdrawing funds, reporting profits and losses, and adjusting positions based on available capital. The base strategy contract ensures a consistent and secure implementation across all strategies.

## Strategy Implementations

The MaxAPY Protocol offers a diverse range of strategy implementations that integrate with various DeFi protocols to generate yield. Each strategy is responsible for depositing funds into a specific protocol, monitoring the position, and harvesting profits when appropriate. Notable strategy implementations include:

`BaseSommelierStrategy`: Supplies underlying tokens to a Sommelier Vault, earning the vault's yield.

`BaseYearnV3Strategy`: A base contract for strategies that interact with Yearn V3 Vaults, enabling staking of vault shares for additional rewards.

These strategy implementations showcase the maxAPY Protocol's versatility and composability, which allow it to adapt to new opportunities and optimize users' returns.


---

# 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/architecture.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.
