Holdr Protocol Overview
  • Protocol Overview
  • Developer Docs
  • Product
    • Overview
    • The Vault
    • Pools
      • Weighted Pools
      • Composable Stable Pools
      • Liquidity Bootstrapping Pools (LBPs)
    • Smart Order Router
  • Concepts
    • Math
      • Weighted Math
      • Stable Math
    • Fees
  • Ecosystem
    • Governance
    • veHLDR and Gauges
      • veHLDR
        • How veHLDR Works
        • How To Use veHLDR
        • How veHLDR Boosting Works
          • Working Supply
          • Calculating My Boost
          • Minimum veHLDR for Max Boost
      • Gauges
        • How Gauges Work
  • Developers
    • Deployment Addresses
  • Getting Started
    • FAQs
      • Swapping
      • Liquidity
      • Liquidity Mining with the veHLDR and Gauge System
      • Fees
      • The Vault
      • Pools and LBPs
Powered by GitBook
On this page
  • Overview
  • Utilize All the Liquidity!
  • Taking Gas Into Account
  • How It Works
  • Multiple Pools, Same Spot Price
  1. Product

Smart Order Router

PreviousLiquidity Bootstrapping Pools (LBPs)NextMath

Last updated 2 years ago

Overview

The Smart Order Router (SOR) finds the best prices for Holdr traders. For given input and output tokens, the SOR finds the optimal trades whether that is a direct swap in one pool, or a combination of trades hopping through multiple pools.

Utilize All the Liquidity!

As the variety of Holdr pools grows, the SOR grows too! The SOR keeps expanding as new pool types that use different math under the hood are added. This ensures that all pools in the Holdr ecosystem can support trades. By integrating with the SOR, any custom pool built on Holdr can benefit from all the other Holdr liquidity. All you need to integrate a pool is first and second order differentiable spotPriceAfterSwap functions (differentiable either numerically or analytically).

Taking Gas Into Account

In an ideal world in which gas costs are negligible, a trade between two tokens would involve each Holdr pool that contains that pair. This would utilize all the available liquidity for the trader and maintain equal prices across all pools. Such a scenario would be an arbitrage-free state, in which no value could be extracted from the pools' price differences.

Since there are incremental gas costs for each swap added to a batch, additional pools are added to the path only when they provide enough of a price difference to make up for the gas. Since only a subset of pools are considered, this can create arbitrage opportunities across Holdr pools.

How It Works

The optimization mechanism finds the path through a set of Holdr Pools with the greatest output (after gas costs).

Multiple Pools, Same Spot Price

In order to get the best price for a trader, the SOR is designed to create an arbitrage-free state between the paths it's using. In order to achieve this, each path the SOR routes through needs to provide the same spot price after the swap has completed.

Page cover image