Decentralized Exchanges — A comprehensive Overview
The area of Decentralized Finance (DeFi) promises revolutionary, new types of financial instruments. In this context, DeFi refers to decentralized applications (DApps) — smart contract infrastructures running on a VM-compatible blockchain layer — that provide some economic purpose. One of the most significant sectors in DeFi is the so-called Decentralized Exchange (DEX).
Author: David Brodhagen
“Now, with the emergence of decentralized exchanges (DEX), holders of cryptocurrencies no longer need to leave the crypto space for swapping their tokens.”¹ ~ Philipp Sandner
DEXs encourage user autonomy by allowing trades directly from non-custodial wallets like Metamask². In contrast to centralized exchanges relying on an order book and matching buy with sell orders, DEXs allow for direct peer-to-peer token transactions without the need for a counterparty.
Famous DEXs are Uniswap³, Sushiswap⁴, Curve⁵, and Balancer⁶ that use an automated market maker as the underlying protocol. These protocols use smart contracts to determine the price of digital assets. Users are essentially not trading against counterparties but rather against the liquidity contained inside smart contracts — so-called liquidity pools. Each trading pair of two or more tokens has its liquidity pool holding a respective amount of the underlying assets (reserves).
If you want to swap Token A to Token B, you send an amount of Token A to the smart contract. Based on the liquidity Token A to Token B ratio lying in the pool, the smart contract sends the calculated amount of Token B back to you. This reflects the pool mechanism of a decentralized exchange in a very simplified way, but in reality, there are thousands of pools with many different assets.
Usually, there is a fee for swapping tokens. This fee could range from 0.05% to 1%, depending on the decentralized exchange. For example, for Uniswap V2⁸, there is a flat 0.3% swapping fee. In Uniswap V3⁹, the fee for pools with lower pairwise liquidity is high due to the resulting increase in price impact upon swapping.
When interacting with a low liquidity pool, you might encounter a high slippage depending on your swapping amount. Slippage is the difference between the projected and the actual price at which the trade becomes executed. It is common with market orders that larger orders tend to have more slippage. But on every serious DEX, you’ll find the Minimum Received Indicator, which shows how many tokens you can expect to get depending on the slippage tolerance you’ve selected (0.5% is standard).
Liquidity Providers (LPs)
You can pairwise lend out your tokens so that the liquidity of tokens within the liquidity pool is available on the decentralized exchanges at all times. In return, you receive so-called Liquidity Provider tokens of the respective pool, which function as a share receipt.
All fees generated by the pool become distributed proportionally to the Liquidity Providers (LPs) contribution. Thus, you can help the exchanges gain liquidity and earn money with those interest-bearing assets.
On the contrary, liquidity provision holds risks that you should comprehend before becoming an LP. As mentioned earlier, pools with low liquidity can lead to high price impacts, resulting in capital inefficiencies for you.
In essence, Impermanent Loss is the difference in value between providing liquidity of two tokens or simply keeping them in a wallet. For example, you deposit two tokens (A and B), then Token A’s price increases by 500% compared to Token B, resulting in a 25% loss difference for you instead of holding. Luckily, Uniswap V3 introduced the concept of concentrated liquidity¹⁰, allowing you to manually select the price range in which your capital gets used.
To sum it up, DEXs allow for non-know your customer (KYC), worldwide availability, and censorship resistant market orders. What is even more important, you remain in possession of your private keys and don’t have to trust any third party. In contrast to the traditional financial system, everyone can become a market maker and earn extra money on token holdings.
This allows freelancers — if they decide to get paid in crypto — to gain passive income on their incomes while keeping complete control over their money. For starters, you can take a look at the smart contracts listed in Table 1 to get an overview about the most relevant Uniswap and Sushiswap smart contracts.
Contrary to liquidity provision, Lending offers the opportunity to earn passive income on single tokens rather than pairwise. This concept behind Decentralized Lending will be covered in a next article.
At basenode.io, our mission is to eliminate the gap between traditional accounting and blockchain-based accounting. Basenode.io is the first token-based accounting solution that offers seamless fiat-to-crypto invoicing. We provide a self-explanatory user interface with a clean and modern look, that naturally supports your workflow. Furthermore, we will integrate support for the most popular networks like Bitcoin, Bitcoin Lightning, Ethereum, Binance Smart Chain, Polygon, and more.
David Brodhagen is COO and co-founder at basenode.io. Before, he worked in the blockchain ecosystem for two years. Besides studying Business Administration he leads the Blockchain Initiative at the Frankfurt School of Finance and Management. You can contact him via email and LinkedIn.