Integrating Ekubo
There are several ways to integrate Ekubo, depending on what you’re building.
Swap on-chain from a smart contract
Section titled “Swap on-chain from a smart contract”Every interaction with Ekubo goes through the Core singleton’s lock callback pattern: call lock, receive a callback, perform swaps and settle net token amounts at the end. See Swapping for the flow. On EVM, production swaps go through the gas-optimized Yul Router with routes encoded by @ekubo/yul-router-sdk; the Router contracts (Starknet, EVM) are reference implementations for building your own.
Quote Ekubo liquidity off-chain (aggregators, solvers)
Section titled “Quote Ekubo liquidity off-chain (aggregators, solvers)”To route trades through Ekubo pools you need to simulate swaps off-chain. The easiest path is the Quoter API, which returns block-pinned split routes ready to execute. To compute quotes yourself, use the SDKs — the Rust SDK implements every pool type and extension — or see Price representation and Pool math to implement the math directly. Remember that pools with extensions can modify swap behavior; see the Aggregators guide for how to handle them safely.
Index Ekubo data
Section titled “Index Ekubo data”The open source indexer ingests Ekubo events on any supported chain into Postgres — it is the same code that powers the Ekubo API. Run your own instance for low-latency or high-volume needs.
Connect an AI agent
Section titled “Connect an AI agent”The public MCP server at mcp.ekubo.org exposes quoting, pool and position data, and unsigned execution plans to any MCP-capable agent.
Provide exclusive, quoted liquidity
Section titled “Provide exclusive, quoted liquidity”Market makers can run RFQ-style pools where each swap is signed off-chain with its own fee and bounds, while still settling in Ekubo Core — see Signed exclusive swaps.
ekubo_sdk (Rust) computes quotes across every pool type; @ekubo/sdk provides pool math in TypeScript; @ekubo/yul-router-sdk encodes swap routes for EVM execution. See SDKs.
Reference integrations
Section titled “Reference integrations”Production integrations of Ekubo you can use as working examples:
| Integration | Language | What it shows | Ekubo code |
|---|---|---|---|
| KyberSwap dex-lib | Go | Aggregator pool discovery, state tracking, and swap simulation | pkg/liquidity-source/ekubo |
| ParaSwap dex-lib | TypeScript | Aggregator integration with on-chain quoting and event-based state | src/dex/ekubo |
| Tycho | Rust | Substreams-based indexing and off-chain swap simulation of Ekubo V3 | protocols/substreams/ethereum-ekubo-v3, crates/tycho-simulation/src/evm/protocol/ekubo_v3 |
Questions about an integration? Ask in the Ekubo Discord.