Mechanics

Cetus DLMM operates using discrete liquidity bins that allow for concentrated liquidity and predictable price behavior. The mechanics of trading within and across bins can be summarized as follows:

Price Within a Bin

Each DLMM price bin maintains a constant price, which can be expressed using a constant-sum relationship. Trades executed within a bin do not change its price:

xP+y=kx⋅P​+y=k

Where:

  • x = reserve of token X in the bin

  • y = reserve of token Y in the bin

  • P​ = fixed price of token X in terms of token Y in this bin

  • k = constant representing the total value of the bin in terms of token Y

How it works:

When a trader buys ΔX from the bin or sells ΔX into the bin, the reserves update as:

Xnew=Xold±ΔXXnew​=Xold​±ΔX
Ynew=kXnewPYnew​=k−Xnew​⋅P

This ensures:

  • The bin price never changes during trades

  • Only the reserves X and Y experience changes during swaps

  • k value is only updated when there is liquidity to be newly added to or withdrawn from the pool

Depletion and Bin Hopping

If all liquidity in the active bin is exhausted (either all token X or all token Y is depleted), the market price moves to the next bin:

  • Left Bin: Contains only token X. Price moves here if the active bin is depleted on the X side.

  • Right Bin: Contains only token Y. Price moves here if the active bin is depleted on the Y side.

This design ensures that slippage is bounded within each bin and the market price jumps discretely to the next bin only when liquidity is exhausted, rather than continuously moving as in traditional AMMs.

Example Trade

Consider a hypothetical SUI/USDC pool:

  • Active Bin Price: P = 5 USDC per SUI

  • Reserves: Rx = 200 SUI, Ry = 1000 USDC

A trader wants to buy 250 SUI with USDC.

Step 1 – Consume the Active Bin:

  • Available liquidity in the active bin: 200 SUI

  • Cost in USDC: 200 × 5 = 1000 USDC

  • Remaining purchase: 250−200 = 50 SUI

Step 2 – Move to the Next Bin:

  • Assume next bin price: P = 5.01 USDC per SUI

  • Cost for remaining 50 SUI: 50 × 5.01 = 250.5 USDC

Step 3 – Total Cost:

ΔY Total = 1000+250.5 = 1250.5 USDC

Slippage:

  • Expected cost at original price: 250×5 = 1250 USDC

  • Final cost: 1250.5 USDC

  • Slippage: 0.5 USDC (0.04%)

This example demonstrates how trades crossing bins result in small, predictable slippage, while price remains constant within each bin.

Last updated