DeFi Scam Prevention | What is a Liquidity Pool? How do they work?

share
DeFi Scam Prevention | What is a Liquidity Pool? How do they work?

Lately, the decentralized exchange Uniswap has been gaining momentum, with numerous "100x coins" appearing frequently. Have the stories of overnight fortunes made you eager to try your luck? Before diving in headfirst, we recommend watching a 10-minute video to understand what a liquidity pool is. This way, you'll realize that the mechanism behind the skyrocketing "100x" coins on Uniswap differs from that of Coinbase or Binance. From feasts to the heavens and earth, to monsters and demons, anything can turn into thin air overnight.

This video explaining "What is a Liquidity Pool?" will cover topics such as "Why DeFi needs it?" and "What are the differences between the liquidity pools of Uniswap, Balancer, and Curve?" Translating the content of the video is recommended for readers to use as a reference, with the original video content being the most accurate source.

Why Does DeFi Need Liquidity Pools?

A liquidity pool refers to a pool of tokens locked in a smart contract. They facilitate trading by providing liquidity and are utilized by decentralized exchanges (DEXs). The concept of liquidity pools was first introduced by Bancor, but it gained popularity through Uniswap.

Before explaining how liquidity pools operate and what Automated Market Makers (AMMs) are, let's first understand why they are needed.

If you are familiar with exchanges like Coinbase or Binance, you know that they operate based on the order book model, similar to traditional stock markets like the New York Stock Exchange (NYSE) and Nasdaq.

In these order book model markets, buyers and sellers each place their orders. Buyers (also known as bidders) aim to buy assets at the lowest price, while sellers aim to sell at the highest price. For a trade to occur, both parties need to agree on a price. This can happen either by the buyer increasing their bid or the seller decreasing their asking price.

But what if no one is willing to adjust their price? Or what if you don't have enough of the asset you want to buy?

This is where market makers come in. Market makers facilitate trades by continuously accepting buy and sell orders, providing liquidity. This allows users to trade without waiting for a counterparty to appear.

Why Can't Decentralized Finance (DeFi) Replicate This Mechanism?

It is possible, but it becomes slow, expensive, and difficult to use. The main reason is that the order book model heavily relies on market makers, requiring many market makers to continuously provide liquidity for a specific asset. Without market makers, exchanges immediately lose liquidity, making it challenging for regular users.

Additionally, market makers need to constantly track current prices, adjust their bids, and submit a large number of orders to exchanges.

Ethereum can process 12-15 transactions per second, with block times ranging from 10 to 19 seconds, making it impractical for order book exchanges. Each transaction interacting with smart contracts incurs gas fees. Just submitting orders could bankrupt market makers.

Can Second Layer Protocols Solve This Issue?

Some second-layer protocols, like Loopring, seem reliable, but they still rely on market makers and face liquidity issues. Moreover, if a user wants to trade on a second-layer protocol, they must go through two additional steps for deposits and withdrawals.

This is why new innovations are needed to operate more smoothly in a decentralized world, which is why liquidity pools are necessary.

How Do Liquidity Pools Work?

Typically, a liquidity pool consists of two tokens, creating a new trading pair market. DAI/ETH is a popular example of a liquidity pool on Uniswap.

When a new liquidity pool is created, the initial liquidity provider (LP) sets the initial price in the pool, ensuring both assets maintain an equivalent value. If the initial price deviates from the global market price, an arbitrage opportunity arises, causing LPs to lose funds. Subsequent LPs face the same risk when adding funds to the pool.

When liquidity is added to the pool, LPs receive special LP tokens representing the proportion of liquidity they provided.

When trades occur using this liquidity pool, 0.3% of the trade fees are distributed proportionally among all LP token holders. If LPs want to withdraw their provided liquidity, their LP tokens must be burned.

Each time LP tokens are burned, a deterministic algorithm triggers price adjustments, which is the Automated Market Maker (AMM) mechanism.

Each protocol uses a different AMM algorithm. Uniswap, a basic liquidity pool, utilizes the constant product market maker algorithm: x * y = k, where the product of the quantities of x and y tokens always equals a constant k.

Due to this algorithm, liquidity pools can provide liquidity regardless of trade size. As demand for a token increases, the algorithm continuously adjusts its price.

The key point of these liquidity pools is that token ratios dictate prices.

For example, buying ETH with DAI in the DAI/ETH pool causes the price of ETH to rise and the price of DAI to drop.

The magnitude of price movements depends on trade size and pool size. Larger pools can handle larger trade volumes with less impact on prices (known as slippage). In essence, larger pools can accommodate larger trades with less slippage.

Due to smaller slippage in larger pools, they offer a better trading experience. Some protocols, like Balancer, have started offering LPs more incentives to attract liquidity, a process known as "liquidity mining." The concepts of liquidity pools and automated market makers are simple yet powerful. By eliminating centralized order books, external market maker support is no longer required.

Uniswap employs the described liquidity pool mechanism, serving as the fundamental model. Other liquidity pools have replicated this concept and introduced innovative ideas.

For example, Curve found that Uniswap's AMM mechanism does not work well for assets with similar prices, such as stablecoins or derivatives of the same token (e.g., WETH/SETH). Curve's algorithm provides lower fees and reduced slippage when trading these types of assets.

Another example is Balancer, which discovered that pools do not need to be limited to two assets. Balancer allows up to eight assets in a single pool.

What Are the Potential Risks?

Common DeFi risks include vulnerabilities in smart contracts, key management, and systemic risks. Additionally, impermanent loss and liquidity pool hacks pose risks. These topics will be further explained in upcoming videos and tracked simultaneously.