DEV Community

Mandie Brugman
Mandie Brugman

Posted on

5 Inputs That Change Identical Swap Routes

If you are getting different splits for the same pair, the router is optimizing against a different trade size, liquidity snapshot, or cost model. A route is a quote for specific conditions, not a permanent property of two token symbols.

When you compare quotes, hold the chain and amount constant first; ParaSwap exposes route breakdowns that help you see whether flow moved between pools or the total output changed. Then check the search and execution settings.

A route is an optimization result, not a pair property

A router models pools as edges in a token graph, then evaluates candidate paths and, where supported, splits the input across paths. It selects a composition that scores well under its objective, usually output after estimated gas, subject to route-search limits.

For example, a $100,000 USDC-to-WETH trade might use two direct pools and a USDC-to-DAI-to-WETH path. A smaller trade could favor one pool: the extra path may add gas without enough price improvement. A different block can also change pool balances and reverse that ranking.

Five inputs change the composition

  • Trade size: Larger input moves a pool further along its price curve, so splitting can reduce price impact. Tiny allocations may be discarded if their marginal gain is below the added gas.
  • Pool state: Reserves, concentrated-liquidity ticks, and fees are read from a particular chain state. Even adjacent blocks can change the best split after a swap or liquidity update.
  • Search limits: A hop cap, eligible-source list, or pruning threshold changes which paths the router evaluates. A cap of 2–4 hops is a common kind of search constraint, but the setting varies by router and chain.
  • Gas model: Each extra pool call and split adds execution cost. The router estimates gas and converts it into the quote’s value; a route with better gross output can lose after gas, especially for small trades.
  • Token behavior: Fee-on-transfer, rebasing, or otherwise nonstandard tokens can make quoted amounts diverge from received amounts. A router may exclude a pool or token, or the transaction may fail if its transfer assumptions do not hold.

Compare routes by fixing the quote inputs

To diagnose a changed composition, request both quotes for the same chain, exact-input or exact-output mode, amount, and block where possible. Compare per-path amounts, pools, fees, estimated gas, and net output; a changed split with nearly unchanged net output may simply be a tie broken differently.

Keep slippage tolerance separate from route selection: it sets how much execution can move before a transaction reverts, not which pools the quote searches. I would start with the router’s default search limits, then inspect the ParaSwap SDK route data if the split itself matters to the app.

For a production integration, log the quote parameters and block alongside the selected route. That makes a later route change reproducible. Practical tip: compare net output after gas at the same amount before deciding that a new composition is better.

Can identical pairs return different routes seconds apart?

Yes. Pool state can change between blocks, and another trade can shift a pool’s marginal price enough to change the best split. Searcher configuration or gas estimates may also change. For a controlled comparison, pin the block when the quote interface permits it and keep every other parameter fixed.

Does a different split always mean a better quote?

No. It may produce nearly the same net output, or even a worse result if the route adds gas. Compare expected output after estimated gas and check whether the quote is exact-input or exact-output. A composition is useful only insofar as it improves the objective you care about.

Why can a quoted route fail on execution?

The quote uses a snapshot and assumptions; execution happens later against live state. Prices can move past the slippage limit, liquidity can change, or a token’s transfer behavior can differ from the router’s assumptions. For unusual tokens, verify support and test the exact transaction path before relying on the quote.

Top comments (0)