# Meteora DLMM

This document describes the output structure for the Meteora DLMM (Dynamic Liquidity Market Maker) decoder functions. The decoder handles six main event types: INITIALIZE\_LB\_PAIR, SWAP, REMOVE\_LIQUIDITY, ADD\_LIQUIDITY, INCREASE\_LIQUIDITY, and DECREASE\_LIQUIDITY.

### Common Properties

All decoded events include the following base properties from `BaseTransactionRecord`:

| Property          | Type             | JSON Type        | Description                                                                                                             |
| ----------------- | ---------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `uuid`            | `bigint`         | `string`         | Unique identifier for the transaction record                                                                            |
| `instructionPath` | `string`         | `string`         | Path to the instruction within the transaction                                                                          |
| `parentProgramId` | `string \| null` | `string \| null` | ID of the parent program if applicable                                                                                  |
| `txSignature`     | `string`         | `string`         | Transaction signature                                                                                                   |
| `blockTime`       | `number`         | `number`         | Block timestamp                                                                                                         |
| `programId`       | `string`         | `string`         | Meteora DLMM program ID                                                                                                 |
| `eventType`       | `string`         | `string`         | Type of event (INITIALIZE\_LB\_PAIR, SWAP, REMOVE\_LIQUIDITY, ADD\_LIQUIDITY, INCREASE\_LIQUIDITY, DECREASE\_LIQUIDITY) |
| `decoderType`     | `DecoderType`    | `string`         | Decoder type identifier                                                                                                 |
| `blockHeight`     | `number`         | `number`         | Block height                                                                                                            |
| `slot`            | `number`         | `number`         | Blockchain slot number                                                                                                  |
| `txFee`           | `number`         | `number`         | Transaction fee in lamports                                                                                             |
| `txFeeUiAmount`   | `PreciseDecimal` | `string`         | UI-formatted transaction fee                                                                                            |

### INITIALIZE\_LB\_PAIR Event

Liquidity book pair initialization event.

| Property                   | Type     | JSON Type | Description                    |
| -------------------------- | -------- | --------- | ------------------------------ |
| `tokenXMint`               | `string` | `string`  | Token X mint address           |
| `tokenYMint`               | `string` | `string`  | Token Y mint address           |
| `tokenXDecimals`           | `number` | `number`  | Token X decimal places         |
| `tokenYDecimals`           | `number` | `number`  | Token Y decimal places         |
| `binStep`                  | `number` | `number`  | Bin step size                  |
| `baseFactor`               | `number` | `number`  | Base factor for price bins     |
| `filterPeriod`             | `number` | `number`  | Filter period                  |
| `decayPeriod`              | `number` | `number`  | Decay period                   |
| `reductionFactor`          | `number` | `number`  | Reduction factor               |
| `variableFeeControl`       | `number` | `number`  | Variable fee control parameter |
| `maxVolatilityAccumulated` | `number` | `number`  | Maximum volatility accumulated |
| `minBinId`                 | `number` | `number`  | Minimum bin ID                 |
| `maxBinId`                 | `number` | `number`  | Maximum bin ID                 |
| `protocolShare`            | `number` | `number`  | Protocol share percentage      |
| `baseFeeRate`              | `number` | `number`  | Base fee rate                  |

### SWAP Event

Token swap event on Meteora DLMM pool.

| Property                        | Type             | JSON Type | Description                               |
| ------------------------------- | ---------------- | --------- | ----------------------------------------- |
| `lbPair`                        | `string`         | `string`  | Liquidity book pair address               |
| `userTokenX`                    | `string`         | `string`  | User's token X account                    |
| `userTokenY`                    | `string`         | `string`  | User's token Y account                    |
| `reserveX`                      | `string`         | `string`  | Token X reserve address                   |
| `reserveY`                      | `string`         | `string`  | Token Y reserve address                   |
| `amountIn`                      | `bigint`         | `string`  | Input token amount                        |
| `amountInUiAmount`              | `PreciseDecimal` | `string`  | UI-formatted input amount                 |
| `amountOut`                     | `bigint`         | `string`  | Output token amount                       |
| `amountOutUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted output amount                |
| `swapForY`                      | `boolean`        | `boolean` | True if swapping for token Y              |
| `fee`                           | `bigint`         | `string`  | Swap fee amount                           |
| `feeUiAmount`                   | `PreciseDecimal` | `string`  | UI-formatted swap fee                     |
| `protocolFee`                   | `bigint`         | `string`  | Protocol fee amount                       |
| `protocolFeeUiAmount`           | `PreciseDecimal` | `string`  | UI-formatted protocol fee                 |
| `feeBps`                        | `number`         | `number`  | Fee in basis points                       |
| `hostFee`                       | `bigint`         | `string`  | Host fee amount                           |
| `hostFeeUiAmount`               | `PreciseDecimal` | `string`  | UI-formatted host fee                     |
| `startBinId`                    | `number`         | `number`  | Starting bin ID for swap                  |
| `endBinId`                      | `number`         | `number`  | Ending bin ID for swap                    |
| `reserveXPostBalance`           | `bigint`         | `string`  | Token X reserve balance after swap        |
| `reserveXPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token X reserve post-balance |
| `reserveYPostBalance`           | `bigint`         | `string`  | Token Y reserve balance after swap        |
| `reserveYPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token Y reserve post-balance |
| `userTokenXPostBalance`         | `bigint`         | `string`  | User token X balance after swap           |
| `userTokenXPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token X post-balance    |
| `userTokenYPostBalance`         | `bigint`         | `string`  | User token Y balance after swap           |
| `userTokenYPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token Y post-balance    |
| `reserveXPreBalance`            | `bigint`         | `string`  | Token X reserve balance before swap       |
| `reserveXPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token X reserve pre-balance  |
| `reserveYPreBalance`            | `bigint`         | `string`  | Token Y reserve balance before swap       |
| `reserveYPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token Y reserve pre-balance  |
| `userTokenXPreBalance`          | `bigint`         | `string`  | User token X balance before swap          |
| `userTokenXPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token X pre-balance     |
| `userTokenYPreBalance`          | `bigint`         | `string`  | User token Y balance before swap          |
| `userTokenYPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token Y pre-balance     |

### REMOVE\_LIQUIDITY Event

Liquidity removal event for Meteora DLMM pool.

| Property                        | Type             | JSON Type | Description                               |
| ------------------------------- | ---------------- | --------- | ----------------------------------------- |
| `position`                      | `string`         | `string`  | Position account address                  |
| `lbPair`                        | `string`         | `string`  | Liquidity book pair address               |
| `userTokenX`                    | `string`         | `string`  | User's token X account                    |
| `userTokenY`                    | `string`         | `string`  | User's token Y account                    |
| `reserveX`                      | `string`         | `string`  | Token X reserve address                   |
| `reserveY`                      | `string`         | `string`  | Token Y reserve address                   |
| `binId`                         | `number`         | `number`  | Bin ID for liquidity removal              |
| `bpsToRemove`                   | `number`         | `number`  | Basis points to remove                    |
| `amountXOut`                    | `bigint`         | `string`  | Token X amount withdrawn                  |
| `amountXOutUiAmount`            | `PreciseDecimal` | `string`  | UI-formatted token X withdrawal amount    |
| `amountYOut`                    | `bigint`         | `string`  | Token Y amount withdrawn                  |
| `amountYOutUiAmount`            | `PreciseDecimal` | `string`  | UI-formatted token Y withdrawal amount    |
| `reserveXPostBalance`           | `bigint`         | `string`  | Token X reserve balance after removal     |
| `reserveXPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token X reserve post-balance |
| `reserveYPostBalance`           | `bigint`         | `string`  | Token Y reserve balance after removal     |
| `reserveYPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token Y reserve post-balance |
| `userTokenXPostBalance`         | `bigint`         | `string`  | User token X balance after removal        |
| `userTokenXPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token X post-balance    |
| `userTokenYPostBalance`         | `bigint`         | `string`  | User token Y balance after removal        |
| `userTokenYPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token Y post-balance    |
| `reserveXPreBalance`            | `bigint`         | `string`  | Token X reserve balance before removal    |
| `reserveXPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token X reserve pre-balance  |
| `reserveYPreBalance`            | `bigint`         | `string`  | Token Y reserve balance before removal    |
| `reserveYPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token Y reserve pre-balance  |
| `userTokenXPreBalance`          | `bigint`         | `string`  | User token X balance before removal       |
| `userTokenXPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token X pre-balance     |
| `userTokenYPreBalance`          | `bigint`         | `string`  | User token Y balance before removal       |
| `userTokenYPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token Y pre-balance     |

### ADD\_LIQUIDITY Event

Liquidity addition event for Meteora DLMM pool.

| Property                        | Type             | JSON Type | Description                               |
| ------------------------------- | ---------------- | --------- | ----------------------------------------- |
| `position`                      | `string`         | `string`  | Position account address                  |
| `lbPair`                        | `string`         | `string`  | Liquidity book pair address               |
| `userTokenX`                    | `string`         | `string`  | User's token X account                    |
| `userTokenY`                    | `string`         | `string`  | User's token Y account                    |
| `reserveX`                      | `string`         | `string`  | Token X reserve address                   |
| `reserveY`                      | `string`         | `string`  | Token Y reserve address                   |
| `binId`                         | `number`         | `number`  | Bin ID for liquidity addition             |
| `amount`                        | `bigint`         | `string`  | Liquidity amount added                    |
| `amountUiAmount`                | `PreciseDecimal` | `string`  | UI-formatted liquidity amount             |
| `amountXIn`                     | `bigint`         | `string`  | Token X amount deposited                  |
| `amountXInUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted token X deposit amount       |
| `amountYIn`                     | `bigint`         | `string`  | Token Y amount deposited                  |
| `amountYInUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted token Y deposit amount       |
| `reserveXPostBalance`           | `bigint`         | `string`  | Token X reserve balance after addition    |
| `reserveXPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token X reserve post-balance |
| `reserveYPostBalance`           | `bigint`         | `string`  | Token Y reserve balance after addition    |
| `reserveYPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token Y reserve post-balance |
| `userTokenXPostBalance`         | `bigint`         | `string`  | User token X balance after addition       |
| `userTokenXPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token X post-balance    |
| `userTokenYPostBalance`         | `bigint`         | `string`  | User token Y balance after addition       |
| `userTokenYPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token Y post-balance    |
| `reserveXPreBalance`            | `bigint`         | `string`  | Token X reserve balance before addition   |
| `reserveXPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token X reserve pre-balance  |
| `reserveYPreBalance`            | `bigint`         | `string`  | Token Y reserve balance before addition   |
| `reserveYPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token Y reserve pre-balance  |
| `userTokenXPreBalance`          | `bigint`         | `string`  | User token X balance before addition      |
| `userTokenXPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token X pre-balance     |
| `userTokenYPreBalance`          | `bigint`         | `string`  | User token Y balance before addition      |
| `userTokenYPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token Y pre-balance     |

### INCREASE\_LIQUIDITY Event

Liquidity increase event for existing positions.

| Property                        | Type             | JSON Type | Description                               |
| ------------------------------- | ---------------- | --------- | ----------------------------------------- |
| `position`                      | `string`         | `string`  | Position account address                  |
| `lbPair`                        | `string`         | `string`  | Liquidity book pair address               |
| `userTokenX`                    | `string`         | `string`  | User's token X account                    |
| `userTokenY`                    | `string`         | `string`  | User's token Y account                    |
| `reserveX`                      | `string`         | `string`  | Token X reserve address                   |
| `reserveY`                      | `string`         | `string`  | Token Y reserve address                   |
| `liquidityAmount`               | `bigint`         | `string`  | Liquidity amount increased                |
| `liquidityAmountUiAmount`       | `PreciseDecimal` | `string`  | UI-formatted liquidity increase amount    |
| `amountXIn`                     | `bigint`         | `string`  | Token X amount deposited                  |
| `amountXInUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted token X deposit amount       |
| `amountYIn`                     | `bigint`         | `string`  | Token Y amount deposited                  |
| `amountYInUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted token Y deposit amount       |
| `activeBinId`                   | `number`         | `number`  | Active bin ID                             |
| `reserveXPostBalance`           | `bigint`         | `string`  | Token X reserve balance after increase    |
| `reserveXPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token X reserve post-balance |
| `reserveYPostBalance`           | `bigint`         | `string`  | Token Y reserve balance after increase    |
| `reserveYPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token Y reserve post-balance |
| `userTokenXPostBalance`         | `bigint`         | `string`  | User token X balance after increase       |
| `userTokenXPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token X post-balance    |
| `userTokenYPostBalance`         | `bigint`         | `string`  | User token Y balance after increase       |
| `userTokenYPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token Y post-balance    |
| `reserveXPreBalance`            | `bigint`         | `string`  | Token X reserve balance before increase   |
| `reserveXPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token X reserve pre-balance  |
| `reserveYPreBalance`            | `bigint`         | `string`  | Token Y reserve balance before increase   |
| `reserveYPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token Y reserve pre-balance  |
| `userTokenXPreBalance`          | `bigint`         | `string`  | User token X balance before increase      |
| `userTokenXPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token X pre-balance     |
| `userTokenYPreBalance`          | `bigint`         | `string`  | User token Y balance before increase      |
| `userTokenYPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token Y pre-balance     |

### DECREASE\_LIQUIDITY Event

Liquidity decrease event for existing positions.

| Property                        | Type             | JSON Type | Description                               |
| ------------------------------- | ---------------- | --------- | ----------------------------------------- |
| `position`                      | `string`         | `string`  | Position account address                  |
| `lbPair`                        | `string`         | `string`  | Liquidity book pair address               |
| `userTokenX`                    | `string`         | `string`  | User's token X account                    |
| `userTokenY`                    | `string`         | `string`  | User's token Y account                    |
| `reserveX`                      | `string`         | `string`  | Token X reserve address                   |
| `reserveY`                      | `string`         | `string`  | Token Y reserve address                   |
| `liquidityAmount`               | `bigint`         | `string`  | Liquidity amount decreased                |
| `liquidityAmountUiAmount`       | `PreciseDecimal` | `string`  | UI-formatted liquidity decrease amount    |
| `amountXOut`                    | `bigint`         | `string`  | Token X amount withdrawn                  |
| `amountXOutUiAmount`            | `PreciseDecimal` | `string`  | UI-formatted token X withdrawal amount    |
| `amountYOut`                    | `bigint`         | `string`  | Token Y amount withdrawn                  |
| `amountYOutUiAmount`            | `PreciseDecimal` | `string`  | UI-formatted token Y withdrawal amount    |
| `binId`                         | `number`         | `number`  | Bin ID for liquidity decrease             |
| `reserveXPostBalance`           | `bigint`         | `string`  | Token X reserve balance after decrease    |
| `reserveXPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token X reserve post-balance |
| `reserveYPostBalance`           | `bigint`         | `string`  | Token Y reserve balance after decrease    |
| `reserveYPostBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted token Y reserve post-balance |
| `userTokenXPostBalance`         | `bigint`         | `string`  | User token X balance after decrease       |
| `userTokenXPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token X post-balance    |
| `userTokenYPostBalance`         | `bigint`         | `string`  | User token Y balance after decrease       |
| `userTokenYPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token Y post-balance    |
| `reserveXPreBalance`            | `bigint`         | `string`  | Token X reserve balance before decrease   |
| `reserveXPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token X reserve pre-balance  |
| `reserveYPreBalance`            | `bigint`         | `string`  | Token Y reserve balance before decrease   |
| `reserveYPreBalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token Y reserve pre-balance  |
| `userTokenXPreBalance`          | `bigint`         | `string`  | User token X balance before decrease      |
| `userTokenXPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token X pre-balance     |
| `userTokenYPreBalance`          | `bigint`         | `string`  | User token Y balance before decrease      |
| `userTokenYPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token Y pre-balance     |

### Data Types

* `bigint`: Large integer values for token amounts, fees, and liquidity
* `string`: Text values for addresses and identifiers
* `number`: Numeric values for bin IDs, basis points, and other integer values
* `boolean`: True/false values for swap direction
* `PreciseDecimal`: High-precision decimal representation for UI display
* `DecoderType`: Enum indicating the decoder type (METEORA\_DLMM)

### Usage

The decoder automatically determines the event type and returns the appropriate structure. All monetary values are provided in both raw (`bigint`) and UI-formatted (`PreciseDecimal`) versions for flexibility in different use cases. The DLMM decoder handles dynamic liquidity market maker mechanics with bin-based liquidity management, variable fees, and concentrated liquidity features.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lyslabs.ai/decoders/meteora-dlmm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
