> ## 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.

# DLMM Pro Program Accounts

> Account layouts, PDA seeds and constants of the DLMM Pro program: pools, configs, tick arrays, position arrays, limit orders, oracle and operator accounts.

DLMM Pro keeps its state in nine program accounts. Token badges live in a separate access registry program. The IDL exported by the SDK as `DlmmProIDL` has the exact layout of each fixed header. It does not define the entries of the variable tails (`PoolRewardInfo`, `PoolActivation`, `Tick`, `Position`, `LimitOrderData`, `Observation` and the reward variants), so those layouts are given in the tables below.

> [!WARNING]
>
> `Pool`, `TickArray`, `PositionArray`, `LimitOrder` and `Oracle` accounts have a variable-length tail after the fixed header the IDL describes. Anchor's `AccountDeserialize` on the generated types reads the whole account after the discriminator as the header, so it fails or panics on these accounts. Decode them with the SDK helpers (`client.state.fetchPoolWithExtensions`, `decodePositions`, `decodeTicks`, `decodeLimitOrderData`, `decodeObservations`) or the `Dynamic*` parsers of the commons crate. See [TypeScript SDK](https://docs.meteora.ag/developer-guides/dlmm-pro/typescript-sdk/reference.md) and [Rust library](https://docs.meteora.ag/developer-guides/dlmm-pro/rust-integration/library.md).

All accounts start with an 8-byte Anchor discriminator. Sizes below count the fixed header after it. Integers are little-endian, and the field tables leave out padding bytes.

## PDA Map

The program ID is `dPro1D5wiqnGMH8vMDG23jh35btTHoWdyqXjqkqxe8n` on mainnet and devnet. The access registry program is `regUFehW9oycnaV2auYyfqyYjKG1W1uLNT7rtUeemQr`. Each SDK helper returns the address only, and its last argument is an optional program ID.

| Account | Seeds | SDK helper |
| - | - | - |
| Pool (static or dynamic config) | `"pool"`, config, the two mints in descending byte order | `derivePool` |
| Pool (launch pool) | `"l_pool"`, the two mints in descending byte order | `deriveLaunchPool` |
| Pool authority | `"pool_auth"` | `derivePoolAuthority` |
| Oracle | `"oracle"`, pool | `deriveOracle` |
| Reserve vault | `"reserve"`, mint, pool | `deriveReserve` |
| TickArray | `"tick_array"`, pool, index as `i32` little-endian | `deriveTickArray` |
| TickArrayBitmapExtension | `"bitmap"`, pool | `deriveTickArrayBitmapExtension` |
| PositionArray | `"position"`, position NFT mint | `derivePosition` |
| LimitOrder | `"limit_order"`, limit order NFT mint | `deriveLimitOrder` |
| Reward vault | `"reward"`, pool, reward index as `u8` | `deriveRewardVault` |
| StaticConfig | `"s_config"`, index as `u64` little-endian | `deriveStaticConfig` |
| DynamicConfig | `"d_config"`, pool creator authority, index as `u64` little-endian | `deriveDynamicConfig` |
| Operator | `"operator"`, whitelisted address | `deriveOperator` |
| TokenBadge (access registry program) | `"token_badge"`, mint | `deriveTokenBadge` |

The pool authority `FSUXyUKbTJ4A5Ccz5M6Uo4J2myc3RsDKTPU9vZwyeXru` signs token transfers out of the reserve and reward vaults. It holds no data.

A tick array index is `floor(floor(tick_id / tick_spacing) / 128)`. The SDK helper `tickIndexFromId` computes it.

## Finding Accounts

Each account type starts with its discriminator, the first 8 bytes of `sha256("account:<Name>")`. Combine it with the offsets below in `getProgramAccounts` `memcmp` filters. Offsets count from the start of the account data, discriminator included.

| Account | Discriminator (hex) | Field offsets |
| - | - | - |
| Pool | `f19a6d0411b16dbc` | `token_x_mint` 8, `token_y_mint` 40, `reserve_x` 72, `reserve_y` 104, `creator` 136 |
| StaticConfig | `e09e6d5df8e8c17e` | `index` 8, `pool_creator_authority` 24 |
| DynamicConfig | `1b06e155b3bc103e` | `index` 8, `pool_creator_authority` 24 |
| TickArray | `4561bdbe6e0742bb` | `pool` 8, `tick_index` 40 |
| TickArrayBitmapExtension | `3c9624db61808b99` | `pool` 8 |
| PositionArray | `bf7fb653f015fda0` | `pool` 8, `nft_mint` 40 |
| LimitOrder | `89b7d45b731d8de3` | `pool` 8, `nft_mint` 40, `referral` 72 |
| Oracle | `8bc283b38cb3e5f4` | `pool` 8 |
| Operator | `db1fbc91458bcc75` | `whitelisted_address` 8 |

To list the positions or limit orders of a pool, filter `PositionArray` or `LimitOrder` accounts by `pool`. To list those of a wallet, read the wallet's Token 2022 accounts that hold 1 token of a 0-decimal mint, then try `derivePosition(mint)` and `deriveLimitOrder(mint)` for each mint. Position and limit order NFT mints have the pool authority as mint authority and their pool as freeze authority.

## Constants

### Ticks and Prices

| Constant | Value | Meaning |
| - | - | - |
| `MIN_TICK_ID`, `MAX_TICK_ID` | -443636, 443636 | Tick ID bounds. |
| `MIN_SQRT_PRICE`, `MAX_SQRT_PRICE` | 4295048016, 79226673515401279992447579055 | Square root price bounds, Q64.64. |
| `MAX_TICK_SPACING` | 256 | Largest tick spacing. |
| `MAX_TICKS_PER_ARRAY` | 128 | Usable ticks in one tick array. |
| `BITMAP_SIZE` | 512 | The inline pool bitmap covers tick array indexes -512 to 511. |
| `MAX_BASIS_POINT` | 10000 | Denominator for basis point values. |

### Positions, Limit Orders, Rewards and Oracle

| Constant | Value | Meaning |
| - | - | - |
| `POSITION_MAX_RANGE` | 45 | Range slots in one position array. |
| `LIMIT_ORDER_MAX_TICK` | 25 | Ticks in one limit order. |
| `NUM_REWARDS` | 2 | Reward slots per pool. |
| `MIN_REWARD_DURATION` | 86400 | Shortest reward period, in seconds. |
| `MAX_REWARD_DURATION` | 31536000 | Longest reward period, in seconds. |
| `MAX_REWARD_START_DELAY` | 2592000 | Longest delay before a reward opens, in seconds. |
| `MAX_OBSERVATION_LENGTH` | 500 | Observations in the oracle ring buffer. A new oracle holds 1. |

### Fees

Fee numerators use `FEE_DENOMINATOR` as the denominator. Share constants are basis points.

| Constant | Value | Meaning |
| - | - | - |
| `FEE_DENOMINATOR` | 1000000000 | Denominator of fee numerators. |
| `MIN_FEE_NUMERATOR` | 100000 | Lowest trading fee, 0.01%. |
| `MAX_FEE_NUMERATOR` | 990000000 | Highest trading fee, 99%. |
| `MM_PROTOCOL_FEE_BPS` | 1000 | Protocol share of the market maker fee. |
| `MM_LAUNCH_POOL_PROTOCOL_FEE_BPS` | 2000 | Protocol share of the market maker fee on a launch pool. |
| `LIMIT_ORDER_PROTOCOL_FEE_BPS` | 5000 | Protocol share of the limit order fee. |
| `LIMIT_ORDER_REFERRAL_FEE_BPS` | 2000 | Referral share of a limit order fee. |
| `HOST_FEE_BPS` | 2000 | Host (referral) share of the protocol fee on a swap. |
| `MAX_PARTNER_FEE_BPS` | 5000 | Largest partner share of the protocol fee. |

## Pool

`Pool` is the root account of a market. The fixed header is 640 bytes.

### Identity and Reserves

| Field | Type | Meaning |
| - | - | - |
| `token_x_mint` | `Pubkey` | Token X mint. |
| `token_y_mint` | `Pubkey` | Token Y mint. |
| `reserve_x` | `Pubkey` | Token X vault (PDA token account owned by the pool authority). |
| `reserve_y` | `Pubkey` | Token Y vault. |
| `creator` | `Pubkey` | Pool creator. Can initialize reward slot 0 and change its authority when the pool has LiquidityMining. |

### Price and Liquidity

| Field | Type | Meaning |
| - | - | - |
| `liquidity` | `u128` | Liquidity of the current tick range, as an unscaled integer. |
| `init_sqrt_price` | `u128` | Square root of the initial price, Q64.64. Drives market-cap scheduled base fees. |
| `sqrt_price` | `u128` | Square root of the current price (token Y per token X), Q64.64. |
| `tick_array_bitmap` | `[u64; 16]` | Inline bitmap of initialized tick arrays with liquidity. 1024 bits cover tick array indexes -512 to 511. |
| `tick_current_id` | `i32` | Tick ID of the current price. |
| `tick_spacing` | `u16` | Distance between usable ticks. At most 256. |
| `is_bitmap_extension_initialized` | `u8` | `1` once the pool has a TickArrayBitmapExtension account. |

### Fees

| Field | Type | Meaning |
| - | - | - |
| `fee_config` | `FeeConfig` | Base fee and dynamic fee configuration. |
| `variable_fee` | `VariableFee` | Runtime state of the dynamic fee. |
| `pool_partner` | `PoolPartner` | Partner address and accrued partner fees. |
| `fee_growth_global_x` | `u128` | Cumulative token X fee per unit of liquidity, Q64.64. |
| `fee_growth_global_y` | `u128` | Cumulative token Y fee per unit of liquidity, Q64.64. |
| `protocol_fee_x` | `u64` | Uncollected protocol fee in token X. |
| `protocol_fee_y` | `u64` | Uncollected protocol fee in token Y. |
| `partner_fee_bps` | `u16` | Partner share of the protocol fee, in basis points. At most 5000. |
| `collect_fee_mode` | `u8` | Token that pays the swap fee. |

`FeeConfig`:

| Field | Type | Meaning |
| - | - | - |
| `base_fee` | `BaseFeeConfig` | Base fee mode and its encoded parameters. |
| `dynamic_fee` | `DynamicFeeConfig` | Dynamic fee parameters. |

`BaseFeeConfig`:

| Field | Type | Meaning |
| - | - | - |
| `base_fee_mode` | `u8` | Fee schedule type. |
| `data` | `[u8; 31]` | Mode-specific parameters, 31 bytes. The SDK `encode*BaseFeeData` helpers build them. |

`data` by mode, with offsets inside `data`. Unused bytes are zero.

| Mode | Layout |
| - | - |
| Fixed | `cliff_fee_numerator: u64` at 0 |
| TimeSchedulerLinear, TimeSchedulerExponential | `cliff_fee_numerator: u64` at 0, `period_frequency: u64` at 8, `reduction_factor: u64` at 16, `number_of_period: u16` at 24 |
| MarketCapSchedulerLinear, MarketCapSchedulerExponential | `cliff_fee_numerator: u64` at 0, `reduction_factor: u64` at 8, `sqrt_price_step_bps: u32` at 16, `scheduler_expiration_duration: u32` at 20, `number_of_period: u16` at 24 |

`DynamicFeeConfig`:

| Field | Type | Meaning |
| - | - | - |
| `max_volatility_accumulator` | `u32` | Cap on the volatility accumulator. |
| `variable_fee_control` | `u32` | Scale factor of the variable fee. |
| `filter_period` | `u16` | Seconds after the last reference update or significant swap during which the volatility reference holds. |
| `decay_period` | `u16` | Seconds after which the volatility reference resets to 0. |
| `reduction_factor` | `u16` | Share of the volatility accumulator kept as the reference between the filter and decay periods, in basis points. |
| `min_delta_tick_for_significant_swap` | `u16` | Minimum tick movement of a swap that counts as significant. |
| `initialized` | `u8` | Non-zero when the pool has a dynamic fee. |

`VariableFee`:

| Field | Type | Meaning |
| - | - | - |
| `sqrt_price_reference` | `u128` | Square root price at the last reference update. |
| `last_significant_swap_timestamp` | `u64` | Time of the last significant swap. |
| `last_reference_timestamp` | `u64` | Time of the last reference update. |
| `volatility_accumulator` | `u32` | Current volatility accumulator. |
| `volatility_reference` | `u32` | Volatility reference the accumulator builds on. |

`PoolPartner`:

| Field | Type | Meaning |
| - | - | - |
| `partner` | `Pubkey` | The `DynamicConfig` `pool_creator_authority` on dynamic-config pools. The default key (no partner) on static-config and launch pools. |
| `pending_fee_x` | `u64` | Accrued partner fee in token X. |
| `pending_fee_y` | `u64` | Accrued partner fee in token Y. |

### Status, Type and Activation

| Field | Type | Meaning |
| - | - | - |
| `activation_point` | `u64` | Slot or timestamp (see `activation_type`) at which the pool opens. |
| `pool_status` | `u16` | Bitmask of disabled actions. |
| `pool_type` | `u8` | Pool kind. |
| `token_x_flag` | `u8` | Token program of mint X. |
| `token_y_flag` | `u8` | Token program of mint Y. |
| `activation_type` | `u8` | Unit of `activation_point` and of activation schedules. |
| `extensions` | `u8` | Bitmask of tail extensions. |

### Pool Enums

| Field | Values |
| - | - |
| `pool_type` | `0` Static, `1` Dynamic, `2` LaunchPool |
| `base_fee_mode` | `0` Fixed, `1` TimeSchedulerLinear, `2` TimeSchedulerExponential, `3` MarketCapSchedulerLinear, `4` MarketCapSchedulerExponential |
| `extensions` | Bit 0 LiquidityMining, bit 1 ActivationAccess |
| `pool_status` | Bit 0 disables swaps. Bit 1 disables adding liquidity, which also blocks `open_position`, `expand_position` and `open_limit_order`. Removing liquidity cannot be disabled. |
| `activation_type` | `0` Slot, `1` Timestamp |
| `collect_fee_mode` | `0` OutputToken (fee taken from the output token), `1` OnlyY (fee always in token Y) |
| `token_x_flag`, `token_y_flag` | `0` Token, `1` Token 2022 |
| `activation_mode` | `0` Open, `1` BondingCurve, `2` TimeBased |

### Dynamic Tail

Bytes after the 640-byte header depend on `extensions`. The pool tail order is fixed: the rewards block first when LiquidityMining is set, then the activation block when ActivationAccess is set. A pool with neither extension has no tail. A pool account is therefore 648 bytes with no extension, 1,000 with LiquidityMining, 776 with ActivationAccess and 1,128 with both.

| Extension | Block | Size | Contents |
| - | - | - | - |
| LiquidityMining | `PoolReward` | 352 bytes | Two `PoolRewardInfo` entries, one per reward slot. |
| ActivationAccess | `PoolActivation` | 128 bytes | Three whitelisted addresses and two activation slots. |

`PoolRewardInfo` (176 bytes):

| Field | Type | Meaning |
| - | - | - |
| `mint` | `Pubkey` | Reward token mint. The slot is initialized when this is not the default key. |
| `vault` | `Pubkey` | Reward vault token account. |
| `authority` | `Pubkey` | Address that can set the emission. |
| `emission_per_second` | `u128` | Emission rate, Q64.64. |
| `open_time` | `u64` | Time the reward starts. |
| `end_time` | `u64` | Time the reward ends. |
| `last_update_time` | `u64` | Last time the reward state was updated. |
| `cumulative_seconds_with_empty_liquidity_reward` | `u64` | Seconds emitted while the pool had zero liquidity. `withdraw_ineligible_rewards` recovers them. |
| `reward_growth_global` | `u128` | Cumulative reward per unit of liquidity, Q64.64. |
| `reward_token_flag` | `u8` | Token program flag of the reward mint: `0` Token, `1` Token 2022. Followed by 15 bytes of padding. |

`PoolActivation`:

| Field | Type | Meaning |
| - | - | - |
| `whitelisted_swap` | `Pubkey` | Address exempt from the activation schedule for swaps, such as an Alpha Vault. |
| `whitelisted_add_liquidity` | `Pubkey` | Address exempt from the activation schedule for adding liquidity, such as the operator that seeds the pool. Matched against the owner of the position (`open_position`, `expand_position` and the add liquidity instructions) or of the limit order (`open_limit_order`). |
| `whitelisted_remove_liquidity` | `Pubkey` | Address exempt from the activation schedule for removing liquidity. Matched against the owner of the position (`remove_liquidity`, `remove_liquidity_by_bps`, `remove_position`) or of the limit order (`cancel_limit_order`). |
| `activations` | `[PoolActivationInfo; 2]` | Two activation slots. Each holds `activation_mode: u8` and `data: [u8; 15]`. |

`data` by `activation_mode`, with offsets inside `data`:

| Mode | Layout |
| - | - |
| Open | 15 zero bytes |
| BondingCurve | `is_reach_target: u8` at 0 (`1` once the target is reached), `target_increase_bps: u64` at 7 |
| TimeBased | `swap_point`, `add_liquidity_point` and `remove_liquidity_point` as 5-byte integers at 0, 5 and 10 |

Use `isSupportExtension(pool.extensions, PoolExtension.LiquidityMining)` to test a bit. Tick arrays and position arrays use their reward variants (`TickWithReward`, `PositionWithReward`) on pools with LiquidityMining. The SDK `withReward` options and the commons `DynamicTickArray` and `DynamicPositionArray` parsers take that choice from the pool.

## StaticConfig

`StaticConfig` fixes fees, tick spacing, collect fee mode, activation type and extensions for every pool created from it. The size is 120 bytes with no tail. The configs that exist are listed in [Pool Fee Configs](https://docs.meteora.ag/developer-guides/dlmm-pro/pool-fee-configs.md).

| Field | Type | Meaning |
| - | - | - |
| `index` | `u64` | Config index. |
| `pool_creator_authority` | `Pubkey` | Only this address can create pools from the config. The default key marks a public config. |
| `collect_fee_mode` | `u8` | Collect fee mode copied into each pool. |
| `activation_type` | `u8` | Activation type copied into each pool. |
| `extensions` | `u8` | Extension bitmask copied into each pool. |
| `tick_spacing` | `u16` | Tick spacing copied into each pool. |
| `fee_config` | `FeeConfig` | Base fee and dynamic fee configuration copied into each pool. |

## DynamicConfig

`DynamicConfig` authorizes a pool creator authority to create pools with its own parameters. It carries only the permissions and the partner fee share. The size is 80 bytes with no tail.

| Field | Type | Meaning |
| - | - | - |
| `index` | `u64` | Config index. |
| `pool_creator_authority` | `Pubkey` | Only this address can create pools from the config. It also becomes the partner of each pool. |
| `permission` | `u128` | Bitmask of `DynamicConfigPermission`: bit 0 is CreatePoolWithoutMintValidation. |
| `partner_fee_bps` | `u16` | Partner share of the protocol fee for pools created from the config. At most 5000. |

## TickArray

`TickArray` stores the initialized ticks of one tick array index (see [Ticks and Liquidity](https://docs.meteora.ag/core-products/dlmm-pro/ticks-and-liquidity.md)). The fixed header is 56 bytes.

| Field | Type | Meaning |
| - | - | - |
| `pool` | `Pubkey` | Pool the array belongs to. |
| `tick_index` | `i32` | Tick array index. The array covers tick IDs `tick_index * 128 * tick_spacing` through `(tick_index + 1) * 128 * tick_spacing - 1`. |

The tail holds the initialized ticks sorted by `tick_id`. A new tick array has no ticks, and the account grows or shrinks as positions and limit orders add or drop references to ticks. The tail starts at byte 64 of the account data and uses `Tick` (160 bytes) or `TickWithReward` (192 bytes) on LiquidityMining pools.

One instruction can grow a tick array by at most 10,240 bytes. That is 64 new ticks (53 on LiquidityMining pools), or 63 when the instruction also creates the tick array on a pool without LiquidityMining. An `open_position` or `expand_position` that needs more new ticks in one array fails with `ReallocExceedMaxLengthPerInstruction`, so split the ranges across instructions.

### Tick

| Field | Type | Meaning |
| - | - | - |
| `sqrt_price` | `u128` | Square root price of the tick, Q64.64. |
| `liquidity_net` | `i128` | Liquidity added (or removed) when the price crosses the tick upward. |
| `liquidity_gross` | `u128` | Total liquidity referencing the tick. |
| `fee_growth_outside_x`, `fee_growth_outside_y` | `u128` | Fee growth on the far side of the tick, Q64.64. |
| `ref_count` | `u64` | Positions and limit orders that reference the tick. |
| `tick_id` | `i32` | Tick ID, at offset 88 of the entry. Followed by 3 bytes of padding. |
| `limit_order_ask_side` | `u8` | `1` when the resting limit orders are asks, `0` for bids. At offset 95. |
| `open_order_amount` | `u64` | Limit order amount not yet reached by the price. |
| `total_processing_order_amount` | `u64` | Limit order amount currently being filled. |
| `processed_order_remaining_amount` | `u64` | Unfilled part of the amount being processed. |
| `order_age` | `u64` | Batch counter. It increments when a swap starts filling the open orders, and resets to 0 when the tick has no orders left. An order placed at age `a` is partly filled when `order_age = a + 1` and fully filled when `order_age >= a + 2`. |
| `fulfilled_order_amount_x`, `fulfilled_order_amount_y` | `u64` | Filled amount of the resting orders in their deposit token (X for asks, Y for bids), used to share the limit order fee. Proceeds are computed at cancel. |
| `limit_order_fee_ask_side`, `limit_order_fee_bid_side` | `u64` | Limit order fees accrued on each side. |

### TickWithReward

| Field | Type | Meaning |
| - | - | - |
| `inner` | `Tick` | The fields above. |
| `reward_growths_outside` | `[u128; 2]` | Reward growth on the far side of the tick per reward slot, Q64.64. |

## TickArrayBitmapExtension

The extension tracks initialized tick arrays beyond the 1024-bit inline bitmap of the pool. The size is 800 bytes with no tail.

| Field | Type | Meaning |
| - | - | - |
| `pool` | `Pubkey` | Pool the extension belongs to. |
| `positive_bitmap` | `[[u64; 8]; 6]` | Six 512-bit bitmaps for tick array indexes 512 to 3583. |
| `negative_bitmap` | `[[u64; 8]; 6]` | Six 512-bit bitmaps for tick array indexes -513 to -3584. |

Liquidity or limit orders in a tick array outside indexes -512 to 511 need this account in the instruction, or the program returns `TickArrayBitmapExtensionAccountIsNotProvided`. On a pool whose `is_bitmap_extension_initialized` is `1`, pass it to `swap` as well: a swap whose search leaves the inline bitmap without it fails with `BitmapExtensionAccountIsNotProvided`. A pool with no extension has no liquidity outside the inline bitmap, so the search stops there. Create it with `initialize_tick_bitmap_extension`, or pass it when creating the pool.

## PositionArray

A [position](https://docs.meteora.ag/core-products/dlmm-pro/positions.md) is one NFT plus one `PositionArray` account that holds up to 45 range slots. Each slot has its own tick range, liquidity, fees and rewards, and ranges can overlap. The fixed header is 136 bytes.

| Field | Type | Meaning |
| - | - | - |
| `pool` | `Pubkey` | Pool the position belongs to. |
| `nft_mint` | `Pubkey` | Position NFT mint. |
| `delegate_permission` | `u32` | Bitmask of `PositionDelegatePermission` granted to the NFT delegate. |
| `layout_version` | `u16` | Increments whenever `expand_position` or `remove_position` changes the slot layout. |
| `vesting` | `PositionVesting` | Vesting schedule of the position. One schedule covers every slot. |

The tail holds one slot per range, starting at byte 144 of the account data (`vesting` is at byte 120). Instructions select slots with a `u64` bitmap in which bit `i` is slot `i`. The tail uses `Position` (128 bytes) or `PositionWithReward` (192 bytes) on LiquidityMining pools.

### Position

| Field | Type | Meaning |
| - | - | - |
| `unlocked_liquidity` | `u128` | Liquidity the owner can remove. |
| `permanent_locked_liquidity` | `u128` | Liquidity locked for good. |
| `vesting_liquidity` | `u128` | Liquidity still vesting. |
| `released_vesting_liquidity` | `u128` | Vesting liquidity already released into `unlocked_liquidity`. |
| `fee_growth_checkpoint_x`, `fee_growth_checkpoint_y` | `u128` | Fee growth inside the range at the last refresh, Q64.64. |
| `fee_pending_x`, `fee_pending_y` | `u64` | Fees accrued and not yet claimed. |
| `tick_lower_id`, `tick_upper_id` | `i32` | Range of the slot, `[tick_lower_id, tick_upper_id)`. Followed by 8 bytes of padding. |

A slot is empty when its total liquidity is zero and it has no pending fees or rewards.

### PositionWithReward

| Field | Type | Meaning |
| - | - | - |
| `inner` | `Position` | The fields above. |
| `rewards` | `[PositionRewardInfo; 2]` | One 32-byte entry per reward slot: `growth_inside_checkpoint: u128` (Q64.64), `pending_amount: u64` and 8 bytes of padding. |

### PositionVesting

Vesting is part of the `PositionArray` header (24 bytes) and applies to all slots. `lock_vesting_position` moves liquidity from `unlocked_liquidity` into `vesting_liquidity`. At the cliff point the program releases `cliff_unlock_bps` of it, then `bps_per_period` for each elapsed `period_frequency`, up to `number_of_period` periods. The time from the lock to the last release is capped at `MAX_VESTING_DURATION` (315,360,000 seconds, 10 years) on Timestamp pools and `MAX_VESTING_DURATION_SLOT` (1,261,440,000 slots) on Slot pools.

| Field | Type | Meaning |
| - | - | - |
| `cliff_point` | `u64` | Slot or timestamp (the pool activation type) of the cliff. |
| `period_frequency` | `u64` | Length of one vesting period, in slots or seconds. |
| `cliff_unlock_bps` | `u16` | Share of the vesting liquidity released at the cliff, in basis points. |
| `bps_per_period` | `u16` | Share of the vesting liquidity released per period, in basis points. |
| `number_of_period` | `u16` | Number of periods after the cliff. |
| `initialize` | `u8` | `1` once a vesting schedule is set. |

## LimitOrder

A [limit order](https://docs.meteora.ag/core-products/dlmm-pro/limit-orders.md) is one NFT plus one `LimitOrder` account holding up to 25 ticks on one side. The fixed header is 136 bytes.

| Field | Type | Meaning |
| - | - | - |
| `pool` | `Pubkey` | Pool the order belongs to. |
| `nft_mint` | `Pubkey` | Limit order NFT mint. |
| `referral` | `Pubkey` | Wallet that receives the referral share of the order fee. |
| `delegate_permission` | `u32` | Bitmask of `LimitOrderDelegatePermission`: bit 0 is CancelLimitOrder. |

The tail holds one `LimitOrderData` (24 bytes) per tick, starting at byte 144 of the account data. Canceling a tick zeroes its `amount`, `age` and `is_ask` but keeps `tick_id`, because `close_limit_order` needs the tick arrays of every entry.

### LimitOrderData

| Field | Type | Meaning |
| - | - | - |
| `amount` | `u64` | Deposited amount. Zero once canceled. |
| `age` | `u64` | Tick `order_age` when the order was placed. Zero once canceled. |
| `tick_id` | `i32` | Tick ID of the order. |
| `is_ask` | `u8` | `1` for an ask, `0` for a bid. Followed by 3 bytes of padding. |

## Oracle

The oracle records the cumulative tick for time-weighted average prices. The fixed header is 48 bytes, followed by a ring buffer of `Observation` entries of 16 bytes each, starting at byte 56 of the account data. A new oracle holds one observation. `increase_oracle_length` grows it to at most 500.

| Field | Type | Meaning |
| - | - | - |
| `pool` | `Pubkey` | Pool the oracle belongs to. |
| `idx` | `u16` | Index of the latest observation in the tail. |
| `last_observation_created_timestamp` | `u64` | Time the latest observation was created. |

### Observation

| Field | Type | Meaning |
| - | - | - |
| `last_updated_timestamp` | `u64` | Time of the observation. Zero marks an empty slot. |
| `tick_cumulative` | `i64` | Cumulative tick at that time. |

The average tick over an interval is `(tick_cumulative_end - tick_cumulative_start) / (timestamp_end - timestamp_start)`.

## Operator

`Operator` grants an address a set of operator permissions. The admin creates it with `create_operator_account`. The size is 48 bytes with no tail.

| Field | Type | Meaning |
| - | - | - |
| `whitelisted_address` | `Pubkey` | Wallet the permissions apply to. |
| `permission` | `u128` | Bitmask of `OperatorPermission`. |

`OperatorPermission` bits: 0 CreateConfigKey, 1 RemoveConfigKey, 2 SetPoolStatus, 3 InitializeReward, 4 UpdateRewardAuthority, 5 UpdatePartnerFee.

## TokenBadge

`TokenBadge` belongs to the access registry program, not to DLMM Pro. A badge for a mint lets pool creation (see [Token 2022 Support](https://docs.meteora.ag/core-products/dlmm-pro/token-2022-support.md)) and reward initialization accept it when the program would otherwise reject its Token 2022 extensions or freeze authority. The size is 64 bytes with no tail. The SDK reads it with `client.state.fetchTokenBadge(deriveTokenBadge(mint))`.

| Field | Type | Meaning |
| - | - | - |
| `token_mint` | `Pubkey` | Mint the badge allows. |
| `mint_score` | `u8` | Score recorded for the mint. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.