You may have come across the theory of liquidity pools in the Defi ecosystem.
But what are liquidity pools and how do they work? And why do we really need them in decentralized finance? In this post I will explain how they work, their main benefits and general aspects.
Guide by u/Fantastic-Cucumber-1
What are liquidity pools?
Liquidity pools are pools of tokens that are locked in a smart contract. By offering liquidity, they guarantee trading, and because of this, they are widely used by decentralized exchanges. DeFi platform Bancor took one of the first initiatives to include liquidity pools.
Liquidity pools, in essence, are the trading aspect of a decentralized exchange. Their role is to increase the liquidity of the market among market participants.
How do liquidity pools work?
In its simplest form, a single liquidity pool contains 2 tokens and each pool establishes a new market for the same pair of tokens. DAI / ETH is perhaps a clear example of a popular liquidity pool at Uniswap.
The first liquidity provider, when a new pool is created, is the one who decides the initial price of the assets in the pool. The liquidity provider is encouraged to provide the pool with an equivalent value of all tokens.
Based on the liquidity provided to a pool, the liquidity provider (LP) receives special tokens called LP tokens in proportion to how much liquidity they provide to the pool. A charge of 0.3% is allocated proportionally to all LP token holders when a transaction occurred in the pool.
The liquidity providers needs to burn their LP tokens if they want to get their underlying liquidity back, plus any unpaid fees. By utilizing a deterministic price algorithm, any token swap within a liquidity pool results in a price shift. This process is also referred to as an automatic market maker (AMM).
A constant commodity market maker algorithm is used for basic liquidity pools such as the one used by Uniswap, which means that the amounts of the 2 tokens given remain the same. In addition, a pool still has liquidity, no matter how massive a trade, because of the algorithm. The main reason for this is that as the target amount increases, the algorithm increases the price of the token asymptotically.
The importance of liquidity
The reason that liquidity is so important is that it largely determines how the price of an asset can shift. In a market with low liquidity, a relatively limited number of open orders are open on both sides of the order book. This suggests that one trade can shift the price significantly in any direction, making the stock unpredictable and unattractive. Because of this, liquidity pools are an important part of the Decentralized Finance (DeFi) revolution.
What are liquidity pools in Defi?
Liquidity pools are intended to successfully address the low liquidity problem and thus ensure that the price of a token does not fluctuate significantly after executing the order of a single large trade.
As mentioned earlier, decentralized exchanges offer bonuses to those who invest in the liquidity pools to maximize engagement. The user has to deposit money into the liquidity pool to reap the benefits and take advantage of it. Liquidity pools are regulated by one or more smart contract protocols. The amount of funds to be invested and the proportional ratio of each token will vary between different DeFi platforms.
How to participate in a liquidity pool?
To provide $50 in liquidity in an ETH / USDC pool, it requires a deposit of $50 in ETH and $50 USDC. In this situation, a total deposit of $100 is required. In return, the liquidity provider collects tokens for the liquidity pool. These tokens reflect their proportional pool share and allow them to withdraw their pool share at any time.
Every time a seller places a trade, a trade fee is deducted from the trade and the order is sent to the smart contract with the liquidity pool. The trading fee is set at 0.3% for most decentralized exchanges. In this case, if you deposit $50 ETH and $50 USDC and you make 1% of the pool with your donation. You will then receive 1% of the 0.3% trading fee for one of the specific trades.
How do liquidity pool exchanges work?
There are currently two types of decentralized exchanges in the DeFi space, namely:
- Exchange of order book: The order book exchanges depend on a bid / ask arrangement to fulfill trades. Orders are redirected to an order book when a new buy or sell order is placed. Then the exchange’s matching engine executes matching orders for the same price. Examples of order book exchanges are 0x and Radar Relay.
- Liquidity pool exchanges: LP exchanges exclude the emphasis of order book trading from their exchange. By doing this, they enable the exchange to keep the liquidity level stable. Examples of LP exchanges are Kyber, Uniswap and Curve Finance.
Advantages of liquidity pools
- Guaranteed liquidity at any price level: Traders do not need to be directly connected with other traders as liquidity is constant, as long as clients have invested their assets in the pool.
- Automated Pricing Enables Passive Market Making: Liquidity providers put their money into the pool and the pricing is controlled by the pool’s smart contract.
- Anyone can become and earn a liquidity provider: Liquidity pools do not require listing fees, KYCs or other obstacles associated with centralized exchanges. If an investor wants to provide liquidity to the pool, he only needs to deposit the equivalent of the assets.
- Lower gas fees: Gas fees are reduced by the minimal smart contract design offered by decentralized exchanges such as Uniswap. Effective price calculations and fee allocations within the pool imply less volatility between transactions. Uniswap V3 will reduce the gas fees even (30%) more.
The return of the liquidity pool depends on three factors:
- The asset prices upon delivery and withdrawal
- The size of the liquidity pool
- The trading volumes.
It is very important to remember that, in proportion to what’s originally invested, investors would end up removing some ratio of assets. This is where the market movement can work either with or against you.Risks of Liquidity Pool
Of course, as with everything in DeFi, you have to consider the potential risks. Some of the associated liquidity risks are listed below:
- Impermanent loss
- Possible smart contract bugs.
- Liquidity pool hacks
- Systemic risks
Before you join a liquidity pool, I would like to stress out the impact of impermanent losses.
Impermanent loss describes the temporary loss of funds occasionally experienced by liquidity providers because of volatility in a trading pair. This also illustrates how much more money the LPs would have had if they simply held onto their assets instead of providing liquidity.
Let’s say you have $50 in ETH and $50 in SUSHI tokens, which adds up to a total of $100. If you deposit your tokens in a 50/50 liquidity pool, you would have a ratio of 0.024 ETH ($2104) and 3.27 ($15.28) SUSHI tokens. After depositing your tokens into the pool, the ratio and the price of the tokens change – This is due to market volatility and trades. This results in that at a given moment there may be more ETH than SUSHI in the pools (or more SUSHI than ETH).
If you decide to withdraw your tokens from the pool, you might receive more ETH than SUSHI (or vice versa). For example, you receive 0.015 ETH and 4.47 SUSHI – And the price of ETH has gone up – Your impermanent loss has become permanent.
Just look at the following example, where a liquidity pool is compared to HODLing. Let’s say you start with the same ratio of tokens as mentioned before, and ETH has increased in value by $200:
- In a liquidity pool where the ratio of SUSHI to ETH has changed to: (4.47 SUSHI * $15.28 = $68.31) + (0.015 ETH * $2304 = $34.46) = $102.87
- If you had HODLED: (3.27 SUSHI * $15.28 = $ 50) + (0.024 ETH * $2304 = $55.30) = $105.30
According to the calculation, you would have made $2.53 more by HODLing. Now, you might ask yourself, why in earth would I provide liquidity then? Well, the answer is simple. As mentioned earlier, as an LP you receive trading fees. If you’re providing liquidity in a popular liquidity pool, APY’s of >30% can be easily achieved. If you want to take it even a step further, you can stake your LP tokens.
Like any other tokens, a user can use the tokens from the liquidity pool during the period of the smart contract. A user can therefore deposit this token on another platform that accepts the liquidity pool token to get additional yield to maximize returns. Therefore, the user can compose two or three interest rates using yield farming, and ultimately increase returns.
An example of such a DeFi platform is harvest.finance. Harvest.finance allows the user to stake their LP tokens and rewards them with additional rewards on top of their fees rewards from the liquidity pool. In harvest.finance’s case, they reward the user with FARM tokens.
So as an example: Let’s say you have deposited $100 in a USDC/ETH liquidity pool on Uniswap with an annual percentage yield (APY) of 50%. The received UNI LP tokens can then be staked at havest.finance for additional rewards, which in this case would be 70% FARM APY. This means that you would receive in 1 year:
- $50 in LP ($25 in USDC and $25 in ETH tokens).
- $70 in FARM tokens.
As you can see, by staking your LP tokens rewards can be highly lucrative. By utilizing these techniques, APY’s of over 200% can be achieved. Of course, you need to remember that the price of tokens such as FARM are quite volatile and thus are risking to turn your $70 in FARM into way less amount of $ in a matter of days.
If you are interested in yield farming, I would recommend to use DeFi dashboard zapper.fi, which gives a great overview of all current liquidity pools and farms.
Liquidity pools provide a user-friendly platform for both users and exchanges. The user does not have to meet any special eligibility criteria to participate in liquidity pools, which means that anyone can participate in the provision of liquidity for a token pair. In the DeFi ecosystem, liquidity pools play an essential role, and the concept has been able to increase the level of decentralization.