Uniswap burst into the scene in November 2018. As the first large-scale successful application using the Automated Market Maker (AMM) model, it quickly became a leader in the decentralized exchange (DEX) space and played a significant role in the DeFi ecosystem. But why do we need DEX? What is AMM and how does it work? This article will answer these questions.
CEX vs. DEX
AMM
What is Uniswap?
Future Outlook
1. CEX vs. DEX
TL;DR While a CEX is operated by a single entity, a DEX is run permissionlessly through smart contracts (specific programmable services that are automatically executed when the conditions stipulated in them are fulfilled) on a blockchain.
At the beginning of the article, let's briefly understand CEX and DEX.
A CEX (Centralized Exchange), such as Binance, Coinbase, and OKX, is a cryptocurrency exchange operated and controlled by a centralized entity. CEXs resemble traditional stock market exchanges in that transactions are settled off-chain or settled on a private blockchain, and liquidity is provided by market makers.
A DEX (Decentralized Exchange), such as Uniswap, PancakeSwap, and SushiSwap, is a cryptocurrency exchange that operates without centralized intermediaries to facilitate crypto trading. DEXs utilize smart contracts and liquidity pools to facilitate token swaps, and all transactions are conducted on-chain.
Feature | CEX | DEX |
Trading times | Determined by the reliability of the exchange, trading cannot be guaranteed at all times. | 24 hours, as long as the blockchain is operating normally. |
Operator | Centralized company | Smart contracts |
Censorship | The centralized operator has the power to disable crypto withdrawals, buying, selling, trading, and account closures | Permissionless and censorship-free environment |
Liquidity sources | Provided by the centralized operator and by market makers | Community-sourced liquidity pools |
Order book | The company maintains control over order matching and matchmaking. Transactions recorded off-chain. | Trades are executed by smart contracts. Transactions recorded on-chain. |
Fees | The fee structure is set by the centralized operator. | Gas fees, platform fees. |
Access | Users need to create accounts. | Users need a crypto wallet to use DEXs. |
Speed | Fast transactions. | Depends on the underlying blockchain. |
Examples | Binance, Coinbase | Uniswap, Aerodrome Finance |
Simply put, CEX has some disadvantages:
Centralized Control: As a single point of control, any failure or shutdown by regulatory authorities can impact all users' assets.
Risk of Misappropriation: Not only do users have usage rights over their assets, but the centralized exchange also controls them, posing risks of misappropriation and theft.
Opaque Management: Users' crypto assets are held within the CEX, lacking public transparency, and only accessible to the exchange's backend.
These issues prompted the birth of DEX. Additionally, DEXs have gained popularity and become widely used platforms worldwide due to the internet, allowing anyone to easily access them through a wallet.
2. AMM
2.1 What is AMM?
Automated market makers (AMMs) are a type of decentralized exchange (DEX) that use algorithmic “money robots” to make it easy for individual traders to buy and sell crypto assets. Instead of trading directly with other people as with a traditional order book, users trade directly through the AMM.
2.2 How does AMM work?
AMMs operate using liquidity pools where users deposit cryptocurrencies to facilitate trading. These pools employ algorithms to establish token prices based on the proportion of assets stored in them. When a user wishes to trade, they can directly exchange one token for another through the AMM. The pricing of these transactions is governed by the algorithms of the liquidity pool. This setup enables AMMs to offer ongoing liquidity for various assets, potentially simplifying the trading of less mainstream cryptocurrencies.
2.2.1 Constant Product Formula
AMMs use mathematical formulas to determine the price of assets in a liquidity pool. The most common formula is the Constant Product Formula, it can be explained simply as follows:
You have two tokens, X and Y. In a liquidity pool, the quantity of token X multiplied by the quantity of token Y always equals a constant value. This formula is usually written as: X * Y = K, where K is a constant.
Put simply, there are tokens and stablecoins in the pool, the lesser the tokens the more expensive the price and vice versa.
This formula ensures that the total value of the tokens in the pool remains constant after each trade and automatically adjusts the prices based on supply and demand.
2.2.2 Liquidity Providers
Those who deposit assets into an AMM are called liquidity providers. In return, liquidity providers receive LP tokens from the AMM. Trading fees are a source of passive income for liquidity providers. They offset the currency risk of letting others trade against the pool's assets. Trading fees are paid to the AMM, not directly to liquidity providers. Liquidity providers benefit because they can redeem their LP tokens for a percentage of the AMM pool.
When the flow of funds between the two assets in a pool is relatively active and balanced, the fees provide a source of passive income for liquidity providers. However, when the relative price between the assets shifts, liquidity providers can take a loss on the impermanent loss.
The loss remains the same regardless of the direction in which the price changes. So the actual return for liquidity providers is a balance between the divergence loss caused by the price differential and the accumulated fees from trades on the exchange.
Uniswap is the most popular DEX with more than 489B trade volume and 71M all time trades. It was built in 2018 on top of the Ethereum blockchain, the world’s second-largest cryptocurrency project by market capitalization, which makes it compatible with all ERC-20 tokens and infrastructure, such as wallet services like MetaMask and MyEtherWallet.
The following are the 7 days volume of DEX, with data as of June 29, 2024:
According to the data, UNISWAP's market share exceeds 50%, giving it an absolute advantage. Additionally, the Number of Swappers in June has more than doubled compared to May.
In the early versions of AMMs, most utilized a straightforward 50:50 asset split, with liquidity spread across the entire spectrum of potential prices for each token.
With the launch of Uniswap V3, the protocol introduced the ability to provide liquidity within a specific and concentrated price range. These ranges are defined by distinct points on a price scale, and fees are earned only when trades occur within this range, similar to strike prices. The narrower the range, the greater the relative share and, consequently, the fee revenue that the liquidity provider (LP) will receive within that specified price range.
Source: Uniswap Whitepaper
The advantages of Uniswap V3:
Concentrated Liquidity: Liquidity providers (LPs) can offer liquidity within specific price ranges rather than across the entire price spectrum. This results in more concentrated liquidity and improved capital efficiency.
Higher Returns: Since liquidity is focused within a narrower price range, LPs gain a larger relative share and increased fee income within that range.
Customizable Liquidity Positions: LPs can create customized liquidity positions, selecting specific price ranges and fee tiers to align with their investment strategies.
3.2 Uniswap V4 - Coming soon
Uniswap V4 protocol is broadly set to be launched in Q3 2024. The Uniswap Foundation said in early 2024 that the timeline for the V4 launch depends on the Ethereum Dencun hard fork. With the successful implementation of the Dencun hard fork on the Ethereum mainnet in March 2024, all that’s left is a comprehensive security audit of the protocol starting from Dencun.
Here are some of the updates:
Cost Efficiency: Uniswap V4 introduces a singleton design, integrating all liquidity pool contracts into one, thus reducing the cost of creating and managing liquidity pools.
Increased flexibility: V4 introduces a new feature, Hooks, that allows developers to perform more flexibly on liquidity pools according to their needs, enhancing the protocol’s flexibility and scalability.
Native ETH Support: Uniswap V4 enhances user experience by enabling direct trading pairs with native ETH, eliminating the need for WETH (Wrapped ETH). This simplification streamlines the trading process and lowers transaction costs.
Unlimited Fee Tiers: Uniswap V4 allows unlimited fee tiers for various liquidity pools. This flexibility allows for a more tailored approach in catering to a diverse range of assets and trading strategies. Each pool can have its own unique fee tiers, optimizing the platform's appeal to a wider spectrum of users and market needs.
4. Future Outlook
4.1 Current status
Since the industry's TVL reached $179.05 billion in November 2021, the TVL of decentralized exchanges has significantly decreased, according to the DeFi market tracking platform Defi Llama. Due to the approval of Bitcoin (BTC) spot exchange-traded funds (ETFs) in the United States and the optimistic sentiment around the halving cycle in April 2024, market sentiment has improved, and DEX TVL and trading volume have significantly rebounded in 2024.
However, one should not be overly optimistic, as DEX vs. CEX dominance (DEXs dominance over aggregated DEXs and CEXs volume (24h)) is only 13%.
Source: Defi Llama
4.2 Challenges faced
Scalability: As they rely on different blockchain protocols to process and record transactions. Blockchains, like Ethereum, are prone to network congestion, high gas fees, and long confirmation times.
Liquidity constraints: DEXs rely on liquidity providers, which are individuals who provide liquidity. This makes DEXs prone to liquidity issues, potentially causing trading disruptions, increased spreads, price volatility, and unfavorable trading conditions, especially for lesser-known tokens and newly listed digital assets. Exchanges must actively manage the liquidity of tokens to create favorable trading environments.
The rise of the DEX platform has been crucial to the growth of the crypto industry, blazing a trail in the fast-rising cryptocurrency market by allowing investors to trade peer-to-peer directly from their own hosted wallets. Dealing with liquidity and scalability issues will fuel its growth, and of course, security and regulatory compliance will need to evolve with the times.
About AEM Algorithm
AEM Algorithm (AEM) is an innovative accounting system provider, empowering Web3 businesses and accountants with advanced solutions and applications for accurate cryptocurrency transaction reporting and financial automation. Their flagship product, AEM Journaler, is a cutting-edge SaaS B2B accounting software that seamlessly integrates with Xero and Intuit QuickBooks. We are the only accounting platform offering a complimentary self-custody crypto wallet, AEM+, under active development.
Socials
Author
Winston Chan Winston Chan is a Core Contributor at Launch Factor, a leading web3 professional accounting firm. He specializes in integrating QuickBooks and Xero with crypto sub-ledgers and reconciling Web3 data for OTC exchanges. Winston holds a First Class Honors degree in Accountancy and an MBA from Nanyang Technological University. As a Chartered Accountant (Singapore), he has gained extensive experience working with esteemed institutions, including OKX, DigiFT, and KPMG. Contact: winston.lf@launchfactor.us Website: https://www.launchfactor.xyz/ |
Dino Liu Dino Liu is always eager to engage in discussions on achieving financial compliance within the Web3 industry. Contact: liuqiyuan2@gmail.com |