How do Liquidity Pools work in Uniswap and other DEFIs?

Liquidity Pool is a relatively new concept that is slowly taking over the Decentralized Finance (DeFi) space. In this article we try to explain How do Liquidity Pools work in Uniswap and other DeFi Protocols.

What are Liquidity Pools and why do we need them in Decentralized Finance (DeFI)?

Liquidity pools in essence are pools of token that are backed by a smart contract. They are used in facilitating liquidity and are extensively used by decentralized Exchanges like Dex. One of the first projects that introduced liquidity pools was Bancor, but concept of Liquidity pool became popular with the Uniswap protocol.

Importance of Liquidity Pools

Before we explain how liquidity pools work under the hood and what is automated market making, it’s important to understand why we need them.

In a standard cryptocurrency exchange like Binance or Coinbase, trading is based on a model called the orderbook model. An orderbook is a list of open trades where both buyers and sellers of the cryptocurrency asset list their interest to buy/sell them. The matching algorithm then analyses the suitable trade based on the parameters set and executes the trade. This is how most traditional stock exchanges like NYSE and Nasdaq work. In this order book model, buyers and sellers come together and place their orders. Buyers/ Bidders try to buy at the lowest price possible and sellers try to sell the same asset at a higher price.

For a trade to happen, both the parties have to agree on a favorable price. This can happen when the buyer bids at a higher price than the rest of the orders and the seller reduces the price. But what if there are not enough coins to buy? This is where market makers come in.

Market makers are entities that are always willing to buy or sell a particular asset, by doing that they provide liquidity so the users can always trade and they don’t have to wait for another counter party to show up.

So is it possible to replicate the same model in Decentralized Finance? Yes. That’s possible, but it would be really slow, expensive and results in poor user experience.

This is one of the reasons why in a orderbook model, there are multiple market makers who are so to say “making the market” in a certain asset. Without market makers, an exchange becomes instantly illiquid and pretty much useless without any trades happening.

Further on the downside, Market makers usually keep track of the prices in the orderbook and adjust it constantly. This results in a huge number of orders being cancelled on the exchange.

Ethereum with the current throughput of around 12 – 15 transactions/second and a block time between 10 – 19 seconds isn’t really a viable option for an orderbook exchange. Every interaction with a smart contract on the Ethereum blockchain would be chargeable through a gas fee and this would drain ETH heavily for market makers for just updating the order without even making any trade.

Second Layer Scaling or commonly known as Layer 2 is a secondary protocol built on top of the primary blockchain. It serves as means to accelerate transactions and mitigate scaling difficulties that blockchains face time to time.

Although some of the second layer scaling projects like Loopring are dependent on market makers, they are still at risk of illiquidity. On top of that, if a user wants to make only a single trade, they will have to move the funds in and out of the second layer, this increases the number of steps and gas fee as well. This isn’t suitable for smaller funds and single trade.

Finally, a Viable Alternative

Faced with a few other challenges there was a need to invent something new in the decentralized exchange space that would help trade better, faster and cheaper. Hence, Liquidity pool was created.

Now that we understand their importance, let’s see how Liquidity pools work?

Fundamentally, a single Liquidity pool holds two token and each pool creates a new market for that particular pair of tokens. For example, take DAI-ETH which is a popular Cryptocurrency pair and enjoys a vast liquidity pool on decentralized exchange 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 in 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 Provider (LP) receives special tokens known as LP tokens in proportion to the liquidity they supplied to the pool. When the trade is facilitated by the pool. A 0.3% fee (at the time of writing this article) is proportionally distributed amongst all the LP token holders.

If the Liquidity provider wants to get their underlying liquidity back plus any accrual fee, they must earn their LP tokens. Each token swap that the liquidity pool facilitates results in the price adjustment according to the deterministic pricing algorithm.

This mechanism is also called an Automated market maker (AMM). Liquidity pools across different protocols will use a slightly different algorithms. Basic liquidity pools such as those on Uniswap use a Constant Product Market Maker algorithm that makes sure that the product of the quantities of the two supplied tokens always remains the same.

Because of the algorithm, the pool can always provide liquidity no matter the size of the trade. The main reason for this is because the algorithm asymptotically increases the price of the token as the quantity increases. The ratio of the tokens in the pool determines the price.

For example, if someone buys ETH from the DAI-ETH pool, they reduce the supply of ETH in and add the supply of DAI in the pool. This results in the increase of price of ETH and decrease in the price of DAI. The price movement is dependent on the size of the trade in proportion to the size of the tokens in the pool. The bigger the size of pool, in comparison to the trade, the lesser the price impact a.k.a Slippage occurs. Large pools can accommodate large order size without much impact on the price. Since, larger liquidity pools create less slippage offers a better trade experience, some exchanges like Balancer started incentivizing liquidity providers with extra tokens for supplying liquidity to certain pools. This process is called Liquidity Mining.

Hope the article helped you understand how liquidity pools work in general. Do let us know your thoughts in the comments below.

How do Liquidity Pools work in Uniswap and other DEFIs?
Article Name
How do Liquidity Pools work in Uniswap and other DEFIs?
Liquidity Pool is a relatively new concept that is slowly taking over the Decentralized Finance (DeFi) space. In this article we try to explain How do Liquidity Pools work in Uniswap and other DeFi Protocols.
Publisher Name
Fast & Clean
Publisher Logo
Tags from the story
, ,
More from Siddharth Jeevagan

How to find the best Vegan Meat products on

In this article lets take a look at How to find the...
Read More