What are liquidity pools in DeFi and how do they work? In this article, we are going to explain the concept in details.
The growth of decentralized finance (DeFi) has resulted in an explosion of on-chain activity. The volumes of decentralized exchange (DEX) are comparable to the volumes on centralized exchanges in terms of volume.
As of December 2020, there are almost 15 billion dollars locked up in DeFi protocols. The ecosystem is growing rapidly with new products.
What makes all this expansion possible? The answer is the liquidity pool, one of the core technologies behind all these products.
What is a liquidity pool?
The concept might sound difficult to those who never heard of it before. You can watch this video for an easy-to-understand explanation:
Decentralized trading, lending, and other functions can be facilitated using liquidity pools (LP), which are collections of funds locked into a smart contract.
The Uniswap DEX, for example, relies on liquidity pools to function.
LP users create pools by combining an equal quantity of two different tokens. In exchange for contributing their funds, LP users gain trading fees from exchanges taking place in their pools, proportional to their proportion of total liquidity.
Anyone can be a liquidity provider, making market making more accessible.
Bancor pioneered the use of liquidity pools, but Uniswap popularised the concept. SushiSwap, Curve, and Balancer are three of the most prominent Ethereum exchanges that utilise liquidity pools.
ERC-20 tokens are included in these pools. BNB Smart Chain (BSC) includes PancakeSwap, BakerySwap, and BurgerSwap, which contain BEP-20 tokens.
Order books vs. liquidity pools
Let’s examine the primary building block of electronic trading — order book — to see how liquidity pools differ.
An order book is a list of all currently open orders for a given market.
The matching engine is the system that matches orders together. The order book is the heart of any centralized exchange (CEX). This design is fantastic for facilitating efficient trade and allowing for complex financial markets.
An order book is a resource that lists offers and requests in a specific market and provides a mechanism for matching them. This is where decentralized finance (DeFi) gets a bit tricky.
DeFi trading requires on-chain transactions without a centralized custodian of funds, which makes creating an order book more costly.
In addition to making market makers’ jobs extremely difficult, blockchains cannot handle the required throughput for trading billions of dollars every day.
Ethereum’s blockchain, for example, is not suited for on-chain order book exchanges. However, these alternatives are on the way. The network cannot handle the volume in its current form.
What are the characteristics of liquidity pools? How do they work?
On-chain market making without the need for an order book has become a reality thanks to automated market makers (AMMs). Because direct counterparties are not required to perform transactions, token pairs that likely would be very illiquid on order book exchanges can be traded.
You can think of automated market makers as an order book exchange that connects buyers and sellers, thus making it a peer-to-peer exchange. Binance DEX, for example, is peer-to-peer because trading occurs directly between user wallets.
Using an AMM is different when trading. You can think of an AMM as a peer-to-peer contract.
When you trade on an AMM, you don’t have a traditional counterparty; rather, you trade against the liquidity pool’s liquidity. A liquidity pool is a smart contract that stores funds provided by liquidity providers. There does not need to be a seller at that specific moment; rather, there must only be enough liquidity in the pool.
When you’re buying the latest food coin on Uniswap, there isn’t a real seller on the other side. Instead, your activity is managed by the algorithm governing the pool. In addition, pricing is determined by this algorithm based on the trades that occur there.
Anyone can be a liquidity provider in some sense, but the liquidity has to come from somewhere. In this case, you are interacting with the contract governing the pool rather than the order book.
What purpose do liquidity pools serve?
Up until now, AMMs have been the most popular use for liquidity pools. However, as we’ve mentioned, pooling liquidity is a simple concept, so it can be utilised in a variety of ways.
One of these is yield farming or liquidity mining. Liquidity pools are the basis of automated yield-generating platforms like yearn, where users add their funds to pools that are then used to generate yield.
The right people receiving new tokens is a tough issue for crypto projects to deal with. Liquidity mining has been one of the more successful approaches. Tokens are distributed algorithmically to users who deposit their tokens in a liquidity pool, with the newly created tokens then being distributed proportionally to each user’s proportion of the pool.
Keep in mind that pool tokens may also serve as tokens from other liquidity pools.
For example, if you are providing liquidity to Uniswap or lending money to Compound, you will receive pool tokens that represent your share. You may be able to deposit those tokens into another pool and earn a return. These chains can become rather convoluted, as protocols integrate other protocols’ pool tokens into their products, and so on.
There are also governance applications in which the token vote quota is particularly high. If the funds are pooled together rather than distributed individually, participants can come together behind a common cause they believe is important for the protocol.
Smart contract insurance is another emerging DeFi sector. Many of its implementations are powered by liquidity pools.
Another cutting-edge use of liquidity pools is for tranching. It’s a risk and reward categorization methodology borrowed from traditional finance that allows financial products to be divided into risk and return categories. These products, as you might expect, allow LPs to select risk and return profiles that are tailored to their needs.
The creation of synthetic assets on the blockchain requires liquidity pools. By adding some collateral to a liquidity pool, connecting it to a trustworthy oracle, and creating a synthetic token pegged to any asset you want, you can achieve the same result. The process is a bit more involved than that, but the concept is simple.
What else can we think of? It’s all up to the ingenuity of DeFi developers to discover more uses for liquidity pools, and there are probably many more uses for liquidity pools that are yet to be discovered.
The risks of liquidity pools
An impermanent loss is a loss in dollar value compared to HODLing when providing liquidity to an AMM. You should be aware of this concept if you provide liquidity to an AMM.
If you’re providing liquidity to an AMM, you might be exposed to temporary losses. These losses can be small or large, depending on the situation.
You should be aware of smart contract risks when depositing funds into a liquidity pool. Your funds are kept in the pool, so while there are no intermediaries holding your money, the contract itself may be considered its custodian. If there is a bug or some other sort of exploit in a flash loan, for example, your money could be permanently lost.
Also, be cautious about pools where the developers can alter the terms of the pool. Developers sometimes have privileged access to the smart contract code in DeFi projects, which might enable them to do something nefarious, such as stealing funds.
One of the core technologies behind the DeFi technology stack is liquidity pools. They enable decentralized trading, lending, yield generation, and much more. These smart contracts power almost every aspect of DeFi, and they are likely to continue doing so.
Zookram is the ultimate guide to learning web3 + crypto. We cover everything you need to know, from how to buy each cryptocurrency to how to mint NFTs.