What is a liquidity pool and how to use one?
Liquidity pools are one of the integral components of decentralized finance (DeFi) that allow decentralized exchanges (DEXs) to operate without the need for intermediaries.
On centralized exchanges, there is a third-party managed order book system that lists all buyer "bid" orders and seller "ask" orders. Matching software then connects traders with suitable counterparties on the other side of the order book to fulfill orders.
Depending on liquidity, market conditions, and other factors, orders can take time to fill and may be filled at a slightly different price.
Many DEXs on the other hand utilize special community-funded liquidity pools to address this shortcoming. These pools act as reserves of assets that other users can trade against.
Smart contracts facilitate all trades executed within the pool, meaning there are no direct counterparties to deal with. The pools take the place of the counterparties and supply instant liquidity when needed.
The overarching term for these types of decentralized finance (DeFi) platforms is Automated Market Maker (AMM) protocols.
Benefits of decentralized exchanges (DEXs)
Among other benefits, DEXs are:
- Non-custodial: Customers maintain full control over their crypto wallet private keys.
- Peer-to-peer: No single company or individual controls the platform or acts as an intermediary between traders.
- Permissionless: There is no restriction on who can use these DeFi pools and provide liquidity to them.
Kraken offers the tokens you need to get started participating in liquidity pools and trading on DEXs. Get started in the world of DeFi by signing up for your Kraken account today.
How do liquidity pools work?
Liquidity providers (LPs)
Each liquidity pool represents a collection of funds locked into a smart contract by voluntary depositors. These depositors are known as "liquidity providers" or "LPs."
Anyone can become a liquidity provider by following a few simple steps, which we'll explore here.
Each liquidity pool usually contains a specific pair of cryptocurrencies for other DEX users to trade against. For example, DEX customers looking to trade ether (ETH) for USD Coin (USDC) will need to locate an ETH/USDC liquidity pool on the platform.
In exchange for providing cryptoassets, LPs receive an amount of LP tokens that represent their share of assets within the pool. LP token holders earn a proportional share of all transaction fees charged to traders that use the pool.
In some cases, holders can lock their LP tokens in other DeFi platforms to generate additional yields. This strategy is known as "yield farming."
Most DEX platforms allow LPs to withdraw their assets from the pool at any time. This process simply involves redeeming LP tokens for the deposited cryptoassets. Upon redemption, the liquidity pool smart contract burns the LP tokens which permanently destroys them. The DEX then transfers the assets back to the user's crypto wallet.
DEXs employ various automated market maker algorithms to make sure the prices of assets held in liquidity pools align with broader market prices. Uniswap, one of the largest decentralized crypto exchanges, uses something called a Constant Product Market Maker algorithm.
The formula for the Uniswap algorithm looks like this:
x * y = k
"X" and "y" represent the two paired assets within the pool. "K" equals a constant value that the algorithm maintains by adjusting the prices of each asset in the pool.
The total value of token "x" reserves multiplied by the total value of token "y" reserves must always equal the same value, "k."
Let's say a pool contains two tokens, UNI and ETH. Bob holds a large quantity of UNI tokens and wants to swap them all for ETH.
To maintain "k," the algorithm increases the price of ETH and reduces the price of UNI when Bob makes his trade. This system guarantees market liquidity, no matter how large the order.
The only issue is price slippage (the price difference between the broader market price and the pool price). Placing large trades in pools with limited liquidity can increase the amount of price slippage a trader induces.
After Bob's trade, there is a greater number of UNI tokens in the pool than ETH. However, because of the adjusted prices, the multiplied value of both assets still equals the same value (k) as before.
The difference in prices after the trade creates an opportunity for arbitrage traders to lock in lower-risk gains. Here, they can add ETH to the pool and withdraw discounted UNI tokens until prices realign with the broader market. This arbirtrage trading within liquidity pools is what allows decentralized exchanges to operate without the need for a centralized intermediary.
To mitigate price slippage issues, Uniswap introduced a concentrated liquidity feature in its v3 upgrade. With this, LPs can now supply liquidity within specific price ranges and can earn increased rewards for doing.
Risks of using DeFi liquidity pools
Before you commit any assets to DeFi liquidity pools, it's important to be aware of three key risks:
- Impermanent loss
- Smart contract bugs
- Rug pulls
A common issue with providing liquidity on DeFi platforms is unrealized losses known as impermanent loss. This problem occurs when the fiat value of assets held in a pool becomes less than the market price for those assets.
AMM algorithms can automatically adjust deposited token prices, making them worth less (in fiat terms) than their market prices. This loss is considered "impermanent" because LPs can wait it out in the hope the value of their assets will rebalance.
Smart contract bugs
Smart contracts lie at the heart of every DeFi protocol. Should there be faults in any of these software programs, hackers might be able to exploit them for their own gain.
Unfortunately, there are several prominent examples of DeFi platforms that suffered significant smart contract exploits. In these cases, hackers made off with tens or even hundreds of millions worth of customer funds.
Smart contract bugs present a major issue with DeFi platforms, particularly for quickly spun up protocols that don't carry out proper smart contract audits.
A DeFi rug pull is a type of scam that has recently become prevalent in the world of decentralized finance (DeFi).
It involves a person or project creating a fake DeFi project, launching a native crypto token, and creating a liquidity pool for it. The native token is often paired with a well-established cryptocurrency such as ether (ETH) or Tether (USDT). The fakers dupe investors into believing the project is credible, purchasing the native token, and adding liquidity to the pool.
Once liquidity reaches a high enough level, the project dumps its own stash of native tokens into the pool and drains the popular tokens. This attack leaves LPs holding worthless tokens, while the project makes off with the valuable cryptocurrency.
How to use a liquidity pool
To become a liquidity provider, you'll need to follow four steps:
1. Choose a platform
The most popular DEXs include Curve, Balancer, Uniswap, PancakeSwap, and SushiSwap.
All of these DEXs have their own native governance tokens, allowing holders to become actively involved in the management of the platforms.
Which platform is best for you depends on many factors. These include your personal risk tolerance, which platform you find the easiest to use, which assets are available, etc.
2. Connect your crypto wallet
Once you've found a liquidity pool, you'll need to connect your crypto wallet to the decentralized platform. This step is typically done by finding a "connect" button on the platform's home page.
You may need to download a specific crypto wallet to connect to the platform depending on which one you opt for.
For Ethereum-based DEXs, MetaMask is the most widely used crypto wallets that most platforms support.
Please triple check any and all wallet connections and make sure you are connecting to a valid and secure DEX. There are many phishing scams on the Internet that prey on users attempting these kinds of connections. You are responsible for your own wallet and crypto assets, and when you connect to a fake DEX you can lose all of your cryptoassets.
3. Select a pair
Different liquidity pools can generate different returns depending on what assets they contain.
To join a liquidity pool, you may need to purchase and own both assets within the chosen pool. On Balancer, another leading AMM-based DEX, this condition is known as adding "multi-asset" liquidity.
For example, to provide liquidity in a LINK/USDC pool, you might need to own both Chainlink (LINK) and USD Coins (USDC). Depending on how the algorithm works, you may also need to deposit the same fiat value for both assets. The platform usually calculates this for you when locking away assets in the pool.
Some platforms list the available liquidity pools you can join, while others ask you to select both assets from two drop-down menus.
4. Add liquidity
For first time users, you may need to set up a proxy contract or sign a transaction message before you can add liquidity. These are usually one-time actions and simply require you to click "confirm" when your crypto wallet screen pops up. In some cases, these steps can incur gas fees.
Again, triple check any and all transactions made to DEXs. Some crypto transactions are irreversible.
Once you've identified your chosen asset pair and deposited the required amount(s), you will receive LP tokens representing your share in the pool.
Most protocols automatically deposit any transaction fees charged to liquidity pool users back into the pool. Liquidity providers earn their share of these fees once they redeem their LP tokens.
Importance of liquidity pools
In summary, liquidity pools are an important tool for decentralized finance (DeFi) platforms.
To use them effectively, it is important to understand the risks and rewards associated with different pools, including fees and impermanent loss.
By doing so, users can make informed decisions about where to allocate their assets in order to maximize their returns in the DeFi ecosystem.
Get started in DeFi with Kraken
Kraken makes it easy to participate in the decentralized financial economy.
Whether you are looking to purchase cryptoassets before using them in a DeFi protocol or looking to convert your crypto holdings back into cash, Kraken makes it easy.
Kraken offers trading on the most popular DeFi assets as well as the most popular cryptocurrencies in the market today.