流动性池
提供流动性
流动性池 是 CoddyKit 上的免费 Web3 & DApp Development Fundamentals 课时。 这是第 3 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Web3 & DApp Development Fundamentals 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Web3 & DApp Development Fundamentals 课程共包含 4 节课。
本课时的部分内容尚未翻译,以英文显示。
What Is a Liquidity Pool?
A liquidity pool is the reserve of two (or more) tokens locked in an AMM smart contract that traders swap against.
Without liquidity there is nothing to trade against, so pools are the foundation of every DEX.
Liquidity Providers (LPs)
A liquidity provider deposits tokens into a pool to enable trading and earn a share of the fees.
Anyone can become an LP — you simply supply both tokens of the pair in the correct ratio.
Depositing in the Correct Ratio
You must add both tokens proportional to the current reserves so you do not shift the price.
If the pool is 1 ETH : 2000 USDC, you deposit in that same ratio.
Pool ratio: 1 ETH : 2000 USDC
To add liquidity with 5 ETH
-> you also add 10000 USDCLP Tokens
In return for your deposit, the pool mints LP tokens representing your share of the reserves.
Burning your LP tokens later lets you withdraw your portion plus accrued fees.
mint LPtokens = pool.totalSupply *
(deposited / reserves)
// LP tokens = proof of your shareEarning Trading Fees
Every swap pays a fee that stays in the pool. As fees accumulate, the value backing each LP token grows.
Your earnings are proportional to your share and the pool's trading volume.
Impermanent Loss
Impermanent loss is the opportunity cost an LP suffers when the two tokens diverge in price compared to simply holding them.
The AMM rebalances the pool as prices move, leaving you with more of the falling asset and less of the rising one.
Why It Is Called Impermanent
The loss is impermanent because it disappears if prices return to their original ratio. It only becomes real when you withdraw at a diverged price.
Fees earned can offset or exceed impermanent loss, which is why high-volume pools remain attractive.
Price diverges -> paper loss vs holding
Price returns -> loss vanishes
Withdraw while diverged -> loss realizedStable Pairs Have Less IL
Pools of similar assets (USDC/DAI) barely diverge in price, so impermanent loss is minimal.
This is why stablecoin pools on protocols like Curve are popular with conservative LPs.
Pool Depth and Slippage
The more liquidity a pool holds, the less each trade moves the price. Deep pools offer low slippage and attract more volume.
More volume means more fees, which attracts more liquidity — a reinforcing cycle.
Liquidity Mining Incentives
To bootstrap a new pool, protocols often offer liquidity mining: extra reward tokens on top of trading fees.
These incentives jump-start liquidity but can fade once rewards end, so LPs must weigh long-term viability.
Putting It Together
Liquidity pools let anyone supply token pairs, receive LP tokens, and earn fees. The trade-off is impermanent loss when prices diverge, partially offset by fees and incentives.
Next we build a simple swap to see the mechanics in code.
Quick Check
Test your liquidity pool knowledge.
Recap: Liquidity Pools
You learned that:
- LPs deposit token pairs and receive LP tokens
- They earn a share of trading fees
- Impermanent loss arises when prices diverge
- Deep pools mean low slippage; incentives bootstrap liquidity
Next: coding a basic swap.
用 AI 导师学习 Web3 & DApp Development Fundamentals — 免费
在浏览器中编写并运行真实代码,获得全天候 AI 导师的即时帮助,并在网页或应用中继续学习。
- 课程
- 29
- 课程
- 105
常见问题解答
「流动性池」课时是免费的吗?
是的 — 「流动性池」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Web3 & DApp Development Fundamentals 课程的其余内容,请升级到 CoddyKit PRO。 Web3 & DApp Development Fundamentals 课程共包含 4 节课。
「流动性池」这节课中我会学到什么?
提供流动性 你通过在浏览器中直接运行的动手代码来练习 Web3 & DApp Development Fundamentals,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 Web3 & DApp Development Fundamentals 需要有经验吗?
无需任何先前经验。CoddyKit 上的 Web3 & DApp Development Fundamentals 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 3 节课,共 4 节。
「流动性池」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 Web3 & DApp Development Fundamentals 课中编写并运行代码吗?
能。每节 Web3 & DApp Development Fundamentals 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。