Sub topic 2
Liquidity pools and how thin liquidity makes prices fragile
This chapter assumes you know what a token is, how a wallet signs a transaction, and what a decentralized exchange (DEX) is at a basic level. The Python examples are short and can be read without programming experience.
Why this matters for scams
Pump-and-dump and rug-pull schemes depend on one fact: a token's quoted price is only as reliable as the pool of money behind it. A small pool lets a small amount of buying push the price sharply up. It also lets one seller push the price sharply down. This chapter explains the mechanism so that later chapters on pumps and rugs make sense.
Order books versus pools
A centralized exchange keeps an order book. Buyers post the prices they will pay, sellers post the prices they will accept, and trades happen when the two meet.
Most new tokens trade differently. They trade on a DEX through an automated market maker (AMM). An AMM is a smart contract that holds two assets in a liquidity pool, for example ETH and a new token. Anyone can swap one asset for the other against the pool. No counterparty has to be online.
Anyone can also create a pool for any token, with no review. This openness is useful, and scammers exploit it.
The constant-product rule
Uniswap v2-style pools follow a simple rule. If the pool holds x of asset A and y of asset B, every swap must keep the product x * y = k constant. The fee is the exception. It stays in the pool, so k grows slightly with each trade.
The pool's spot price is the ratio of its reserves. With 100 ETH and 1,000,000 tokens, one token costs 100 / 1,000,000 = 0.0001 ETH.
When you buy tokens, you add ETH and remove tokens. The pool recalculates how many tokens it can release while keeping k fixed. Each additional token you take costs more than the last. Selling works the same way in reverse.
def amount_out(amount_in, reserve_in, reserve_out, fee=0.003):
"""Constant-product (x * y = k) swap output, as in Uniswap v2-style pools."""
amount_in_after_fee = amount_in * (1 - fee)
return reserve_out * amount_in_after_fee / (reserve_in + amount_in_after_fee)
# A pool holding 100 ETH and 1,000,000 tokens.
eth_reserve = 100.0
token_reserve = 1_000_000.0
# ETH received for selling 100,000 tokens into the pool.
print(amount_out(100_000, token_reserve, eth_reserve))
# The same sale after the creator has withdrawn 90% of the liquidity.
print(amount_out(100_000, token_reserve * 0.1, eth_reserve * 0.1))The first call returns about 9.07 ETH. At the spot price the tokens are "worth" 10 ETH, so the seller loses roughly 9% to price impact and the 0.3% fee. The second call returns about 4.99 ETH for the same tokens. Nothing about the token changed. Only the pool shrank, and the seller's proceeds roughly halved.
Price impact and slippage
Price impact is how far your own trade moves the price. Slippage is the difference between the price you expected when you clicked and the price you actually got. Price impact is the main cause of slippage, and other trades that land before yours can add to it.
Ignoring the fee, selling dx tokens into a pool with x tokens in reserve gives an average execution price that is x / (x + dx) of the spot price. The size of the trade relative to the pool is what matters, not its absolute size.
| Trade size as share of the pool's reserve of the asset you add | Approximate price impact |
|---|---|
| 1% | 1% |
| 10% | 9% |
| 25% | 20% |
| 50% | 33% |
| 100% | 50% |
A pool with deep reserves absorbs ordinary trades with little movement. A pool with shallow reserves does not.
Thin liquidity moves prices in both directions
Take the pool from the example, with 100 ETH and 1,000,000 tokens. Suppose a buyer spends 10 ETH.
def swap(amount_in, reserve_in, reserve_out, fee=0.003):
out = reserve_out * amount_in * (1 - fee) / (reserve_in + amount_in * (1 - fee))
return out, reserve_in + amount_in, reserve_out - out
eth, tokens = 100.0, 1_000_000.0
price_before = eth / tokens
bought, eth, tokens = swap(10, eth, tokens)
price_after = eth / tokens
print(f"tokens received: {bought:,.0f}")
print(f"price change: {(price_after / price_before - 1) * 100:.1f}%")The buyer receives about 90,661 tokens, and the quoted price rises about 21%. A single 10 ETH purchase moved the token's price by a fifth.
Now compare how this looks to an outside observer. The price chart shows a 21% jump. Liquidity trackers show a token that is "up" with volume. The chart does not show that one wallet spent a modest amount of money to cause it.
This asymmetry is what manipulators use:
- Buying small amounts creates large price moves. A promoter can make a chart look strong with little capital.
- Selling large holdings moves the price down far more than the paper value suggests. A holder whose tokens are worth a lot on screen may not be able to sell them at anything close to that value.
- Reported value overstates what you can actually withdraw. The quoted price applies to the next tiny trade. It does not apply to your whole position.
Liquidity providers and what they own
Pools are funded by liquidity providers (LPs). An LP deposits both assets and receives LP tokens in return. LP tokens are a receipt that proves a claim on a share of the pool. Burning them returns that share of both assets, at whatever ratio the pool then holds.
This design has two consequences for scam analysis.
- Whoever holds the LP tokens controls the pool's exit. If a token's creator seeds the pool and keeps the LP tokens in their own wallet, they can withdraw the ETH at any time. The ETH in the pool is mostly the buyers' money by then.
- Where the LP tokens sit is more informative than how large the pool looks. A large pool whose LP tokens are in an anonymous wallet is a different risk from one whose LP tokens are locked in a time-lock contract or sent to a burn address.
Honest projects do hold LP tokens too, so holding them is not proof of bad intent. The point is to know who can pull the liquidity. Chapter material later in this tutorial covers how to check that on a block explorer.
Pairing and the "real" money in a pool
Most pools pair a new token with a established asset such as ETH, WETH, or a stablecoin. The established asset is the only real money in the pool. The new token is worth only what that pool will pay for it.
This gives a rough ceiling on what holders can collectively cash out. If a pool holds 100 ETH, then all holders of the token together cannot extract more than 100 ETH, no matter what the quoted market cap says. The next section on market cap builds on this idea. Even that ceiling is optimistic, because each sale pushes the price down and the later sellers get less.
A useful comparison is the pool's ETH reserve against the token's quoted market cap, which is price multiplied by total supply. If a token claims a market cap of 10 million dollars and its pool holds 20,000 dollars of the paired asset, the number only describes the price of the last tiny trade.
Common fragilities to recognize
- Very small pool relative to claimed market cap. One sale of a few percent of supply can crush the price.
- Liquidity added in one block and removed soon after. Pools that exist for hours are cheaper to build and cheaper to abandon.
- Single-sided or lopsided pools. If the creator holds most of the token supply and the pool holds only a little ETH, the creator is the largest potential seller against a thin buy side.
- High volume on a small pool. Wash trading between a few wallets, using the same funds repeatedly, can fake activity. Volume does not show depth.
- Slippage settings set very high. Some tokens only work if you accept 20% or more slippage. That may be a tax coded into the contract, or a sign that the pool is too thin for normal trades.
How to judge depth before buying
A few quick checks give a practical sense of how fragile a pool is:
- Read the pool's reserves of the paired asset, not the token's displayed market cap.
- Compare your intended trade with that reserve. Keeping a trade to a small fraction of the reserve keeps price impact low.
- Estimate your exit. Run the same formula for selling your whole position and see what you would receive.
- Check who holds the LP tokens and whether they are locked.
- Check how long the pool has existed and whether liquidity has changed recently.
Key points
- AMM pools price assets from their own reserves using
x * y = k. There is no order book. - Price impact depends on trade size relative to reserves. Small pools move a lot.
- Whoever holds the LP tokens controls withdrawal of the pool's real assets.
- Market cap multiplies a thin-pool price by total supply, so it can greatly overstate what holders can withdraw.
Exercise
A pool holds 50 ETH and 500,000 tokens. Ignoring fees, how much ETH do you receive for selling 50,000 tokens, and how does that compare with the spot value of those tokens?
Show answer
Output = 50 * 50,000 / (500,000 + 50,000) = 2,500,000 / 550,000, about 4.55 ETH. The spot price is 50 / 500,000 = 0.0001 ETH per token, so 50,000 tokens look worth 5 ETH. You receive about 9% less, which matches the price impact of 1 - 500,000 / 550,000.
Exercise
Why can a creator who holds the pool's LP tokens remove "the buyers' money" even though they never sold a single token?
Show answer
LP tokens are a claim on a share of the pool's reserves. Burning them returns that share of both assets, including the ETH that buyers paid in. The creator does not need to sell the token to take that ETH.