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.
| Account | SDK helper | Seeds |
|---|
Permissionless LbPair (v1) | deriveLbPair | sorted mints, bin_step |
Permissionless LbPair (v2) | deriveLbPair2 | sorted mints, bin_step, base_factor |
LbPair from PresetParameter2 | deriveLbPairWithPresetParamWithIndexKey | preset_parameter pubkey, sorted mints |
Customizable permissionless LbPair | deriveCustomizablePermissionlessLbPair | ILM_BASE, sorted mints |
Permission LbPair | derivePermissionLbPair | base_key, sorted mints, bin_step |
| Reserve vault | deriveReserve | lb_pair, mint |
BinArray | deriveBinArray | bin_array, lb_pair, bin array index |
BinArrayBitmapExtension | deriveBinArrayBitmapExtension | bitmap, lb_pair |
Oracle | deriveOracle | oracle, lb_pair |
Position / PositionV2 | derivePosition | position, lb_pair, base pubkey, lower_bin_id, width |
| Reward vault | deriveRewardVault | lb_pair, reward index |
PresetParameter (legacy) | derivePresetParameter | preset_parameter, bin_step |
PresetParameter2 | derivePresetParameterWithIndex | preset_parameter2, index |
TokenBadge | deriveTokenBadge | token_badge, mint |
Constants
| Constant | Value | Use |
|---|
MAX_BIN_PER_ARRAY | 70 | Bins per BinArray |
DEFAULT_BIN_PER_POSITION | 70 | Bins stored inline in PositionV2 before extension |
MAX_BIN_PER_LIMIT_ORDER | 50 | Max bins per limit order account |
BIN_ARRAY_BITMAP_SIZE | 512 | Default bitmap covers bin array indexes −512…511 |
DEFAULT_OBSERVATION_LENGTH | 100 | Default oracle sample capacity |
NUM_REWARDS | 2 | Reward 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
| Field | Type | Meaning |
|---|
parameters | StaticParameters | Base fee, dynamic fee config, bin ID bounds, protocol share, function type, collect fee mode |
v_parameters | VariableParameters | Runtime volatility accumulator, reference bin, last update timestamp |
protocol_fee | ProtocolFee | Uncollected protocol fees (amount_x, amount_y) |
last_updated_at | | Last fee-parameter update (rate-limited) |
StaticParameters fields:
| Field | Meaning |
|---|
base_factor, base_fee_power_factor, bin_step | Base fee rate = base_factor × bin_step × 10 × 10^base_fee_power_factor (1e9 units) |
filter_period, decay_period, reduction_factor | Dynamic fee time windows and decay |
variable_fee_control, max_volatility_accumulator | Variable fee scaling and cap |
min_bin_id, max_bin_id | Supported bin ID range for this pool |
protocol_share | Protocol portion of swap fees (basis points) |
function_type | 0 undetermined, 1 liquidity mining, 2 limit order |
collect_fee_mode | 0 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
| Field | Meaning |
|---|
token_x_mint, token_y_mint | Pool token mints |
reserve_x, reserve_y | Program-controlled vault token accounts |
active_id | Current active bin ID (price bin) |
bin_step | Price increment per bin (basis-point style spacing) |
bump_seed, bin_step_seed, base_factor_seed | PDA derivation seeds stored on-chain |
require_base_factor_seed | Whether base_factor is included in permissionless pool seeds |
Status, type, and activation
| Field | Meaning |
|---|
pair_type | 0 permissionless, 1 permission, 2 customizable permissionless, 3 permissionless v2 (Token-2022) |
status | 0 enabled, 1 disabled (withdraw-only except whitelisted wallets) |
activation_type | Slot or timestamp activation unit for permission pools |
activation_point | Time point when a permission pool enables trading |
pre_activation_duration | Window before activation for pre-activation swap address |
pre_activation_swap_address | Wallet allowed to swap before activation |
creator | Pool creator |
creator_pool_on_off_control | Creator can toggle pool status (customizable permissionless only) |
base_key | Signer base key for permission pools |
Rewards, oracle, and bitmap
| Field | Meaning |
|---|
reward_infos | Two RewardInfo slots (mint, vault, funder, duration, rate, timestamps) |
oracle | Oracle account pubkey |
bin_array_bitmap | Packed 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
| Field | Meaning |
|---|
token_mint_x_program_flag, token_mint_y_program_flag | 0 SPL Token, 1 Token-2022 |
version | Layout version (LayoutVersion, currently V1 for new pools) |
BinArray and Bin
BinArray
BinArray stores 70 Bin entries for one bin-array index.
| Field | Meaning |
|---|
index | Bin array index; maps to bin IDs index × 70 … index × 70 + 69 |
version | Layout version (V0, V1, V2; new arrays use V2) |
lb_pair | Parent pool |
bins | Fixed 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.
| Field | Meaning |
|---|
amount_x, amount_y | Market-making token amounts (protocol fees already excluded) |
price | Bin price, calculated from bin ID and bin_step |
liquidity_supply | Total LP liquidity shares in the bin |
fee_amount_x_per_token_stored, fee_amount_y_per_token_stored | Cumulative swap fee per liquidity unit (for LP fee claims) |
fulfilled_order_amount_x, fulfilled_order_amount_y | Limit-order fulfillment accounting |
limit_order_fee_ask_side, limit_order_fee_bid_side | Fees collected from ask/bid limit orders |
open_order_amount | Pending open limit order amount |
total_processing_order_amount | Orders currently being processed |
processed_order_remaining_amount | Remaining processed order amount |
order_age | Limit order age counter for the bin |
limit_order_ask_side | Whether 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.
| Field | Meaning |
|---|
lb_pair | Parent pool |
positive_bin_array_bitmap | Bitmap for positive bin array indexes |
negative_bin_array_bitmap | Bitmap 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.
| Field | Meaning |
|---|
lb_pair | Pool this position belongs to |
owner | Position owner (used to index user positions) |
lower_bin_id, upper_bin_id | Inclusive bin range |
liquidity_shares | 70 inline shares (one per bin in the default width) |
reward_infos | 70 inline UserRewardInfo checkpoints |
fee_infos | 70 inline FeeInfo checkpoints |
last_updated_at | Last fee/reward sync timestamp |
total_claimed_fee_x_amount, total_claimed_fee_y_amount | Lifetime claimed swap fees |
total_claimed_rewards | Lifetime claimed rewards per slot (2 entries) |
lock_release_point | Earliest point (slot/timestamp per pool) when locked liquidity can be withdrawn |
fee_owner | Address allowed to claim fees (bootstrap positions) |
version | Layout version |
permissionless_operation_bits | Bitmask for permissionless position actions |
Nested types
FeeInfo per bin:
| Field | Meaning |
|---|
fee_x_per_token_complete, fee_y_per_token_complete | Last synced cumulative fee checkpoints |
fee_x_pending, fee_y_pending | Claimable pending fees |
UserRewardInfo per bin:
| Field | Meaning |
|---|
reward_per_token_completes | Per-reward cumulative checkpoints (2 slots) |
reward_pendings | Claimable pending rewards (2 slots) |
Dynamic extension
Positions wider than 70 bins append PositionBinData after the header:
| Field | Meaning |
|---|
liquidity_share | Share for one extended bin |
reward_info | UserRewardInfo for that bin |
fee_info | FeeInfo 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).
| Field | Meaning |
|---|
lb_pair | Pool |
owner | Order owner |
bin_count | Number of LimitOrderBinData entries |
Per-bin extension
| Field | Meaning |
|---|
amount | Order size |
age | Order age |
bin_id | Target bin |
is_ask | 1 = 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.
| Field | Meaning |
|---|
idx | Index of the latest observation |
active_size | Count of initialized samples |
length | Total observation capacity (default 100; extend with increase_oracle_length) |
Observation (each sample)
| Field | Meaning |
|---|
cumulative_active_bin_id | Time-weighted cumulative active bin ID |
created_at | Sample start timestamp |
last_updated_at | Sample last update timestamp |
PDA: ["oracle", lb_pair].
PresetParameter (legacy)
PresetParameter is the legacy pool-creation preset keyed by bin_step only.
| Field | Meaning |
|---|
bin_step | Bin step for pools created from this preset |
base_factor | Base fee factor |
filter_period, decay_period, reduction_factor | Dynamic fee parameters |
variable_fee_control, max_volatility_accumulator | Variable fee scaling |
min_bin_id, max_bin_id | Bin bounds (legacy presets store explicit bounds) |
protocol_share | Protocol fee share |
PDA: ["preset_parameter", bin_step.to_le_bytes()]. Prefer PresetParameter2 for new integrations.
PresetParameter2
PresetParameter2 is the current admin-configured preset.
| Field | Meaning |
|---|
index | Preset index (PDA key) |
bin_step, base_factor, base_fee_power_factor | Fee and price spacing |
filter_period, decay_period, reduction_factor | Dynamic fee config |
variable_fee_control, max_volatility_accumulator | Variable fee scaling |
protocol_share | Protocol fee share |
concrete_function_type | 0 limit order, 1 liquidity mining |
collect_fee_mode | Fee 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.
| Field | Meaning |
|---|
token_mint | Approved 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.