What Is a DeFi Liquidity Pool, and How Does It Work?
What is a liquidity pool in DeFi? It is a smart contract holding token reserves; swaps use a formula to set prices, while providers earn fees and accept market risk.
Cryptons Newsroom5 min read
A liquidity pool in DeFi is a smart contract that holds tokens for people to swap against, with prices set by a formula rather than an order book. In a common two-token pool, traders add one token and take out the other; liquidity providers deposit both tokens and earn a share of swap fees.
Understanding the pool’s pricing helps you see why a swap’s quoted rate can change with its size.
How a liquidity pool sets swap prices
A pool holds paired reserves, such as ETH and USDC, inside a smart contract. An automated market maker uses those reserves and a pricing rule to quote trades, so a trader can swap without waiting for another person to place a matching order. Uniswap is one example of a protocol that uses this model.
In a Uniswap v2 pool, the rule is the constant-product formula: x*y=k. Here, x and y are the reserve amounts of each token, and k is their product. The pool keeps that product from falling during a swap, while the ratio between the reserves helps determine the price.
Take a pool with 10 ETH and 20,000 USDC. Its starting reserve ratio is 2,000 USDC per ETH. If you swap USDC for ETH, your USDC goes into the pool and ETH comes out. That leaves more USDC and less ETH in reserve, moving the pool along the x*y=k curve. As a result, each additional ETH costs more USDC than the one before it.
Ignoring the fee, a 2,000 USDC swap in this example would take out about 0.91 ETH. The pool would then hold about 9.09 ETH and 22,000 USDC, putting its reserve ratio near 2,420 USDC per ETH. The execution rate for the whole trade differs from the starting ratio because the trade changes the reserves as it happens. That difference is price impact.
The Uniswap v2 Core whitepaper describes a 0.3% fee per swap, which is added to the pool’s reserves. The trader receives slightly less output as a result. Pool rules and fees vary across protocols and versions, so a quote depends on the particular route and pools involved.
Pool depth affects how sharply a trade moves the price: the same swap usually changes the reserves by a smaller proportion in a deeper pool. An aggregator can compare routes across pools and divide a trade to seek more output. KyberSwap Aggregator routes token swaps across supported liquidity sources and networks; its route may combine pools instead of relying on one pool. For background on the token associated with the project, the KNC token link adds context about KyberSwap’s token.
Liquidity providers supply both tokens to a pool. In Uniswap v2, they receive LP tokens that represent their share of the pool. When swaps generate fees, those fees increase the reserves, so the value represented by an LP token can grow relative to the pool’s original deposits. In this v2-style design, the fees compound automatically; providers do not have to collect them separately for them to become part of the reserves.
Uniswap v3 handles fee accrual differently: fees accrue separately from the position’s liquidity and must be collected by the provider. V3 liquidity positions also have chosen price ranges, so a position earns swap fees only while it is active at the pool’s current price. The version matters when you assess how fees accrue and what managing a position involves.
How do liquidity providers earn money?
Liquidity providers earn a share of swap fees when traders use the liquidity they supplied. In Uniswap v2, the stated pool fee is 0.3% per swap, and fees are added to reserves, increasing the pool’s value for LPs in proportion to their share. Fee income can be offset by changes in the value of the deposited tokens.
What is impermanent loss?
Impermanent loss is the difference between the value of your pool position and what the same tokens would be worth if you had simply held them outside the pool. It can happen when the tokens’ relative market price changes: arbitrage trades shift the pool’s reserves toward the new market price, changing the mix of tokens you own through your share. Fees may offset some of that difference, but the result depends on price movement, pool activity, and fees earned.
A pool is different from an order book: an order book matches buy and sell offers at listed prices, while a pool offers trades against reserves under a formula. A pool also differs from a wallet balance because depositing makes you a proportional liquidity provider exposed to both reserve changes and the pool’s rules.
How do I add liquidity to a pool?
Choose a supported pool, review its tokens, fee terms, and deposit requirements, then connect a wallet and approve the token transactions. In a two-token pool, you generally provide both assets in the pool’s required proportions. Check the pool and network before confirming, since deposits are governed by smart contracts.
Are liquidity pools safe to deposit into?
Liquidity pools carry risks, including smart-contract vulnerabilities, token risks, and impermanent loss when relative prices move. Review the specific pool and protocol, understand how its fees and liquidity rules work, and only deposit assets you can afford to put at risk.