The DODO protocol acts as both a liquidity provider and a liquidity distributor. Liquidity distribution is achieved by providing an aggregator functionality on the trading side that enables trade between two arbitrary tokens on the same network. Intelligently finding the best order routing from a liquidity source provides traders with the best price and lowest slippage when swapping tokens.
DODO's in-house routing algorithm calculates the optimal trade path for users by aggregating liquidity from each exchange on the chain. It supports splitting between different protocols, as well as splitting between different market depths within the same protocol. After obtaining a path, the smart contract on the chain will execute the trading action for the user. The security verification in the smart contract ensures the safety of the user's funds and the validity of the offer.
There are two strategies used DODO routing, one of which is called linear routing and the other is called split-order routing.
Linear routing means that in the process of finding a transaction path, all of the coins being traded pass through the same pool, based on which the path with the best price for the target token is found (similar to the routing algorithm of Uniswap V2). This algorithm has low complexity, fast computation, less interaction with the contract, and uses less gas.
For example, if a user needs to trade ETH-USDC, the optimal path found by linear routing may be ETH-USDT-USDC, and the final path passes through only two pools, one at a time. These two pools may come from different protocols, for example, ETH-USDT is a Uniswap V3 pool and USDT-USDC is a DODO pool. The linear routing algorithm collects information from all pools involving input tokens, target tokens and generic intermediate tokens in any combination from each protocol, and then recursively finds the optimal path.
Split-order routing refers to the process of finding a transaction path in which the user's funds are allocated to different trading pools simultaneously. These tokens are split between these pools at a specific proportion calculated to yield the best price for those tokens. This algorithm has high complexity, less computational speed, and more path-contract interaction than linear routing. This makes it use much more gas, but the price is better than with linear routing.
Again, using ETH-USDC as an example, the coins that the transaction path passes through may be ETH-USDT-USDC. The ETH and USDT trade may pass through two pools: 30% of the user's ETH is converted to USDT via Uniswap v3, and 70% of the user's ETH is converted to USDT via DODO V2. For the next trade in the transaction path, USDT-USDC, the initial USDT is the sum of the above two sources of USDT, which is then optimally split between several USDT-USDC trading pools to yield the final amount of USDC.
In order to control the gas and increase the success rate of the transaction, no more than three pools are passed through for each pair.
The following is a list of liquidity sources that are used to execute trades by DODO's routing algorithm:
Ethereum: DODO V1, DODO V2, UniSwap V2, UniSwap V3, SushiSwap, ShibaSwap, CurveV1 Partial Stable Coin Pools
BSC: DODO V1, DODO V2, Pancake V2, Pancake V1, MDEX, BakerySwap, GamBit, Biswap, ApeSwap, BabySwap, WooFi
Aurora: DODO V1, DODO V2, Trisolaris, wannaSwap
Boba: DODO V1, DODO V2, ooLongSwap
DODO's in-house SmartTrade routing algorithm still has more room for optimization, and we will continue to optimize trading paths and token splitting in order to get better quotes. DODO continues to work hard to provide better prices to our users.