Understanding How Liquidity Pools Work in Crypto

What is a Liquidity Pool?

In the world of cryptocurrency and decentralized finance, when you buy a token, it is likely that there might not be a corresponding seller on the other end. Then, who sells you the tokens? Where do you get the tokens you buy from? How is it possible to buy the tokens 24/7 in the decentralized exchanges such as pancakeswap? The answer lies in the concept of something called Liquidity Pool.

In simple terms, Liquidity Pool is a crowdsourced supply of tokens or digital assets that are locked in a smart contract. These tokens are important because they keep the Decentralized Exchange (DEX) liquid allowing the users to buy and sell from it. These pools also typically allow users to pool or contribute their assets in the smart contract for some benefits such as APYs or a share of transaction fees. In sharp contrast with traditional markets where there are buyers, sellers and orderbooks, the decentralized finance platforms utilize something called Automated Market Makers which are algorithms that allow digital assets to be traded automatically and without needing any permission by utilizing the liquidity pools.

Liquidity pools are basic foundations of many Decentralized Exchanges such as PancakeSwap, Biswap, UniSwap. As of writing this article, there are over 100 Decentralized Exchanges in operation

Liquidity pool concept was originally introduced by Bancor and was made popular by Uniswap.

Who are liquidity providers?

Decentralized Finance is a peer-to-peer monetary system. There are no third parties, only direct traders. Anybody who provides the assets for liquidity are called liquidity providers, and anyone who holds certain tokens can become liquidity provider. It could be the project team or the individual users.

Usually when projects provide the liquidity, their liquidity is locked optionally in good faith in order to give some sense of security to the users of that token. However, individual users can and often do provide the liquidity on the exchanges. User provided liquidity can also be locked depending on the smart contract. Some DEXes host unlocked liquidity pools.

Who sets the initial price for the liquidity then? It will be first liquidity provider. This means projects or teams usually provide the initial liquidity, set a price and then allow other users to participate in providing the liquidity.

Why liquidity pools are important?

Liquidity pools are very important because first and foremost, without liquidity, people cannot trade. Prior to Automated Market Makers implementation in DEXes, it was difficult to find enough people to trade so that the market would be liquid. And remember the DEX is providing a peer-to-peer service. With the implementation of the Automated Market Makers, there is not a need for a seller to be on the other end of the transaction when someone is buying.

We can summarize the benefit of Liquidity Pairs in the statements below.

  1. Liquidity Pools are important because they provide Liquidity, Speed, Convenience to DeFi ecosystem
  2. Liquidity Pools results in lower transaction costs for the users because those are pre-programmed
  3. Liquidity Pools make DeFi system available 24 hours a day, 7 days a week, 365 days a year.
  4. Liquidity Pools reduce the price volatility otherwise the price of the token could swing largely in either direction and make the price unpredictable.
  5. Liquidity Pools allows any user, irrespective of their qualification, to participate and gain extra rewards via one or more of the following as long as they have sufficient tokens to create the LP.
    • Staking Rewards
    • Portion of network fees
    • Governance token where available

How liquidity Pools Work?


Many liquidity pools contain a pair of tokens. For example, Onino has a couple of liquidity pools as of writing this article. There is a ONI-BNB pool on Binance Chain and there is ONI-FTM pool on the Fantom Chain. When the Liquidity Pairs are created, users will have to use a DEX contribute certain amount on Token A and certain amount of Token B. Although the ratio of Token A and Token B can vary based on the how the pool is defined, many pools have 1:1 ratio. This means if you are creating a LP, you would be contributing half of Token A and half of Token B by their value.

For example, let’s say a token as is priced at $2 per Token and Token B is priced at $4 per token, then in order to create a LP that is equivalent to let’s say $1000, then you need to contribute $500 of Token A and $500 of Token B.

So, in our example above, assuming 1:1 ratio, the number Token A you will be contributing would be $500 / $2 = 250 and the number of Token B you will be contributing would be $500 / $4 = 125

The liquidity pair thus created would be totally different asset than your individual tokens. The smart contract locks your individual tokens and then issues another LP token.

How to create Liquidity Pair

Liquidity Pairs are usually created on Decentralized Exchanges. It really depends on where the Liquidity Pair is hosted. Even on the same blockchain, there might be similar LP contracts on different DEXes (but their contract addresses would be different). For example, if you are on Binance Smart chain, you can potentially have an ONI-BNB Liquidity Pool on Pancakseswap and you could also have ONI-BNB Liquidity on let’s say another DEX Biswap (This is a theoretical statement. As of writing this article, Onino has not created an ONI-BNB pool on Biswap)

Here are generic steps of creating Liquidity Pair

  1. Access a DEX where the token pair smart contract is deployed such as PancakeSwap via a Dapp browser such as those within the MetaMask.
  2. Connect your Wallet to the DEX. This gives DEX an access to use your tokens for creating LP.
  3. Access the Liquidity page on the DEX. On Pancakseswap, it’s under Trade > Liquidity
  4. There will be option to Add Liquidity. Click on that.
  5. You can then choose the pair of tokens and how much Liquidity you want to provide.
  6. If the token you are trying to pair is not found, you can search for the token by contract address and then import the token.
  7. You can then finally approve the tokens and supply liquidity. The number of tokens you specified will be reduced from your wallet and you will gain a LP token. Make sure to add the LP Token to your wallet so that you can track it.
  8. Many projects which created liquidity pairs also allow you to stake the LP tokens on their website so that you earn not only the transaction fee but also the staking rewards.

Please read this article that has detail instructions on how to create ONI-BNB Liquidity Pair in PancakeSwap and Stake in Onino’s Farm Pool

How to remove Liquidity Pair

When you remove liquidity from a pool, you get back the underlying tokens that constitutes the pool. However, please note that due to the impermanent loss, the count of tokens you receive might be different from the count of tokens that you originally put in the pool. Simply this is because pools try to balance the ratio of tokens underlying the Liquidity Pair, so if one token goes high up in the price or goes down, the ratio is adjusted to reflect the same. If you have a Liquidity Pair of Token A and Token B, if you received less of Token A, you will always receive more of Token B and vice versa.

Always compute how much you are getting back before removing he liquidity, sometimes it helps out to wait a little and re-evaluate the return. When the Liquidity is removed, the LP tokens are burned and the underlying tokens are returned based on the current ratio at the time of liquidity removal.

Having said that, these are generic steps in removing your liquidity pair.

  1. First thing is, if your LP tokens are staked in various Farms (which means your LP tokens are in the smart contract wallet and not in your wallet, you need to unstake first. Various projects have their own methodologies of unstaking but many of them allow you to unstake unlocked tokens on their website.
  2. Once the LP tokens are unstaked, make sure the LP tokens are in your wallet. If you did not previously import the LP token contract address in your wallet, you might not see the tokens in the wallet and might need to re-import to be visible on the wallet. However, they can be seen directly using corresponding scans such as BSCScans or FTMScans depending on what blockchain the LP Token is on.
  3. Next step is to navigate to your DEX, connect your wallet and find the liquidity page.
  4. Once the wallet is connected, you should be able to see your contributed LP on the DEX (again depends on what DEX your LP token was created in)
  5. If you don’t see your contributed LP tokens, sometimes you need to import the LP Token contract address in the DEX. Most of the DEX provide a link to import the contract on the Liquidity page.
  6. Once you see the contributed LP token, simply remove the liquidity using the option provided and confirm or approve the transaction.
  7. You should now see the tokens returned to your wallet. You should see both tokens returned. Let’s say you had created a Liquidity Pair using ONI-BNB, the liquidity removal process should return both your tokens (although will be on a different ratio) to your wallet. If you don’t see the tokens, make sure to import those tokens using the contract address.

How to stake Liquidity Pair

Usually, Liquidity Pairs are created on a DEX such as PancakeSwap, UniSwap, SpookySwap etc. Many DEXes might also allow you to Stake the Liquidity Pair right in their farms. Also many projects can also host the Liquidity Pair Farms on their own website.

Here are some sample farms hosted at PancakeSwap.


Various farms on PancakeSwap DEX on Binance Chain Network

Here are some farms hosted at the Onino’s farming pool.

ONI-BNB Farm on BSC Network

What are the risks of Liquidity Pools?

What are the risks of Liquidity Pools?

Although there are several benefits of using liquidity pools such as making the market liquid, gaining some staking or network transaction rewards etc., it can also come with some risks, which the investors need to be aware of before deciding to providing liquidity.

  • Impermanent loss can happen in the Liquidity Pool
    In a simple term, impermanent loss is a difference in the value of the token if you held normally versus if you put it in the pool. They are called impermanent because you don’t incur loss until you remove the liquidity and can correct itself later based on the price movement of the tokens later. But if you remove liquidity, you can incur a permanent loss, although many LP tokens can be staked at a high reward and the loss is usually offset with those rewards.

    The reason impermanent loss happens is because one of the tokens in the pair either goes up or goes down significantly in value and the automatic ratio adjustment happens in the pool.

  • There could be Possible smart contract bugs
    When you create a liquidity pair, your tokens are deposited into a smart contract. If the smart contract has vulnerabilities or bugs, you fund is at a risk being lost totally or partially depending upon the nature of the bug.
  • Liquidity pool hacks or misuse
    The smart contracts are written by various developers and some of who might even choose to be anonymous for various reason. Those developer or the smart contract owners might have added admin rights, privileges and other functions which could be hacked or misused.
  • Locked Pools won’t allow to remove liquidity pools before the lock expiry
    In order to incentivize investors to hold the tokens for a longer period of time, and thus create a price stability, many projects create long term locked pools. While the rewards in those pools are high, you will have to wait for the lock to expire before you can remove the liquidity, thus you might not be able to do some risk managements (e.g., selling some tokens if prices are falling too much) until the lock has expired.

Conclusion

Liquidity Pools are great way to enable liquidity to a digital asset exchange and is mostly crowdsourced. While there are benefits of creating Liquidity Pairs and staking them to earn passive income via staking rewards, or a portion of network fee, it is not suitable for all investors because it carries some risks of impermanent loss, faulty contracts and some changes of contract misused from unvested projects.

Resources:

  1. Great video explaining liquidity pools and how they work:
    https://www.youtube.com/watch?v=cizLhxSKrAc
  2. Video explaining Impermanent Loss from Binance Academy:
    https://www.youtube.com/watch?v=HPGSSkOq0-Q
  3. Step by step instructions on how to create Liquidity Pair on Pancake Swap
    https://acryptochain.com/2022/02/25/step-by-step-guide-on-how-to-create-liquidity-pair-on-pancakeswap/
  4. Top DEXes listed on CoinMarketCap
    https://coinmarketcap.com/rankings/exchanges/dex/

If you like the content of this website and would like to make some donations, please send your tokens to the following address.

0xE2b6e9677A0180c0C19261829Be0449eDa7d923E


Posted

in

by

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.