Diving into DeFi: Decentralized Exchanges and the Rise of AMMs
Decentralized exchanges serve as the foundations of DeFi. They enable the permissionless listing of any tokens and facilitate the seamless swapping of tokens thanks to Automated Market Makers (AMMs).
Last week, I had the privilege of attending a DeFi lecture at the University of Zurich, where Henry and Magnus, two seasoned DeFi hedge fund managers, generously shared their insights into the world of decentralized finance (DeFi). This emerging financial ecosystem eliminates intermediaries by leveraging smart contracts to automate transactions. In this blog post, we'll delve into the crucial role of liquidity and automated market makers (AMMs) in DeFi, as highlighted during their lecture.
The lecture started by the definition of DeFi by Magnus. He underlined that DeFi is the financial system that eliminates the need for intermediaries. This is achieved thanks to smart contracts (computer programs on the blockchain) that automate financial transactions.
DeFi is the financial system that eliminates the need for intermediaries using smart contracts to automate financial transactions.
Background: Understanding Liquidity
In traditional financial markets, liquidity refers to the ease of converting an asset into cash or the desired asset. This essentially measures how quickly and easily you can buy or sell an asset at a fair price. Traditional markets achieve liquidity through methods like auctions, Dutch auctions, and order book systems.
Liquidity is the ease with which an asset can be converted into cash (or the asset desired).
Auctions are public sales where goods or services are sold to the highest bidder, ensuring fair pricing through competitive bidding.
Dutch auctions, on the other hand, involve starting with a high price and gradually decreasing it until a bid is placed, ensuring that the item's value is discovered through the bidding process.
Order book systems, used in traditional stock markets, are facilitated by market makers who buy and sell assets on their own account, providing liquidity to the market and helping maintain fair prices by quoting both above and below the current market price.
A market maker in an order book is a firm or individual that buys and sells on a trading instrument for their own account to provide liquidity to the market, making it easier to trade assets and keeping prices fair.
Introduction to Automated Market Makers (AMMs)
In the realm of DeFi, AMMs are the game-changers. These are smart contracts that determine token swap prices based on the reserves within liquidity pools, in contrast to traditional order book systems where prices are determined by open buy or sell orders.
Liquidity pools in DeFi are collections of digital assets locked within smart contracts, serving to facilitate decentralized trading, lending, and other financial services. Liquidity providers (LPs) deposit their assets into these pools, earning trading fees and other rewards in return. In return, they usually receive some form of LP ownership, which represent their share of the pool and can be redeemed for their share of the pool's assets at any time.
AMM Metrics
AMMs enable decentralized exchanges and are permissionless, meaning anyone can participate as a liquidity provider or trader.
Traders using AMM-based DEXs face the risk of slippage, which refers to the difference between the expected and actual trade price due to market volatility and low liquidity. Most protocols include slippage control mechanisms to protect traders from unfavorable pricing.
Slippage, the risk for traders on DEX, is the difference between the expected and actual trade price, caused by market volatility and low liquidity.
LPs, on the other hand, contribute liquidity to AMM pools and earn fees from traders. However, they face the risk of impermanent loss, which occurs when the fees earned from traders do not fully compensate for unfavorable rebalancing of AMM liquidity pools.
Impermanent loss is a risk for LP that occurs when the fees earned from traders do not fully compensate for unfavorable rebalancing of AMM liquidity pools.
Types of AMMs
UniSwap V1: A popular AMM protocol on Ethereum, which uses the Constant Function Market Maker (CFMM) model, where LPs earn a share of trading fees proportional to fees paid by traders for each swap. Each pool token must be paired with ETH
UniSwap V2: An improvement on V1, allowing users to swap any token paris and use a router for swaps. Introduction of Flash Swaps.
UniSwap V3: Still based on the CFMM model, but with concentrated liquidity and non-fungible liquidity representation through NFTs.
Curve V1: Focused on stablecoin swaps, using dynamic curves and variable fees based on deviation from internal price oracles.
Curve V2: Evolution of Curve v1 to support any tokens (not only crypto-currencies) with pricing curves being automatically re-calibrated
TraderJoe V2: Utilizes a bin-based model called Liquidity Books with variable fees and stability mechanisms.
Balancer V1 and V2: Allows for more than two tokens per pool, supporting dynamic deposits and withdrawals, and offering flashloan support (0 fees).
If you are interested in underlying math, you can see it below (source: J Xu, “SoK DEX with AMM Protocols”, 2023)
Summary
Decentralized Exchanges are a rapidly evolving space, with a plethora of AMMs and market-making strategies. Each of these models comes with its own set of risks and benefits, and anyone can participate in these protocols. Additionally, many DeFi protocols are available across various blockchain networks, especially EVM-compatible chains like Polygon or Binance Smart Chaib.
Notably, Uniswap V4 is on the horizon, and concentrated liquidity protocols continue to grow. Bank of International Settlements is investigating Curve v2 for cross-border trading of CBDCs that might revolutionize the fx markets.
The future holds exciting innovation in DeFi, emphasizing that it's not just about speculating on cryptocurrency values; it's about building market-making strategies that drive the new blockchain-based economy.
Thank you for reading this blog. Feel free to share it with your network to spread the knowledge about the fascinating world of DeFi.
In our upcoming blog series, we'll take a closer look at the insightful content presented by Henry during the lecture: Uniswap v3 (concentrated liquidity), the management of your LP position, risk mitigation through options to hedge impermanent loss, as well as MEV (Maximum Extractable Value) and flash loans.
Kudos again to Magnus and Henry for their fantastic lecture that contributed to this blog!