4 min read

DEXs vs DEX Aggregators

DEXs vs DEX Aggregators

In this article, we will talk about DEXs and DEX aggregators. We will first see what these are, what key features they have, and then we will look into how you can earn from token swaps on different DEXs. In the end, we will explore why using a DEX aggregator might be better than having a favourite DEX.

What is a DEX?

A DEX or a decentralized exchange is an exchange that allows peer-to-peer cryptocurrency transactions. Traditional exchanges, or centralized exchanges (CEXs), perform trades using order books, which are lists kept by the exchange for sell or buy orders for different securities, organized by price level. In contrast, on decentralized exchanges, no third party is needed since users on such exchanges can interact directly with each other. This also results in removing the trading fees since decentralized exchanges are non-custodial (the exchange does not need to possess your tokens in order for you to be able to trade them). Decentralized exchanges rest on blockchains such as Ethereum or Binance Smart Chain and rely on the use of smart contracts (computer programs stored on a blockchain that run when certain predefined conditions are met) to operate.

Some of the most popular DEXs are Uniswap, PancakeSwap, and SushiSwap. All of them are AMM-based DEXs (Automated Market Making-based Decentralized Exchanges). Therefore, they use protocols implemented in smart contracts to fill orders and execute token swaps, trading against a liquidity pool (LP). Additionally, besides decentralization, they also bring other features such as yield farming or community governance.

What are some of the features to consider when deciding which DEX to use?

Probably one of the most important aspects when choosing a DEX is the existence of a pair that you are interested in (some more exotic tokens are harder to find), as well as the liquidity for the associated pool. You don’t want to trade in a pool that does not have enough liquidity, especially with larger amounts of coins, because it is likely to experience slippage (by the time the whole order executes, you might realize that the price has changed significantly in your disadvantage, as a result of not having enough liquidity).

Another important factor is represented by the fees. For example, when executing a token swap (a trade) on the exchange, you pay 0.3% in fees when using Uniswap, which goes entirely to the liquidity providers, and 0.25% when using PancakeSwap. On PancakeSwap, the 0.25% in fees has the following distribution, 0.17% goes to liquidity providers, 0.03% is sent to PancakeSwap Treasury, and 0.05% is sent towards CAKE buyback and burn. SushiSwap has a 0.3% in fees, where 0.25% goes to liquidity providers, and the remaining 0.05% is distributed to SUSHI token holders.

Additionally, it is important to know which blockchain runs the exchange. For example, Uniswap and SushiSwap run on the Ethereum blockchain, whereas PancakeSwap runs on Binance Smart Chain. This affects the transaction fees and execution times (when the Ethereum blockchain is congested, users experience high gas fees and long execution times), but also the level of decentralization. Even though Binance Smart Chain is a modified Ethereum fork, thus compatible with Ethereum Virtual Machine (EVM) and Ethereum applications, it does not benefit from the same level of decentralization as the Ethereum blockchain. Binance Smart Chain has only 21 validators that process transactions and sign blocks, making it a centralized platform in comparison to the Ethereum blockchain that has over 200 000 validators as of July 2021.

How to earn from cryptocurrency swaps on different DEXs such as Uniswap, SushiSwap, PancakeSwap?

Now that you have an idea about what is a DEX and what to consider when choosing one, let’s move forward and see how to earn from cryptocurrency swaps on different DEXs.

Uniswap, PancakeSwap, SushiSwap, and some other DEXs use what is called a Constant Product Market Maker (CPMM) design, which is a special type of Automated Market Maker (AMM). Liquidity providers deposit pairs of assets into a smart contract that are equal in VALUE (the number of tokens for each asset might be different, but they have to be equal in value), and the liquidity traders trade against those pools at a price that is determined by the quantity of the existing deposited assets. Therefore, using smart contracts, the provision of liquidity is automated. This works because of a function that establishes pre-defined prices based on the available amount of the assets.

Let’s take a concrete example to see how this works. Let’s assume we have the following pair, ETH/USDC. Let’s name x the ETH portion of the pool, and y the USDC portion. The total liquidity of the pool is a constant, k. Therefore, so far we have x * y =k. The idea behind an AMM-based DEX is that k must remain constant. Therefore, if a trader, Alice buys 1 ETH for 3000 USDC using the ETH/USDC pool, this increases the USDC and decreases the ETH part from the pool. In order for k to remain constant, the price of ETH increases, given that now there is less ETH in the pool. This creates an opportunity for arbitrage. Anyone can trade tokens with the smart contract until the pool price for ETH converges back to the current market price (provide ETH to this pool that trades ETH at a greater price than the market, until the ETH reaches the price of the market).

What is a DEX aggregator and why is it better to use a DEX aggregator than to search manually for the best-fit DEX?

Now that we know what a DEX is, let's learn about DEX aggregators. You can imagine a DEX aggregator as a search engine for DEXs. A DEX aggregator sources liquidity from multiple places, enabling users to access better swap rates, optimize slippage, and minimize liquidity fluctuations better than by using a single DEX. A DEX aggregator allows access to multiple markets and pools, leading to a wider token diversity. Also, it can help with the reduction of slippage (a DEX aggregator can split your trade across different liquidity pools from different DEXs, obtaining better prices than by using a single DEX). Some examples of DEX aggregators are ParaSwap, 1inch Exchange, Matcha by 0x, or Slingshot (formerly DEX.AG). Therefore, instead of checking manually on different DEXs for best pair prices, which is an exhausting and inefficient task, you can use a DEX aggregator that automates and optimizes the process for you. If you are not yet convinced, think about how you search for the best flight prices, do you use a flight aggregator such as Skyscanner or Google Flights, or do you look on the website of every single airline company? ;)