The Bin architecture

The Bin Architecture is the foundational framework of Bean’s DLMM. It models the liquidity pool as a sequence of discrete and fixed-price segments, known as bins, rather than a continuous price curve.

This design introduces order book-like precision to the AMM model while preserving composability and automation.


1. Fixed Price Bins

Each bin corresponds to a static, predefined price level. The price pi of bin index i is defined by the following relation:

pi=p0(1+binstep10,000)ip_i = p_0*(1+\frac{bin step}{10,000})^i

  • pi: The price in bin number i

  • po: The starting price (reference bin at index 0)

  • binStep: spacing between bins in basis points (bps)

  • i: bin index (positive or negative)

For example, an LP sets the initial price of the MON/USDC pair at 0.0500, and assumes a bin step of 1 bps. The resulting bin prices are:

Bin Index (i)
Formula
Price (USDC/MON)

-2

0.05001.000120.0500*1.0001^{-2}

0.049990

-1

0.05001.000110.0500*1.0001^{-1}

0.049995

0

0.05000.0500

0.050000

+1

0.05001.000110.0500*1.0001^1

0.050005

+2

0.05001.000120.0500*1.0001^2

0.050010


2. Liquidity Composition

In Bean DLMM, liquidity is divided into discrete price bins, with each bin representing a fixed exchange rate between two tokens in a trading pair:

  • Base Token: The asset supplied by liquidity providers. This is the token being bought or sold (e.g., MON).

  • Quote Token: The asset used to price the base token. It serves as the unit of account (e.g., USDC).

However, not all bins contain reserves of both tokens. The presence and composition of token reserves depend on the bin’s function relative to the current market price.

Initial or Active Bin

The initial bin is selected by liquidity providers to define the price level where they expect trades to occur. This price is typically aligned with the current market rate.

Consequently, the initial bin becomes the first active bin in the pool and must hold both the base token and the quote token. This ensures the pool can support two-directional trading, allowing users to execute swaps in either direction (for example, MON to USDC and USDC to MON).

Surrounding or Non-Active Bin

Bins adjacent to the active bin serve as unidirectional liquidity reservoirs. Each surrounding bin contains only one token, either the base token or the quote token, depending on its position relative to the active price.

These bins remain inactive until a price movement promotes one of them to the active bin, where it can facilitate swaps in a single direction based on its token reserve.


3. Trading Mechanism

In Bean DLMM, swaps are executed bin by bin, beginning with the active bin, which holds reserves for both tokens in the pair.

Execution Logic

When a user initiates a trade (for example, swapping USDC for MON), the protocol does the following:

  1. The protocol removes MON (base token) from the active bin

  2. The user’s USDC (quote token) is deposited into the same bin

  3. The swap is executed at the bin’s fixed exchange rate

As long as the active bin has sufficient reserves, trades occur at that bin’s fixed price with zero slippage.

Multi-Bin Routing

If the reserves of the base token in the active bin are fully depleted, the protocol automatically routes the trade to the next bin in the direction of the swap. This new bin becomes the active bin, and the process continues at the next fixed price level.

Each swap dynamically shifts the active bin along the price curve, creating a discrete, predictable trading path across bins.


4. Price Movement

In Bean DLMM, price evolves through discrete bin traversal, where each bin represents a fixed exchange rate. The active price moves bin by bin as liquidity is consumed.

Bin Indexing

Bin 0 be the initial (reference) bin, aligned with the LP’s selected price. Bin positioning and reserve logic:

Bin Index
Price Relation
Position
Token Reserve

i < 0

Below reference price

Left of bin 0

Quote token only

i = 0

Reference price

Initial bin

Both tokens

i > 0

Above reference price

Right of bin 0

Base token only

Active Price Transition

The active bin is where trades occur. When its token reserves are fully consumed, the active price moves to the next bin.

Moving Right: Occurs during buying pressure, meaning the price increases.

For example, users swap USDC → MON, selling USDC to buy MON.

  • The protocol removes MON (base token) from the active bin

  • If MON is fully consumed, the next bin to the right becomes active.

  • The new bin reflects a higher price for MON (fewer MON per USDC in the pool)

Moving Left: Occurs during selling pressure, meaning the price decreases.

For example, users swap MON → USDC, selling MON to buy USDC.

  • The protocol removes USDC (quote token) from the active bin

  • If USDC is fully consumed, the next bin to the left becomes active

  • The new bin reflects a lower price for MON (more MON per USDC)

This bin-based model mirrors an on-chain order book. It enables deterministic price progression, minimizes slippage for traders, and gives LPs precise control over where to deploy capital.

Last updated