3Route DEX Aggregator. How it Works.
A bit of theory
DEX aggregators are widely used in the DeFi world. But in Tezos these ones are especially needed. This comes out from several observations:
There are quite many competitive DEXes. There are a number of different DEXes in Tezos that have a comparable liquidity. Each of them has its own list of liquid tokens.
Liquidity is very distributed between different pools. DEXes are developing fast and new pools are appearing. Some liquidity is getting there but some remains in the old pools.
The "base" currency is different in top DEXes. Some DEXes promote their token as a base currency for most liquid pairs. So, users often have to go through several pools to swap an arbitrary token A to token B
Stablecoins are competitive and stable DEXes are widespread. A number of different stablecoins are widely used in Tezos. And several DEXes already made their own Stableswap type pools.
All this leads to the situation, when you can find many different ways (let's name them routes) through DEXes to swap an arbitrary token A to token B. In other words, to swap A for B you can firstly swap A for C on DEX1, then C for D on DEX2, and then D for B on DEX3. Our small research has shown that for popular pairs you can often find more than 100 different routes consisting of no more than 3 consecutive swaps. And every such route gives its own resulting price for a specific volume.
Why is this not too good?
Let's imagine what happens when someone makes a swap on some particular pair on some DEX in Tezos. This trade immediately creates a number of unbalanced routes on various DEXes, which is actually an arbitrage opportunity. So many users actually lose some amount of money in every DEX swap, because they cannot use the DEXes' liquidity efficiently.
So, the first thing to do is to build the best route for the specific volume of your swap. And if there are hundreds of possible routes - finding the best one is already not an easy task.
Why is routing not enough?
Even if you use some advantageous route for your swap, it immediately creates some arbitrage opportunities in some other routes. So, if the size of your swap is sufficient, arbitrage bots immediately find some route that can extract some money from DEXes after your swap. So, you actually pay them, because you can't use all DEXes liquidity at once.
That's why 3Route doesn't only find one best route for your trade. It also finds some more good routes, and then it distributes your volume between these routes in order to get the best possible price for your swap. In other words, it minimizes the total price impact of your swap.
Why smart contracts?
Another crucial thing about 3Route is that it uses smart contracts for execution of the swaps. It makes the execution of transactions much more likely. It's quite an essential thing when you try to execute a number of parallel and consecutive swaps in one transaction. So it means that your slippage could be quite small and the swap will still have good chances to be included in the block.
How you can cut your expenses in half
This is too much of a theory, but let's see how 3Route works by example. Suppose you want to swap 10 000 XTZ for uUSD. Fundamentally you have 3 options:
Option 1: find one most liquid pair on some DEX
Let's check the list of uUSD holders on the TzKT Explorer. You'll likely find the following pair:
- XTZ -> uUSD (Quipuswap XTZ/uUSD)
So, you can go to the Quipuswap DEX and find that swapping 10 000 XTZ would give you, for example, 9105 uUSD. More accurately, it means that you would have something around $645 of expenses (assuming 1XTZ = $0.975, 1 uUSD = $1) for this trade. That happens because of a significant market impact.
QuipuSwap interface, XTZ/UUSD pair
Option 2: find a best route through some DEXes
Alternatively, you can do several consecutive transactions, swapping your coins through some liquid pools to get the best final price. One common way to do it – use Temple wallet Swap service. Probably it would give the following route:
- XTZ -> kUSD (Quipuswap XTZ/kUSD) + kUSD -> uUSD (Quipuswap Stableswap uUSD/kUSD/USDT).
For example, you would get something around 9160 uUSD, which means for you about $590 of expenses. This is already much better than the Option 1 result.
Temple Route interface, XTZ/UUSD pair
Option 3: use 3Route
Finally let's see what we have with 3Route. Here we can see the following thing – your 10000 XZT would be splitted into 3 parts, and each would go through one of these 3 routes:
- XTZ -> USDt (Quipuswap XTZ/USDt) + USDt -> uUSD (Plenty Stable uUSD/USDt)
- XTZ -> kUSD (Quipuswap XTZ/kUSD) + kUSD -> USDt (Quipuswap Stableswap uUSD/kUSD/USDt) + USDt -> uUSD (FlatYouves uUSD/USDt).
- XTZ -> tzBTC (Sirius DEX) + tzBTC -> uBTC (FlatYouves uBTC/tzBTC) + uBTC -> uUSD (QuipuSwap TokenToToken).
As a result, you would get around 9438 uUSD, or approximately you would have around $312 of expenses!
3Route interface, XTZ/UUSD pair
Let's compare all 3 options:
Example: 10,000 XTZ to uUSD | You get (uUSD) | Your expense ($) |
---|---|---|
Best pair | 9105 | 645 |
Best route | 9160 | 590 |
3Route | 9438 | 312 |
So, in this example, using 3Route would give you up to 333 more uUSD! And your expenses could be more than halved!
Just in case of interest, let's also look into a smaller trade example:
Example: 1,000 XTZ to uUSD | You get (uUSD) | Your expense ($) |
---|---|---|
Best pair | 957 | 18 |
Best route | 958 | 17 |
3Route | 966 | 9 |
So, using 3Route would give you up to 9 more uUSD. And it still cuts your expenses in half!
Conclusion
Using 3Route could save users up to ~50% in costs, which seems to be really cool. But even cooler is that the 3Route protocol helps to use DEXes liquidity in a much more efficient way. And we just can't help but be happy about it.
For now it's a beta version of the 3Route protocol, so please try it. And we will be very happy to get any feedback. And also we'll keep working on that to make it more efficient and deliver you the best possible prices.