Gaming DEX
  • Gaming DEX
    • Gaming DEX Overview
  • PRODUCT
    • Pools
      • Weight Pools
      • Stable Pool
      • Extra Rewards
    • The Vault
    • Smart Order Router (SOR)
    • Anti-Trader Field (AT-Field)
    • MultiGemSwap
  • LOGIC
    • Weight Math
    • Stable Math
    • Service Fee
  • BRIDGE
    • Bridge Specification
  • TOKEN
    • Z Token
    • Gauge
  • CONTRACTS
    • Oasys Hub
    • DeFi Verse
  • OTHRES
    • Roadmap
    • FAQ
    • Disclaimer
    • Revision History
Powered by GitBook
On this page
  • Overview
  • Leveraging All The Liquidity
  • Gas Considerations
  • Structure
  • Multiple Pools, Same Spot Prices
  1. PRODUCT

Smart Order Router (SOR)

PreviousThe VaultNextAnti-Trader Field (AT-Field)

Last updated 6 months ago

Overview

The Smart Order Router (SOR) finds the best price for traders. SOR finds the optimal trade for a given input and output token, whether it is a direct Swap in one pool or a combination of trades hopping multiple pools.

Leveraging All The Liquidity

The more pools you have, SOR will increase. SOR will continue to expand as new pool types using different calculation methods are added. This ensures that the transaction can be supported by all pools within the Gaming DEX ecosystem.Any custom pool built on the Gaming DEX can benefit from the liquidity of all other Gaming DEXs by integrating with SOR. To integrate the pool, a first- and second-order differential "spotPriceAfterSwap" function is required. (numerically or analytically differentiable).

Gas Considerations

A transaction between two tokens would involve each pool containing the pair in an ideal world where gas costs are negligible. In this case, the trader can take advantage of all available liquidity while maintaining the same price in all pools.This is an arbitrage-free scenario in which no profit is drawn from the pool's price differential. A pool is only added to the path if the price difference is sufficient to cover the gas, as the cost of gas rises each time a Swap is added to a batch. Since only a portion of the pool is considered, arbitrage opportunities between pools may arise.

Structure

In the set of Gaming DEX pools, the optimization mechanism finds the path with the highest output (after gas cost payment).

  1. The Smart Order Router retrieves a list of all pools that contain the two tokens that the user wishes to trade.

  2. The transaction size is then optimized across all pools for the best overall execution process. This takes into account pool slippage and gas costs.

  3. Finally, the swap procedure is bundled and sent to the Vault as a BatchSwap for atomic execution.

Multiple Pools, Same Spot Prices

SOR is designed to create an arbitrage-free condition between the paths used in order to obtain the best price for the trader. To accomplish this, after the Swap is completed, each route through the SOR must offer the same spot price.