What are Liquidity Pools?
- Liquidity pools are smart contracts that manage the deposits of two types of crypto assets to allow swaps on a DEX
- Liquidity providers earn trading fees from every swap in a way to compensate impermanent loss
Liquidity pools are smart contracts that manage the deposits of two types of crypto assets (or tokens) in order to allow swaps (trades) on a decentralized exchange (DEX). These pools tend to consist of an even split (50%/50%) between two currencies (but there are also liquidity pools that have different ratios).
How do Liquidity Pools work?
Imagine you have a new decentralized exchange that wants to open only a single pool for HBAR and HELI. In order to allow anyone to make a swap HBAR for HELI and vice versa, the decentralized exchange would need to attract liquidity providers to the pool. This is where liquidity providers come into play.
Decentralized exchanges try to attract liquidity providers. They do this by charging a fee on every swap (trade) that takes place that gets routed through a particular liquidity pool and redistribute that fee among all liquidity providers. To give an example, if one provides 5% of the liquidity in a pool, one would also be entitled to 5% of all fees generated from that pool. Understanding the fee structure is critical when providing liquidity, as ultimately rewards from fees could more than offset the risk of impermanent loss.
In the HBAR <> HELI example, a liquidity provider would need to include both tokens in their deposit. So if someone wanted to deposit 1000 HBAR and 1 HBAR would be worth 2 HELI then the liquidity provider would need to provide 1000 HBAR and 2000 HELI tokens to maintain the 50/50 ratio. Once the funds are provided, the provider receives LP tokens back that represent one's percentage of the combined value of both tokens in the liquidity pool.
The LP tokens represent the percentage share of the pool the LP token holder owns. The ratio of the underlying assets of an LP token can change over time given changes in asset prices, swapping fees that accumulate, and other factors.