> 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>
