★★ Introduction to Liquidity Pools

This article explores various types of liquidity pools used in decentralized exchanges (DEX), with a focus on those utilized by STON.fi exchange. Unlike traditional centralized exchanges, which rely on order books to match buy and sell orders through a central intermediary, DEXs use automated market makers (AMMs) and liquidity pools to facilitate trading.

In centralized exchanges, order books record all buy and sell orders, and trades are executed when matching orders are found. In contrast, AMM liquidity pools allow users to trade directly against a pool of assets, with prices determined by algorithms based on the relative quantities of the assets in the pool. This approach eliminates the need for order books and intermediaries and hence enables truly decentralized trading and liquidity provision.

We will detail how different types of liquidity pools operate, their respective advantages and use cases, and their risk profile. It is crucial for liquidity providers (LPs) and traders to understand how these mechanisms operate in order to effectively manage assets and execute trades in the decentralized financial ecosystem of STON.fi.

Constant Product Pool

What is it?

A Constant Product Pool is a type of liquidity pool used in DEXs which was made popular by Uniswap. It operates based on a simple mathematical formula that maintains a balance between two assets in the pool. The most common form of this pool uses the formula X⋅Y=K, where X and Y represent the reserves of two different tokens, and K is a constant. This pool type is designed to enable automated and continuous trading of tokens without relying on traditional order books.

Use Case

The constant product pool allows for seamless trading between two assets without the need for an intermediary or centralized exchange. Traditional exchanges rely on order books where buyers and sellers are matched, which can lead to liquidity issues, especially in case of less popular tokens. The constant product pool solves this by ensuring that as long as there is liquidity in the pool, trades can occur at any time. Hence, it makes it easier for users to exchange tokens directly on the blockchain.

How does it work?

The core principle of a constant product pool is the constant product formula X⋅Y=K. Here’s how it functions:

  • Reserves: The pool holds two different tokens, say Token A and Token B, with reserves represented by X (amount of Token A) and Y (amount of Token B).

  • Price Adjustment: When a user trades Token A for Token B, they add Token A to the pool and remove Token B. The amount of Token B they receive is determined by ensuring that the product of the two reserves remains constant (K). As a result, the price of the tokens adjusts automatically according to the supply and demand in the pool (Figure 1).

Figure 1: Uniswap Pool Work Principle

For example, if a large amount of Token A is added to the pool, its price relative to Token B will decrease, making Token A cheaper and Token B more expensive. The mechanism of price adjustment based purely on supply and demand is a fundamental aspect of how these pools support continuous and decentralized trading.

Due to the constant product mechanism, slippage increases as the trade size grows relative to the pool's liquidity. This occurs because a larger trade moves the pool further from the equilibrium point, causing a more significant price impact and a higher effective price. For large trades, this slippage can become substantial and reflects the trade-off between liquidity and price stability.

Advantages

  1. Continuous Liquidity: The constant product pool provides liquidity at all times and allows users to trade tokens whenever they want without waiting for a counterparty to appear.

  2. Decentralization: The pool operates entirely on smart contracts and removes the need for a central authority or intermediaries to manage trades.

  3. Simplicity and Accessibility: The X⋅Y=K formula is straightforward and easy for developers to implement. It is also quite understandable for users how their trades will impact prices.

Risk Profile

The risk in a constant product pool largely revolves around the concept of impermanent loss, which occurs when the price of one token in the pool changes relative to the other. If one token increases in value significantly, LPs may find that their share of the pool is worth less than if they had simply held the tokens separately. This risk is "impermanent" because it only becomes a realized loss if the liquidity is withdrawn while the price difference exists. However, this risk can be mitigated by the fees earned from trading within the pool.

Moreover, these pools are considered low risk in terms of accessibility and liquidity availability. Trades can always occur as long as there is liquidity, so users do not face the risk of not being able to trade when they want to, unlike in traditional order book systems.

Weighted Constant Product Invariant Pool

What is it?

A Weighted Constant Product Invariant Pool or a Weighted Pool is a type of liquidity pool that permits different weights to be assigned to the assets within the pool. Unlike traditional pools where the assets are usually balanced equally (e.g., 50/50), a weighted pool can allocate different percentages to each asset. For example, a pool could consist of 80% Token A and 20% Token B. This flexibility enables the pool to reflect various portfolio allocations or risk preferences, offering a broader range of use cases compared to standard liquidity pools (Figure 2).

Figure 2: Comparison of Weighted Pools vs Traditional AMM Pool

Use Case

Weighted pools are needed to provide more customized liquidity provisioning options and to accommodate different risk and return profiles. In traditional 50/50 pools, LPs must maintain equal amounts of each asset, which might not always align with their investment goals or risk tolerance. By allowing different weights, weighted pools enable LPs to create pools that match specific portfolio strategies, such as a higher allocation to a particular asset or a diversified but non-equal exposure to multiple assets. This type of pool is more suited for stable/volatile pairs or volatile/volatile pairs. For stable only pairs, simpler pools, designed specifically for those assets, such as the Stableswap Pool, provide more efficient and lower-slippage trading.

How does it work?

In a weighted pool, each asset has a predefined weight, which determines its proportion in the pool. The pricing formula adjusts based on these weights. If we denote the assets in the pool as X and Y, and their respective weights as Wx​ and Wy​, the pool maintains the following relationship:

This weighted formula allows for different price impacts depending on the weight of each asset. For instance, if one asset is more heavily weighted, trades involving that asset will have a different price impact than trades involving a less weighted asset. Hence, these pools can cater to a wide range of investment strategies, from conservative to aggressive, and can be a more versatile tool for LPs.

In a weighted pool, slippage depends on how assets are weighted and the size of the trade compared to the pool's total liquidity. Asset weights adjustment can help reduce slippage but larger trades can still cause noticeable slippage as they shift the pool's balance. Generally, slippage in correctly weighted pools is lower than in constant product pools but also increases with larger trades relative to the pool's size.

Advantages

  1. Customizable Portfolio Exposure: Weighted pools allow LPs to create pools that reflect their desired asset distribution. For example, an LP might want to create a pool that is 80% in a stable asset and 20% in a riskier token to suit a more risk-averse portfolio.

  2. Enhanced Capital Efficiency: By assigning different weights, LPs can potentially earn higher returns on assets that they are more confident in, but still provide liquidity for other assets.

  3. Diversification: Weighted pools offer a way to diversify holdings without needing to maintain equal balances of each asset. This is particularly useful in multi-asset pools where LPs might want exposure to several tokens but not in equal amounts. This flexibility helps to balance overall portfolio risk and adapt to changes in asset values over time.

Risk Profile

The risk profile of a weighted pool depends on the specific weights assigned to each asset. On the one hand, the ability to allocate more capital to stable or low-risk assets can reduce the overall risk of impermanent loss. For example, a pool weighted heavily towards stablecoins might have a lower volatility compared to a standard 50/50 pool involving a volatile token pair.

On the other hand, if a pool is weighted heavily towards a more volatile asset or consists of 2 volatile assets, the LP could face higher risks, including increased impermanent loss or larger fluctuations in the value of their pool tokens. Therefore, the risks are directly tied to how the weights are configured and the volatility of the underlying assets.

StableSwap Pool

What is it?

A StableSwap pool is a type of liquidity pool specifically designed for assets that are expected to trade at or near the same value. These are typically stablecoins, such as USDT, USDC, and DAI, or tokenized versions of the same underlying asset, like different versions of wrapped Bitcoin (e.g., WBTC, renBTC). The key characteristic of a StableSwap pool is that it uses a curve with lower slippage for trades which makes it a more efficient alternative for assets that have similar values.

Use Case

In a traditional AMM pool like the constant product one, swapping between assets of equal value can lead to significant slippage, especially with large trades. StableSwap pools mitigate this by using a different mathematical curve that facilitates larger trades with minimal price impact, which is particularly beneficial in scenarios where users want to move large amounts of stable assets between different platforms or need to rebalance portfolios.

How does it work?

StableSwap pools employ a modified curve, often referred to as the StableSwap invariant, that flattens near the ideal 1:1 ratio of the assets. Unlike the constant product formula (X⋅Y=K) used in traditional AMMs, StableSwap pools are designed to accommodate swaps with minimal deviation from the 1:1 ratio.

This curve enables larger trades with much lower slippage when the assets in the pool are close to their pegged value. However, if the ratio between the assets deviates significantly, the curve becomes steeper, increasing slippage to protect the pool’s balance (Figure 3).

Figure 3: Comparison of Stable Swap with Constant Product Pool (Uniswap)

Advantages

  1. Lower Slippage: The primary advantage of StableSwap pools is the reduced slippage for trades involving similar-value assets. This is crucial for large transactions where traditional AMM pools would cause significant price deviations.

  2. Efficiency in Stable Asset Trading: StableSwap pools are optimized for stablecoins or similar assets which is most suitable for traders who need to move between these assets without incurring significant costs.

  3. Preservation of Asset Value: The design of StableSwap pools ensures that trades occur closer to the intended 1:1 value and preserves the pegged value of stablecoins or other similar assets within the pool.

Risk Profile

The assertion of "less risk" in the context of StableSwap pools is based on the fact that these pools are designed to handle assets that are inherently less volatile. Since the assets in the pool are supposed to maintain similar values, the risk of impermanent loss is significantly reduced compared to more volatile pairs. Moreover, the modified curve helps maintain the pool's balance and protects LPs from significant losses due to large trades or price fluctuations.

Wstableswap Pool

What is it?

The Wstableswap Pool is a more advanced type of liquidity pool that combines the characteristics of Weighted Pools and Stableswap Pools. It is specifically designed for assets expected to maintain a stable value relative to each other, such as stablecoins, but also allows different weightings for each asset. This hybrid approach provides liquidity LPs with an opportunity to manage assets in varying proportions but still benefit from the low slippage typically associated with Stableswap Pools.

Use Case

The Wstableswap Pool addresses a key limitation of traditional Stableswap Pools, which presume equal weightings of assets. They are effective in terms of low-slippage trades between similar-value assets, but lack flexibility in asset allocation. The Wstableswap Pool includes customizable weightings which makes it suitable for scenarios where different stablecoins or other assets need to be managed in non-equal proportions. This flexibility benefits LPs who require more control over their asset distribution but still aim at minimizing slippage.

How does it work?

The Wstableswap Pool utilizes a sophisticated formula that incorporates elements from both weighted and stableswap principles.

The weighting of assets allows LPs to allocate their capital in varying proportions. For instance, one can allocate a higher percentage of the pool’s value to a particular stablecoin while keeping a smaller proportion for another. This flexibility helps managing different assets according to market needs or personal preferences.

The amplification factor A plays a crucial role in minimizing slippage. It works by flattening the curve around the equilibrium point and reducing price impact during trades, particularly when the assets are near their intended ratios. This feature ensures that trades involving assets with similar values experience minimal slippage, similar to traditional Stableswap Pools.

Advantages

The Wstableswap Pool offers several key benefits:

  1. Flexible Asset Management: LPs can adjust the weights of assets to suit their specific needs, allowing for varied exposure levels and more effective capital utilization.

  2. Low Slippage for Similar Assets: Even with customizable weights, the pool maintains low slippage for trades between assets close in value and makes it efficient for managing stablecoins or other similar assets.

  3. Optimized Capital Allocation: The ability to set different asset weights enables LPs to align their investments with market expectations and risk profiles and potentially improve their overall returns.

Risk Management

Despite its flexibility and advantages, particularly in slippage reduction, the Wstableswap Pool does involve certain risks. The complexity of the formula, notably the tuning of the amplification factor A, requires careful management to avoid inefficient outcomes. Correctly adjusting weights is another important factor to consider. A thorough understanding and configuration of these elements is crucial to optimize performance and manage potential risks effectively.

Last updated