Ultimate magazine theme for WordPress.

What are liquidity pools in DeFi and how do they work? | by Martian Doge Academy | June 2023

Decentralized finance (DeFi) has led to an explosion in on-chain activity. DEX volumes can reasonably compete with volumes on centralized exchanges. As of December 2020, there is nearly $15 billion worth of value locked in DeFi protocols. The ecosystem is growing rapidly with new product types.

But what makes all this expansion possible? One of the core technologies behind all these products is the liquidity pool.

A liquidity pool is a collection of funds locked in a smart contract. Liquidity pools are used to enable decentralized trading, lending, and many more features that we will explore later.

Liquidity pools are the backbone of many decentralized exchanges (DEX) like Uniswap. Dubbed Liquidity Providers (LP), users add the equal value of two tokens to a pool to create a market. In return for providing their funds, they receive trading fees from the trades occurring in their pool, proportional to their share of the total liquidity.

Because anyone can be a liquidity provider, AMMs have made market making more accessible.

One of the first protocols to use liquidity pools was Bancor, but the concept gained more attention with the popularization of Uniswap. Some other popular exchanges that use liquidity pools on Ethereum are SushiSwap, Curve, and Balancer. Liquidity pools at these venues contain ERC-20 tokens. Similar equivalents on the BNB chain are PancakeSwap, BakerySwap and BurgerSwap, with pools containing BEP-20 tokens.

To understand how liquidity pools differ, let’s take a look at the basic building block of electronic trading – the order book. Simply put, the order book is a collection of the currently open orders for a specific market.

The system that matches orders is called the matching engine. Along with the matching engine, the order book is the heart of any centralized exchange (CEX). This model is excellent for facilitating efficient exchanges and allowed the creation of complex financial markets.

However, in DeFi trading, trades are executed on-chain without a central party holding the funds. This presents a problem when it comes to order books. Each interaction with the order book incurs gas fees, making trades significantly more expensive to execute.

Also, the work of market makers, i.e. traders who provide liquidity for trading pairs, becomes extremely expensive. Most importantly, most blockchains are unable to handle the throughput required for day-to-day trading of billions of dollars.

This means that on a blockchain like Ethereum, an on-chain order book exchange is virtually impossible. You could use sidechains or layer 2 solutions and these are in the pipeline. However, the network is unable to handle the throughput in its current form.

Before we move on, it’s worth noting that there are DEXes that work well with on-chain order books. Binance DEX is based on the BNB chain and is specially designed for fast and cheap trading. Another example is Project Serum, which is built on the Solana blockchain.

However, since many assets in the crypto space are on Ethereum, you cannot trade them on other networks unless you use some kind of cross-chain bridge.

Automated Market Makers (AMM) have changed this game. They represent a significant innovation that enables on-chain trading without the need for an order book. Since trades do not require a direct counterparty to execute trades, traders can enter and exit positions on token pairs that would likely be highly illiquid on order book exchanges.

One could think of an order book exchange as peer-to-peer, with buyers and sellers connected through the order book. For example, trading on Binance DEX is peer-to-peer as trading occurs directly between user wallets.

Trading with an AMM is different. You might think of trading on an AMM as peer-to-contract.

As mentioned earlier, a liquidity pool is a set of funds deposited into a smart contract by liquidity providers. When you execute a trade through an AMM, you have no counterparty in the traditional sense. Instead, you trade against the liquidity in the liquidity pool. In order for the buyer to be able to buy, there does not need to be a seller at this point, only sufficient liquidity in the pool.

On the other hand, when you buy the latest grocery coin on Uniswap, there is no seller in the traditional sense. Instead, your activity is managed by the algorithm that governs what happens in the pool. In addition, the pricing is also determined by this algorithm based on the trades taking place in the pool.

Of course, liquidity has to come from somewhere, and anyone can be a liquidity provider, so in a way they can be viewed as your counterparty. However, it is not the same as the order book model as you are interacting with the contract that governs the pool.

So far we have mainly discussed AMMs, which are the most popular use of liquidity pools. However, as mentioned earlier, pooling liquidity is an extremely simple concept that can be used in a variety of ways.

One of them is yield farming or liquidity mining. Liquidity pools are the foundation of automated revenue generation platforms like Yearn, where users deposit their funds into pools that are then used to generate revenue.

Getting new tokens into the hands of the right people is a very difficult problem for crypto projects. Liquidity mining has been one of the more successful approaches. In principle, the tokens are distributed algorithmically to users who bring their tokens into a liquidity pool. Then, the newly minted tokens are distributed in proportion to each user’s share of the pool.

Remember; These can even be tokens from other liquidity pools, so-called pool tokens. For example, if you provide liquidity to Uniswap or lend funds to Compound, you will receive tokens representing your share of the pool. You may be able to deposit these tokens into another pool and earn a return. These chains can get quite complicated as protocols incorporate other protocols’ pool tokens into their products, and so on.

We could also consider governance as a use case. In some cases, a very high threshold of token votes is required to make a formal governance proposal. If funds are pooled instead, participants can champion a common cause that they feel is important to the record.

Another emerging DeFi sector is smart contract risk insurance. Many of its implementations are also based on liquidity pools.

Another, even more modern use of liquidity pools is tranching. This is a concept borrowed from traditional finance, in which financial products are divided according to their risks and returns. As expected, these products allow LPs to choose individual risk and return profiles.

Minting synthetic assets on the blockchain also relies on liquidity pools. Add collateral to a liquidity pool, connect it to a trusted oracle, and you have a synthetic token pegged to the desired asset. Okay, it’s actually a more complicated problem, but the basic idea is so simple.

What else can we think of? There are likely many more uses for liquidity pools that have yet to be discovered, and it all depends on the ingenuity of DeFi developers.

When providing liquidity to an AMM, you need to be aware of a concept called ‘impermanent loss’. In short, providing liquidity to an AMM is a dollar loss compared to HODLing.

If you are providing liquidity to an AMM, you are likely to face temporary loss. Sometimes it can be tiny; sometimes it can be huge.

Another point to keep in mind is the risks of smart contracts. When you deposit funds into a liquidity pool, they are in the pool. So while technically there are no intermediaries holding your funds, the contract itself can be thought of as the custodian of those funds. For example, if a bug or some sort of exploit occurs on a quick loan, your money could be lost forever.

Also, be wary of projects where the developers have permission to change the pool rules. Sometimes developers can have an admin key or other privileged access within the smart contract code. This can allow them to potentially do something malicious, such as take control of the funds in the pool. Read our article on DeFi scams to try and avoid rug pulls and exit scams as much as possible.

Liquidity pools are one of the core technologies behind the current DeFi technology stack. They enable decentralized trading, lending, revenue generation and much more. These smart contracts are powering almost every part of DeFi and will most likely continue to do so.

Learn Crypto Trading, Yield Farms, Income strategies and more at CrytoAnswers
https://nov.link/cryptoanswers

Comments are closed.

%d bloggers like this: