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

# AMM Integration

### <mark style="color:$info;">To integrate your AMM:</mark>

### Requirements

* Factory contract address
* Fee info
* Pool type (V2, V3, custom)

### Data structure

**V2:**

```
json{
  "pool": "0x...",
  "token0": "0x...",
  "token1": "0x...",
  "reserve0": "...",
  "reserve1": "...",
  "feeBps": 30
}
```

**V3:**

```
json{
  "pool": "0x...",
  "token0": "0x...",
  "token1": "0x...",
  "sqrtPriceX96": "...",
  "liquidity": "...",
  "tick": 0,
  "feeBps": 30
}
```

### Integration steps

1. Provide DEX details
2. Compatibility check
3. Add to system
4. Route testing

### Performance requirements

* API response < 500 ms
* Data freshness < 1 min
* Min liquidity > $10,000
* Stable contracts

## Technical Details <a href="#technical-details" id="technical-details"></a>

### <mark style="color:$info;">Algorithms</mark>:

* Bellman-Ford
* Dynamic Programming
* Weighted Distribution

### <mark style="color:$info;">Metrics</mark>:

* **Build time:** \~200 ms
* **Accuracy:** ±0.1%
* **Max routes:** 5
* **Max hops:** 4

### <mark style="color:$info;">Caching</mark>:

* **Pool states:** 15–30 s refresh
* **Swap results:** 10 s cache
* **Token symbols:** persistent

<br>


---

# 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://dirolprotocols-organization.gitbook.io/dirol/amm-integration.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.
