Centralized Exchanges (CEX) use an order matching system or custodial infrastructure (where the exchange stores the wallet’s private keys). In contrast, a Decentralized Exchange (DEX) offers an autonomous system and eliminates the need of any intermediaries, allowing users to trade directly from their non-custodial wallets. These autonomous systems are known as Automated Market Makers. They serve as the underlying technology behind DEXs, relying on mathematical formulas to provide liquidity for users to buy and sell crypto assets.
What are AMMs?
Before jumping to Automated Market Makers (aka AMM), let's understand who are Market Makers. Market Makers are entities, such as brokerage firms or financial institutions, that provide liquidity in the market by buying or selling assets (generally in bulk) listed on the exchange. They act as intermediaries in the market. AMMs use smart contracts to store and transfer funds, but their broader functionalities are explored in a later section of the blog. They eliminate the need for intermediaries by automating the process of pricing assets on an exchange with the help of a predefined algorithm. Since AMMs require non-custodial wallets, it should be obvious that they don't support fiat money.
That's obvious, but how do they work? before proceeding to how they work, we need to understand what is a liquidity pool.
Liquidity Pool
A liquidity pool is a collection of assets (generally consisting of a pair but more can exist) that AMMs use to provide liquidity to users. Liquidity providers deposit their assets into the liquidity pool and earn fees in return for that. This is known as Yield Farming. Liquidity is essential for AMMs because if an AMM doesn't have enough liquidity, it can lead to capital inefficiency, impermanent loss, and slippage.
AMM Models
There are many AMM models in the market but some of the major ones are:
1. Constant Product Market Maker (CPMM)
This type of AMM uses the equation x * y = k to calculate the prices of assets, where x and y represent the initial supply of the assets in the liquidity pool, and k is a constant. If the value of x increases, the value of y must decrease for k to remain constant and vice versa. UniswapV2 used this formula to determine prices.
2. Constant Sum Market Maker (CSMM)
They are similar to CPMM but incorporate the formula x + y = k to generate the asset prices and are generally more suitable for pairs where the assets have a relatively stable value in relation to each other. In this design, if the off-chain price between the tokens deviates from 1:1, arbitrageurs can deplete one of the reserves, effectively wiping out liquidity on one side of the pool and leaving traders with no access to that asset. A notable protocol that uses the CSMM model is Balancer.
3. Dynamic AMM
Dynamic Automated Market Makers (dAMMs) continuously adjust their trading parameters based on market conditions. Unlike traditional AMMs with fixed rules, dAMMs use algorithms to optimize liquidity pool ratios and trading fees, offering traders more competitive rates and reducing slippage in volatile markets. Using the DAMM and chainlink price feeds, sigmadex calculates its asset price.
4. Virtual AMM
Virtual AMMs work with the same equation as CPMM (x * y = k), but they have different mechanisms to store the assets. VAMM does not contain an actual liquidity pool rather, the real assets are stored in a smart contract vault responsible for overseeing all the collateral supporting the VAMM. Perpetual Protocol adopted this model for their DEX.
5. Stableswap AMM
It is designed for trading stablecoins, which are cryptocurrencies whose value is intended to remain relatively stable and often pegged to a fiat currency like the US dollar. The primary feature of a Stableswap AMM is its focus on minimizing price slippage during stablecoin swaps. Curve Finance utilizes this model to provide exchange facilities.
Benefits of using AMMs
- They eliminate the need for intermediaries, creating a fully decentralized environment for users.
- They offer lower trading fees compared to CEXs, as maintenance costs are minimal.
- They provide more liquidity compared to traditional exchanges.
- They are available 24x7 unlike traditional exchanges, which sometimes face downtime for maintenance break
Challenges with AMMs
Impermanent Loss
Impermanent Loss occurs when there is a difference in the dollar value between depositing assets and holding the asset in a wallet. This can happen due to price fluctuations in the asset. Since the price of the asset in AMMs isn't determined automatically, arbitrageurs are needed to buy the underpriced asset and sell the overpriced assets, aligning the asset's price with the market price. The profit arbitrageurs make represents the impermanent loss of the depositor.
Price Slippage
Price slippage occurs when there is a difference between the market price and the expected price of assets, and arbitrage traders take advantage of this opportunity to earn profits. While this helps to maintain an accurate price of an asset on the AMM, it can also lead to impermanent loss for the liquidity provider.
Capital Inefficiency
Order matching exchanges provide more flexibility to trade at your price, unlike AMMs where prices can remain fixed if no trades are occurring.
Less trading pairs
They don't offer as many trading pairs as compared to traditional exchanges because they are typically designed for trading ERC-20 tokens.
Security
Vulnerabilities in smart contracts can be exploited by malicious actors, leading to hacks or losses of user funds.
Lack of Advanced Order types
Sadly, AMMs don't support advanced order types like limit orders, stop orders, etc. which are provided by CEXs.
Read more:
- The evolution of Decentralized Exchanges in Blockchain
- Sushiswap
- An overview of Decentralized Finance
- Uniswap docs
- What are MEVs?
_________________________________________________________
Disclaimer: The information contained in this website is for general informational purposes only. The content provided on this website, including articles, blog posts, opinions, and analysis related to blockchain technology and cryptocurrencies, is not intended as financial or investment advice. The website and its content should not be relied upon for making financial decisions. Read full disclaimer and privacy Policy.
For Press Releases, project updates, and guest posts publishing with us, email to contact@etherworld.co.
Subscribe to EtherWorld YouTube channel for ELI5 content.
Share if you like the content. Donate at avarch.eth or Gitcoin
If you've something to share with the blockchain community, join us on Discord!