Copied


Uniswap (UNI) and Automated Market Making: A Comprehensive Primer

Felix Pinkston   May 31, 2024 10:46 4 Min Read


Decentralized exchanges (DEXs), such as Uniswap (UNI), serve as critical components within the crypto-financial system. These platforms enable users to trade cryptocurrencies directly with each other or through liquidity pools, effectively eliminating the need for a counterparty or centralized entity to execute trades, according to Glassnode Insights.

Permissionless Trading

Uniswap stands as the largest DEX protocol, renowned for its permissionless access and user-friendly interface. Users maintain control over their funds and transact via liquidity pools containing assets from both sides of a trading pair. Additionally, anyone can create or participate in a trading pool for any token pair, making DEXes attractive for trading various digital assets.

The main trade-offs with DEXs revolve around the scalability of the underlying blockchain, leading to higher latency and transaction fees. In contrast, centralized exchanges offer faster trade execution without blockchain transaction fees, though users must transfer assets into the custody of the exchange operators.

Decentralized Market Making

Uniswap introduced a pivotal innovation with the Automated Market Maker (AMM) design. This setup facilitates the creation of liquidity pools and adjusts token prices based on the relative liquidity balance on both sides of a trade. In traditional exchanges, Market Makers provide liquidity by placing buy and sell orders to create deeper order books. Conversely, DEXes use smart contracts to replace this order book model with liquidity pools, with prices dictated by the AMM design.

Each pool contains reserves for a given token pair. For example, the WETH-USDC pool contains reserves of both WETH and USDC, often deposited in a 50:50 split based on each side's price. The AMM design allows anyone to become a market maker by depositing tokens into the pool. In return, Liquidity Providers (LPs) receive fees from trades in the pool, typically a small percentage of the transaction value, distributed proportionally based on their pool share.

Price Determination via the Constant Product Formula

Liquidity pools utilize AMM algorithms to manage token prices and balance liquidity within the pool post-trade. Whenever a trade occurs, the algorithm adjusts the token quantities in the pool and recalculates each token's price based on the remaining quantities using the Constant Product Formula:

x * y = k

  • x is the quantity of token in liquidity pool a
  • y is the quantity of token in liquidity pool b
  • k is a constant

The product of the two token quantities remains constant after a trade. If someone buys Token B using Token A, the sold amount of Token A is added, and the purchased amount of Token B is removed from the pool. This process keeps the product, k, constant as the token quantities change with each trade. The exchange rate is determined by the ratio of the change in x to the change in y.

Additionally, arbitrage opportunities help maintain token prices in alignment with other trading venues. Should a DEX liquidity pool offer a token at a steep discount compared to centralized exchanges, traders can buy it via the DEX and sell it at the exchange to capture the spread.

Concentrated Liquidity

Earlier AMMs typically used a 50:50 asset split with liquidity distributed across the full range of possible prices for each token. Uniswap V3 introduced the concept of concentrated liquidity, allowing liquidity to be applied within a designated price range. These ranges are defined by discrete points on a given price scale, and fees are earned only when the market trades within this range.

This design enhances the user experience for DEX traders by providing tighter spreads. It also gives Liquidity Providers more opportunities to actively manage their positions and improves capital efficiency for the pools. This can reveal insights into market makers' price and volatility expectations as they adjust their liquidity positions.

Fee Tiers

Uniswap's fee revenue mechanism attracts liquidity through different fee tiers: 0.01%, 0.05%, 0.30%, and 1.00%. These tiers accommodate varying levels of risk and trading volume. The lowest fee tier (0.01%) suits pools involving stablecoins or assets with minimal price volatility, encouraging higher-volume, lower-margin trading. Higher fee tiers compensate LPs for taking on asset inventory risk, a higher likelihood of impermanent loss, and lower expected trade volumes.

Summary and Conclusions

Uniswap has pioneered new crypto-financial primitives like the AMM protocol and enabled permissionless trading via blockchains. These DEX protocols align incentives so market makers have a fee revenue incentive to provide liquidity, while traders access global trade execution without relinquishing custody of their funds.

While this article covers many key design elements of DEXs, the ecosystem continues to push the boundaries of what is possible in a decentralized future.


Read More