# High Level Architecture

Locust integrates on-chain smart contracts with an off-chain executor. This architecture delivers a DeFi native product with high levels of customization, flexible strategies, and excellent performance.

**Core Components**

1. **Fund Contract (Vault):**
   * **User Interactions:** Users deposit funds into the Fund Contract and redeem them when needed.
   * **Purpose:** It acts as a secure vault for storing user assets and serves as the central repository for fund management.
2. **Strategy Contract:**
   * **Fund Withdrawal:** The Strategy Contract periodically withdraws funds from the Fund Contract to implement specific investment strategies.
   * **Periodic Repayment:** To support ongoing user redemptions and ensure accurate accounting, the Strategy Contract periodically repays a portion of the funds back to the Fund Contract.
   * **Authz Grants:** This contract issues authorization (Authz) grants to the off-chain Locust executor, defining what actions the executor is permitted to perform.
3. **Locust Off-Chain Executor:**
   * **Management Role:** It manages the funds held within the Strategy Contract, executing strategy-specific operations.
   * **Security via Authz:** The executor is only authorized to sign messages on behalf of the Strategy Contract when it holds the appropriate Authz permissions. This design ensures that every action taken is explicitly permitted and verificable on-chain.

<figure><img src="/files/hN986oGTqZCcZT0EBia1" alt=""><figcaption><p>Figure 1: High Level Locust Architecture</p></figcaption></figure>

{% file src="/files/1rErjHZiyQnPvq1rCs9n" %}


---

# 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://docs.margined.io/design/high-level-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.
