> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lunya.io/llms.txt
> Use this file to discover all available pages before exploring further.

# DEX Integration Overview

> What carries over from Uniswap V3, what differs, and where to start

## Orientation

The exchange core is a **port of Uniswap V3** — extended with three pool types and a plugin system. For an integrator that means most of your V3 knowledge and tooling transfers, and the places where it does not are few, deliberate, and listed here.

Three ways in, by depth:

1. **The [SDK](/developers/sdk)** — quoting, swapping, curve trading; unsigned calls, bring your own signer.
2. **The periphery** — [`SwapRouter` and `Quoter`](/developers/dex/swaps-and-routing) for execution and pricing, the position manager for liquidity.
3. **The pools directly** — [`swap` + callback](/developers/dex/swaps-and-routing#the-pool-level-swap) for aggregators that settle themselves.

## What is identical to Uniswap V3

| Surface                                                                             | Status                                                     |
| ----------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `Swap`, `Mint`, `Burn`, `Collect`, `Flash`, `Initialize` events                     | **Byte-identical** — subgraphs and indexers work unchanged |
| `swap`, `mint`, `burn`, `collect`, `flash`, `initialize` signatures                 | Identical                                                  |
| `ticks`, `tickBitmap`, `positions`, `liquidity`, `feeGrowthGlobal*`, `protocolFees` | Present and identical                                      |
| Position manager `IncreaseLiquidity` / `DecreaseLiquidity` / `Collect` events       | Signature-identical, down to which argument is indexed     |

The identical events are what carry the integration: aggregators discover pools by indexing, and that path works with no changes.

## What differs

| Surface                | Difference                                                                                                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Callbacks              | `lunyaSwapCallback` / `lunyaMintCallback` / `lunyaFlashCallback`, not `uniswapV3*`                                                                                        |
| Route encoding         | The path's middle field is a **one-byte pool type**, not a three-byte fee — see [Swaps & Routing](/developers/dex/swaps-and-routing#path-encoding)                        |
| Pool identity          | `(token0, token1, poolType)` — **no fee tiers**; `createPool` takes no fee argument                                                                                       |
| Pool addresses         | CREATE2 from the **deployer** (a separate contract, not the factory), one init code hash **per pool type** — see [Pools & Discovery](/developers/dex/pools-and-discovery) |
| `fee()`                | Absent — the fee is plugin-decided per swap; `feeInfo()` returns `(fee, isDynamic)`, backward-looking                                                                     |
| `slot0()`              | Five fields, not seven: `(sqrtPriceX96, tick, fee, feeProtocol0, feeProtocol1)` — same shape on **every** pool type                                                       |
| Oracle                 | Not in the pool — the TWAP lives in a [plugin](/exchange/plugins#twap-oracle), governance-replaceable per pool                                                            |
| `SetFeeProtocol` event | `uint16 × 4`, not V3's `uint8 × 4` — the one indexer handler that needs changing                                                                                          |

## Rules of thumb

1. **Never point V3 periphery at these pools** — the callback names alone guarantee failure, and address validation by init-code-hash recomputation is wrong here.
2. **Validate pool callers against `factory.getPool(...)`**, not a hardcoded init code hash: blueprints are governance-replaceable, and there is one hash per type anyway.
3. **Read prices via `slot0()` or `sqrtPriceX96()`** — shared, uniform, never reverting (an uninitialized pool returns zeros). On tickless pools the `tick` is a measurement, not a mintable index.
4. **Reuse your V3 indexing** for the six trading events; add handlers for what is new — see [Events](/developers/dex/events).
5. **Oracle trust**: a pool's TWAP is a plugin the pool's governance can swap; factor that in before using a pool as a price source.
