What are Liquidity pools and how do they work

What are Liquidity pools and how do they work?

23.05.2022 07:30
by Srđan Jovanović
9 min read

Liquidity pools are essential for DeFi. They are smart contracts written in a way to hold certain funds and allow buyers and sellers to conduct trade on DEXes.

DeFi Liquidity pools explained

In a traditional exchange, buyers submit offers to buy assets (stocks, assets, crypto) claiming how big is their demand, and at what price are they willing to do the trade. Sellers place asking orders, declaring how much they are willing to sell, and at which price point. This is all recorded in an “order book” 

What is the problem with this “order book” model?

The main problem is that if there are no matches, e.g if no buyers offer to match the selling trader’s asking price, there is no trade. Buyers are forced to buy at the lowest asking price. Sellers are forced to either wait for the matching buyer or to lower their price.

What is the solution?

The liquidity pool uses an algorithm. It is a pool of assets, containing both tokens that traders are interested in. Instead of one big pool of varied assets, pools are created much like the traditional “trading pairs”. The crypto liquidity pool for ETH/BTC, for example, is holding both Ether and Bitcoin, enabling anyone interested in buying or selling these coins to do so without having to wait for their orders to match. Thanks to the users, called “liquidity providers” there are always enough coins to trade, and the prices are automatically balanced out by the smart contract code which handles the price to match supply and demand, sharing a portion of the trading fee with those users kind enough to provide liquidity, which in turn incentivizes many to do so.

How do Liquidity pools work?

A lot of what we’re going to explain here will make more sense if you are familiar with what is DeFi and how it works. Basically, DeFi was very difficult to get into before the invention of Automated Market Makers and Liquidity pools. If you want to get started with DeFi, this guide will be more suitable, as here we’ll dive a bit deeper into how Liquidity pools (LP) actually work. 

One of the basic principles of LP is that it wants to maintain the value stored in the pool. Since the tokens are provided in pairs, the LP smart contract makes sure that the total value remains the same.

Let’s say you want to provide liquidity. You lock 100 tokens A worth $1 and 50 tokens B worth $2.  Now, buyers and sellers interested in A/B pairs can conduct their business because there are tokens available, and the automated market maker software (AMM) will make sure that the tax from traders is collected in form of a trading fee, and that the prices of tokens A and B are balanced according to supply and demand. 

Liqudity Pool

Let’s imagine another case. Mike and Sylvia deposited tokens A and B with a total value of $1000. The liquidity pool is now $2000 strong, as Mike provided $500 worth of A tokens and $500 worth of B tokens. Sylvia did the same. They are now liquidity providers and receive LP tokens that represent their percentage, their stake in the pool. 

Traders buy and sell all day. Automated Market Maker collects trading fees and adjusts the prices. At the end of the day, trading fees amount to $200. Because Mike provided half of the liquidity, as well as Sylvie, they each get a percentage of the fees collected according to their LP tokens, e.g $100 each, as they both have exactly half of all the LP.

Liquidity pools enable Decentralized Exchanges to even exist. Also, it enables traders to swap any token as long as the said token is contained in any of the liquidity pools. This is called Routing and it’s the reason Uniswap and other modern DEXes exist.

Picture this, Mike is providing liquidity for tokens A and B. Sylvia is providing liquidity for tokens A and C. Buyer comes along and wants to swap token B for token C. Alas, there are no B/C trading pair pools! Routing comes to play, as Uniswap (or any other DEX) will reroute buyer’s funds, swapping buyer’s B token for A token, and then getting some C tokens, as there is a liquidity pool covering A/C. 

How does liquidity impact the price of a token?

Let’s say some trader buys 50 tokens A from the aforementioned pool. Now there are 50 tokens A worth $50 and 50 tokens b worth $2. The initial worth of the pool was $200 (the total worth of token A + token B). To keep the pool worth $200, the code will raise the price of token A, which reflects the high demand and low supply. Our buyer from this example would have paid some fees and the fee would be distributed to liquidity providers. 

This is why it’s important for DEXes to have a lot of liquidity providers. The more the providers, the more stable the trading pair is, the more stable the price is, but also the portion of shared fees is smaller per provider

For those providers interested in depositing riskier tokens or tokens with lower supply, rewards are greater. 

Farming with LP

Farming with LP

Liquidity providing is so important that they are the lifeblood of Decentralized Exchanges. Thus providers are further incentivized to “stake” or lock the LP tokens gained from contributing to the pools for gaining further rewards.

Investors ready to provide crypto to pools of liquidity can gain higher rewards for more volatile tokens or tokens lower in supply, but they can also seek the pools with the highest trading fees for increased return on investment.

Platforms like Yield.finance even automatically seek out the best deals, redistributing tokens so that investors’ funds are always in the best spot to collect the most rewards.

This is called farming and many DEXes support this even on their own platforms. For example, TraderJoeXYZ will offer 5% APY for providing liquidity but offer native JOE tokens for those who stake their LP tokens.

List of LP platforms 

Some of the best DeFi liquidity pools right now are Balancer, Curve, and Uniswap. Of course, there are others, and many DEXes offer LP services as well, but these three are the biggest and most specialized.  

Balancer

This platform will find the best pools and manage your portfolio, and it’s non-custodial, e.g it will not take away your funds. It is very modular allowing users to customize their pools. It can access private pools, where the main parameters, like tokens, fees, and prices can be set by the user. For those interested in yield farming, there are rewards paid in the native token BAL.

Curve Finance

If you want to stay away from the volatility of crypto tokens, Curve offers stablecoin pools. This reduces slippage, e.g losses that come with the fluctuating price of the tokens involved in the trading pair LP. 

Uniswap

Easy to use and the best suited for Ethereum and all ERC-20 (Ethereum based) tokens, this exchange is actually the collection of pools that we explained above when we were talking about Routing. Basically, anyone can start an LP on Uniswap, the exchange fee is fixed at 0.3%. This is the most popular and easiest to use the platform in the LP segment, and maybe even all of DeFi. 

Uniswap

While Uniswap is the best for beginners and experts alike, Curve finances provide specialized service that is connected to stablecoins, whale Balancer is definitely the best for experienced investors who are ready to set their own parameters of an LP.

Risk of farm

The risks of yield farming are typical for all the DeFi. Beware of volatile tokens, pump and dump schemes, rug pulls, and APY nosediving. Rug pulls are particularly nasty. Scammers will hype a project and create immediate interest, then once they access the liquidity, they will prevent providers from withdrawing their funds by blocking fraudulent token sales. Rug pull scheme is hard to detect, and usually very quick to execute, leaving its victims unable to react.

Also, watch out for LP distribution. If one investor is holding the vast majority of the LP they can manipulate prices and incur losses. Speaking of losses, there is a specific category of risk connected with farms – impermanent loss.

What is impermanent loss?

Providing LP means the investor deposits a trading pair of tokens. If the price of either token rises or falls, if it changes value, then the investor faces a potential loss. 

If the price rises, the provider would have had more value if they simply held on to a token, because the price of the token staked in the pool is not connected to market price (say, the price on Coinbase), but with the value of the other token provided. 

If the token loses value, then the potential loss is even greater because LP no longer holds a balanced value. 

This is called impermanent loss because it only becomes a permanent loss if the provider cashes out, and withdraws their funds instead of keeping the assets in the pool until the prices bounce back.

Conclusion 

Providing liquidity means that assets are readily available for trade at close to market rates. Stablecoins are similar to money (which they actually represent) as they are ready to be exchanged at a fixed value. Volatile tokens are akin to luxury assets, which are harder to move and are more vulnerable to market fluctuations.

Contrasting to traditional exchanges and centralized crypto markets, DeFi exchanges have a better way to deal with volatile, rare, or small tokens due to incentives provided for the LP providers.

Thus liquidity pools are the lifeblood of DeFi, as tokens of all shapes and sizes are not only readily available, with no “order book” hassle, but smart investors can profit from incentivized LP providing, yield farming, and staking their LP tokens. 

Disclaimer: All information contained here should not, under any circumstances, be construed as financial advice, investment recommendation or an offer of, or solicitation for, any transactions in cryptocurrencies.

Author

  • Long-time editor, crypto enthusiast, and all for free trade. Also a social scientist, musician, and a thorough-going liberal. Wrapped up a degree in linguistics, an MA in politics, and a PhD in history. Six postdocs afterwards. Speaks English, Serbian, Czech, and Swedish, communicative in German, Russian, Polish, Italian, Slovak, Norwegian, and even some Mandarin. Cryptocurrencies are the future.

Subscribe and be in touch
Click here