Carefully! Lots of text
Liquidity pools are one of the core technologies underpinning the current DeFi ecosystem. They are integral to automated market makers (AMMs), borrowing and lending protocols, yield farming, synthetic assets, on-chain insurance, blockchain gaming—the list goes on.
The idea itself is extremely simple. A liquidity pool is funds collected into a large digital mountain. But what to do with this mountain in conditions of operation without any permits, when everyone can add liquidity to it? Let's look at how DeFi brings the idea of liquidity pools to life.
Introduction
The emergence of decentralized finance (DeFi) has fueled a surge in on-chain activity. DEX volumes can seriously compete with volumes on centralized exchanges. As of December 2020, more than $15 billion was locked in DeFi protocols. The ecosystem is rapidly expanding with new types of products.
But what made this development possible? One of the core technologies underlying all these products is liquidity pools.
What is a liquidity pool?
A liquidity pool is a collection of cryptocurrency tokens locked in a smart contract. Liquidity pools are used to enable decentralized trading, lending, and many other functions that we will discuss later.
Many decentralized exchanges (DEXs) such as Uniswap rely on liquidity pools. Users called liquidity providers (LPs) add equal value of two tokens to a pool to create a market. In exchange for providing their funds, they earn trading commissions from trades that occur in the pool, in proportion to their share of the total liquidity.
And since anyone can become a liquidity provider, AMMs have made the market more accessible.
One of the first protocols to use liquidity pools was Bancor. However, this concept gained fame due to the popularization of Uniswap. Other popular exchanges that use liquidity pools on Ethereum include SushiSwap, Curve, and Balancer. The liquidity pools at these sites contain ERC-20 tokens. Similar equivalents on Binance Smart Chain (BSC) are PancakeSwap, BakerySwap and BurgerSwap, where the pools contain BEP-20 tokens.
Money liquidity vs order book
To understand how liquidity pools differ from each other, let's look at a key element of electronic trading - the order book. In simple words, an order book is a set of current open orders in a given market.
The system that matches orders with each other is called a matching engine. Together with the matching engine, the order book is the core of any centralized exchange (CEX). This model is excellent for ensuring efficient exchange and allows for the creation of complex financial markets.
At the same time, De-Fi trading involves executing on-chain transactions without a centralized party owning the funds. This creates a problem when using order books. Each interaction with the order book incurs a gas fee, which makes executing trades much more expensive.
In addition, it increases the costs of market makers and traders providing liquidity to trading pairs. But the main thing is that most blockchains cannot provide the necessary throughput to trade billions of dollars every day.
This means that on blockchains like Ethereum, on-chain implementation of an exchange order book is virtually impossible. Sidechains or second-layer solutions can be used, and they are already in development. However, in its current form the network cannot yet provide the necessary throughput.
Before we move on, it's worth noting that there are DEXs that work great with on-chain order books. Binance DEX is built on Binance Chain and is specifically designed for fast and low-cost trading. Another example is Project Serum on the Solana blockchain.
However, due to the fact that most of the assets in the crypto space are on the Ethereum blockchain, you cannot trade them on other networks without using some kind of cross-chain bridges.
How does the liquidity pool work?
Automated market makers (AMMs) have changed the game. This is an important innovation that allows you to trade online without the need to maintain an order book. Because trades do not require a direct counterparty, traders can enter and exit positions in token pairs, which can be highly illiquid on order book exchanges.
An exchange with an order book can be considered a peer-to-peer exchange, where buyers and sellers are connected by an order book. For example, trading on Binance DEX is peer-to-peer as trades are carried out directly between users' wallets.
Trading using AMM works differently. It is more like concluding a contract with a participant.
As we have already said, a liquidity pool is a collection of funds invested by liquidity providers in a smart contract. When you enter into an AMM trade, you do not have a counterparty in the traditional sense. Instead, you make a trade against the liquidity in the liquidity pool. To make a purchase, the buyer does not need to have a seller, only sufficient liquidity in the pool.
When you buy another coin named after a dish on Uniswap, there is no traditional seller on the other side of the transaction. Your activity is controlled by an algorithm that controls what happens in the pool. Prices are determined by an algorithm based on transactions in the pool. If you want to better understand how AMM works, read our article.
Of course, liquidity has to come from somewhere, and anyone can be a liquidity provider to be considered your counterparty in some sense. But this works differently than with the order book model, because you interact with the contract that manages the pool.
What are liquidity pools used for?
So far, we have discussed primarily AMM as the most popular use case for liquidity pools. However, as we said, liquidity pooling is a very simple concept, so it can be applied in many different ways.
One option is income farming or liquidity mining. Liquidity pools are at the heart of automated yield-generating platforms, such as farms, where users add their funds to pools to then generate income.
Transferring new tokens to the right people is an extremely difficult problem for crypto projects. One of the most successful approaches has been liquidity mining. The bottom line is that tokens are distributed among users who have placed tokens in the liquidity pool according to the algorithm. Newly generated tokens are distributed in proportion to each user's share in the pool.
Note that these can even be tokens from other liquidity pools, called pool tokens. So, for example, if you provide liquidity to Uniswap or lend to Compound, you receive tokens that make up your share of the pool. You can transfer these tokens to another pool and make a profit. Such chains can be quite complex, as some protocols integrate pool tokens of other protocols into their products, and so on.
Another use case is management. Sometimes a large number of tokenized votes are required to be able to put forward a formal governance proposal. If votes in the form of tokens are combined, participants will be able to come to an agreement on issues that they consider important to the protocol.
Another emerging DeFi sector is smart contract risk insurance. Many of the options are also based on liquidity pools.
Another, even more advanced use of liquidity pools is tranching. This concept, borrowed from traditional finance, involves separating financial products based on their risks and rewards. Such products allow liquidity providers to select individual risk and return profiles.
Mining synthetic assets on the blockchain also depends on liquidity pools. Deposit collateral into a liquidity pool, connect it to a trusted oracle, and you'll have a synthetic token tied to any asset you need. In reality everything is, of course, but the general meaning is this.
What else can you think of? There are many use cases for liquidity pools that we have yet to uncover, and they depend on the ingenuity of DeFi developers.
➟ Thinking about where to start working with cryptocurrencies? Buy Bitcoin (BTC) on Binance!
Risks of liquidity pools
When providing liquidity to AMMs, be aware that impermanent losses exist. In a nutshell, this is the loss in dollar value of an asset listed by AMM compared to hodling.
If you provide liquidity to an AMM, you are likely to be exposed to volatile losses. Sometimes their size is small, sometimes large. If you are planning to invest in a liquidity pool, be sure to read our article before doing so.
Another thing to keep in mind is the risks of smart contracts. When you deposit funds into a liquidity pool, they stay in the pool. That is, despite the fact that technically there are no intermediaries storing your funds, the contract itself can be considered as a custodian of these funds. If, for example, there is a bug or vulnerability in a flash loan, your funds may be lost forever.
Also beware of projects where developers have the right to change pool rules. Sometimes developers may leave an administrator key or privileged access capabilities in the smart contract code. This gives them the ability to perform malicious actions, such as gaining control of funds in the pool. To avoid scam projects and rug pulling, read our article on DeFi scams.
Summary
Liquidity pools are one of the key technologies underlying the DeFi technology stack. They enable decentralized trading, lending, profit making and much more. These smart contracts are used in almost every area of DeFi and are likely to remain popular for a long time to come.
Still have questions about liquidity pools and decentralized finance? Visit our Q&A Ask Academy platform where the Binance community will answer your questions.