Uniswap and Automated Market Makers: How DEXs Actually Work

Home » Uniswap and Automated Market Makers: How DEXs Actually Work

Quick answer: Automated market makers like Uniswap replace the traditional buyer-meets-seller order book with a mathematical formula and pooled liquidity — traders swap directly against a smart contract holding reserves of both assets, with prices determined algorithmically based on the ratio of those reserves. This design let decentralized trading scale without needing centralized market makers or matched buy/sell orders, and it’s become the dominant model for on-chain token trading.

Before automated market makers existed, decentralized exchanges struggled with a fundamental chicken-and-egg problem: order book-based trading needs deep, active liquidity to function well, but attracting that liquidity to a new, decentralized platform without centralized market makers was genuinely difficult. Uniswap’s launch in 2018 offered an elegant solution that reshaped how decentralized trading works entirely.

The Constant Product Formula

Uniswap’s original and still most widely used AMM design relies on a deceptively simple mathematical formula: x multiplied by y equals k, where x and y represent the reserve quantities of two tokens in a liquidity pool, and k is a constant that the formula maintains through every trade.

Here’s how this plays out practically: imagine a pool holding ETH and a stablecoin. If a trader wants to buy ETH from the pool using the stablecoin, they add stablecoin to the pool’s reserves and remove ETH. To keep x times y constant, as the ETH reserve shrinks, the effective price of the remaining ETH in the pool rises — the formula automatically adjusts pricing based on the changing ratio of the two reserves, without needing an external price feed or order book matching to determine that new price.

This means larger trades relative to a pool’s total size cause proportionally larger price impact (slippage), since removing a bigger chunk of one asset shifts the ratio more dramatically. This is precisely why deep liquidity matters so much for a given trading pair — a pool with larger total reserves can absorb bigger trades with proportionally less price impact than a shallow, thinly funded pool.

Where the Liquidity Actually Comes From

AMM pools are funded by liquidity providers — anyone willing to deposit an equal value of both tokens in a given pair into the pool’s smart contract. In exchange, liquidity providers earn a share of the trading fees generated by every swap that routes through their pool, proportional to their share of the total pool’s liquidity.

This is a genuinely different model from traditional market making, which typically requires specialized firms with sophisticated infrastructure and capital. AMMs democratized liquidity provision — essentially anyone can become a liquidity provider for a given pool, earning fee income in exchange for taking on the risks involved, most notably impermanent loss, covered in dedicated depth elsewhere on this site, which describes the specific risk of a pool’s asset ratio shifting unfavorably relative to simply holding the underlying assets separately.

Why This Design Was So Important

The constant product AMM model solved several problems simultaneously that had genuinely hampered earlier attempts at decentralized trading. It provided continuous liquidity without requiring active buy and sell orders to be matched — a pool is always ready to quote a price and execute a trade, unlike an order book that requires an actual counterparty order sitting at a compatible price.

It also removed the need for a centralized entity to manage an order book or act as a designated market maker, aligning cleanly with the broader decentralization goals of the DeFi ecosystem — anyone can create a new trading pool for virtually any token pair, permissionlessly, without needing approval from a centralized exchange operator.

This permissionless pool creation had a real downstream effect on the broader crypto ecosystem: it dramatically lowered the barrier for new tokens to gain tradeable liquidity, for better and occasionally for worse, since it also made it trivially easy to create low-quality or outright fraudulent tokens with superficial tradeable liquidity.

Beyond the Basic Constant Product Model

Uniswap itself has evolved considerably since its original constant product design, introducing concentrated liquidity in later versions — letting liquidity providers specify a specific price range within which their capital is actively deployed, rather than spreading liquidity evenly across the entire theoretical price curve from zero to infinity. This significantly improves capital efficiency for liquidity providers willing to actively manage their position’s price range, though it also introduces additional complexity and active management requirements compared to the simpler original model.

Other AMM designs have emerged with their own specialized formulas for specific use cases — Curve’s stablecoin-optimized formula, covered in depth elsewhere on this site, being a notable example of how the basic AMM concept has been adapted and specialized for different trading needs beyond Uniswap’s original general-purpose design.

A Practical Scenario

Imagine you want to swap a modest amount of a stablecoin for a smaller-cap token traded on Uniswap. The AMM smart contract calculates the exact amount of the token you’ll receive based on the pool’s current reserve ratio and the constant product formula, executing the entire trade in a single transaction without needing to find a matching counterparty order. If the pool has relatively shallow liquidity for that specific token, your trade might cause noticeable price impact — meaning the effective price you pay is somewhat worse than the pool’s price before your trade, purely due to how the formula responds to the reserve ratio shift your trade causes.

Key Takeaways

Automated market makers use a mathematical formula and pooled liquidity to determine prices and execute trades, replacing the traditional order book model most trading platforms have historically used. Uniswap’s constant product formula (x times y equals k) automatically adjusts pricing based on reserve ratios as trades occur. Liquidity providers fund these pools in exchange for a share of trading fees, taking on impermanent loss risk in return. This design enabled permissionless, continuous liquidity for virtually any token pair, fundamentally reshaping how decentralized trading works across the broader crypto ecosystem.

FAQ

How does an AMM determine token prices without an order book?
Prices are calculated algorithmically based on the ratio of reserves in a liquidity pool, using a mathematical formula like Uniswap’s constant product model, rather than matching buy and sell orders.

Who sets the price on a Uniswap pool?
No single party sets it directly — the formula automatically calculates price based on the pool’s current reserve ratio, which shifts as trades occur.

Can anyone become a liquidity provider?
Yes, generally anyone can deposit an equal value of both tokens in a pair into a pool’s smart contract and begin earning a proportional share of trading fees.

What is concentrated liquidity?
A feature introduced in later Uniswap versions letting liquidity providers deploy capital within a specific price range rather than across the entire theoretical price curve, improving capital efficiency at the cost of requiring more active management.

Why do larger trades on an AMM have more price impact?
Larger trades shift a pool’s reserve ratio more significantly, and the AMM formula’s automatic price adjustment means bigger reserve shifts translate to bigger effective price changes for the trade.

This article is for educational purposes only and is not financial advice. Always do your own research (DYOR) before making investment decisions.

Leave a Reply

Your email address will not be published. Required fields are marked *

© Copyright 2026 FiscalFrontier
Powered by WordPress | Mercury Theme