Starknet's flagship AMM. Singleton `Core` contract with super-concentrated liquidity, flash accounting, native ETH swaps, and a first-class `extensions` model — pools can be parameterized by extension contracts (TWAMM, oracle, MEV-resist) so the AMM functions like a programmable execution venue.
- 01Starknet token swaps
- 02super-concentrated LPing on Cairo
- 03TWAMM / time-weighted execution
- 04oracle-extension TWAP feeds
- 05extension-based custom pool logic
- pnpm add @ekubo/sdk starknet
| Variable | Scope | Description |
|---|---|---|
| NEXT_PUBLIC_STARKNET_RPC_URL | Client | Starknet mainnet JSON-RPC URL used to read Ekubo Core, the quoter, and extension contracts. |
Use Ekubo for swaps and LPing on Starknet. Quote via the Ekubo HTTP quoter (`GET https://mainnet-api.ekubo.org/quote/{amount}/{tokenIn}/{tokenOut}`) — it returns the optimal split route and expected output. Execute through Ekubo's `Core` singleton (`0x00000005dd3D2F4429AF886cD1a3b08289DBcEa99A294197E9eB43b0e0325b4b`) by calling `swap(node, route, token_amount)` from a multicall: locking happens via `Core.lock(callback)` which invokes your callback contract for the swap path. Pools are identified by `PoolKey { token0, token1, fee, tick_spacing, extension }` — `extension` is `0x0` for vanilla pools or a non-zero extension contract for TWAMM/oracle/custom logic. Manage positions via the `Positions` contract, which mints an ERC-721 representing each LP range.
- ⚑Pools are keyed by `(token0, token1, fee, tick_spacing, extension)` — the same token pair with different extensions are entirely separate pools; routing to the wrong extension can hit a TWAMM that won't fill instantly.
- ⚑Cairo signed-tick math behaves differently from Solidity — sqrt-price representations are 128.128 fixed-point; SDK code lifted from Uniswap v3 will produce wrong amounts.
- ⚑Swaps are executed inside a `Core.lock` callback — your contract must handle the re-entry and settle balances before the lock returns, or the transaction reverts; this is unfamiliar to devs coming from EVM Uniswap v4.
- ⚑Starknet fee market: paymaster usage and `version=3` transaction fields (`l1_gas`, `l2_gas`, `l1_data_gas` resource bounds) must be set correctly or transactions get rejected; the SDK helpers in starknet.js handle this if used through `account.execute`.
- ⚑Out-of-range concentrated positions earn nothing and are exposed to IL on a JIT-friendly chain — tight ranges on volatile pairs typically lose money without active rebalancing.
- ⚑TWAMM orders execute over time on every block touch; an order can sit partially filled if no swap-or-touch happens — UI must show pending vs filled portions and let users `withdraw_proceeds_from_sale_to`.