How Smart Routing Is Designed to Work on t0ns

Product
By Alex Horbov, CEO
Token icons for TON, Bitcoin, Ethereum, Tether, USDC and others on rings around a center point, suggesting swap routes

When it comes to decentralized exchanges (DEXs), one of the biggest challenges is routing a swap across fragmented liquidity, where the same tokens can sit in several different pools. t0ns is building a smart routing system designed to compare the available paths for a swap and choose one.

t0ns is in pre-launch. Swaps and liquidity pools are not yet publicly available.

The system would calculate routes when a swap is requested, weighing price, slippage, and execution speed. Here’s a closer look at how it is designed to work.

1. Route Calculation on the Backend

In the planned design, the process begins on the t0ns backend, which is meant to collect on-chain data from the liquidity pools within the DEX. This data would include token reserves, pool sizes, current prices, and fee structures.

Once the data is collected, the routing algorithm would construct multiple possible swap routes for each transaction request.

For example:

  • Direct route: A → B
  • Multi-hop route: A → TON → B
  • Complex route: A → USDT → TON → B

Each potential path would be evaluated using the pricing model of the pools it passes through, such as the Constant Product AMM formula (x × y = k) for standard pools. This would let the system simulate the expected output for each route, factoring in pool liquidity, trading fees, and estimated slippage.

The result would be a map of feasible routes, ranked by effectiveness.

2. Optimization Logic: Choosing a Path

Once the potential routes are calculated, the optimization logic would take over. Here’s what the design calls for next:

  • Effective output comparison: Each route would be scored based on the net amount of tokens the user would receive after all fees and slippage are accounted for.
  • Pool scoring system: Pools with low liquidity, unstable reserves, or poor historical performance would be deprioritized automatically.
  • Slippage sensitivity: The algorithm is meant to simulate how each route would perform under different slippage levels. If the first step of a multi-hop swap shows excessive slippage, that route would be discarded.

Routes would be chosen by net output rather than by speed alone.

Additionally, users would be able to set their own slippage tolerance.

The slippage tolerance sets how far the execution price may move from the expected price while a swap is pending; if the price moves further, the swap fails and does not execute. Experienced traders could fine-tune settings to match their strategy.

3. Displaying the Result to the User

After calculations and optimizations are complete, the t0ns interface would display the results in a clear and user-friendly way:

  • Default mode: Only the top-ranked route would be shown, to keep the view simple.
  • Advanced mode: Users would be able to explore route options with detailed metrics, including price impact, hop count, and expected slippage.

The intent is to give traders control without overwhelming them. Beginners could rely on automation, while power users could analyze and compare paths manually.

4. On-Chain Execution

Once the user confirms the swap, the backend would send a pre-built instruction to the smart contract, including the exact route — i.e., the sequence of pools to execute.

The smart contract would then process the swaps step-by-step:

  • Each swap in the route would be executed on-chain.
  • The contract would follow the pre-calculated path.
  • The route computation itself would stay off-chain (to save gas and time), with only the execution happening on-chain.

This architecture is intended to keep trades verifiable on-chain while limiting the time and cost of computing routes.

Why Smart Routing Matters

Without smart routing, users often face inefficient swaps — paying higher fees or receiving less than optimal prices. By automating route discovery, t0ns is designed to combine performance with simplicity inside a Telegram-native environment.

The goal is for t0ns to handle route selection so that users do not need to think about liquidity distribution, pool depth, or fee differences.

As the DEX develops, smart routing could expand to include new liquidity sources, cross-chain routes, and adaptive logic based on TON’s evolving ecosystem.

In Short

  • Data-driven routing: Routes would be calculated from current pool data.
  • Optimization engine: Designed to compare direct and multi-hop paths.
  • User-friendly interface: Planned to show one suggested route by default, with an advanced view for experienced users.
  • On-chain execution: Swaps would be processed by the smart contract, with route computation kept off-chain.

Smart routing is planned as a core part of the t0ns DEX on TON.

The full sequence from input validation to network execution is walked through in what happens between a tap and a swap.