What are liquidity pools? How do you work? Why are they needed in decentralized finance?
Also, What are the differences between liquidity pools of different protocols? like UniSwap, Balancer or Curve?
I’ll go through all of that in this article!
🤽 What are the liquidity pools?
All right, let’s talk about liquidity pools. Liquidity pools are essentially pools of tokens locked in a smart contract. They facilitate trading by providing liquidity and are used extensively by some decentralized exchanges, also known as DEXs.
One of the first projects to introduce liquidity pools was Banker, but Uniswap made them widely known.
Before I explain how liquidity pools work under the hood and what automated market making is, let’s try to understand it why we need them at all.
If you are familiar with standard crypto exchanges like Coinbase or Binance, you may have seen that their trading is based on the order book model. This is how traditional exchanges like the New York Stock Exchange or Nasdaq work.
In this order book model Buyers and sellers come together and place their orders. Buyers, also called bidders, try to buy a specific asset at the lowest possible price, while sellers try to sell the same asset for as high as possible in order for deals to take place.
The buyer and seller must agree on the price. This can be done either by a buyer bidding higher or a seller lowering their price.
But what if no one is willing to place their orders at a reasonable price level? What if there aren’t enough coins that you want to buy?
That’s where market leader come play
Essentially, market makers are entities that facilitate trading by always being ready to buy or sell a specific asset. In this way, they provide liquidity so that users can trade at any time and do not have to wait for another counterparty to show up.
Okay, can we do something like this in decentralized finance?
The answer is that we can. But unfortunately, it would be slow, expensive, and always result in a poor user experience.
The main reason for this is that the order book model is highly dependent on there being one or more market makers that are always willing to make the market for a given asset.
Without market makers, an exchange becomes illiquid and almost unusable for ordinary users. Additionally, market makers typically track the current price of an asset by constantly changing its prices, resulting in a significant number of orders and order cancellations being sent to an exchange.
Therefore, with a current throughput of around 12 to 15 transactions per second and a block time of between 10 and 19 seconds, Ethereum is not a viable option for an order book exchange.
Over and beyond, Each interaction with a smart contract costs a gas feeso market makers would go bankrupt just by updating their orders.
📈 How about an L2 for scaling?
Some of the L2 projects like Loopring look promising but are still dependent on market makers and may face liquidity issues.
Furthermore, if a user only wants to make a single trade, they would need to move their funds in and out of the L2. which adds two extra steps to their process.
This is precisely why there was a need to invent something new that could work well in the decentralized world. And this is where liquidity pools come into play.
👷♂️ So how do liquidity pools work?
Now that we understand why we need liquidity pools in decentralized finance, let’s look at how they work in their basic form.
A single liquidity pool contains two tokens, and each collection creates a new market for that particular token pair. DAI can be an excellent example of a popular liquidity pool on Uniswap.
When a new pool is created, The first liquidity provider is the one who sets the initial price of the assets in the pool. After that, the liquidity provider gets an incentive to provide both tokens in the pool with the same value.
Suppose the initial price of the tokens in the pool differs from the current world market price. In this case, an immediate arbitrage opportunity arises, which can result in capital losses for the liquidity provider.
This concept of providing tokens in the right proportion will remain in place for any other liquidity providers willing to add more funds to the pool later.
When liquidity is added to a pool, the liquidity provider LP receives special tokens, called LP tokens, in proportion to the amount of liquidity it provides to the pool. *
When a trade is facilitated through the pool, a 0.3% fee is prorated among all LP token holders (this fee is subject to change at each DEX).
The liquidity provider must destroy their LP tokens if they wish to recover their underlying liquidity plus any accrued fees. Each token exchange facilitated by a liquidity pool results in a price adjustment according to a deterministic pricing algorithm.
This mechanism is known as an automated market maker (AMM) and liquidity pools across different protocols may use a slightly different algorithm.
For example, basic liquidity pools like those used by Uniswap use a constant product market-maker algorithm that ensures that the product of the amounts of the two supply tokens always stays the same.
Furthermore, because of the algorithm, a pool can always provide liquidity no matter the size of a trade. The main reason is that the algorithm increases the price of the token asymptotically when the desired quantity increases.
🧮 What is the mathematics behind the liquidity pools?
The math behind the constant Product Market Maker is quite interesting, but to make sure this article doesn’t get too long, I’ll save it for another time.
This is the most important finding The ratio of tokens in the pool determines the price.
So, for example, if someone buys it from a DAI pool, they reduce the supply of ETH and add the supply of DAI, which increases the price of ETH and decreases the price of DAI.
How much the price moves depends on the size of the trade relative to the size of the pool. The larger the pool compared to a trade, the smaller the impact on price slip.
So Big pools can do bigger deals without changing the price too much because larger liquidity pools cause less slippage and result in a better trading experience.
Some protocols, like balancers, started to incentivize liquidity providers with additional tokens to provide liquidity for specific pools. This process is known as liquidity mining, and we may dedicate an article just to this topic in a future post.
The concepts behind liquidity pools and automated market making are simple but extremely powerful. We no longer need a centralized order book and are not dependent on external market makers to continuously provide liquidity to an exchange.
Uniswap uses the liquidity pools just described and they are the most basic forms of liquidity pools.
Other projects have adopted this concept and come up with some exciting ideas.
For example, Curve recognized that the automated market-making mechanism behind Uniswap does not work very well for assets that should be very similarly priced, such as stablecoins or different variants of the same coin, such as WETH or SETH curve pools. Therewith, They found that implementing a slightly different algorithm could result in lower fees and slippage when exchanging these tokens.
Another exciting idea for liquidity pools came from Balancer, who recognized this We don’t have to limit ourselves to just having two assets in a pool. In fact, Balancer allows for up to eight tokens in a single liquidity pool.
🚀 Some final thoughts
This is a short talk on liquidity pools as the math behind it is awesome. Many projects are currently being worked on Implementation of additional functions and new ways to manage them (also with new algorithms like UniSwap V3).
But I hope that with this article you at least have a better idea of how they work and why they are crucial for the development of DeFi tools!
So what do you think of liquidity pools? feel free Leave a comment!
✅ Follow my social networks!
– Twitter: https://twitter.com/thenaubit
Learn Crypto Trading, Yield Farms, Income strategies and more at CrytoAnswers
https://nov.link/cryptoanswers
Comments are closed.