Chapter 3 Automated Market Making
Previously, I demonstrated how to deposit ETH and USDC into a Uniswap v3 (Univ3) liquidity pool and how to track earned 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 the yield comes from for liquidity providers (LPs). Let’s get started!
3.1 The mechanism
Before AMM, trading required matching “buys” and “sells”. AMM changed that: for the first time, exchanging financial assets no longer required counterparties. 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 continuously adjusts 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 tier” means that for every swap routed through the pool, 0.05% of the volume goes to the LPs. LPs can withdraw liquidity—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. So it’s always 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?
Swap: A user buys ETH with USDC on Uniswap, and Uniswap routes the transaction through the 0.05% fee tier pool—only when it offers the best rate.
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.
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 sells ETH for USDC?
What happens when there’s a big movement in the market price of ETH?
Market price increase: The market price of ETH pumps.
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.
Arbitrage: Bots will buy ETH from the pool and sell it in the external market for profit. This activity depletes the pool’s ETH supply and pushes its internal price higher until it (nearly) matches the market price.
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.
Pool price increase: Thanks to arbitrage bots, the price of ETH in the pool quickly goes up.
Pull liquidity: Say it goes above the upper bound of your position. Your position now holds 100% USDC, and you decide to withdraw liquidity and close the position.
ETH-USDC ratio change: Your USDC withdrawal eases the upward price pressure caused by arbitrage bots depleting ETH. Meanwhile, the rising ETH price in the pool encourages others to sell ETH into the pool or add 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 I’d like to highlight before we move on: an ETH-USDC LP position holds more USDC when ETH price rises and more ETH when its price falls. More broadly, a volatile3-stable LP position holds 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 holds 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.” Therefore, LP positions can be used to dollar-cost average in and out of a volatile coin. We’ll explore this topic 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 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 high quality assets5.
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.↩︎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.↩︎
The term ‘volatile coin’ (or simply ‘volatile’) refers to any cryptocurrency that’s not pegged to USD—distinguishing it from stablecoins—irrespective of its actual price volatility.↩︎
Perp DEXs, short for Perpetual Decentralized Exchanges, are platforms powered by smart contracts that allow users to trade perpetual swaps with leverage against liquidity pooled from the LPs.↩︎
In crypto, the ‘high-quality’ label comes with an expiration date, and most of the expiration dates are sooner than you think. Crypto history is littered with assets that were once high-quality before failing gradually (e.g., AVAX) or spectacularly (e.g., LUNA, UST). As of May 2025, I consider BTC, ETH, SOL, SUI, AAVE, HYPE, PEPE, and Fartcoin high-quality, and believe they are likely to perform well through 2026. But when looking decades (or even just a few years) ahead, I think Bitcoin is the only asset that will endure and the other coins will go to zero sooner or later.↩︎