> For the complete documentation index, see [llms.txt](https://yieldex.gitbook.io/yieldex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yieldex.gitbook.io/yieldex-docs/architecture/overview.md).

# Overview

The Yieldex architecture is divided into three key modules:

1. Data Collection Module
2. Decision Making / Analytics Module
3. On-chain Interaction Module

<figure><img src="/files/0ZevDt22Bf9451HnczgF" alt=""><figcaption></figcaption></figure>

### Data Collection Module

* Collects information about current APY/APR, TVL, availability, etc. from the protocols in different networks.&#x20;
* Store results in a database and periodically update (e.g., every 10 minutes).&#x20;

### Decision Making (Analytics) Module

* Receives grouped data on returns
* Calculates whether it makes financial sense to transfer funds: for example, from AAVE USDT (APY \~5%) to Compound USDT (APY \~8%).&#x20;
* Generates a "call to action" — a structure that specifies the network, protocol, token (USDT, USDC, etc.), quantity, and target return.&#x20;

### On-chain Interaction Module

* Accepts "call to action" and initiates transactions on users' smart wallets
* Uses ERC-4337 mechanics to securely aggregate transactions within a single "UserOperation".&#x20;
* Sets signing parameters, and uses session keys for limited actions (deposit/withdraw/borrow/repay).

### Sequence from Deposit to Rebalance

{% @mermaid/diagram content="sequenceDiagram
participant User as User (EOA)
participant SAcc as SmartAccount (ERC-4337)
participant DCM as DataCollection
participant DMM as DecisionMaking
participant OIM as OnChainInteraction
participant Protocol as Onchain Protocol
Note over User, SAcc: 1) activates Yieldex and grants permissions
User->>SAcc: Create smart account<br/>+ Setup session keys
SAcc-->>User: Done
Note over DCM, DMM: 2) Data collection and decision logic
DCM->>DMM: Yield/APY data
DMM->>DMM: Profit analysis (Delta\_Profit > threshold?)
alt Profit is significant
DMM->>OIM: Call to Action<br/> {operation: rebalance}
OIM->>SAcc: Transaction request<br/> deposit/withdraw
SAcc->>SAcc: Check session key
SAcc->>Protocol: re-deposit/withdraw
Protocol-->>SAcc: Done
SAcc-->>OIM: Transaction executed
else Small profit
DMM->>DMM: Skip
end" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://yieldex.gitbook.io/yieldex-docs/architecture/overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
