What is a Crypto Liquidity Pool? & How it Actually Works
https://www.youtube.com/watch?v=SP6DShCCIvY
Transcript:
liquidity pools are one of the core technologies behind many current defy applications but to understand why we really need them you need to know how traditional crypto exchanges and stock exchanges work the most commonly used cryptocurrencies trading mechanism today is the order book mechanism it is used by a lot of centralized crypto exchanges like coinbase and binance but in case you don’t know how it works here is a quick recap buyers and sellers place orders on the market buyers state how much of a crypto they
want to buy and the maximum price they are willing to pay sellers on the other hand state how much they want to sell and the minimum price they are willing to accept a transaction occurs when an order from a buyer is matched with an order from a seller and the two of them agree on the same price, but what happens if there are no matching orders? Or if there is no enough supply for a token in the market to complete the transaction? In stock exchanges, what happens is that some people or organizations
step in and buy or sell the asset at a fair price to help sellers and buyers complete their transactions. These individuals or organizations are called market makers. These market makers make profits from the difference between the price they buy the stocks at and the price they sell the stocks with it.
But in cryptocurrencies, market makers will lose all their profits in transaction fees on the blockchain as they always cancel orders and issue new ones also the slow transactions speed of most cryptos right now make the order book mechanism not a good option for new low volume tokens and for tokens relying on blockchains that charge a high gas fee like ethereum and from there comes the need for the liquidity pools technology welcome to crypto b where we explain cryptocurrencies and d5 topics in the most simple and beginner friendly way in this video you will know what
exactly is a liquidity pool and how it works who is a liquidity provider and why would you put your money in a liquidity pool the different types of liquidity pools and finally we will talk about some of the risks of investing in liquidity pools so let’s get started a liquidity pool is basically a collection of tokens locked in a digital container or pool where anyone can add tokens to it.
This pool of funds is under the control of a smart contract. If you don’t know what a smart contract is, it is basically a code on the blockchain that executes transactions automatically when certain conditions are met, without any authority or intermediaries. But what you need to know now is that the smart contract controls the pull tokens and execute transactions using these tokens automatically.
The tokens locked in the liquidity pool are used to facilitate token swaps anytime between traders. So you and other people can swap between any two pair of tokens anytime, even if there are no sellers willing to swap your tokens on the market. For example, you can swap your ethereum for monotokens using a liquidity pool on uniswap, you don’t need any other seller to sell you the monotokens as you will buy from the tokens already available in the pool.
So now, you know what is a liquidity pool but how does it really work a liquidity pool in its most basic form contains two tokens like the ethereum monopair when a liquidity pool is first created the first person to deposit tokens in the pool is called the first liquidity provider and he needs to set the prices of both tokens this step needs to be done correctly as enemas prices will create an instant arbitrage opportunity for traders where they can buy the undervalued token and sell it to other
liquidity pools where it is correctly priced for example they can buy one ethereum for one thousand mana tokens in a pool and then sell this one ethereum to another pool for one thousand two hundred mana tokens although these arbitrage traders make easy profits of these trades they perform a very important role in regulating the prices of liquidity pools and keeping them all closely priced and you will see how in a minute the first liquidity provider provides the two tokens with an exact ratio of 50 50. so if he wants to put in 1000 US dollars, he needs to provide $500 in Ethereum and
$500 in Mono. This also applies to any other liquidity provider. For example, if you want to provide $250 to the pool, you provide $125 in Ethereum and $125 in Monookens let’s say a liquidity pool has 125 ethereum and 125 000 monotokens the current price of one ethereum in the pool is 1 000 mana the price of both tokens changes constantly after each swap transaction made by traders and these prices are adjusted by a mechanism called the automated market maker mechanism simply it is a mechanism that is based
on a mathematical formula used to adjust the prices of tokens relative to each other in a liquidity pool most liquidity pools like the ones on uniswap use the constant product mathematical formula according to this formula in our example the product of multiplying the total number of ethereum times the total number of Ethereum, times the total number of Monatokens in the pool, is always a constant number that doesn’t change.
The math is a little bit complicated, but we will make sure you understand it. In our example here, for our liquidity pool, the quantity of Ethereum is the X, and the quantity of Monat is the Y, and the constant number is the Z, which in our case will always be 15 million 625 000 so if someone wants to exchange 25 000 mana tokens for ethereum how much will he get paid you know that the product of the two quantities will always be a constant number which is 15 million six hundred twenty five thousand so after he deposits his mana tokens, we will have 150,000 mana tokens in the pool.
To get the amount of Ethereum that we need in the pool to keep our Z constant, we divide the Z by the total quantity of mana after the swap, which will result in 104.166 Ethereum. What that means is that 104.166 Ethereum coins need to remain in the liquidity pool after the swap to keep our Z constant.
At the beginning we had 125 Ethereum, and we need 104.166 to remain, so he gets paid 20.834 Ethereum. If we try to calculate the price he paid for each Ethereum, we will get a result of 1199.99 Mono per Ethereum. And the price before the swap was 1000 Mono per Ethereum.
So why did he pay a higher price for each Ethereum? That is because any liquidity pool has a finite number of tokens, in our case, the liquidity pool had a finite amount of Ethereum and a finite amount of Mono tokens. When someone exchanges mana tokens for ethereum he reduces the supply of ethereum in the pool and increases the supply of mana this will raise the price of ethereum and lower the price of mana and this is because the liquidity pool has to maintain the ratio between the value of ethereum and the value of mana in the pool at 50 50. so the pool sells the first ethereum at the normal price and the second one mana in the pool at 50-50. So the pool sells the first Ethereum at the normal price
and the second one at a higher price and the third at a higher price and so on to keep liquidity in the pool. This is called the price impact of a transaction or slippage. By how much the price increases depends on the size of the transaction compared to the size of the pool. Bigger pools are less impacted by transactions and have very low slippage.
Smaller pools on the other hand are severely impacted by large transactions and their prices are very volatile. So if there is a pool that has $20,000 in liquidity and someone came to exchange $5,000 in Mono for Ethereum, this would lower the price of Mono significantly and raise the price of Ethereum.
Unlike a pool with $2 million in liquidity, the same transaction won’t shift the price that much. You should also know that most decentralized exchanges can perform more than one transaction to swap your tokens. For example, if you want to swap Mono tokens for LINK tokens, the exchange will swap your Mono to Ethereum first and then swap your Ethereum to Link tokens.
And you will pay a fee for each pool involved. We said before that the liquidity providers are the people who deposit their money in a liquidity pool. They need to deposit their money in a 50-50 ratio. But you may be wondering, why do people deposit their money into liquidity pools? Well, all transactions facilitated by liquidity pools have a fee of 0.
3%, and these fees go to liquidity providers. This transaction fee may not seem like a lot, but they add up over time as traders execute trades every day. When liquidity providers deposit their money into a pool, they receive special tokens, When liquidity providers deposit their money into a pool, they receive special tokens called the Liquidity Provider Tokens or LP tokens.
The tokens are split up among liquidity providers according to their shares in the pool. The transaction fees accumulated from the pool transactions are then divided among LP tokens folders. For example, if you and three of your friends set up a pool, each one of you paid $5,000 in liquidity, and the pool collected $400 in fees, then each one of you will get paid $100.
If a liquidity provider wants to restore the invested liquidity back, he will need to destroy or burn the LP token as he no longer holds a share in the pool. Let’s now talk about the different types of liquidity pools. The type of liquidity pool that we explained before is the type that uses the constant product formula which is the type of pools on Uniswap.
It has two tokens only and their prices adjust as we make transactions. Curve on the other hand is an another platform that use a different formula, which makes the prices on it very stable, and has very low transaction fees, where it can go as low as 0.04%.
Curve liquidity pools are used for stablecoins, which are cryptocurrencies with very stable prices tied to other assets like the US dollar or gold. We also have the balance or protocol liquidity pools that can have up to 8 tokens in the same pool. However, the most popular type is the Uniswap liquidity pool, based on the constant product algorithm. Let’s now talk about some of the risks of investing in liquidity pools.
It may be very tempting to invest your money in one of these high-paying liquidity pools as they may offer interest rates higher than anything seen on our traditional financial markets. But keep in mind that there are several risks involved with depositing your money in these liquidity pools first we have the smart contracts risks smart contracts are just a code and like any code in the world it can have errors and can be hacked like the hack of urine finance that happened in february 2021 where hackers succeeded in stealing
11 million dollars of investors’ money. When you invest your money in a liquidity pool, you need to buy the two tokens to deposit them into the pool. If one of the tokens raises in price after a while, the arbitrage traders will rush to buy it at low prices from liquidity pools, which will decrease its supply in the pool, and decrease your share of the token in the pool so you now have lost the profit that you could have made if you just bought this token and held it this is called impermanent loss and we
will explain it in details in a video coming very soon subscribe to our channel so you don’t miss it rug pulls are in another type of risk and liquidity pools this happens when developers create a new token and set up a liquidity pool for it, paired with another well-known cryptocurrency like Ethereum.
After that, they encourage people to invest in their liquidity pool by offering insane returns and then, after a lot of people have invested their money into their pool, they use an intentionally placed backdoor in the code to issue millions of their token, and swap these tokens for the Ethereum in the pool, depleting the pool from it, and then disappear without any trace.
This leaves the investors with a pool full of worthless tokens. So you need to study the project you are investing in it before making any decisions and make sure that they are a reputable team, not in another rug pool.