Which DEX is Be...
Which DEX is Better for YOU?
If you have been in the crypto market for long enough, you have heard the term DEX. So what does it exactly mean and how does it work?
We’ll dive deep into the world of DEXs in this week’s Saturday School.
DEX or Decentralized Exchange is a type of crypto exchange that runs on the blockchain on a completely permissionless and trustless contract. Smart contract algorithms execute pre-programmed unbiased execution strategies without any intervention from humans or machines.
So basically, unlike in centralized exchanges where trades are controlled by the people running the exchange, in DEXs it’s completely pre-programmed and decentralized.
There are primarily two types of DEXs. One that follows a traditional order book system like centralized exchanges and the other that uses AMMs. Let’s have a look into both.
The order book system is the conventional method of approving and executing trades in exchanges. It is used by securities exchanges, centralized crypto exchanges, and first-generation DEXs.
How does it work?
As the name suggests, a record book is used to keep tabs on all the open buy/sell orders of assets. The orders are manually matched and the spread between the buy and sell price determines the market price of a particular asset.
It’s not the most efficient system however it works in specific scenarios. For example dYdX, a DEX that deals with crypto derivatives use this framework.
Automated Market Makers or AMMs are the second generation of DEXs where instead of relying on an order book, trades are executed using an underlying liquidity pool.
So instead of you dealing with people directly, you get to deal with “money robots” who will fulfill your order from a pool of ‘money’.
A liquidity pool is basically a storage of different currencies where lenders lock their assets up for yields (interest) and borrowers borrow from them directly.
Now generally a liquidity pool works with a pair of assets for example a DAI:ETH pool. And there are several different pair pools on any exchanges.
This is essential for DEXs to run efficiently because, without liquidity, the AMMs will fall short on executing orders creating massive price displacement in the exchange.
There are primarily three types of AMM models used by exchanges. Let’s have a look at them.
A constant product market maker is a model that was popularized by Uniswap and Bancor.
Without going into the mathematical details, a CPMM works based on the function x*y=k. The goal here is to keep the K constant. In order to do that, when the supply of X increases, the supply of Y must decrease and vice versa.
This ensures the constant availability of liquidity but at increasingly higher prices.
The CMMM model is specifically used when there are more than two assets in a liquidity pool and therefore the optimal liquidity ratio isn’t 50/50.
A great example of this is Balancer. It allows pairs of 80/20 or 70/30 DAI/ETH. You can stretch a liquidity pool to as many as 8 different assets in Balancer.
The equation used here is (x*y*z)^(⅓)=k. (Where 3 assets are present)
Hybrid CFMM is the next generation of AMMs where different mechanisms are used to take larger moving parts into account.
For example, Curve uses a combination of CPMM and CSMM to create an advanced mechanism that will create denser pockets of liquidity that reduce the price impact within a set range of trades.
Following the rapid development of the entire crypto ecosystem, AMMs are also evolving at an insanely fast pace. While in the past obstacles like impermanent loss and low capital efficiency have caused a lot of damage, new versions of AMMs are coming to tackle the issues.
Just like Hybrid CFMMs, new models of AMMs are trying to solve bigger challenges. Upgrades like Dynamic Automated Market Maker (DAMM), Proactive Market Maker (PMM), and Virtual Automated Market Makers (vAMM) are showing big promises as we speak.
Join Stader’s newsletter
Get the latest updates, new DeFi strategies and exclusive offers right in your email box