AMM Implementations in the Solana Ecosystem: Analyzing CPMM, CLMM, and DLMM

The Core of Web3 Finance: AMM and Its Implementation in the Solana Ecosystem

In the current landscape of the Web3 industry, DeFi-related products dominate the market. Among them, Automated Market Makers (AMM) play a crucial role in driving financial innovation in Web3. This article will introduce several important AMM implementations within the Solana ecosystem, aiming to provide references for liquidity providers (LP) in choosing investment strategies.

Solana ecosystem AMM research: The underlying code behind high liquidity

CPMM: Basic Constant Product Model

Constant Product Market Maker (CPMM) is one of the most basic implementations of AMM. Taking the constant product-based AMM launched by a certain trading platform as an example, its core principle is to maintain a constant product of the supply of two tokens in the pool: X * Y = k.

When users add liquidity to the pool, the system will automatically create an associated account for the user and issue LP Tokens to prove the user's share in the specific pool. These LP Tokens will be destroyed when liquidity is withdrawn.

The on-chain program of CPMM is developed using Anchor. When users perform a token swap, it will trigger swap-related instructions. Taking the TRUMP-USDC trading pair as an example, the system will calculate the number of tokens that can be swapped based on the constant product formula.

The formula is: (x + Δx)(y - Δy) = xy

After mathematical transformation, the number of exchangeable target tokens is obtained: Δy = (Δx * y) / (x + Δx)

It is important to note that this calculation does not include fees, which have already been deducted in the pre-processing logic.

Solana Ecosystem AMM Research: The Underlying Code Behind High Liquidity

Solana Ecosystem AMM Research: The Underlying Code Behind High Liquidity

CLMM: Concentrated Liquidity Market Maker

The centralized liquidity market maker (CLMM) launched by a certain trading platform is similar to the V3 version of a certain DEX, allowing for the creation of multiple fee tiers for each token pair's pool. The CLMM inherits several concepts from the certain DEX, such as ticks, multi-rate tiers, and concentrated liquidity.

Unlike CPMM, CLMM allows liquidity providers to choose a specific price range when injecting funds, and the funds are only distributed within that range. This mechanism enables LPs to have more precise control over fund allocation, improving capital efficiency.

CLMM also supports single-sided liquidity provision, similar to limit orders in traditional finance. In this model, LP's funds are only utilized when the token price reaches a specific range, but it also faces more risks.

For pools with smaller price fluctuations, LPs tend to choose a narrower price range; while for pools with more volatility, they tend to select a larger range. The purpose of this approach is to avoid the current price deviating from the selected range as much as possible, thereby reducing impermanent loss.

However, the concentrated liquidity model imposes higher requirements on LP's financial knowledge and management capabilities. LPs need to manage their liquidity more actively to cope with the potential risks brought by market fluctuations.

Solana Ecosystem AMM Research: The Underlying Code Behind High Liquidity

Solana Ecosystem AMM Research: The Underlying Code Behind High Liquidity

Solana ecosystem AMM research: The underlying code behind high liquidity

DLMM: Dynamic Liquidity Market Maker

Dynamic Liquidity Market Maker (DLMM) is an AMM product launched by a certain platform, which also draws on the design concept of a certain DEX V3. DLMM introduces the concept of "Bin", dividing the pool into Bin units starting from the base price, with each Bin step being a small interval.

The feature of DLMM is that if a trade occurs within the same Bin, traders will enjoy zero slippage. This mechanism helps to increase trading volume and success rates, theoretically allowing LPs to earn more trading fee revenue.

In DLMM, the tokens in the pool are similarly distributed on both sides of the current price. The currently activated bin contains two types of tokens, while other bins contain only a single type of token. When a certain token in the activated bin decreases to zero, the system automatically transfers the activation status to the adjacent bin, thus driving the price change in the pool.

DLMM provides LPs with three strategy options: Spot, Curve, and Bid Ask. The Spot strategy is suitable for most liquidity pools; the Curve strategy is more suitable for pools with low price volatility, such as stablecoin pairs; the Bid Ask strategy is suitable for pools with high price volatility, but requires LPs to frequently adjust their positions to respond to market changes.

Solana Ecosystem AMM Research: The Underlying Code Behind High Liquidity

Solana Ecosystem AMM Research: The Underlying Code Behind High Liquidity

Summary

As an important component of the Web3 financial sector, AMM drives the development of decentralized finance through its innovative mechanisms. With continuous technological advancements and improvements in the ecosystem, AMM is expected to play a greater role in the future, further transforming the traditional financial landscape. However, participating in AMM investments still requires caution, and LPs should fully understand the risk and return characteristics of various strategies to make informed choices based on their own circumstances.

SOL4.54%
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • 5
  • Share
Comment
0/400
OffchainOraclevip
· 08-03 18:34
Sol is far ahead!
View OriginalReply0
MemeTokenGeniusvip
· 08-03 18:33
Solana ecosystem fanatic? Blowing up AMM again?
View OriginalReply0
OnchainFortuneTellervip
· 08-03 18:30
Why is the sol stuck again?
View OriginalReply0
Web3Educatorvip
· 08-03 18:25
*adjusts glasses* let me break this down for my web3 students...
Reply0
liquiditea_sippervip
· 08-03 18:22
So sol is back to roll with amm, right?
View OriginalReply0
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)