Smart-Order Router
Find the best swap prices on Sui across any DEX, all in one place
Last updated
Find the best swap prices on Sui across any DEX, all in one place
Last updated
Our Smart Oder-Router (SOR) is a DEX aggregator which connects not only to all of the pools on Aftermath, but also any other DEX on Sui which provides an API we can connect to and has sufficient liquidity. This means that when you choose an asset you wish to trade for, our Router will search every DEX on Sui to find you the best deal, even if it doesn't come from one of our own pools.
Currently, the Aftermath SOR is integrated with liquidity pools on Aftermath, DeepBook, Cetus, Turbos, FlowX, Kriya, Suiswap, and BlueMove. As the Sui DeFi ecosystem grows and new sources of liquidity come online, they too will be integrated into our router to ensure you only need to go to one place to ensure you receive the best price for all of your swaps.
Beyond merely searching every liquid DEX on Sui, the Smart-Order Router is also capable of splitting a single swap into multiple sub-paths. This means that a percentage of the swap can route through one or multiple pools on one DEX, while multiple other sub-paths can complete the remainder of the trade. This is especially useful when performing large trades, as the slippage incurred is greatly minimized when the trade can be split across multiple pools on multiple DEXes. We took full advantage of Sui’s native features when designing our aggregator, so routes always require the end user to sign just one transaction, regardless of the route's overall complexity or total number of swaps.
Splitting a trade into multiple sub-paths is made possible by the use of Programmable Transaction Blocks (PTB). With PTBs, multiple co-related swaps can be batched together into one atomically-executed transaction. Route-wide validity checks are enforced using a Hot Potato pattern, to ensure slippage tolerances are not exceeded. This also leads to greater security by preventing misuse of coins touched throughout the route, as some sub-paths involve coins other than the input and output coins specified by the user. Permissionless composibility is made possible by enforcing these security measures at the contract level, allowing others to build on top of the SOR.
By designing our Router with permissionless composability in mind, we have made it simple for other Sui builders to integrate the SOR into their dApps. Current SOR integrations include Aftermath's Dynamic Gas feature, in-wallet swaps on Nightly wallet, swaps within the Scallop Tools UI, and trading through the Suiba Telegram bot, with more integrations to be announced soon!