arrow-up
Tech Deep Dives

What Are DEX Aggregators? A Deep Dive by 1inch

By
Published on:
November 24, 2020

Contributor: As DEXes are growing in popularity, so are DEX aggregators — what exactly are they?

What Are DEX Aggregators? A Deep Dive by 1inch

Table of Contents

What Is a DEX?

A decentralized exchange (DEX) is a cryptocurrency exchange that operates without the involvement of a central authority or third party. As a result, a user retains full control of their funds stored or traded on DEXs, which offer a higher degree of security than centralized exchanges (CEXs). Decentralized exchanges rest on the Ethereum blockchain and require Ethereum smart contracts to operate. On the other hand, centralized exchanges are run by a third party, which collects trading fees. 


CEXs do not sit entirely on the blockchain. Because CEXs are not on the blockchain, they are faster and it is possible to transact fiat as well as crypto.   

What Is the Need for DEX Aggregation?

The birth of the 1inch MVP illustrates the need for DEX aggregators. Anton Bukov and I created the 1inch MVP in 18 hours at the ETHNewYork hackathon in 2019. They did so simply because they needed it for their own personal use.


As Anton, the CTO of 1inch, describes, “The first customers of 1inch were myself and Sergej. It was exhausting and inefficient to manually check for the best trading prices on all the DEXs —  Uniswap, Kyber, 0x — before placing a trade. We — like all crypto users — needed an elegant algorithm to search every DEX for the best trading price and instantly deliver an optimized trade.”


In order to receive the best and most efficient price for a swap, one must check for the best price across all the DEXs. Manually checking is not efficient and does not enable complex trading routes and paths. Thus, sophisticated DEX aggregator algorithms are key for saving money on swaps.


In recent months, DEX aggregators have seen explosive growth that’s on par with DEX volume growth. 


How Do DEX Aggregators Work? 

DEX aggregators source liquidity from different DEXs and thus offer users better token swap rates than they could get on any single DEX. DEX aggregators have the ability to optimize slippage, swap fees and token prices which, when done right, offer a better rate for users.


For instance, a swap deal split between several DEXs can get a user an overall better price than a swap on any single exchange.


A DEX aggregator’s main task is to offer a user better swap rates than any specific DEX can offer and to do that in the shortest possible time. Other major tasks are protecting users from price impact and reducing the probability of failed transactions.


DEXs are generally interested in DEX aggregator integrations, as they can attract more users and volume. Recent data shows that high notional traders are increasingly using DEX aggregators, while retail users still choose to access DEXs directly.

DEX Aggregators and the DeFi Boom

DEX aggregators are a somewhat newer concept that arose from the rise in DEXs. They have become more important to users in the recent DeFi boom as more and more users prioritize better prices on their trades. 


A Step-by-Step Guide to Pathfinder

DEX aggregator 1inch has recently released version 2 of its protocol, whose main component is Pathfinder, an API containing a new discovery and routing algorithm.


Pathfinder can split swaps across 21 supported liquidity protocols and, if necessary, it can also use different “market depths” within the same protocol.


This is how routes for a typical Pathfinder swap look like:


pathfinder routing


Why Use ‘Market Depths’?

A market depth, or depth of market, is a measure of supply and demand for liquid assets, such as cryptocurrencies, based on the number of open buy and sell orders.


The use of “market depths” is a major improvement on the protocol’s previous version. With different “market depths” serving as sort of bridges between source and destination tokens, the new algo offers a more sophisticated approach than just splitting a swap across different protocols.


This more complex approach translates into concrete advantages for a user. For instance, thanks to improved quotes, 1inch offers a swap rate for 1 sBTC-sUSD that’s better than Uniswap’s offer by nearly 98%.


1inch aggregator


Partial and Dynamic Fill Mechanism

1inch’s solution for reducing the probability of failed transactions is Pathfinder’s partial and dynamic fill mechanism.


In Pathfinder, partial fill is enabled by default, although a user can disable it in the “Advanced settings” menu. Still, using this feature is more advisable, as it can protect users from price slippage and failed transactions, which would be especially noticeable for substantial swap volumes. 


When a user makes a swap on 1inch, it will be split between several protocols to get the user the rates originally offered in the UI. However, the rate on one of the protocols could change, becoming less attractive for the user, before the swap has been completed. Here, the “partial fill” comes into the picture, as the order can be filled only partially, and the route, in which the rate has changed — or several routes — can be easily cancelled.


As a result, the user does not get a failed transaction, and their unswapped coins just return to their wallet. In this case, the user only pays the swap fee. Moreover they can save further by burning Chi gas tokens which helps to reduce gas costs by 43%. 


Similarly, the dynamic component could also help prevent failed transactions, as it enables parts of the swap to immediately switch to another protocol in the split or path.


For instance, the algo splits a swap between three protocols: Uniswap, SushiSwap and Balancer. If the Uniswap swap has failed, the entire swap will switch to SushiSwap and Balancer, and it will be still executed, giving the user the rate they had previously seen in the interface and accepted. 

Versatility

Pathfinder was designed as a very versatile algorithm that could support various protocols. Currently, due to Pathfinder, 1inch already supports all major protocols, including Uniswap V1, Uniswap V2, Balancer, Curve, Chai, Sushiswap, Kyber, Oasis, Mooniswap, Compound, Aave, Yearn and Bancor.


However, the way Pathfinder was designed makes it possible to also support blockchains other than Ethereum. There are plans to add support for Binance Smart Chain, a parallel Binance chain.


Meanwhile, the Pathfinder can be expanded to enable integration with a centralized exchange. This, in turn, would open up totally new business opportunities for startups to build on top of the 1inch protocol. For instance, they could create products for arbitrage between CEX and DEX.

Collateral Tokens

Another major feature of Pathfinder is the ability to use collateral tokens from lending protocols Aave and Compound as part of the swap path. 


routingagainpathfinder


Aave and Compound pack other tokens into collateral coins, like, for instance, Compound’s USD-pegged coin, cUSD. Previously, these collateral tokens could not be used as part of swap routes on 1inch, as users would have to go to the lending protocol that issued the coins to unpack them or pack back into collateral coins.


Now, Pathfinder can pack, unpack or migrate collateral tokens for a user with just one transaction, saving them time and money. In addition, users can easily swap collateral tokens held in pools, as all packing/unpacking is done automatically.

Maximum Return and Lowest Gas Options

Finally, Pathfinder allows a user to choose between the “Maximum return” and the “Lowest gas” options. The former option means complex routes for the swap to get the user the best rates. Alternatively, in the “Lowest gas” option, swaps are done at market rates, without splits across different exchanges or complex routes, but the user pays the lowest possible gas fee.


market pathfinder


This article contains links to third-party websites or other content for information purposes only (“Third-Party Sites”). The Third-Party Sites are not under the control of CoinMarketCap, and CoinMarketCap is not responsible for the content of any Third-Party Site, including without limitation any link contained in a Third-Party Site, or any changes or updates to a Third-Party Site. CoinMarketCap is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement, approval or recommendation by CoinMarketCap of the site or any association with its operators. This article is intended to be used and must be used for informational purposes only. It is important to do your own research and analysis before making any material decisions related to any of the products or services described. This article is not intended as, and shall not be construed as, financial advice. The views and opinions expressed in this article are the author’s [company’s] own and do not necessarily reflect those of CoinMarketCap.

Author(s)

Sergej Kunz

I'm 1inch Network co-founder.

Join the thousands already learning crypto!

Join our free newsletter for daily crypto updates!

Email submitted!
Oops! Something went wrong while submitting the form.

Related Articles