# Architecture

<figure><img src="/files/jTa1mDEFDOHqXNz7YJOk" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
**Architecture**\
Each strategy (hXXI, HYPE++, etc) is a standalone unit comprising key components: the *Vault, the strategy contract,* and the *Trader OMS*. \
\
1\) **The Vault Contract (V1 & V3 Contracts)**\
The Vault is the user facing ERC-4626 compatible single staking vault, which handles all deposits, withdrawals, and share accounting functions. When a user deposits funds in the vault, they receive a vault token representing their share in the vault. The vault facilitates simplified single-click access to the strategies in a familiar interface.\
\
2\) **The Trader Contract** \
Each vault deployment utilizes a unique trader smart contract which defines allowable trading parameters and roles including:

* Allowed Spenders&#x20;
* Allowed Tokens&#x20;
* Enabled trading modules&#x20;
* Enabled trading function
* Executor role<br>

The trader contract ensures trading parameters are defined by the smart contracts according to the strategy mandates. \
\
\**See Product Disclaimer: Investment risks for additional details regarding interaction with Anchorage Digital Porto Wallet via Approved Investment Manager structure.*\
\
3\) **The Trader OMS (Strategy Contract)**\
The Trader OMS serves as the interface for our trading team to actively trade according to strategy mandates. The OMS embeds traditional hedge fund risk limit parameters within its smart contracts, ensuring trading is limited within the defined smart contract parameters, direct withdraws are restricted, and no exposure to front end exploits to integrated DeFi protocols. \
\
OMS smart contracts are built on a modular (diamond / cutter) system facilitating protocol interactions and expansion. Each module can be assembled to modify or create new strategies with minimal development or security risks to quickly capture market opportunities as they arise.\
\
The OMS provides a secure and powerful interface for safely executing the strategy within the risk parameters of the smart contracts.
{% endhint %}

**Strategy Flow**

The strategies are deployed in cycles called “epochs.” Each epoch has a *funding* phase, a *trading* phase, and a *withdraw* phase. \
\
**Funding Phase**: When the vault opens in the funding phase, users can deposit the vault’s underlying currency. Users can also withdraw freely during this phase.\
\
**Trading Phase:** During the trading phase, users may not deposit or withdraw, and the trader smart contract may take custody of the vault’s funds to run the strategy mandates. \
\
**Withdraw Phase:** At the conclusion of the epoch, the funds are returned to the vault +/- PNL for users to withdraw at NAV or automatic rollover to next epoch.&#x20;

{% hint style="info" %}
Depending on position structure, there may be an unwinding period upon conclusion of the epoch:\
\
Flagship Strategies: Funds are returned to vault within 72 hours of expiry. \
Tactical Strategies: Funds may be traded upto 30 days past expiry based on market opportunities.
{% endhint %}


---

# 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://gitbook.d2.finance/protocol/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.
