8.4 Liquidity Pools and Yield Farming (Basics)

Having explored lending and decentralized trading, liquidity pools and yield farming emerge as the next essential building blocks in DeFi. Liquidity pools act like community piggy banks where users deposit tokens, and traders can then swap from that shared pool instead of finding individual buyers or sellers. In return, liquidity providers earn fees, and through yield farming, they may also collect bonus rewards in the form of governance or incentive tokens. This combination not only offers participants a way to generate passive income but also keeps decentralized markets functioning smoothly. Together, these mechanisms explain much of how DeFi users earn returns while simultaneously strengthening the ecosystem.
Why Liquidity Matters in Crypto
In traditional finance (and many centralized exchanges), trades are matched using an order book: buyers place bids and sellers place asks, and when they overlap, the trade happens. But for many token pairs—especially less popular ones—there may be few buyers or sellers at any moment, making it hard to execute trades without large price movements (known as slippage).
Decentralized exchanges (DEXs) want to allow anyone to swap tokens without relying on a central operator. To make that work, they need a system that ensures trades can proceed even when there aren’t matching buyers and sellers. That’s where liquidity pools come in. Instead of finding a counterparty directly, a trader swaps with a pool of funds provided by users.
In effect, liquidity pools replace the traditional buyer‑meets‑seller model with a fund of tokens that “always” accepts trades, as long as there’s sufficient liquidity.
What Is a Liquidity Pool?
A liquidity pool is a smart contract (on a blockchain) that holds reserves of two (or more) tokens. Users called liquidity providers deposit tokens into the pool. In return, they earn a share of the fees generated when traders use the pool to swap between these tokens.
Key properties:
- LPs deposit tokens in a pair (e.g. Token A + Token B).
- The pool uses an automated pricing formula (an algorithm) to decide how much of one token is exchanged for the other, depending on supply and demand.
- LPs receive LP tokens that represent the proportion of the pool they own. When they want out, they redeem (burn) these LP tokens to claim their share (original tokens plus fees).
- The more liquidity in the pool, the smoother (lower‑slippage) trades tend to be.
How Pricing Works: The “Constant Product” Model
One foundational pricing mechanism in many DEXs (like early versions of Uniswap) is called the constant product formula:
x×y=k
Here:
- x = amount of token A in the pool
- y = amount of token B in the pool
- k = a constant (the product stays fairly constant through trades)
In practice, a small fee (for example, 0.3%) is charged on each trade, which is added to the pool, subtly altering how the invariant behaves and providing extra reward for LPs.
Because the pool price can diverge from prices on broader markets, arbitrage traders may step in to restore consistency, helping keep the pool’s internal price close to the market price.
Over time, more advanced pools may adopt other curves or rules (especially for stablecoins), but the constant product model remains a useful starting point.
Becoming a Liquidity Provider (LP): Step by Step
Here’s how someone typically becomes an LP:
- Pick a Platform / Protocol
Choose a DEX or AMM (Automated Market Maker) on a blockchain you trust. Examples include Uniswap, SushiSwap, Balancer, Curve, PancakeSwap, Raydium, and others. - Connect Your Wallet
You’ll need a crypto wallet that supports the chain (e.g. MetaMask for Ethereum). You grant permission for the protocol to interact with your tokens. - Choose a Token Pair
You must supply both tokens in the pool. Usually, you deposit them in equal value (e.g. if 1 ETH = 3,000 USDC, you'd deposit 1 ETH + 3,000 USDC). The platform often helps with calculation. - Deposit Your Tokens (“Add Liquidity”)
The transaction is confirmed on‑chain (you’ll pay gas fees). Once successful, you receive LP tokens representing your share of the pool. - Earn Trading Fees
Each time someone trades via that pool, fees are collected (a small percentage of their trade) and automatically added to the pool. These extra tokens raise the pool’s reserves, so LPs’ shares become more valuable. - Withdraw Your Liquidity
When you’re ready, you burn your LP tokens and redeem your share of the pool—both your initial tokens and the earned fees.
In some protocols, you can stake your LP tokens in a separate contract to earn extra rewards (this is often called yield farming).
Rewards and Use of LP Tokens
When you deposit as an LP, you receive LP tokens that act as proof of your share in the liquidity pool. These LP tokens:
- Let you redeem your share when you want.
- Can often be used further in the DeFi ecosystem (for example, staked in another protocol to earn extra yield).
- Are sometimes tradeable or transferable (depending on the protocol).
Because LP tokens represent your proportion of the pool, if you contributed 10% of the liquidity, you’d receive 10% of the LP tokens and later be entitled to 10% of the pool’s assets (including fees).
Benefits of Liquidity Pools
- Earn Passive Income via Fees: LPs gain a portion of trading fees in proportion to the liquidity they supplied.
- Enable Decentralized Trading: No central intermediary is needed; liquidity comes from users themselves.
- Lower Slippage (in Large Pools): Bigger pools absorb large trades with less impact on price.
- Composability and Layering Strategies: LP tokens can be used in other protocols (staking, lending, derivatives) to enhance yield.
- Accessibility: Anyone can become an LP (given the capital and suitable tokens).
Key Risks to Watch Out For
As a beginner, you should be aware of the following risks:
- Impermanent Loss (IL): If the price ratio between the two tokens changes significantly after you deposit, your holdings (on withdrawal) might be worth less than if you had held the tokens separately. The loss is “impermanent” only if prices revert. Otherwise, it becomes real when you withdraw. (This is one of the most important risks in liquidity providing.)
- Smart Contract Vulnerabilities / Exploits: Bugs or security flaws in the pool’s code can allow hackers to drain funds. Some newer projects may have weak audits or untested code.
- Rug Pulls / Malicious Projects: Some token projects may lure liquidity, then withdraw it (or manipulate prices), leaving LPs with worthless tokens. This is a form of exit scam.
- Low Liquidity / High Slippage: In small or shallow pools, trades can heavily move prices. If many LPs withdraw, a pool may become illiquid.
- High Transaction Fees / Gas Costs: On “expensive” blockchains (e.g. Ethereum during peak congestion), transaction fees can eat into your returns.
- Being “Out of Range” (for Range‑Based Liquidity Schemes): In advanced systems where you allocate liquidity only within certain price bounds, if the market price moves outside your specified range, your liquidity becomes inactive (you essentially hold just one token) and stop collecting fees until the price returns to your range.
Advanced Variants and Innovations
Over time, protocols have developed enhancements to classic liquidity pools:
- Concentrated Liquidity / Custom Ranges: Instead of spreading your liquidity across all possible prices, you choose a narrower price interval over which your liquidity is active. This increases capital efficiency (you can earn more fees per unit of capital), but with more risk of being inactive if the market moves out of your range.
- Stablecoin / Low Volatility Pools: Pools with tokens that maintain a peg (e.g. USDC/USDT) often use more gentle curves or algorithms to reduce slippage when the two tokens stay close in value.
- Pools with More Than Two Tokens: Some protocols support multi‑asset pools (e.g. three or more tokens), or uneven weights (not strictly 50/50). This provides flexibility and diversification.
- Hybrid Models Combining Pools and Order Books: Some DEXs integrate liquidity from pools into order book systems, or combine both models to improve depth and execution. (Some platforms like Raydium have experimented with this.)
- Liquidity Bootstrapping Pools (LBPs): Used for token launches or initial distribution. These allow variable weights or changing dynamics to help reveal price discovery while discouraging early whales.
How to Choose and Evaluate a Pool as a Beginner
When deciding whether to provide liquidity to a particular pool, consider these factors:
- Pool Size / Total Value Locked (TVL): Larger pools tend to be safer (less volatile slippage).
- Trading Volume: High-volume pools generate more fees, increasing your return potential.
- Volatility of the Pair: More stable pairs (e.g. stablecoins) reduce impermanent loss risk.
- Protocol Reputation and Security: Choose audited, well-known projects with track records.
- Fee Structure: Understand how much of each trade goes to LPs.
- Incentives / Extra Rewards: Some pools offer extra token rewards to attract LPs (yield farming).
- Your Risk Tolerance and Time Horizon: Dynamic markets may move outside your comfort zone.
- Exit Mechanics / Gas Cost: Withdrawing liquidity costs gas and may incur slippage.
Start small to test the waters.
Liquidity Pools on Other Chains
While much of the early innovation has been on Ethereum, many of the same ideas apply on other blockchains. For example, Raydium is a DEX on Solana that uses liquidity pools and has incorporated hybrid features (pool + order book integration) to improve depth and execution.
Because Solana has much lower transaction costs and higher throughput, some of the pressures (like gas fees) are less severe. But the same principles (impermanent loss, smart contract risk, range management) still apply.
Popular Liquidity Pools
Platform/Pool | Blockchain | Why It’s Great for Beginners | Key Features and Details |
---|---|---|---|
Uniswap (ETH/USDC) | Ethereum | Easy-to-use interface for swapping tokens; perfect for beginners learning DeFi. High trading volume ensures smooth trades. | Automated market maker (AMM) for token swaps; V3 allows providers to focus liquidity for better returns; supports all ERC-20 tokens. |
Curve (3pool: USDT/USDC/DAI) | Ethereum | Great for beginners wanting stable investments; focuses on stablecoins to reduce price volatility risks. | Optimized for stablecoin swaps with low slippage; offers CRV token rewards; deep liquidity reduces impermanent loss. |
PancakeSwap (BNB/CAKE) | BNB Smart Chain | Low-cost transactions and a fun interface make it beginner-friendly; ideal for those new to providing liquidity. | Fast swaps with low fees; integrates yield farming and lotteries; supports BEP-20 tokens; high liquidity for BNB pairs. |
Balancer (80/20 BTC/WETH) | Ethereum | Flexible pool options let beginners experiment with different assets without complex setup. | Customizable pool weights (e.g. 80% BTC, 20% WETH); supports multi-asset pools; smart pool creation for diversified strategies. |
SushiSwap (SUSHI/ETH) | Multi-chain | Similar to Uniswap but with extra rewards, making it appealing for new liquidity providers. | Token swaps, staking, and BentoBox lending; supports cross-chain pools; SUSHI token rewards for providers. |
Lido (stETH/ETH) | Ethereum | Simplifies staking for beginners by offering liquid stETH tokens, usable in DeFi. | Liquid staking for ETH; high total value locked (TVL); integrates with other DeFi platforms for additional yields. |
Summary
- Liquidity pools are a core building block of decentralized trading: they allow token swaps without needing direct order matching.
- You supply pairs of tokens to a pool and receive LP tokens representing your share.
- You earn trading fees, but face risks, especially impermanent loss and contract vulnerabilities.
- Newer designs (range-based liquidity, multi‑token pools) improve efficiency but add complexity.
- Always evaluate pool size, volume, token volatility, security, and reward structure.
- Start small, use known and audited protocols, and monitor your position actively.
"A liquidity pool in crypto and DeFi is a group of assets tied up in a smart contract, which allows traders to trade certain coins and tokens back in forth using an algorithm to determine current pricing."
Yield Farming
Yield farming (sometimes called liquidity mining) is a DeFi strategy in which crypto holders lend or lock up their tokens into protocols and earn rewards. These rewards typically come from:
- Transaction fees paid by users of a protocol
- Interest from lending/borrowing markets
- Incentive tokens (often governance tokens) distributed by the protocol to attract liquidity
In other words, yield farming is a way to make your crypto “work” for you—earning additional returns rather than just holding.
Many DeFi platforms use smart contracts to automate this process, so once you deposit your tokens, they are managed programmatically.
Why Yield Farming Exists (and Why It Matters)
DeFi protocols need liquidity (i.e. tokens locked in them) to function—whether for swapping tokens (on DEXs), lending/borrowing, or other financial services. To attract that liquidity from users, protocols provide economic incentives: that’s where yield farming comes in.
- For decentralized exchanges (DEXs), liquidity allows token swaps without needing direct counterparties.
- For lending protocols, deposited tokens become available to borrowers, earning interest.
- Protocols often distribute their own “native” tokens as extra rewards to encourage participation and decentralize governance.
By providing incentives, yield farming helps bootstrap and sustain DeFi ecosystems.
Basic Mechanics and Workflow
While implementations vary, most yield farming follows a common set of steps:
- Choose a Platform / Protocol
You pick a DeFi platform (e.g. a DEX, lending protocol) that supports yield farming. - Deposit or “Lock Up” Your Tokens
- In a liquidity pool / AMM model, you deposit a pair of tokens (e.g. ETH + USDC) into a pool.
- In a lending model, you deposit (lend) tokens to a market where others can borrow them.
- Receive a “Receipt” (LP Tokens, Stake Tokens, etc.)
When you deposit, you often receive a token (e.g. LP tokens) that represents your share of the pool. - Stake or Register Those Tokens into a “Farm”
In many systems, you take your LP tokens (or equivalent) and stake them further in a “farm” contract to claim additional rewards. - Earn Rewards Over Time
Rewards accrue, often in the form of fees, interest, and/or native token incentives. You may periodically “harvest” (claim) these rewards. - Reinvest (Compound) or Withdraw
You can choose to reinvest your earnings into the same or another pool to increase returns, or withdraw your tokens (plus rewards) when you wish. - Unstaking / Exiting
To exit, you unstake, redeem your LP tokens (if applicable), and collect your underlying tokens and rewards.
Using these steps, yield farmers try to maximize return by choosing the best pools, timing, and reinvestment strategies.
Sources of Yield (Where the Rewards Come From)
Yield in farming typically comes from three major sources:
Source |
Description |
Transaction Fees / Trading Fees |
In AMM pools, trades incur a small fee (e.g. 0.3% or another
rate). Part of that fee goes to liquidity providers proportionally. |
Interest from Lending / Borrowing |
When you deposit tokens in a lending market, borrowers pay
interest. A share of that interest is passed back to you. |
Incentive / Reward Tokens |
Protocols may distribute their own token (governance or reward
token) to users who supply liquidity. This is extra incentive beyond
fees/interest. |
Many farming setups combine two or all three of these sources. For example, in an AMM, you might get both trading fee revenue and receive governance token rewards.
Key Metrics: APR, APY, and Calculating Returns
When comparing yield farming options, two common metrics are used:
- APR (Annual Percentage Rate): The simple (non‑compounded) rate you’d earn over a year.
- APY (Annual Percentage Yield): The effective rate accounting for compounding, i.e. earning interest on interest.
Because yield farming often allows you to reinvest rewards, APY can give a more accurate sense of potential growth.
Other important factors affecting returns:
- Trading volume in the pool (more volume = more fees)
- Liquidity size / Total Value Locked (TVL) — very small pools may offer high rates but carry more risk
- Reward token issuance rate and how rewards are distributed
- Impermanent loss, which can reduce effective yield (see next section)
- Gas costs / transaction costs (especially on networks like Ethereum)
Many platforms display estimated APR / APY so users can compare pools.
Main Risks in Yield Farming
Yield farming carries significant risks. For a beginner, these are the most critical to understand:
- Impermanent Loss (IL): If the price ratio between the two tokens in your liquidity pool changes significantly, you might end up worse off compared to simply holding the tokens. The loss is “impermanent” in that if ratios return, it may vanish—but if you withdraw during divergence, the loss becomes permanent.
- Smart Contract / Protocol Vulnerabilities: Bugs, exploits, or vulnerabilities in the smart contracts underlying the yield farm can lead to loss of funds. Even audited contracts are not immune.
- Rug Pulls / Project Scams: Some projects launch farming incentives to attract liquidity, then the creators remove all liquidity or otherwise abandon the project, leaving users stuck. This is especially common with new or unaudited tokens.
- Liquidity Drying / Slippage: If many participants withdraw liquidity, a pool can become shallow. Large trades may incur extreme slippage.
- Volatility / Token Price Risk: Even if farming earns high returns, your underlying tokens may lose value. High volatility can overwhelm the benefits.
- Changing Reward Schemes / Rate Cuts: Protocols may reduce the reward distribution over time, leaving farmers with lower yields than expected.
- Gas / Transaction Costs: Frequent harvesting or reinvesting can incur high gas costs (on networks like Ethereum), which can eat into profit.
- Complexity and Management Overhead: Yield farming often requires monitoring multiple pools, moving funds, and timing. It’s more active than just staking.
Because of these risks, yield farming is often better suited for users who are comfortable with crypto risk and actively manage their positions.
Variants and Advanced Strategies
Beyond the basic workflow, yield farming has evolved with many variants:
a) Single-Token Staking / Pools
Some protocols allow you to stake a single token (no pair) in a “pool” and earn rewards. This avoids impermanent loss but may offer lower yield.
b) Leverage / Leveraged Farming
Some platforms allow you to borrow additional tokens to increase your farming position (e.g. borrowing token A to pair more with token B). This magnifies returns but also increases risk (e.g. liquidation).
c) Yield Aggregators / Vaults
These are smart contracts or services that automatically move funds across multiple protocols to maximize yield, compounding for users. Examples include Yearn Finance, Beefy, etc.
d) Auto‑Compounding / Reinvest Bots
Some strategies automatically harvest rewards and reinvest them, reducing manual effort.
e) Strategy Layering
Combining yield farming with lending, borrowing, or leveraging to amplify returns.
Because these techniques increase complexity and risk, they are typically better for intermediate or advanced users.
Example: Yield Farming on PancakeSwap
To make it more concrete, here is an illustrative example of yield farming on PancakeSwap (on the Binance Smart Chain) following their documentation:
- Provide Liquidity
Choose a token pair with a farm incentive (e.g. CAKE/BNB). Deposit both tokens into the liquidity pool. When you do this, you receive LP tokens representing your share. - Stake the LP Tokens in the Farm
After you have LP tokens, stake them in a farming contract (Farm) to receive additional rewards (e.g. CAKE tokens). - Harvest Rewards Periodically
You can claim (harvest) your accumulated CAKE rewards from the farm. In newer versions, you may have multiple positions, each requiring separate harvests. - Add or Remove Liquidity While Staking
On some versions, you can adjust your staked liquidity (add more tokens or remove some) without completely unstaking. The unclaimed rewards are harvested in the process. - Unstake and Exit
When you're done, you unstake your LP tokens, redeem them for the underlying tokens (plus earned fees while in the pool), and withdraw them to your wallet.
When evaluating which farm to pick, PancakeSwap shows metrics like TVL, fees, and APR to help users compare.
This example shows a “farm” built on top of a liquidity pool: deposit → stake → harvest → withdraw. Many DeFi systems follow a similar pattern.
"In the simplest terms, Yield Farming is finding the best places to put your crypto so that you can earn more free crypto."
Sample Walkthrough
Here's a scenario to help you see how math might work (with simplified numbers, ignoring fees and gas for clarity):
- Suppose you pick a liquidity pool of Token A and Token B. You deposit 100 A + 1,000 B (equal value) into the pool.
- The protocol offers an incentive of 100 reward tokens per block (or per time period) for all LPs.
- Your share of the pool is 1% (you contributed 1% of the pool).
- Thus, you’re entitled to 1 reward token per block (1% of 100).
- Over time, those reward tokens accumulate. Suppose over a year, you collect 10,000 reward tokens.
- If reward tokens are worth, say, $2 each, your rewards amount to $20,000.
- Meanwhile, your underlying assets could shift in value due to market movements, and impermanent loss might affect your final returns.
If you reinvest your rewards back into the pool (compounding), your yield might increase further. This simplified example demonstrates the relationship between your share, reward rate, and yield.
Popular Yield Farms
Platform | Blockchain | Why It’s Great for Beginners | Key Features and Details |
---|---|---|---|
Yearn Finance | Ethereum (Multi-chain) | Automates yield farming to make earning rewards easy without complex management. | Vaults automatically move funds to high-yield opportunities; auto-compounds profits; supports multiple chains like Polygon. |
PancakeSwap | BNB Smart Chain | Low fees and a fun, simple interface make it perfect for new farmers; offers high reward rates. | Stake CAKE in syrup pools for high APYs; includes lotteries and farms for BEP-20 tokens; fast and cheap transactions. |
Aave | Ethereum (Multi-chain) | Safe and reliable for beginners; earn passive income by lending assets with minimal effort. | Lend tokens to earn interest; aToken rewards; supports stable/variable rates; flash loans for advanced users. |
Curve Finance | Ethereum | Focuses on stablecoins for low-risk farming, ideal for cautious beginners. | Earn CRV rewards; low impermanent loss for stablecoin pools; veCRV governance for voting; deep liquidity. |
SushiSwap | Multi-chain | User-friendly with extra rewards, great for beginners who want community-driven platforms. | Onsen farms for high yields; Kashi lending; SUSHI token staking; supports cross-chain farming. |
GMX | Arbitrum/Avalanche | High yields from trading fees; simple for beginners to stake in GLP pools. | GLP token for liquidity provision; earns fees from leveraged trading; zero-slippage swaps; low-cost L2 chains. |
Tips and Best Practices
Here are recommended practices to reduce risk and increase your chances of success:
- Start with well-known, audited protocols (Uniswap, Curve, PancakeSwap) rather than brand-new, untested ones.
- Avoid extremely small / low‑liquidity pools. They may offer high yields but carry high risks.
- Compare multiple pools by looking at TVL, volume, APR, and rewards.
- Factor in gas / transaction costs before harvesting frequently.
- Monitor your positions. Be ready to exit if rewards drop or token prices collapse.
- Consider yield aggregators if you prefer less manual work (but understand their mechanics).
- Don’t overleverage early on. Leverage increases risk steeply.
- Understand lock-up periods, withdrawal constraints, or penalties.
- Use only capital you can afford to lose in high-risk experiments.
Conclusion
- Liquidity pools are the foundational primitive for many DeFi services: they enable on-chain swaps, price discovery, and permissionless liquidity. The math (invariants) and LP share mechanics govern pricing, fees, and earnings.
- Yield farming is the practice of earning returns by providing liquidity and staking LP tokens (or otherwise redeploying capital), but it combines multiple risks—especially impermanent loss, smart-contract exposure, and token price risk.
- For beginners: start with low-volatility pools, use audited protocols, account for gas, and treat yield farming like a risk-managed experiment rather than guaranteed income.
Liquidity pools and yield farming form the engine room of decentralized finance, enabling seamless swaps for traders and rewarding liquidity providers with fees and incentives. Having explored how pools balance assets, how yield farming strategies operate, and the trade-offs involved, you now understand how liquidity and incentives drive much of DeFi. But with opportunity comes risk: the same smart contracts that power these systems can expose users to vulnerabilities, and price movements can lead to impermanent loss for liquidity providers. In the next lesson, we’ll examine these two critical risks—smart contract risk and impermanent loss—to understand how they arise and how to manage them effectively.