# Smart Contract Architecture

Our smart contract architecture is engineered to facilitate direct interaction between our AI models and a broad spectrum of pools , in order to enable the system to respond to market changes with minimal latency.

#### Individualized Wrapper Contracts for Pool Integration&#x20;

* **Individual Wrapper Contracts** : Each pool from our list is paired with a wrapper contract. Recognizing the diverse architectures of various protocols, these wrapper contracts are essential for normalizing interactions across pools.&#x20;
* **Standardized Interface Functions** : Despite being individually customized , all wrapper contracts adhere to a standardized format with core functions like 'deposit' and 'withdraw'. This standardization is critical for the master smart contract to uniformly interact with multiple pools, irrespective of their individual contract structures.
* **Integration with Master Contract** : The wrapper contracts act as connectors between individual DeFi pools and our central master contract. This design is what allows for the execution of AI-driven decisions across multiple different protocols.

#### Master Smart Contract and AI Model Interaction

* **Master Contract** : Our “central nervous system” , the master smart contract, compliant with the ERC20 standard. It functions as the operational nexus, orchestrating asset deposits/withdraws based on the AI's recommendations. The contract is engineered to effi ciently manage interactions with the wrapper contracts, translating AI decisions into blockchain transactions.&#x20;
* **Direct AI Model Integration** : To facilitate direct interaction between the off-chain AI models and the on-chain master contract, we employ a dedicated API gateway. This gateway acts as a secure conduit, relaying commands from the AI models to the master contract. It's designed to handle high-frequency data transmission, ensuring that the AI's real-time analyses are promptly refl ected in on-chain actions.

<figure><img src="https://3956004477-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGhcGDDb2h8fFpPreXeSt%2Fuploads%2FFlHSVMxKeYYhcH5ifcdI%2FA.I%20Aggregator%20(4).png?alt=media&#x26;token=a071367a-92ff-48a6-a3d0-2af675a80ee4" alt=""><figcaption></figcaption></figure>


---

# 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://fortuna-finance-1.gitbook.io/documentation/a.i-yield-aggregator/how-does-it-work/smart-contract-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.
