CertiK Logo
CertiK Logo
Products
Company
incident-response
Back to all stories
Technology
What is a Liquidity Pool?
1/21/2022

In this blog we will cover what is a Liquidity Pool, how to earn using Liquidity Pools, and the risks that can occur when a smart contract audit is missed during the process in development of smart contracts.

What is a Liquidity Pool?

Liquidity pools enable users to buy and sell crypto on decentralized exchanges and other DeFi platforms without the need for centralized market makers. Liquidity pools utilize smart contracts play a crucial role in driving the feasibility of the existing DeFi technology stack. Decentralized exchanges, synthetic assets, yield farming, borrow-lend protocols, and on-chain insurance all utilize the concept of liquidity pooling effectively. In the case of conventional finance, a centralized organization like banks offers liquidity. In the context of the broader DeFi ecosystem, liquidity pools have been a significant growth factor, bringing in the necessary liquidity to create a sustainable decentralized financial system. Within the decentralized trading space, there are hundreds of liquidity pools and many platforms that provide access to those pools.

To really understand liquidity pools, we need to understand the importance of liquidity itself. Whenever traders enter any market, they rely on the market's liquidity. You can monitor liquidity to see how much is there before entering the market. Without available liquidity, it is much harder to buy and sell assets, with potentially either side seeing unfavorable price conditions based on demand. Liquidity is the measure by which one asset can be exchanged for another of equal value. Without liquidity, traders would have to wait for their orders to be fulfilled until counter-party traders make the matching offer. By that time, the price of the asset itself might shift. This is where liquidity pools and smart contracts come in to replace such centralized market maker mediators.

In the early phases of DeFi, decentralized exchanges (DEXs) suffered from crypto market liquidity problems when attempting to model the traditional market makers. Liquidity pools helped address this problem by having users be incentivized to provide liquidity instead of having a seller and buyer match in an order book. 

Now, liquidity pools are the backbone of many DEX’s, such as Uniswap. Users called liquidity providers (LP) add an equal value of two tokens in a pool to create a market. Any time you lock your crypto funds into a liquidity pool, you become a liquidity provider. This is the essence of yield farming, with liquidity pools as yield farms and liquidity providers as yield farmers. In exchange for providing their funds, they earn trading fees from the trades that happen in their pool, proportional to their share of the total liquidity. Bancor revolutionized market making in 2017 by removing order books entirely and introduced a network of on-chain liquidity pools to pair pools of tokens with one another which was the start of liquidity pools that we see and use today. Centralized crypto exchanges follow the Order Book model, similar to conventional stock exchanges, which enables buyers and sellers to place orders. In the Order Book model, buyers aim at purchasing an asset at the lowest possible price, while sellers focus on selling the asset at the maximum price possible. The problem with this is when the buyers and sellers don't meet an agreement regarding the price, which is where the liquidity pool and smart contracts come into play. The low fees and non-custodial nature of liquidity pools are also a significant draw for traders. Liquidity pools exist for a wide range of assets because they can be created by users themselves.

Benefits of using liquidity pools over traditional marketing making include:

  • Ensures there is enough liquidity to meet DeFi protocols
  • Anyone can provide liquidity to these pools
  • Provides many layers of earning potential
  • Earning a governance token can provide voting rights to oversee decision-making concerning the pool
  • Users maintain control of their digital assets
  • Utilizes smart contracts

While there are many benefits, it may have users wondering what the downsides or risks associated with LP’s are. 

What are the risks with liquidity pools?

Becoming a liquidity provider comes with a unique set of risks. “Impermanent loss” refers to the fact that the value of pooled assets can fluctuate against one another depending on supply and demand. Impermanent loss is inherently interwoven in the AMM concept and occurs when the price of a pool’s tokens changes compared to when they were deposited. The more significant the change is, the bigger the loss. 

Liquidity providers should keep in mind smart contract risks. Once assets have been added to a liquidity pool, they are controlled exclusively by a smart contract, with no central authority or custodian. So, if a bug or some kind of vulnerability occurs, the coins could be lost for good. A smart contract audit can help secure smart contracts and expose any vulnerabilities. A smart contract audit is a line-by-line inspection of a contract’s source code. Without a smart contract audit, project developers run the risk of exposing vulnerabilities that are easily exploitable by hackers.

Be wary of projects where the developers have permission to change the rules governing the pool. Sometimes, developers can have a private key or some other privileged access within the smart contract code. Without a smart contract audit this can enable them to potentially do something malicious, like taking control of the funds in the pool. There are market manipulation tactics, particularly occurring in smaller pools with lower liquidity. Liquidity pools where governance is overly centralized gives room for malicious behavior as a developer can decide to take control of the funds in the pool. Therefore, it’s important to choose wisely where to deposit funds in a pool. So-called “hackers” use techniques such as flash loans to flood markets with outsized orders and drain smart contracts of funds. Therefore, users should be extremely wary of smaller providers or pools with lower liquidity, as they’re more vulnerable to such attacks. Other than a smart contract audit provided by CertiK, Skynet’s new liquidity monitoring, allows you to scroll down and see Liquidity Monitoring right on the Skynet page. 

Earning on liquidity pools

As mentioned earlier, liquidity pools also offer the opportunity to profit from crypto holdings by becoming a liquidity provider and earning transaction fees. AMMs need to incentivize users to deposit their tokens to pools. An automated market maker (AMM) is a tool used to provide liquidity in DeFi. They are used to enable the automatic trading of digital assets. They do this by using liquidity pools as a replacement for traditional buyer and seller markets. Here, the concept of yield farming (also known as liquidity mining) comes into play. Some protocols, including Uniswap, Balancer and Yearn.finance reward liquidity providers in their own platform tokens. Yield farming is when users earn token rewards in exchange for providing liquidity to AMMs’ pools to facilitate token swaps. This is similar to depositing fiat money to a savings account in a bank and collecting interest on the deposited assets. Liquidity pools could offer improved accessibility and yield farming opportunities alongside opening up new avenues in DeFi. Many users would see a similarity before providing liquidity and staking, so what's the difference? Staking refers to the process of locking up your crypto asset in a blockchain in order to keep the network secure and earn rewards from transaction fees. Don’t forget to monitor liquidity to make sure there is some before jumping into it. With the dawn of DeFi, the definition of staking has broadened to contain any form of depositing of a crypto asset to earn a financial reward. Liquidity provision refers to depositing one or more assets into a liquidity pool to earn trading fees or lending interest. While the concept is not that different from staking, the mechanics and risks involved are different. 

Liquidity pools have definitely changed the game in DeFi, and possibly even the entire financial industry. Through innovation we have seen many new pools, higher rewards, and an emergence of a new era. With smart contract audits providing the security, liquidity pools will continue to evolve.