Chapter 3 Automated Market Making

In the previous chapter, I showed you how to deposit ETH and USDC into a Uniswap v3 (Univ3) liquidity pool. By doing so, you became a liquidity provider (LP) and started earning fees. Uniswap invented Automated Market Making (AMM) and built a decentralized exchange (DEX) based on it. Since then, AMM has become a very popular design for DEXs. In this chapter, we’ll dive into how AMM works and explain where LP’s yield comes from. Let’s get started!

3.1 The mechanism

Before AMM, trading required matching “buys” and “sells”. AMM changed that: for the first time in history, exchanging financial assets no longer required a counterparty. Instead, all we need is a liquidity pool—a smart contract where you and I can deposit or withdraw assets at any time. For example, if you want to sell USDC for ETH, you simply deposit USDC into the pool and withdraw ETH from it. Conversely, if you want to sell ETH for USDC, you deposit ETH and withdraw USDC. The price is determined mathematically and adjusts automatically based on the ratio of tokens in the pool.

Let’s look at one such pool, the 0.05% fee tier ETH-USDC Univ3 pool on Arbitrum1. At the time of writing, this pool holds 16,706 ETH and 9,936,731 USDC, totaling $49 million in value. This massive amount of liquidity helps keep the pool’s internal price aligned with the external market price and minimizes slippage2. The “0.05% fee” means that LPs earn 0.05% of the trading volume. LPs can withdraw their liquidity—either partially or in full—at any time. However, if a large amount of liquidity is removed from the pool, the price of ETH in the pool can deviate significantly from the market price. That’s why it’s a good idea to compare the pool price with the market price before making a swap. As a thought experiment, let’s explore how trading activity, external price movements, and liquidity removal impact the 0.05% fee tier ETH-USDC pool.

What happens after a swap?

  1. Swap: A user buys ETH with USDC on Uniswap, and Uniswap routes the transaction through the 0.05% fee tier pool—but only when it offers the best rate.

  2. Balance change: The swap sends USDC to the pool and removes ETH from it, leaving the pool with more USDC and less ETH than before.

  3. Price adjustment: As a result, the price of ETH in the pool is automatically increased. This higher ETH price encourages others to either sell ETH into the pool or add more ETH liquidity.

As an exercise, what happens if someone swaps ETH for USDC?

What happens when there’s a big movement in the market price of ETH?

  1. Market price increase: The market price of ETH pumps.

  2. Price discrepancy: However, within the pool, the price of ETH increases more slowly because the ratio of ETH to USDC doesn’t change instantly on its own.

  3. Arbitrage: Bots will buy ETH from the pool and sell it on the external market for profit. This activity depletes the pool’s ETH supply and pushes its internal price higher until it (nearly) matches the external price.

  4. Impact on LPs: Your LP position will have less ETH and more USDC than before. If you were to remove liquidity at this point, you’d end up with less ETH than you initially deposited. With ETH price now 20% higher, you’d likely do worse than if you had simply held ETH in your wallet.

  5. Pool price increase: Thanks to arbitrage bots, the price of ETH in the pool quickly goes up.

  6. Pull liquidity: Say it has gone above the maximum of the price range of your LP position. As a result, your position now holds 100% USDC, and you decide to withdraw liquidity and close the position.

  7. ETH-USDC ratio change: Because of your USDC withdrawal, the pool now has less USDC, easing some of the upward price pressure caused by arbitrage bots depleting ETH. At the same time, the rising ETH price in the pool may encourage others to take profit by selling ETH into the pool or adding ETH liquidity, which also helps counteract the depletion of ETH by bots.

As an exercise, what happens when the market price of ETH dumps?

I hope you now have a good understanding of how AMM works. There’s an important detail in the discussion above that I’d like to highlight before we move on: an ETH-USDC LP position will hold more USDC when ETH price rises and more ETH when its price falls. More broadly, a volatile3-stable LP position will hold more of the stablecoin when the volatile coin’s price goes up and more of the volatile coin when its price goes down. Even more generally, a COIN1-COIN2 LP position will hold more of COIN2 when COIN1’s price increases relative to COIN2’s and more of COIN1 when its price decreases relative to COIN2’s. This happens because, by the AMM design, an LP position always “buys low and sells high.” As a result, LP can be used as a way to dollar-cost average in and out of a volatile coin. We’ll explore this in greater detail in the next chapter.

3.2 Where does the yield come from

There are five ways for us to make money with money in decentralized finance (DeFi). The table below summarizes them all.

DeFi Activity Difficulty Enjoyable? 1-Year (Bear + Bull) Return
Trading Hard Yes Negative for most people
Providing liquidity to DEXs Medium Yes 20% ~ 100%+
Providing liquidity to Perp DEXs4 Easy Yes 5% ~ 40%+
Lend-borrow looping Easy No < 20%
Airdrop farming Easy No 2 ~ 5-figure USD
DeFi Activity Risks
Trading Buy high and sell low. Leverage.
Providing liquidity to DEXs Buy high and sell low. Impermanent loss.
Providing liquidity to Perp DEXs Traders big wins.
Lend-borrow looping Liquidation. More money markets got exploited than DEXs.
Airdrop farming Wasted effort. Sybil detection. Dilution. Team rug. Scam links.
DeFi Activity Yield Source
Trading No yield. Capital gain from price appreciation.
Providing liquidity to DEXs Swap fees.
Providing liquidity to Perp DEXs Leverage trading and liquidation fees + LP entry and exit fees.
Lend-borrow looping Supply rate - Borrow rate.
Airdrop farming Money raised.

When we provide liquidity to a DEX like Uniswap, our yield comes from trading fees—commissions paid by users every time they make a swap. These fees typically range from 0.01% to 1% of the trading volume, paid out in the tokens of the trading pair. The more trading volume there is, the tighter our price range, and the longer the price stays within our price range, the more fees we’ll earn.

Some DEXs, like Uniswap, passes all trading fees to LPs. Others go a step further by also rewarding LPs with their own governance tokens. For example, on Trader Joe, pools marked with a green “REWARDS” tag distribute JOE tokens to LPs in addition to trading fees. On the other hand, some DEXs, such as Ramses on Arbitrum, Cleopatra on Mantle, Cellana on Aptos, and Velodrome, reward LPs solely with governance tokens and allocate all trading fees to holders of their vote-escrowed governance tokens. In a raging bull market, governance tokens from newer DEXs with growing TVL can pump, making it potentially worthwhile to farm them through LP positions. However, in a bear market, I stick to providing liquidity on trusted platforms like Uniswap, Raydium, Orca, and Meteora, focusing exclusively on blue-chip asset pairs5. It’s reassuring to know my capital is parked in battle-tested smart contracts, earning high-quality assets.


  1. Its contract address is 0xc6962004f452be9203591991d15f6b388e09e8d0. You can check how many tokens are held in it by visiting its arbiscan page: https://arbiscan.io/address/0xc6962004f452be9203591991d15f6b388e09e8d0.↩︎

  2. Slippage is the difference between the expected price shown on a DEX’s UI when you initiate a swap and the actual price you get when your swap is executed. Positive slippage means your trade is executed at a better price, and negative slippage means it’s executed at a worse price. This happens because prices can change rapidly between the time you initiate a swap and when it’s finalized.↩︎

  3. Here, “volatile” or “volatile coin” simply refers to a coin whose price isn’t 1:1 pegged to a fiat currency, unlike a stablecoin.↩︎

  4. Perp DEXs, short for Perpetual Decentralized Exchanges, are platforms powered by smart contracts that allow users to trade perpetual swaps with leverage, using liquidity provided by LPs.↩︎

  5. The consensus on which coins are blue-chip assets changes over time as the crypto market cycles through booms and busts. At one point, AVAX and LUNA were widely regarded as blue-chip—look where they are now. ETH and SOL held that status for years, all the way up to Trump’s 2024 election—look where they are now. As of 6 March 2025, I consider only BTC to be truly blue-chip.↩︎