*Paid Advertisement. Not financial advice. RugDoc is not responsible for the projects showcased here. DYOR and ape safu.

Introduction to liquidity pools

Liquidity pools play an important role in yield farming. To better understand how liquidity pools work, we will explain what liquidity pools are, what the mechanism is behind them and what to take in account before investing in liquidity pools.

What are liquidity pools #

Liquidity pools (LP) are pools of tokens that are managed by smart contracts. Because decentralized exchanges (DEXes) do not provide liquidity themselves, investors are needed to deposit their tokens into pools to provide liquidity for token pairs. This allows traders to swap between the tokens from the token pairs. In essence, liquidity pools are the trading aspect of a decentralized exchange.

How liquidity pools work #

A liquidity pool always contains two or more tokens. Each liquidity pool creates a market for the assets in the pool. Cake/BNB is a good example of a popular liquidity pool at the DEX Pancakeswap.

Liquidity pools can be created via a DEX, if one does not yet exist for a specific token pair. To do so, liquidity providers must add both token contract addresses and deposit these tokens into the liquidity pool. DEXes aim to maintain liquidity pools with a token ratio of 50/50. This means that in our Pancakeswap example, liquidity providers will have to deposit the same value of CAKE and BNB into the liquidity pool.

After the liquidity provider has deposited his tokens into the pool, he will receive an amount of LP tokens in return. These tokens are the receipt of the deposit. Make sure you don’t lose these LP tokens, as they are needed to withdraw your assets from the liquidity pool. Every time a transaction (read: swap) is made in the liquidity pool, a certain percentage (usually 0.3%) goes to the LP token holders.

Using a deterministic price algorithm, any token swap within a liquidity pool will result in a price shift. This algorithm is also known as an automated market maker (AMM).

A constant commodity market maker algorithm is used for basic liquidity pools such as the one used by Pancakeswap, which results in the amounts of the token pair remaining the same. This algorithm allows liquidity pools to maintain their liquidity, regardless of the size of the trades. The reason for this is that as the target amount increases, the algorithm increases the price of the token asymptotically.

The main reason liquidity is so important is because it largely determines how the price of an asset shifts. In a low liquidity market, a relatively small amount of open orders will be open on both sides of the order book. This results in a significant price shift, making the asset unpredictable and unattractive. Due to this reason, liquidity pools are an important part of the decentralized finance (DeFi) revolution.

How decentralized exchanges work #

Currently, there are two types of decentralized exchanges in the DeFi space:

  • Order book exchanges: These types of exchanges depend on buy and sell (limit) orders from investors. When the order book matches a buy and sell order of the same price, the order will be executed. When an investor places a market order, the order book looks for the first open order and executes it for the entered price.
  • Liquidity pool exchanges: These type of exchanges do not use an order book and use an automated market maker. As a result, liquidity pool exchanges ensure that the liquidity level remains stable.

Example of participating in a liquidity pool #

Suppose an investor wants to provide $200 of liquidity in the Cake/BNB (50/50) liquidity pool. Because the investor wants to deposit $200, he will need to have $100 in BNB and Cake tokens: After all, it is a 50/50 liquidity pool.

After the investor (also called liquidity provider) has deposited his assets, he will receive LP tokens in return. These tokens reflect the value of the investor’s investment + the extra trading fees that is earned from the liquidity pool. When the investor wants to withdraw his assets from the liquidity pool, he has to return the LP tokens.

Every time a trader executes a token swap in the Cake/BNB liquidity pool, a trading fee is charged. As mentioned before, this fee is around 0.3% on most DEXes. Suppose the investor has a 10% share of the liquidity pool: in total there is $2000 dollars in the liquidity pool and the investor’s share is $200. When a trader swaps a token, the investor receives 10% of the 0.3% trading fees in the liquidity pool. The trading fees are paid in both Cake and BNB.

Liquidity pools: The advantages #

Liquidity pools have several advantages over traditional exchanges:

  • Guaranteed liquidity: Thanks to the AMM algorithm, traders will always able to swap their assets, provided that the Liquidity Providers deposited enough liquidity.
  • Anyone can provide liquidity: Unlike centralized exchanges, liquidity pools do not require KYCs, listing fees or other stumbling blocks. When an investor chooses to provide liquidity, all he needs to do is deposit his assets into the liquidity pool.
  • Low gas fees: Because DEXes such as Pancakeswap use smart contracts, gas fees can be kept at minimum.

The risks #

Keep in mind that various risks may arise when providing liquidity in a liquidity pool and it is possible to lose your assets. The most important risks are:

  • Smart contract bugs: Once smart contracts are deployed, they are irreversible and immutable. Hence, a great deal of consideration must be placed on the development of them. Smart contract bugs could result in a permanent loss of assets.
  • Rug pulls: A rug pull is a malicious maneuver where the developers of a project drain their liquidity pools in order take profits at the expense of other investors. This leaves the investors with worthless tokens from the scam project.
  • Website issues: This problem arises when a DApp’s website is not available. This results in investors not being able to withdraw their money from the liquidity pool via the DApp. Fortunately, this issue can be solved easily by using emergency withdraws.
  • Network risks: These are more general risks that can affect the whole crypto market. A well-known network risk is the 51% attack, of which more than 51% of all network nodes have become malicious. This results in hackers being able to hack the complete blockchain network and being able to change its rules and steal crypto. However, 51% attacks are very costly and even when fully executed often don’t make up for the costs to perform such an attack in the first place.
  • Impermanent losses: This describes the temporary loss of assets deployed in liquidity pools due to the volatility in a trading pair.

Impermanent losses #

Before you start providing liquidity to liquidity pools, it is important to understand exactly how impermanent losses work.

Suppose an investor has deposited $100 of Cake and $100 of BNB tokens into a 50/50 liquidity pool on Pancakeswap. This means that the investor has a token ratio of 6.80 Cake ($100) and 0.31 BNB ($100). After the deposit, the ratio between the tokens and the prices of the tokens changes, which is caused by market volatility and trading. This results in, that at a given moment, there is more Cake than BNB in the liquidity pool or the other way around.

If the investor chooses to withdraw his tokens from the liquidity pool after a change in token ratios, he may receive more Cake than BNB: for example 7.50 Cake and 0.28 BNB. If the price of BNB has gone up during this period, this will result in the investor’s impermanent loss becoming permanent.

To clarify how impermanent losses work, let’s use an example where we compare profits from the liquidity providing of Cake and BNB versus HODLing the assets. Let’s say the investor has deposited $200 worth of Cake and BNB into a liquidity pool on Pancakeswap. Suppose the price of BNB has increased from $317 (at purchase) to $600 (after providing liquidity and shift in the ratio Cake to BNB):

  • The liquidity pool after the ratio of Cake to BNB has changed to: (7.50 Cake $14.67 = $110) + (0.28 $600 = $168) = $278
  • If the investor had HODLed rather than depositing its assets in the liquidity pool: (6.80 Cake 14.67 = $100) + (0.31 $600 = $186) = $286

According to the calculation, the investor would have earned $8 extra profit from HODLing. The investor has two options, should he have chosen to provide liquidity:

  • Wait until the BNB price is back at $300: After all, the impermanent loss no longer applies.
  • Wait for the liquidity pool’s trading fees to offset the impermanent loss.

Because trading fees help to reduce the impact of impermanent loss, it is important to take a good look at the APY’s of liquidity pool. The higher the APY, the less likely you will exit the liquidity pool with a permanent loss.

Conclusion #

Liquidity pools play a significant role in DeFi. They allow investors to trade tokens while providing liquidity providers with the opportunity to generate transaction fee profits. Investors do not have to meet certain requirements to provide liquidity in a pool. Thanks to easy-to-use platforms such as Pancakeswap, novice investors can easily start providing liquidity or swap tokens from the various liquidity pools.

Updated on June 28, 2021
How do you feel about this article?

Leave a Reply

*Paid Advertisement. Not financial advice. RugDoc is not responsible for the projects showcased here. DYOR and ape safu.

EN