Skip to main content

Module most_liquid

Module most_liquid 

Source
Expand description

Most Liquid algorithm implementation.

This algorithm finds routes by:

  1. Finding every route between the two tokens as a sequence of tokens, no pools chosen yet
  2. Ranking those sequences by spot price and liquidity depth, deepest first
  3. Solving each sequence hop by hop, taking the pool that pays most at the amount that reaches it — one simulation per pool per hop rather than per pool combination, and never the same pool on two hops
  4. Ranking the solved sequences by net output (output less gas, in the output token)
  5. Building swaps for the winner alone, with stats recorded to the tracing span

Structs§

DepthAndPrice
Algorithm-specific edge data for liquidity-based routing.
MostLiquidAlgorithm
Algorithm that selects routes based on expected output after gas.