What is a liquidity pool and how does it work?

Aman Kuvera
7 min readMar 24, 2022

Liquidity means the availability of assets or tokens in an exchange for users to buy/borrow. Liquidity pool in laymen's terms means a pool (space) where tokens are deposited for providing liquidity. Liquidity pools are available both in centralized and decentralized exchanges. For example, Binance liquidity pool (centralized exchange), Uniswap liquidity pool (decentralized exchange)

Who deposits tokens in liquidity pools?

👉 A liquidity provider deposits tokens in the liquidity pools.

Who can be a liquidity provider?

👉 Anyone who is willing to deposit tokens in the liquidity pool can be a liquidity provider.

Let’s see how a Liquidity Pool works?

working of a liquidity pool

Now that we’ve established the basics of the liquidity pool, let’s see how it works.

Providing liquidity

👉 Liquidity pools generally have 1 pair of tokens, for example, ETH-USDT. The reason they are paired is that when someone asks for one token, say ETH, they can deposit some USDT and get its equivalent ETH for it. Therefore, a liquidity provider deposits paired tokens in the pool in a 50:50 ratio which means if he/she deposits 1ETH, they have to deposit 2443 USDT as well based on the current value of 1 ETH in USDT.

Liquidity pools on Uniswap

Note: Some platforms have complex pools as well. For example, the liquidity pools on Balancer. They allow more than 2 tokens in a liquidity pool and as many as 8 tokens as well. This runs on very complex calculations, but it works!

What does a liquidity provider get in return?

👉 Depending on the liquidity where one is providing the liquidity, the rewards are determined. For example, if you are providing liquidity in a liquidity pool in Uniswap, the liquidity provider gets incentives from the gas fees generated from the transactions made by the people exchanging tokens from the liquidity pool. These incentives are otherwise the APR(%) that the liquidity pool calculates based on your contribution to the pool and pays it to you in ETH or USDT accordingly, for this instance. In addition to this APR, you get some governance tokens as well (in this case, UNI tokens — the native UNIswap tokens) based on the amount of liquidity he/she provides.

👉 Quick Glossary

  • Gas Fee — this is the transaction fee that is paid by the person making a transaction on the blockchain network. The fee is paid to the smart contract which is then distributed to the network nodes who help to validate the transaction.
  • Governance tokens — as we know blockchain networks are decentralized and hence the decisions on the network are collectively taken by the people who contribute to it by running nodes, validating transactions, mining, providing liquidity, staking tokens, etc. In return for their contributions to the network, they receive rewards in the form of native network tokens. For example, UNI is the native token for UNIswap. The people who own these tokens are allowed to vote for or against various activities that happen on the network or Decentralized App in the case of Uniswap. Hence, these people vote to make decisions. This act is called governance and the token is called Governance token.
Voting and governance on Uniswap

💱 Exchanging or swapping tokens from the liquidity pool

Any person who wants to exchange his/her token for any other token can visit the exchange, for example, Uniswap exchange, and connect your wallet that holds the tokens to be exchanged (for example Metamask)

Let’s say that you have 1 Ethereum and you want to exchange it for USDT as in the above example.

You just have to add the token that you want to swap and its amount in the first row and select the token that you want to receive in the second row. The exchange will automatically calculate the number of tokens you’ll receive equivalent to the value of the first token. This is called the decentralized exchange, we learned about it in the previous article. Decentralized exchange uses the tokens in the liquidity pool to exchange tokens for you.

💰 How is the value of the tokens decided?

Let us assume that a pool contains 5 ETH tokens and 14568 USDT tokens. Say many people exchange USDT for ETH and fewer people exchange ETH for USDT or vice versa. Considering the first scenario, the demand for ETH increases as everyone wants ETH in exchange for USDT.

As simple supply and demand work, when the demand for a token increases, its quantity in the pool decreases, which in turn increases the price of that token.

While the quantity of ETH in the pool is decreasing, the amount of USDT is increasing in the pool, and hence, when the quantity of something increases its price decreases. Therefore, the value of USDT decreases with an increase in quantity.

Visualization of the above scenario (Determining the price of a token)

In this scenario, when the price of a token in the pool decreases, it isn’t equal to the actual market value of that token in other exchanges. This is when people benefit a lot. Traders buy these tokens for a lower price from the pool and sell them on exchanges for higher prices, hence earning quick profits. These trades are called Arbitrage trades.

Even though it seems like arbitrage trades aren’t completly fair but they are necessary in order to bring the lowered token value in sync with the market. When people executre these arbitrage trades, the token that is more in quantity in the pool (in this case USDT) will be bought more and hence, this reduces the quantity of USDT while increasing it price.

Note: At any point in time, the total value of token A in a pool will be equal to the total value of token B. This is the general formula used by many Automated Market Makers to maintain the liquidity in the pool. The total value of the pool only changes when there are new liquidity providers adding more tokens into the pools.

What happens if I want to exchange tokens for Ethereum but those tokens aren’t a part of the liquidity pool?

So far we’ve seen how to exchange one token for another from a liquidity pool on a decentralized exchange. in our example, we had considered the pool of two tokens ETH-USDT. Now, what happens if I want some ETH but I do not have USDT but I have MATIC instead? Let’s say that there exists another liquidity pool with the pair MATIC-USDT. In such cases, the dex does something which is called Routing. What routing does is that it first exchanges your MATIC for its equivalent USDT and then exchanges this USDT for ETH from the first pool. In this way, any token can be exchanged for another token on the decentralized exchange because of the various liquidity pools available.

What are Automated Market Makers?

In traditional finance, we exchange money and make transactions using something called an order book where all the transfers and deposits are recorded by the banks. Automated Market Makers or AMMs are automated decentralized tools that maintain the orders and enable trading for people using the liquidity pool without depending on a centralized entity. The main responsibility of an AMM is to maintain the prices of tokens in the liquidity pool while increasing or decreasing the number of tokens in the pool. The AMMs use various formulas to determine the value of tokens in the pool, the most common formula used by AMMs is

the number of tokens A in the pool * the number of tokens B in the pool = k

where k is a constant representing that the total liquidity of the pool should always remain constant. This formula was initially proposed by Vitalik Buterin in his paper on AMMs and is used by Uniswap as well in their AMM.

What is an Order Book?

An order is the list of orders that a trading platform generally uses to record the buy and sell orders that traders and investors have made on the platform for various assets. Here’s an image of what an order book looks like in a centralized crypto exchange (Binance). The upper table shows the order book for all the tokens on the platform whereas the one at the bottom shows the order book for Bitcoin alone.

Order Book in a centralized exchange

What is an order book Dex?

An order book dex is a decentralized crypto exchange but with features of a centralized exchange included in it with decentralization like margin trading, spot trading, perpetual contract trading, lending, and borrowing. The Order book dex maintains an order book for the trading activities like a centralized exchange but it isn’t actually centralized but is managed by smart contracts. For example, dYdX.

✨ Voila! Now you know so many things about the crypto space. This might seem a lot to you but I hope you understand the concepts clearly as I’ve tried my best to make it completely beginner friendly. Hope you can now explain to your friends and colleagues what liquidity pools, AMMs, and Order book Dex’ are. Do leave feedback. See you in the next one!

Connect

Twitter | Website | LinkedIn | Instagram | Medium

Up Next: What’s Yield Farming?

--

--

Aman Kuvera

A MERN Stack Web developer and software engineer. I write about Web development, Web3, Crypto Currencies, and Basic concepts of Blockchain for beginners