How a route is built
Updated
What Smart Route does between the amount you type and the transaction you sign: where it looks, what one transaction may combine, and why a quote never changes behind your back.
One transaction, all or nothing
Every swap is a single transaction. When it reaches a block, all of it happens; if any part cannot, none of it does and your coins stay in your wallet. A route has one of two shapes:
- Direct: the whole amount through one source, which is a V2 pool, a V3 range, a Lithos pool, a Machina order or the SigmaUSD bank.
- Split: one transaction across several sources: V3 ranges (Crux concentrated liquidity) and Machina orders, together with at most one fixed source, which is a V2 pool, a Lithos pool or the SigmaUSD bank.
A fixed source has to recreate its own box as the first output of the transaction, so two of them never fit in one. Lithos pools and the bank do not share a transaction with V3 ranges either, and a Lithos pool of two tokens without ERG always trades alone.
When there is no route
If no transaction of these shapes can fill the swap, ErgoDEX shows “No route”. It does not chain two transactions through a third token. Such routes were removed: when a second step failed, the first had already left you holding the token in the middle. You can still make the two swaps yourself.
Where it looks
Quotes are made from the boxes live on the chain at the latest block: V2 (Legacy) pools, V3 ranges, Lithos pools, open Machina orders and the SigmaUSD bank. A box already spent by a transaction waiting in the mempool is left out, and a source that cannot be read is left out of the quote rather than guessed.
Settings → Route decides what a market swap may take:
- Best, the default: whatever pays most in one transaction, through one source or split, or a smart order.
- One pool: the whole amount through the single best pool, bank or order.
Picking a V3 pool in the pool list pins the swap to that pool: the route uses only its ranges, and the Route setting does not apply to that swap.
A quote is pinned to its boxes
A quote names the exact boxes it read. When you press Swap, our server checks every one of them against the chain again before it builds the transaction. If one has moved, because a pool traded, an order filled or the bank changed, the server does not rebuild the swap on other boxes: it refuses, and ErgoDEX asks you to review a fresh quote.
A quote also expires 12 seconds after it is made. An expired quote is never signed; ErgoDEX shows a fresh one.
The least you receive
Every swap transaction states the least you accept: the quote less your slippage, 0.5% by default (Settings → Slippage, up to 50%). If the pools have moved past it by the time the transaction reaches a block, the transaction is invalid and nothing leaves your wallet.
Price impact is guarded apart from slippage: from 10% a market swap needs a second press, and above 30% it is blocked unless Settings allows it (see the FAQ).
What the route card shows
The card shows each source with its share of the amount. Route details add the minimum received, the average rate, the price impact, the pool and protocol fees of every source together as a share of what passes through (the network fee is separate), and every part with its minimum, fee, impact and the box it spends. They also list the single sources quoted for the whole amount, and how the route compares with the best of them.
Smart orders
A large ERG swap can pay more split across fixed sources, which cannot share a transaction. ErgoDEX then offers a smart order beside the route, but only when it beats the one-transaction route by at least 0.3% after its fee. You sign once, and our executor fills it, one source per transaction. How it fills: How orders are routed and filled. What it costs: Fees.