Skip to main content

Protocol Design

Order Routing

Pools Protocol features a smart routing engine that enables users to find the best swap path across multiple pools. This is especially useful when a direct pool between two tokens does not exist or has poor liquidity.

The routing system identifies all available pools and determines the optimal swap path by simulating various possible routes. Each route is composed of a sequence of Swap Steps, where each step represents a trade in one of the protocol's liquidity pools.

When a user initiates a swap, the system evaluates:

  • Token reserves in each pool

  • Swap direction (TokenA → TokenB or vice versa)

  • The fee charged by each pool

  • Expected output for a given input (or vice versa)

The engine chooses the route that maximizes the output amount while considering slippage and trade fees.

Price Discovery

If the token involved in the swap does not have a known price (e.g. via an oracle), the routing system estimates it by tracing a path to a token with a known value—such as IOTA. It leverages the liquidity and relative prices across pools to compute a derived price.

This dynamic routing and price estimation mechanism ensures users always get the best available rate for their trade, even in complex scenarios where the tokens being swapped don't have a direct relationship.