Uniswap: The Basics


In early 2018, decentralized finance (DeFi) was much more vision than industry manifested in applications and code. Only a small handful of use cases were fully proven. However, that November, DeFi made a significant leap when software engineer Hayden Adams announced the launch of a new application called Uniswap. A peer-to-peer decentralized exchange (DEX), Uniswap facilitates the trading of ERC-20 tokens on large blockchains such as Ethereum. To do so, Uniswap uses an automated market maker (AMM), which replaces the role of the order book on a traditional exchange.

Defined by its elegant design, simple user interface, composability with decentralized applications (dapps), and philosophical alignment with crypto values, Uniswap has been broadly adopted within DeFi. Today, Uniswap regularly processes billions of dollars of daily trading volume and is the fifth largest DeFi application as measured by total value locked (TVL). As the undisputed leader in decentralized asset exchange, Uniswap can benefit substantially from the continued growth of the DeFi ecosystem.

Key Takeaways

  • Uniswap is DeFi’s largest and most liquid decentralized exchange (DEX). Uniswap is best known for its automated market maker (AMM) which ensures that liquidity is always available to trade against regardless of order size or the presence of a counterparty.
  • Uniswap’s code base conforms to the standards of major blockchain ecosystems such as Ethereum. This feature gives Uniswap a high degree of composability across DeFi applications and positions it as a cornerstone of the DeFi ecosystem.
  • Uniswap’s smart contracts introduce features not typical of a traditional exchange, such as directly allocating trade revenues to individual liquidity providers, democratizing the power to create new markets, and near-instantaneous trade settlement. Uniswap is stewarded by holders of the UNI token who are empowered to vote on governance proposals encompassing revenue distribution arrangements, fee structures, product offerings, and protocol strategy.

Uniswap Uses Smart Contracts and Math to Reinvent the Financial Exchange

Most traditional asset exchange platforms use an order book to facilitate trading, which requires the exchange to maintain a list of all buy and sell orders for an asset, including order amounts and prices. It also requires a counterparty for every trade: a party willing to buy every sell order, and a party willing to sell every buy order. Also critical to the traditional exchange is the market maker, an intermediary that provides liquidity and depth to a market for an asset by continually quoting both sides of the market.

Uniswap is designed to eliminate these processes and facilitate asset exchange without involving any centralized parties or intermediaries. To achieve this, Uniswap uses liquidity pools and a constant product function to create an automated market maker (AMM) system. This unique infrastructure ensures that there is always liquidity available to trade against regardless of the presence of a counterparty. This infrastructure also provides the secondary benefit of allowing price discovery to occur natively within the DeFi ecosystem.

Liquidity Pools Are Smart Contracts that Provide a Frictionless Trading Venue

Liquidity pools serve as the individual marketplaces for asset exchange on a DEX. Uniswap’s pools use two different tokens, a trading pair, in amounts proportional to their relative market prices. The tokens are crowdsourced from DeFi participants, called liquidity providers (LPs), and constitute the pool of funds that liquidity demanders, or traders, trade against. The smart contract logic governing these pools allows a liquidity demander to exchange one of the pool’s tokens for the other based on an algorithmically derived exchange rate.

On a large order book, institutional market makers are incentivized to act as a counterparty to trades by profiting from the bid-ask spread. Similarly, LPs on Uniswap require compensation in exchange for locking their assets in a smart contract. To incentivize liquidity provision as a service, LPs earn a pro-rata share of a pool’s trading fees. In Uniswap v3, the newest version, LPs can provide funds across four fee tiers: 0.01%, 0.05%, 0.3%, and 1%.1

Liquidity Pool-Based Exchanges Have a Unique Approach to Setting Market Prices

On an order book, market price is determined by the point at which the highest bid price meets the lowest ask price. Because Uniswap does not use an order book, there are no bid or ask prices available to reference. Instead, Uniswap leverages a constant product function to determine asset prices. This approach is summarized by the equation x*y=k, where x is the amount of token A in a liquidity pool, y is the amount of token B in a liquidity pool, and k is a constant number. As the ratio of token A to token B fluctuates with trade, the exchange rate between the two assets changes in response.

Consider a liquidity pool of 1,000 ETH (x) and 1,000,000 USDC (a USD-pegged stable coin) (y). Initially, the pool implies a price of 1 ETH = $1000, and the pool’s constant product (k) is 1,000,000,000 (1,000*1,000,000 = 1,000,000,000).

Now consider the effects of a trader using this pool to exchange some amount of USDC for 5 ETH. As exhibited in the table below, withdrawing 5 ETH (“ETH Purchased” = 5) would leave 995 ETH remaining in the pool (“New ETH Liquidity” = 995 = x). To maintain a constant product of 1,000,000,000, the user would need to deposit enough USDC to bring the constant product k back to 1,000,000,000. In this case, a withdrawal of 5 ETH would necessitate a deposit of 5,025.13 USDC, or approximately $5,025.13, resulting in a total amount of 1,005,025.13 USDC (“New USDC Liquidity” = 1,005,025.13 = y) in the pool. This amount is confirmed by the equation: 995*1,005,025.13 = 1,000,000,000. Based on the new ratio of ETH/USDC in the pool, the new implied price of ETH following the trade would be 1,005.03 USDC (“Cost per ETH” = $1,005.03).

The constant product function ensures that as the amount of ETH withdrawn from the pool increases, the USDC-denominated price of ETH increases asymptotically. In other words, orders of a larger size will cause a larger impact on the market price of a liquidity pool’s constituent assets but with the benefit that the system will always have liquidity available to trade against. In reality, major liquidity pools are much larger than this illustration, meaning trades of a given size are far less impactful on market prices. As of January 23, 2023, Uniswap v3’s ETH/USDC pool consists of approximately 108,630 ETH across all 4 fee tiers, worth ~$177.1m at the time of writing.2

Arbitrage also plays a critical role in maintaining the accuracy of asset prices on Uniswap. Because asset prices are influenced by the relative supply of tokens in liquidity pools, small imbalances can push prices on Uniswap out of line with those on centralized exchanges. In practice, arbitrageurs who bring Uniswap pools back into alignment with centralized exchanges quickly exploit these minor price discrepancies.

Uniswap Is Uniquely Positioned to Serve the DeFi Ecosystem

Uniswap’s approach to asset exchange provides a boon to the liquidity profiles of crypto assets. So long as a token pair has an active liquidity pool, users can always execute a trade. Uniswap’s AMM also allows users to create new markets for any token on the ERC-20 standard without listing fees. An immediate benefit of the AMM is the ability to create active markets for exotic and illiquid tokens including tokens of nascent and early-stage protocols.

Because LPs are only incentivized to contribute to liquidity pools that offer the prospect of trading revenues, rational economic behavior determines which markets capital is allocated to. The result is deep liquidity in the most active trading pools, and more efficient capital allocation to promising but more esoteric corners of the market. A study from May 2022 indicated that Uniswap v3’s AMM had roughly twice the market depth—a frequently used measure of liquidity—for spot ETH/stablecoin markets than the largest centralized exchange platforms.3

As a blockchain-native application, Uniswap benefits from the operational efficiencies associated with smart contracts and blockchain technology. Because Uniswap settles trades to blockchains such as Ethereum, users benefit from near instantaneous settlement while being provided with robust security assurances. Users can also expect to pay lower fees on the platform due in part to the reduced costs of disintermediation.

In addition, the Uniswap protocol is coded according to Ethereum standards, which means Uniswap benefits from a high degree of composability with applications across the DeFi ecosystem. Uniswap can be easily integrated with decentralized applications of all types, serving as backend trading infrastructure, a permissionless market data feed, a source of organic yield in DeFi, and more. Uniswap’s unique attributes position the platform as a critical money lego for the DeFi ecosystem and provide a value proposition unlikely to be challenged by its centralized counterparts.

UNI Token Gives Owners Influence Over the Protocol’s Strategy

Uniswap’s native asset, UNI, is a governance token that represents the communal ownership of the protocol. Owners of the UNI token have the right to participate in Uniswap’s on-chain governance process by voting on governance proposals. By extending the power to vote on matters such as fee structures and revenue distribution arrangements, UNI owners are the stewards of the protocol and its strategy. Currently, UNI owners do not receive any of the platform’s trading fees or revenues, though numerous proposals to allocate a portion of these fees to owners are under consideration.