> For the complete documentation index, see [llms.txt](https://docs.lyslabs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lyslabs.ai/decoders/raydium-cpmm.md).

# Raydium CPMM

### 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 CPMM program ID                                          |
| `eventType`       | `string`         | `string`         | Type of event (INITIALIZE, SWAP\_BASE\_INPUT, DEPOSIT, WITHDRAW) |
| `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 Event

Pool initialization event for Raydium CPMM.

| Property              | Type             | JSON Type | Description                        |
| --------------------- | ---------------- | --------- | ---------------------------------- |
| `mint`                | `string`         | `string`  | Pool mint address                  |
| `token0Mint`          | `string`         | `string`  | Token0 mint address                |
| `lpMint`              | `string`         | `string`  | LP token mint address              |
| `creatorToken0`       | `string`         | `string`  | Creator's token0 account           |
| `creatorToken1`       | `string`         | `string`  | Creator's token1 account           |
| `creatorLpToken`      | `string`         | `string`  | Creator's LP token account         |
| `token0Vault`         | `string`         | `string`  | Token0 vault address               |
| `token1Vault`         | `string`         | `string`  | Token1 vault address               |
| `initAmount0`         | `bigint`         | `string`  | Initial amount of token0           |
| `initAmount0UiAmount` | `PreciseDecimal` | `string`  | UI-formatted initial token0 amount |
| `initAmount1`         | `bigint`         | `string`  | Initial amount of token1           |
| `initAmount1UiAmount` | `PreciseDecimal` | `string`  | UI-formatted initial token1 amount |
| `openTime`            | `string`         | `string`  | Pool opening timestamp             |

### SWAP\_BASE\_INPUT Event

Token swap event in Raydium CPMM 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               |
| `minimumAmountOut`                 | `bigint`         | `string`  | Minimum acceptable output amount         |
| `minimumAmountOutUiAmount`         | `PreciseDecimal` | `string`  | UI-formatted minimum output amount       |
| `inputMint`                        | `string`         | `string`  | Input token mint address                 |
| `outputMint`                       | `string`         | `string`  | Output token mint 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                         |
| `actualPrice`                      | `PreciseDecimal` | `string`  | Actual swap price                        |
| `expectedAmountIn`                 | `PreciseDecimal` | `string`  | Expected input amount                    |
| `slippagePercentage`               | `number`         | `number`  | Actual slippage percentage               |
| `slippageTolerance`                | `number`         | `number`  | Slippage tolerance percentage            |
| `slippageAmount`                   | `bigint`         | `string`  | Slippage amount                          |
| `slippageAmountUiAmount`           | `PreciseDecimal` | `string`  | UI-formatted slippage amount             |
| `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   |
| `inputAccountPostBalance`          | `bigint`         | `string`  | Input account balance after swap         |
| `inputAccountPostBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted input account post-balance  |
| `inputAccountPreBalance`           | `bigint`         | `string`  | Input account balance before swap        |
| `inputAccountPreBalanceUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted input account pre-balance   |
| `outputAccountPostBalance`         | `bigint`         | `string`  | Output account balance after swap        |
| `outputAccountPostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted output account post-balance |
| `outputAccountPreBalance`          | `bigint`         | `string`  | Output account balance before swap       |
| `outputAccountPreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted output account pre-balance  |

### DEPOSIT Event

Liquidity deposit event for Raydium CPMM.

| Property                        | Type             | JSON Type | Description                           |
| ------------------------------- | ---------------- | --------- | ------------------------------------- |
| `lpTokenAmount`                 | `bigint`         | `string`  | LP token amount minted                |
| `lpTokenAmountUiAmount`         | `PreciseDecimal` | `string`  | UI-formatted LP token amount          |
| `maximumToken0Amount`           | `bigint`         | `string`  | Maximum token0 amount to deposit      |
| `maximumToken0AmountUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted maximum token0 amount    |
| `maximumToken1Amount`           | `bigint`         | `string`  | Maximum token1 amount to deposit      |
| `maximumToken1AmountUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted maximum token1 amount    |
| `token0AmountIn`                | `bigint`         | `string`  | Actual token0 amount deposited        |
| `token0AmountInUiAmount`        | `PreciseDecimal` | `string`  | UI-formatted token0 deposit amount    |
| `token1AmountIn`                | `bigint`         | `string`  | Actual token1 amount deposited        |
| `token1AmountInUiAmount`        | `PreciseDecimal` | `string`  | UI-formatted token1 deposit amount    |
| `vault0Mint`                    | `string`         | `string`  | Vault0 mint address                   |
| `vault1Mint`                    | `string`         | `string`  | Vault1 mint address                   |
| `token0Account`                 | `string`         | `string`  | User's token0 account                 |
| `token1Account`                 | `string`         | `string`  | User's token1 account                 |
| `token0Vault`                   | `string`         | `string`  | Token0 vault address                  |
| `token1Vault`                   | `string`         | `string`  | Token1 vault address                  |
| `lpMint`                        | `string`         | `string`  | LP token mint address                 |
| `userToken0PreBalance`          | `bigint`         | `string`  | User token0 balance before deposit    |
| `userToken0PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token0 pre-balance  |
| `userToken0PostBalance`         | `bigint`         | `string`  | User token0 balance after deposit     |
| `userToken0PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token0 post-balance |
| `userToken1PreBalance`          | `bigint`         | `string`  | User token1 balance before deposit    |
| `userToken1PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token1 pre-balance  |
| `userToken1PostBalance`         | `bigint`         | `string`  | User token1 balance after deposit     |
| `userToken1PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token1 post-balance |
| `userLpPreBalance`              | `bigint`         | `string`  | User LP balance before deposit        |
| `userLpPreBalanceUiAmount`      | `PreciseDecimal` | `string`  | UI-formatted user LP pre-balance      |
| `userLpPostBalance`             | `bigint`         | `string`  | User LP balance after deposit         |
| `userLpPostBalanceUiAmount`     | `PreciseDecimal` | `string`  | UI-formatted user LP post-balance     |
| `vault0PreBalance`              | `bigint`         | `string`  | Vault0 balance before deposit         |
| `vault0PreBalanceUiAmount`      | `PreciseDecimal` | `string`  | UI-formatted vault0 pre-balance       |
| `vault0PostBalance`             | `bigint`         | `string`  | Vault0 balance after deposit          |
| `vault0PostBalanceUiAmount`     | `PreciseDecimal` | `string`  | UI-formatted vault0 post-balance      |
| `vault1PreBalance`              | `bigint`         | `string`  | Vault1 balance before deposit         |
| `vault1PreBalanceUiAmount`      | `PreciseDecimal` | `string`  | UI-formatted vault1 pre-balance       |
| `vault1PostBalance`             | `bigint`         | `string`  | Vault1 balance after deposit          |
| `vault1PostBalanceUiAmount`     | `PreciseDecimal` | `string`  | UI-formatted vault1 post-balance      |

### WITHDRAW Event

Liquidity withdrawal event for Raydium CPMM.

| Property                        | Type             | JSON Type | Description                           |
| ------------------------------- | ---------------- | --------- | ------------------------------------- |
| `lpTokenAmount`                 | `bigint`         | `string`  | LP token amount burned                |
| `lpTokenAmountUiAmount`         | `PreciseDecimal` | `string`  | UI-formatted LP token amount          |
| `minimumToken0Amount`           | `bigint`         | `string`  | Minimum token0 amount to receive      |
| `minimumToken0AmountUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted minimum token0 amount    |
| `minimumToken1Amount`           | `bigint`         | `string`  | Minimum token1 amount to receive      |
| `minimumToken1AmountUiAmount`   | `PreciseDecimal` | `string`  | UI-formatted minimum token1 amount    |
| `token0AmountOut`               | `bigint`         | `string`  | Actual token0 amount withdrawn        |
| `token0AmountOutUiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token0 withdrawal amount |
| `token1AmountOut`               | `bigint`         | `string`  | Actual token1 amount withdrawn        |
| `token1AmountOutUiAmount`       | `PreciseDecimal` | `string`  | UI-formatted token1 withdrawal amount |
| `vault0Mint`                    | `string`         | `string`  | Vault0 mint address                   |
| `vault1Mint`                    | `string`         | `string`  | Vault1 mint address                   |
| `token0Account`                 | `string`         | `string`  | User's token0 account                 |
| `token1Account`                 | `string`         | `string`  | User's token1 account                 |
| `token0Vault`                   | `string`         | `string`  | Token0 vault address                  |
| `token1Vault`                   | `string`         | `string`  | Token1 vault address                  |
| `lpMint`                        | `string`         | `string`  | LP token mint address                 |
| `userToken0PreBalance`          | `bigint`         | `string`  | User token0 balance before withdrawal |
| `userToken0PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token0 pre-balance  |
| `userToken0PostBalance`         | `bigint`         | `string`  | User token0 balance after withdrawal  |
| `userToken0PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token0 post-balance |
| `userToken1PreBalance`          | `bigint`         | `string`  | User token1 balance before withdrawal |
| `userToken1PreBalanceUiAmount`  | `PreciseDecimal` | `string`  | UI-formatted user token1 pre-balance  |
| `userToken1PostBalance`         | `bigint`         | `string`  | User token1 balance after withdrawal  |
| `userToken1PostBalanceUiAmount` | `PreciseDecimal` | `string`  | UI-formatted user token1 post-balance |
| `userLpPreBalance`              | `bigint`         | `string`  | User LP balance before withdrawal     |
| `userLpPreBalanceUiAmount`      | `PreciseDecimal` | `string`  | UI-formatted user LP pre-balance      |
| `userLpPostBalance`             | `bigint`         | `string`  | User LP balance after withdrawal      |
| `userLpPostBalanceUiAmount`     | `PreciseDecimal` | `string`  | UI-formatted user LP post-balance     |
| `vault0PreBalance`              | `bigint`         | `string`  | Vault0 balance before withdrawal      |
| `vault0PreBalanceUiAmount`      | `PreciseDecimal` | `string`  | UI-formatted vault0 pre-balance       |
| `vault0PostBalance`             | `bigint`         | `string`  | Vault0 balance after withdrawal       |
| `vault0PostBalanceUiAmount`     | `PreciseDecimal` | `string`  | UI-formatted vault0 post-balance      |
| `vault1PreBalance`              | `bigint`         | `string`  | Vault1 balance before withdrawal      |
| `vault1PreBalanceUiAmount`      | `PreciseDecimal` | `string`  | UI-formatted vault1 pre-balance       |
| `vault1PostBalance`             | `bigint`         | `string`  | Vault1 balance after withdrawal       |
| `vault1PostBalanceUiAmount`     | `PreciseDecimal` | `string`  | UI-formatted vault1 post-balance      |

### Data Types

* `bigint`: Large integer values for token amounts
* `string`: Text values for addresses and identifiers
* `number`: Numeric values for percentages and timestamps
* `PreciseDecimal`: High-precision decimal representation for UI display
* `DecoderType`: Enum indicating the decoder type (RAYDIUM\_CPMM)

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