Smart Order Router (SOR)
Last updated
Last updated
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.
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).
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.
In the set of Gaming DEX pools, the optimization mechanism finds the path with the highest output (after gas cost payment).
The Smart Order Router retrieves a list of all pools that contain the two tokens that the user wishes to trade.
The transaction size is then optimized across all pools for the best overall execution process. This takes into account pool slippage and gas costs.
Finally, the swap procedure is bundled and sent to the Vault as a BatchSwap for atomic execution.
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.