# Raydium CLMM

This document describes the output structure for the Raydium CLMM (Concentrated Liquidity Market Maker) decoder functions. The decoder handles five main event types: CREATE\_POOL, SWAP, INCREASE\_LIQUIDITY\_V2, DECREASE\_LIQUIDITY\_V2, and OPEN\_POSITION\_TOKEN\_22\_NFT.

### 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`         | Raydium CLMM program ID                                                                                              |
| `eventType`       | `string`         | `string`         | Type of event (CREATE\_POOL, SWAP, INCREASE\_LIQUIDITY\_V2, DECREASE\_LIQUIDITY\_V2, OPEN\_POSITION\_TOKEN\_22\_NFT) |
| `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                                                                                         |

### CREATE\_POOL Event

Concentrated liquidity pool creation event.

| Property       | Type     | JSON Type | Description                     |
| -------------- | -------- | --------- | ------------------------------- |
| `mint`         | `string` | `string`  | Pool mint address               |
| `token0Mint`   | `string` | `string`  | Token0 mint address             |
| `token0Vault`  | `string` | `string`  | Token0 vault address            |
| `token1Vault`  | `string` | `string`  | Token1 vault address            |
| `sqrtPriceX64` | `bigint` | `string`  | Square root price in X64 format |
| `openTime`     | `string` | `string`  | Pool opening timestamp          |

### SWAP Event

Token swap event in concentrated liquidity pool.

| Property                         | Type             | JSON Type | Description                            |
| -------------------------------- | ---------------- | --------- | -------------------------------------- |
| `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             |
| `otherAmountThreshold`           | `bigint`         | `string`  | Amount threshold for the other token   |
| `otherAmountThresholdUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted amount threshold          |
| `sqrtPriceLimitX64`              | `bigint`         | `string`  | Square root price limit in X64 format  |
| `isBaseInput`                    | `boolean`        | `boolean` | Whether the base token is the input    |
| `inputMint`                      | `string`         | `string`  | Input token mint address               |
| `outputMint`                     | `string`         | `string`  | Output token mint address              |
| `inputTokenAccount`              | `string`         | `string`  | Input token account address            |
| `outputTokenAccount`             | `string`         | `string`  | Output token account address           |
| `inputVault`                     | `string`         | `string`  | Input vault address                    |
| `outputVault`                    | `string`         | `string`  | Output vault address                   |
| `pricePre`                       | `PreciseDecimal` | `string`  | Price before swap                      |
| `pricePost`                      | `PreciseDecimal` | `string`  | Price after swap                       |
| `slippageTolerance`              | `number`         | `number`  | Slippage tolerance percentage          |
| `slippagePercentage`             | `number`         | `number`  | Actual slippage percentage             |
| `slippageAmount`                 | `bigint`         | `string`  | Slippage amount                        |
| `slippageAmountUiAmount`         | `PreciseDecimal` | `string`  | UI-formatted slippage amount           |
| `inputTokenPreBalance`           | `bigint`         | `string`  | Input token balance before swap        |
| `inputTokenPreBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted input token pre-balance   |
| `inputTokenPostBalance`          | `bigint`         | `string`  | Input token balance after swap         |
| `inputTokenPostBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted input token post-balance  |
| `outputTokenPreBalance`          | `bigint`         | `string`  | Output token balance before swap       |
| `outputTokenPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted output token pre-balance  |
| `outputTokenPostBalance`         | `bigint`         | `string`  | Output token balance after swap        |
| `outputTokenPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted output token post-balance |
| `inputVaultPreBalance`           | `bigint`         | `string`  | Input vault balance before swap        |
| `inputVaultPreBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted input vault pre-balance   |
| `inputVaultPostBalance`          | `bigint`         | `string`  | Input vault balance after swap         |
| `inputVaultPostBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted input vault post-balance  |
| `outputVaultPreBalance`          | `bigint`         | `string`  | Output vault balance before swap       |
| `outputVaultPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted output vault pre-balance  |
| `outputVaultPostBalance`         | `bigint`         | `string`  | Output vault balance after swap        |
| `outputVaultPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted output vault post-balance |

### INCREASE\_LIQUIDITY\_V2 Event

Liquidity addition event for existing positions.

| Property                         | Type             | JSON Type | Description                        |
| -------------------------------- | ---------------- | --------- | ---------------------------------- |
| `mint0`                          | `string`         | `string`  | Token0 mint address                |
| `mint1`                          | `string`         | `string`  | Token1 mint address                |
| `amountDeposited0`               | `bigint`         | `string`  | Amount of token0 deposited         |
| `amountDeposited0UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token0 deposit amount |
| `amountDeposited1`               | `bigint`         | `string`  | Amount of token1 deposited         |
| `amountDeposited1UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token1 deposit amount |
| `liquidity`                      | `bigint`         | `string`  | Liquidity amount added             |
| `amount0Max`                     | `bigint`         | `string`  | Maximum token0 amount              |
| `amount0MaxUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted max token0 amount     |
| `amount1Max`                     | `bigint`         | `string`  | Maximum token1 amount              |
| `amount1MaxUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted max token1 amount     |
| `postTokenBalance0`              | `bigint`         | `string`  | Token0 balance after deposit       |
| `postTokenBalance0UiAmount`      | `PreciseDecimal` | `string`  | UI-formatted token0 post-balance   |
| `postTokenBalance1`              | `bigint`         | `string`  | Token1 balance after deposit       |
| `postTokenBalance1UiAmount`      | `PreciseDecimal` | `string`  | UI-formatted token1 post-balance   |
| `preTokenBalance0`               | `bigint`         | `string`  | Token0 balance before deposit      |
| `preTokenBalance0UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token0 pre-balance    |
| `preTokenBalance1`               | `bigint`         | `string`  | Token1 balance before deposit      |
| `preTokenBalance1UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token1 pre-balance    |
| `tokenVault0PostBalance`         | `bigint`         | `string`  | Vault0 balance after deposit       |
| `tokenVault0PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted vault0 post-balance   |
| `tokenVault1PostBalance`         | `bigint`         | `string`  | Vault1 balance after deposit       |
| `tokenVault1PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted vault1 post-balance   |
| `tokenVault0PreBalance`          | `bigint`         | `string`  | Vault0 balance before deposit      |
| `tokenVault0PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted vault0 pre-balance    |
| `tokenVault1PreBalance`          | `bigint`         | `string`  | Vault1 balance before deposit      |
| `tokenVault1PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted vault1 pre-balance    |
| `protocolPosition`               | `string`         | `string`  | Protocol position account          |
| `personalPosition`               | `string`         | `string`  | Personal position account          |
| `tickArrayLower`                 | `string`         | `string`  | Lower tick array account           |
| `tickArrayUpper`                 | `string`         | `string`  | Upper tick array account           |
| `tokenAccount0`                  | `string`         | `string`  | Token0 account address             |
| `tokenAccount1`                  | `string`         | `string`  | Token1 account address             |
| `tokenVault0`                    | `string`         | `string`  | Token0 vault address               |
| `tokenVault1`                    | `string`         | `string`  | Token1 vault address               |

### DECREASE\_LIQUIDITY\_V2 Event

Liquidity removal event from existing positions.

| Property                         | Type             | JSON Type | Description                           |
| -------------------------------- | ---------------- | --------- | ------------------------------------- |
| `mint0`                          | `string`         | `string`  | Token0 mint address                   |
| `mint1`                          | `string`         | `string`  | Token1 mint address                   |
| `protocolPosition`               | `string`         | `string`  | Protocol position account             |
| `personalPosition`               | `string`         | `string`  | Personal position account             |
| `tickArrayLower`                 | `string`         | `string`  | Lower tick array account              |
| `tickArrayUpper`                 | `string`         | `string`  | Upper tick array account              |
| `recipientTokenAccount0`         | `string`         | `string`  | Recipient token0 account              |
| `recipientTokenAccount1`         | `string`         | `string`  | Recipient token1 account              |
| `tokenVault0`                    | `string`         | `string`  | Token0 vault address                  |
| `tokenVault1`                    | `string`         | `string`  | Token1 vault address                  |
| `liquidity`                      | `bigint`         | `string`  | Liquidity amount removed              |
| `amount0Min`                     | `bigint`         | `string`  | Minimum token0 amount                 |
| `amount0MinUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted min token0 amount        |
| `amount1Min`                     | `bigint`         | `string`  | Minimum token1 amount                 |
| `amount1MinUiAmount`             | `PreciseDecimal` | `string`  | UI-formatted min token1 amount        |
| `amountWithdrawn0`               | `bigint`         | `string`  | Amount of token0 withdrawn            |
| `amountWithdrawn0UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token0 withdrawal amount |
| `amountWithdrawn1`               | `bigint`         | `string`  | Amount of token1 withdrawn            |
| `amountWithdrawn1UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token1 withdrawal amount |
| `postTokenBalance0`              | `bigint`         | `string`  | Token0 balance after withdrawal       |
| `postTokenBalance0UiAmount`      | `PreciseDecimal` | `string`  | UI-formatted token0 post-balance      |
| `postTokenBalance1`              | `bigint`         | `string`  | Token1 balance after withdrawal       |
| `postTokenBalance1UiAmount`      | `PreciseDecimal` | `string`  | UI-formatted token1 post-balance      |
| `preTokenBalance0`               | `bigint`         | `string`  | Token0 balance before withdrawal      |
| `preTokenBalance0UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token0 pre-balance       |
| `preTokenBalance1`               | `bigint`         | `string`  | Token1 balance before withdrawal      |
| `preTokenBalance1UiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token1 pre-balance       |
| `tokenVault0PostBalance`         | `bigint`         | `string`  | Vault0 balance after withdrawal       |
| `tokenVault0PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted vault0 post-balance      |
| `tokenVault1PostBalance`         | `bigint`         | `string`  | Vault1 balance after withdrawal       |
| `tokenVault1PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted vault1 post-balance      |
| `tokenVault0PreBalance`          | `bigint`         | `string`  | Vault0 balance before withdrawal      |
| `tokenVault0PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted vault0 pre-balance       |
| `tokenVault1PreBalance`          | `bigint`         | `string`  | Vault1 balance before withdrawal      |
| `tokenVault1PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted vault1 pre-balance       |

### OPEN\_POSITION\_TOKEN\_22\_NFT Event

New position opening event with Token-22 NFT.

| Property                   | Type             | JSON Type | Description                       |
| -------------------------- | ---------------- | --------- | --------------------------------- |
| `positionNftAccount`       | `string`         | `string`  | Position NFT account address      |
| `tokenAccount0`            | `string`         | `string`  | Token0 account address            |
| `tokenAccount1`            | `string`         | `string`  | Token1 account address            |
| `tokenVault0`              | `string`         | `string`  | Token0 vault address              |
| `tokenVault1`              | `string`         | `string`  | Token1 vault address              |
| `token0Balance`            | `bigint`         | `string`  | Token0 balance                    |
| `token1Balance`            | `bigint`         | `string`  | Token1 balance                    |
| `token0BalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token0 balance       |
| `token1BalanceUiAmount`    | `PreciseDecimal` | `string`  | UI-formatted token1 balance       |
| `tickLowerIndex`           | `number`         | `number`  | Lower tick index for the position |
| `tickUpperIndex`           | `number`         | `number`  | Upper tick index for the position |
| `tickArrayLowerStartIndex` | `number`         | `number`  | Lower tick array start index      |
| `tickArrayUpperStartIndex` | `number`         | `number`  | Upper tick array start index      |
| `liquidity`                | `bigint`         | `string`  | Initial liquidity amount          |
| `amount0Max`               | `bigint`         | `string`  | Maximum token0 amount             |
| `amount1Max`               | `bigint`         | `string`  | Maximum token1 amount             |
| `amount0MaxUiAmount`       | `PreciseDecimal` | `string`  | UI-formatted max token0 amount    |
| `amount1MaxUiAmount`       | `PreciseDecimal` | `string`  | UI-formatted max token1 amount    |
| `mint0`                    | `string`         | `string`  | Token0 mint address               |
| `mint1`                    | `string`         | `string`  | Token1 mint address               |

### Data Types

* `bigint`: Large integer values for token amounts and liquidity
* `string`: Text values for addresses and identifiers
* `number`: Numeric values for tick indices and timestamps
* `boolean`: True/false values for input type indicators
* `PreciseDecimal`: High-precision decimal representation for UI display
* `DecoderType`: Enum indicating the decoder type (RAYDIUM\_CLMM)

### 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 CLMM decoder handles concentrated liquidity positions with tick-based pricing and NFT-based position management.


---

# 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/raydium-clmm.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.
