Liquidity pools are a unique concept of the Decentralized Finance (DeFi) Ecosystem. They are one of the key elements on which the decentralized exchanges (DEX) that are part of the DeFi ecosystem are based.
Major Roles in Liquidity Pools
There are several roles engaged in the operation of liquidity pools.
- Investors. These market participants lock their assets in pools, thereby providing liquidity and trading opportunities for other participants. Investors receive a commission for doing so, i.e., passive income. They are also called liquidity providers (LPs) and market makers. They need to supply two tokens, a trading pair of equivalent value, to provide liquidity. The amount of income depends on the trading volume of a particular cryptocurrency pair and is proportional to the amount invested in the pool.
- Traders. Liquidity pools create a market for specific asset pairs, enabling traders to buy or sell coins on decentralized exchanges using the supplied liquidity. Decentralization is the essence of this kind of trading, i.e., the ability to interact peer-to-peer, without an intermediary in the form of a centralized exchange. The existence of a liquidity pool makes no sense without traders.
- Automated Market Makers (AMMs) are among the participants in liquidity pools. Their role is to automate the process of traders’ interaction with the pool and display the actual value of coins within the pool. These are smart contracts that represent the pool as a transaction participant and use mathematical formulas to adjust the market price of both assets in a trading pair depending on supply and demand fluctuations.
There are different algorithms for regulating the price of assets within the liquidity pool, which perform automatic arbitrage to maintain price parity in the trading pair:
- Constant Function Market Makers (CFMMs);
- Constant Product Market Maker (CPMM);
- Constant Sum Market Maker (CSMM);
- Constant Mean Market Maker (CMMM), etc.
However, since any algorithms are vulnerable to unpredictable market movements, which was clearly demonstrated by the collapse of the UST algorithmic stablecoin, the liquidity pools involve arbitrage traders, who manually balance the value of assets on different platforms where algorithms fail.
The Structure of Liquidity Pools on DEX as an Example
Decentralized exchange Uniswap was one of the first platforms to utilize liquidity pools. Uniswap does not have an order book like centralized exchanges, instead, it employs AMMs. Algorithms and arbitrage traders provide up-to-date market values of digital assets.
Uniswap pools operate with the following formula to maintain a liquidity balance:
X*Y = K
X — first token deposited into the pool;
Y — the second token that forms, together with the first, a trading pair and is also part of the pool (often a stablecoin);
K — the total liquidity in the pool, which must remain constant.
If a user buys any token in the pool, for example, ETH in the ETH/USDT pool using USDT, the value of ETH increases as it becomes smaller. But the total K value must remain unchanged, which is exactly what is ensured algorithmically.
Liquidity Pools’ Risks
Risk is present in liquidity pools for all market participants. First, all transactions function through smart contracts, and in case of a systemic error, assets can be lost. Second, DeFi projects are subject to frequent cyberattacks. Finally, one of the most common risks specifically for the investor refers to impermanent losses.
Let’s assume that a market maker puts 10 BTC and 1,000 USDT into a liquidity pool, i.e., the price of BTC in this example is $100, while the total amount of investment is $2,000. At the same time, the entire pool volume is 100 BTC and 10,000 USDT — 10% of liquidity was put by a specific market maker, and the rest was contributed by other pool participants. The total liquidity of the pool (K) is 1,000,000.
Everything is fine as long as the value of the assets doesn’t change. But if the price of BTC starts to grow, algorithms or arbitrage players will buy BTC from the pool at a lower price until the ratio of prices in the pool compares with the market value of the asset. Suppose BTC grew to $400, then arbitrage manipulations add USDT to the pool and remove BTC from the pool until the ratio reflects the current price and corresponds to the initial index of the pool’s total liquidity. Thus, the pool will be left with 50 BTC and 20,000 USDT.
If the market maker decides to withdraw their 10% of the pool before the pair equalizes, they will receive 5 BTC and 2,000 USDT, for a total of $4,000. At first glance, the liquidity provider has made a profit, but if they had kept the initial 10 BTC and 1,000 USDT, their total value would have been $5,000. This is called an impermanent loss, because the size of the loss is constantly changing along with the rate of the assets that make up the trading pair, and is fixed only at the moment of their withdrawal from the pool.
Therefore, liquidity pools implement one of the key ideas in decentralized finance — the ability to trade and exchange assets without an intermediary. Besides, pools enable market makers to receive passive income and market participants to earn money from P2P trading of assets that are not represented on centralized exchanges.