A liquidity pool is a pool of tokens that are locked in a smart contract. Liquidity pools are used to facilitate trading by providing liquidity and are extensively used by some of the decentralized exchanges (DEX).
Users called liquidity providers (LPs) add an equal value of two tokens in a pool to create a market. 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. 
- One of the first protocols to introduce the concept of a liquidity pool was Bancor
- Liquidity Pools gained widespread attention in decentralized finance through the popularization of Uniswap.
Liquidity Pools vs. Order Books
Trading on standard crypto exchanges like Coinbase or Binance is based on the order book model. This is also the way traditional stock exchanges such as NYSE or Nasdaq work. 
In this order book model buyers and sellers come together and place their orders. Buyers, known as “bidders”, try to buy a certain asset for the lowest price possible whereas sellers try to sell the same asset for as high as possible. 
Both buyers and sellers have to converge on the price for a trade to take place. This can happen by either a buyer bidding higher or a seller lowering their price. Market makers come to play if there is no one willing to place their orders at a fair price level, or if there are not enough coins that users want to buy.
Market makers are entities that facilitate trading by always willing to buy or sell a particular asset. By doing so, they provide market liquidity, so the users can always trade and they don’t have to wait for another counterparty to show up. The main reason for this is the fact that the order book model relies heavily on having a market marker or multiple market makers willing to always “make the market” in a certain asset. Without market makers, an exchange becomes instantly illiquid and it’s pretty much unusable for normal users. Also, market makers usually track the current price of an asset by constantly changing their prices which results in a huge number of orders and order cancellations that are being sent to an exchange. 
Ethereum with a current throughput of around 12-15 transactions per second, and a block time between 10-19 seconds is not really a viable option for an order book exchange. Additionally, every interaction with a smart contract costs a gas fee, so market makers would go bankrupt by just updating their orders.
Currently, there are many DEX operating on different blockchain networks that use liquidity pools, For Ethereum, the most popular DEXes are Uniswap and Sushiswap. For Binance Smart Chain or BNB Chain, it is Pancakeswap. Acala and Zenlink DEXes use liquidity pools on Polkadot.
How Do Liquidity Pools Work?
In its basic form, a single liquidity pool holds 2 tokens and each pool creates a new market for that particular pair of tokens. DAI/ETH is a good example of a popular liquidity pool on Uniswap. 
When a new pool is created, the first liquidity provider is the one that sets the initial price of the assets in the pool. The liquidity provider is incentivized to supply an equal value of both tokens to the pool. If the initial price of the tokens in the pool diverges from the current global market price, it creates an instant arbitrage opportunity that can result in lost capital for the liquidity provider. This concept of supplying tokens in a correct ratio remains the same for all the other liquidity providers that are willing to add more funds to the pool later. 
When liquidity is supplied to a pool, the liquidity providers (LPs) receive special tokens called LP tokens in proportion to how much liquidity they supplied to the pool. When a trade is facilitated by the pool a 0.3% fee is proportionally distributed amongst all the LP token holders. If the liquidity provider wants to get their underlying liquidity back, plus any accrued fees, they must burn their LP tokens. 
Each token swap that a liquidity pool facilitates results in a price adjustment according to a deterministic pricing algorithm. This mechanism is also called an automated market maker (AMM) and liquidity pools across different protocols may use a slightly different algorithm. 
Basic liquidity pools such as those used by Uniswap use a constant product market maker algorithm that makes sure that the product of the quantities of the 2 supplied tokens always remains the same. Because of the algorithm, a pool can always provide liquidity, no matter how large the trade is. The main reason for this is that the algorithm asymptotically increases the price of the token as the desired quantity increases. 
In conclusion, the ratio of the tokens in the pool dictates the price. E.g. If someone buys ETH from a DAI/ETH pool they reduce the supply of ETH and add the supply of DAI which results in an increase in the price of ETH and a decrease in the price of DAI. How much the price moves depends on the size of the trade, in proportion to the size of the pool. The bigger the pool is in comparison to trade, the lesser the price impact, and slippage, occurs, so large pools can accommodate bigger trades without moving the price too much. 
Because larger liquidity pools create less slippage and result in a better trading experience, some protocols like Balancer started incentivizing liquidity providers with extra tokens for supplying liquidity to certain pools. This process is called liquidity mining.
Types of Liquidity Pools
One of the first projects that introduced liquidity pools was Bancor, but they became widely popularized by Uniswap. 
The liquidity pools described above are used by Uniswap and are the most basic forms of liquidity pools. Other projects iterated on this concept:
The other idea for different liquidity pools came from Balancer who noticed users don’t have to limit themselves to having only two assets in a pool, Balancer allows for as many as 8 tokens in a single liquidity pool. 
Liquidity Pool Advantages
Guaranteed liquidity at every price level
The “liquidity pool” is just an automated market maker in the form of a smart contract that automatically matches traders’ buy and sells orders based on predefined parameters. Traders do not need to be matched directly with other traders, so as long as investors have deposited assets into the pool, liquidity is constant (although trades that are large relative to the available liquidity can still incur significant slippage).
Automated pricing enables passive market
On order book exchanges, market makers need to constantly adjust their bids and asks as asset prices move. As expected, market makers tend to be professionals who have the time and expertise to actively manage their market-making strategies. Liquidity pools don’t need to aggregate information across exchanges to determine the price of assets. Liquidity providers simply deposit their assets into the pool and the smart contract takes care of the pricing.
Anyone can become a liquidity provider and earn
Liquidity pools require no listing fees, KYC, or other barriers characteristic of centralized exchanges. Anyone can invest in an existing liquidity pool or create a new exchange pair for any token, at any time. When an investor wants to supply liquidity into a pool, they deposit the equivalent value of both assets. Supplying $100 of liquidity into an ETH/DAI pool requires a deposit of $100 worth of ETH and $100 DAI, so $200 in total. In return, the investor receives liquidity pool tokens which represent their proportional share of the pool and allows them to withdraw that share at any time. When someone places a trade, trading fees are deducted from the asset that the trader sends to the exchange contract and added to the liquidity pool after the trade. For example, Uniswap charges a 0.3% trade fee. If your $100 ETH/DAI contribution makes up 0.007% of the pool, you’ll get 0.007% of that 0.3% trading fee.
Lower gas fees
Decentralized exchanges like Uniswap have a minimalist smart contract design that reduces gas costs. Efficient price calculations and fee distributions within the pool means less friction between transactions. For example, most smart contracts can only send traded funds back to the same wallet; Uniswap enables traders to exchange assets and send them to another wallet in a single transaction. 
Liquidity Provider Control
The DEXes like Uniswap are getting better and better with updated versions and provide better control to liquidity providers (LPs). Using the latest version of Uniswap (v3), the LPs can define what price ranges their capital is allocated to when providing liquidity to the pool. Individual positions are aggregated together into a single pool, forming one combined curve for users to trade against. It is called concentrated liquidity, liquidity that is allocated within a custom price range. Concentrated liquidity improves capital efficiency, but it can also amplify the chances of impermanent loss. In addition, v3 also enabled multiple fee tiers, which allows LPs to get a better reward/share for the risks they are taking.
Liquidity Pool Token and Yield Farming
A user who deposits the token into the liquidity pool is supplied by the exchange's liquidity pool token, which would be proportionate to the value of the liquidity provided. This is how the exchange will know how much the user has deposited in the liquidity pool. Moreover, once the user decides to withdraw the tokens from the liquidity pool and remove the liquidity, the exchange-provided tokens will be burned, and the initial tokens with the accrued incentives will be returned to the user. Yield Farming is a method used by investors in DeFi to maximize the return on investment, using different products in the DeFi ecosystem. 
Although there are different ways to maximize the returns using yield farming, the most commonly used method is by utilizing the Liquidity tokens, which the DeFi platforms provide. As mentioned earlier, DeFi platforms provide liquidity pool tokens to the users for using DeFi services like lending, borrowing, or depositing in liquidity pools. A user can use the liquidity pool tokens during the period of the smart contract, like any other token. Hence, to maximize the return, a user can deposit this token in a different platform that accepts the liquidity pool token to get additional yield. A user could repeat this with any number of platforms and any number of liquidity pool tokens, that is if the platform accepts the said token. Hence, by using yield farming, a user can compound two or more interest rates and ultimately maximize the returns. 
Liquidity Pools introduce new risks such as impermanent loss and liquidity pool hacks to decentralized finance. Other risks include smart contract bugs, admin keys, and flash loan exploits.
Did you find this article interesting?
Aug 11, 2022
Aug 11, 2022
Aug 11, 2022
Aug 11, 2022
Aug 11, 2022
Aug 11, 2022
Liquidity on Polkadot
Sep 24, 2022
Liquidity pools explained
Sep 24, 2022
Liqduity Pools explained
Sep 24, 2022
Concentrated Liquidity explained
Sep 24, 2022
Introducing Uniswap V3
Sep 24, 2022