Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

This page summarizes the account model used by lb_clmm. For exact layouts, use the IDL and generated TypeScript types exported by @meteora-ag/dlmm.

PDA Map

Pool and reserve PDAs sort the two mint public keys lexicographically.
AccountSDK helperSeeds
Permissionless LbPair (v1)deriveLbPairsorted mints, bin_step
Permissionless LbPair (v2)deriveLbPair2sorted mints, bin_step, base_factor
LbPair from PresetParameter2deriveLbPairWithPresetParamWithIndexKeypreset_parameter pubkey, sorted mints
Customizable permissionless LbPairderiveCustomizablePermissionlessLbPairILM_BASE, sorted mints
Permission LbPairderivePermissionLbPairbase_key, sorted mints, bin_step
Reserve vaultderiveReservelb_pair, mint
BinArrayderiveBinArraybin_array, lb_pair, bin array index
BinArrayBitmapExtensionderiveBinArrayBitmapExtensionbitmap, lb_pair
OraclederiveOracleoracle, lb_pair
Position / PositionV2derivePositionposition, lb_pair, base pubkey, lower_bin_id, width
Reward vaultderiveRewardVaultlb_pair, reward index
PresetParameter (legacy)derivePresetParameterpreset_parameter, bin_step
PresetParameter2derivePresetParameterWithIndexpreset_parameter2, index
TokenBadgederiveTokenBadgetoken_badge, mint

Constants

ConstantValueUse
MAX_BIN_PER_ARRAY70Bins per BinArray
DEFAULT_BIN_PER_POSITION70Bins stored inline in PositionV2 before extension
MAX_BIN_PER_LIMIT_ORDER50Max bins per limit order account
BIN_ARRAY_BITMAP_SIZE512Default bitmap covers bin array indexes −512…511
DEFAULT_OBSERVATION_LENGTH100Default oracle sample capacity
NUM_REWARDS2Reward slots per pool and position
Bin array index for a bin ID: floor(bin_id / 70), with extra adjustment for negative remainders. Each bin array covers 70 consecutive bin IDs.

LbPair

LbPair is the root pool account.

Fee parameters

FieldTypeMeaning
parametersStaticParametersBase fee, dynamic fee config, bin ID bounds, protocol share, function type, collect fee mode
v_parametersVariableParametersRuntime volatility accumulator, reference bin, last update timestamp
protocol_feeProtocolFeeUncollected protocol fees (amount_x, amount_y)
last_updated_atLast fee-parameter update (rate-limited)
StaticParameters fields:
FieldMeaning
base_factor, base_fee_power_factor, bin_stepBase fee rate = base_factor × bin_step × 10 × 10^base_fee_power_factor (1e9 units)
filter_period, decay_period, reduction_factorDynamic fee time windows and decay
variable_fee_control, max_volatility_accumulatorVariable fee scaling and cap
min_bin_id, max_bin_idSupported bin ID range for this pool
protocol_shareProtocol portion of swap fees (basis points)
function_type0 undetermined, 1 liquidity mining, 2 limit order
collect_fee_mode0 input only, 1 only token Y
VariableParameters tracks volatility_accumulator, volatility_reference, index_reference, and last_update_timestamp for dynamic fees.

Pool identity and reserves

FieldMeaning
token_x_mint, token_y_mintPool token mints
reserve_x, reserve_yProgram-controlled vault token accounts
active_idCurrent active bin ID (price bin)
bin_stepPrice increment per bin (basis-point style spacing)
bump_seed, bin_step_seed, base_factor_seedPDA derivation seeds stored on-chain
require_base_factor_seedWhether base_factor is included in permissionless pool seeds

Status, type, and activation

FieldMeaning
pair_type0 permissionless, 1 permission, 2 customizable permissionless, 3 permissionless v2 (Token-2022)
status0 enabled, 1 disabled (withdraw-only except whitelisted wallets)
activation_typeSlot or timestamp activation unit for permission pools
activation_pointTime point when a permission pool enables trading
pre_activation_durationWindow before activation for pre-activation swap address
pre_activation_swap_addressWallet allowed to swap before activation
creatorPool creator
creator_pool_on_off_controlCreator can toggle pool status (customizable permissionless only)
base_keySigner base key for permission pools

Rewards, oracle, and bitmap

FieldMeaning
reward_infosTwo RewardInfo slots (mint, vault, funder, duration, rate, timestamps)
oracleOracle account pubkey
bin_array_bitmapPacked bitmap for initialized bin arrays in the default range (−512…511)
Each RewardInfo is initialized when mint != default. The funder must match funder or be protocol admin.

Token program flags

FieldMeaning
token_mint_x_program_flag, token_mint_y_program_flag0 SPL Token, 1 Token-2022
versionLayout version (LayoutVersion, currently V1 for new pools)

BinArray and Bin

BinArray

BinArray stores 70 Bin entries for one bin-array index.
FieldMeaning
indexBin array index; maps to bin IDs index × 70index × 70 + 69
versionLayout version (V0, V1, V2; new arrays use V2)
lb_pairParent pool
binsFixed array of 70 Bin structs
PDA: ["bin_array", lb_pair, index.to_le_bytes()].

Bin

Each Bin holds liquidity, pricing, swap-fee growth, and limit-order state for one price bin.
FieldMeaning
amount_x, amount_yMarket-making token amounts (protocol fees already excluded)
priceBin price, calculated from bin ID and bin_step
liquidity_supplyTotal LP liquidity shares in the bin
fee_amount_x_per_token_stored, fee_amount_y_per_token_storedCumulative swap fee per liquidity unit (for LP fee claims)
fulfilled_order_amount_x, fulfilled_order_amount_yLimit-order fulfillment accounting
limit_order_fee_ask_side, limit_order_fee_bid_sideFees collected from ask/bid limit orders
open_order_amountPending open limit order amount
total_processing_order_amountOrders currently being processed
processed_order_remaining_amountRemaining processed order amount
order_ageLimit order age counter for the bin
limit_order_ask_sideWhether ask-side limit orders are active
For liquidity-mining pools, reward growth checkpoints are packed into select bin fields at runtime; read pool function_type and reward state together when decoding bins for LM pools.

BinArrayBitmapExtension

BinArrayBitmapExtension extends the pool bitmap beyond the default ±512 bin-array index range.
FieldMeaning
lb_pairParent pool
positive_bin_array_bitmapBitmap for positive bin array indexes
negative_bin_array_bitmapBitmap for negative bin array indexes
Required when operating on bin arrays outside LbPair::bitmap_range() (−512…511). Swaps and liquidity updates that cross this range must pass the extension account or the program returns BitmapExtensionAccountIsNotProvided. PDA: ["bitmap", lb_pair].

PositionV2

PositionV2 is the current LP position format.

Fixed header

FieldMeaning
lb_pairPool this position belongs to
ownerPosition owner (used to index user positions)
lower_bin_id, upper_bin_idInclusive bin range
liquidity_shares70 inline shares (one per bin in the default width)
reward_infos70 inline UserRewardInfo checkpoints
fee_infos70 inline FeeInfo checkpoints
last_updated_atLast fee/reward sync timestamp
total_claimed_fee_x_amount, total_claimed_fee_y_amountLifetime claimed swap fees
total_claimed_rewardsLifetime claimed rewards per slot (2 entries)
lock_release_pointEarliest point (slot/timestamp per pool) when locked liquidity can be withdrawn
fee_ownerAddress allowed to claim fees (bootstrap positions)
versionLayout version
permissionless_operation_bitsBitmask for permissionless position actions

Nested types

FeeInfo per bin:
FieldMeaning
fee_x_per_token_complete, fee_y_per_token_completeLast synced cumulative fee checkpoints
fee_x_pending, fee_y_pendingClaimable pending fees
UserRewardInfo per bin:
FieldMeaning
reward_per_token_completesPer-reward cumulative checkpoints (2 slots)
reward_pendingsClaimable pending rewards (2 slots)

Dynamic extension

Positions wider than 70 bins append PositionBinData after the header:
FieldMeaning
liquidity_shareShare for one extended bin
reward_infoUserRewardInfo for that bin
fee_infoFeeInfo for that bin
Use increase_position_length / decrease_position_length (or v2 variants) to resize. PDA seeds include lower_bin_id and width (number of bins, not upper_bin_id).

Position (legacy)

Position uses a smaller integer type for liquidity shares instead of the current one. Migrate to PositionV2 with migrate_position_from_v1 / migrate_position_from_v2. New positions should use initialize_position / initialize_position2.

LimitOrder

LimitOrder supports limit-order pools (function_type limit order).
FieldMeaning
lb_pairPool
ownerOrder owner
bin_countNumber of LimitOrderBinData entries

Per-bin extension

FieldMeaning
amountOrder size
ageOrder age
bin_idTarget bin
is_ask1 = ask (sell X for Y), 0 = bid
Close empty accounts with close_limit_order_if_empty. Up to 50 bins.

Oracle

Oracle stores a fixed metadata header plus a dynamic Observation ring buffer.

Metadata

FieldMeaning
idxIndex of the latest observation
active_sizeCount of initialized samples
lengthTotal observation capacity (default 100; extend with increase_oracle_length)

Observation (each sample)

FieldMeaning
cumulative_active_bin_idTime-weighted cumulative active bin ID
created_atSample start timestamp
last_updated_atSample last update timestamp
PDA: ["oracle", lb_pair].

PresetParameter (legacy)

PresetParameter is the legacy pool-creation preset keyed by bin_step only.
FieldMeaning
bin_stepBin step for pools created from this preset
base_factorBase fee factor
filter_period, decay_period, reduction_factorDynamic fee parameters
variable_fee_control, max_volatility_accumulatorVariable fee scaling
min_bin_id, max_bin_idBin bounds (legacy presets store explicit bounds)
protocol_shareProtocol fee share
PDA: ["preset_parameter", bin_step.to_le_bytes()]. Prefer PresetParameter2 for new integrations.

PresetParameter2

PresetParameter2 is the current admin-configured preset.
FieldMeaning
indexPreset index (PDA key)
bin_step, base_factor, base_fee_power_factorFee and price spacing
filter_period, decay_period, reduction_factorDynamic fee config
variable_fee_control, max_volatility_accumulatorVariable fee scaling
protocol_shareProtocol fee share
concrete_function_type0 limit order, 1 liquidity mining
collect_fee_modeFee collection mode for new pools
min_bin_id / max_bin_id are derived from bin_step at pool creation. PDA: ["preset_parameter2", index.to_le_bytes()].

TokenBadge

TokenBadge records an admin-approved Token-2022 mint.
FieldMeaning
token_mintApproved mint pubkey
Required in pool creation when a Token-2022 mint has restricted extensions. PDA: ["token_badge", mint].

Token-2022 in transactions

Pools with token_mint_*_program_flag = 1 use Token-2022. When building custom instructions, include remaining accounts required by mint extensions (transfer hooks, transfer fees, and so on). The SDK resolves token program IDs and hook metas from mint accounts.