# PancakeSwap decoder (Carbon 2.0)

> Decode PancakeSwap instructions, accounts and events in Rust with carbon-pancake-swap-decoder 2.0.0. Program ID HpNfyc2Saw7RKkQd8nEL4khUcuPhQ7WwY1B2qjx8jxFq.

`carbon-pancake-swap-decoder` decodes the instructions, accounts and events of the PancakeSwap program (`HpNfyc2Saw7RKkQd8nEL4khUcuPhQ7WwY1B2qjx8jxFq`): 27 instructions, 10 account types, 11 events. It is generated with Codama from the program's IDL; see [decoders](https://carbon.sevenlabs.org/concepts/decoders.md) for how decoders plug into a pipeline.

|                  |                                                                                                                   |
| ---------------- | ----------------------------------------------------------------------------------------------------------------- |
| Crate            | [`carbon-pancake-swap-decoder`](https://crates.io/crates/carbon-pancake-swap-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-pancake-swap-decoder@2.0.0`                                                                     |
| Program ID       | `HpNfyc2Saw7RKkQd8nEL4khUcuPhQ7WwY1B2qjx8jxFq` (`carbon_pancake_swap_decoder::PROGRAM_ID`)                        |
| Category         | [DEX & AMM](https://carbon.sevenlabs.org/decoders/dex-and-amm.md)                                                 |
| Decoder          | `carbon_pancake_swap_decoder::PancakeSwapDecoder`                                                                 |
| Instruction enum | `instructions::PancakeSwapInstruction`                                                                            |
| Account enum     | `accounts::PancakeSwapAccount`                                                                                    |
| Event enum       | `instructions::CpiEvent`                                                                                          |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                          |
| API docs         | [docs.rs/carbon-pancake-swap-decoder/2.0.0](https://docs.rs/carbon-pancake-swap-decoder/2.0.0)                    |
| Source           | [decoders/pancake-swap-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/pancake-swap-decoder) |

Other DEX and AMM decoders: [BonkSwap](https://carbon.sevenlabs.org/decoders/bonkswap.md), [FluxBeam](https://carbon.sevenlabs.org/decoders/fluxbeam.md), [Gavel](https://carbon.sevenlabs.org/decoders/gavel.md), [Heaven](https://carbon.sevenlabs.org/decoders/heaven.md), [Jupiter Limit Order](https://carbon.sevenlabs.org/decoders/jupiter-limit-order.md), [Jupiter Limit Order v2](https://carbon.sevenlabs.org/decoders/jupiter-limit-order-2.md), [Kamino Limit Order](https://carbon.sevenlabs.org/decoders/kamino-limit-order.md), [Lifinity AMM v2](https://carbon.sevenlabs.org/decoders/lifinity-amm-v2.md), [Meteora DAMM v2](https://carbon.sevenlabs.org/decoders/meteora-damm-v2.md), [Meteora DLMM](https://carbon.sevenlabs.org/decoders/meteora-dlmm.md), [Meteora Pools](https://carbon.sevenlabs.org/decoders/meteora-pools.md), [OpenBook v2](https://carbon.sevenlabs.org/decoders/openbook-v2.md), [Orca Whirlpools](https://carbon.sevenlabs.org/decoders/orca-whirlpool.md), [Phoenix v1](https://carbon.sevenlabs.org/decoders/phoenix-v1.md), [PumpSwap](https://carbon.sevenlabs.org/decoders/pump-swap.md), [Raydium AMM v4](https://carbon.sevenlabs.org/decoders/raydium-amm-v4.md), [Raydium CLMM](https://carbon.sevenlabs.org/decoders/raydium-clmm.md), [Raydium CPMM](https://carbon.sevenlabs.org/decoders/raydium-cpmm.md), [Raydium Stable Swap](https://carbon.sevenlabs.org/decoders/raydium-stable-swap.md), [Stabble Stable Swap](https://carbon.sevenlabs.org/decoders/stabble-stable-swap.md), [Stabble Weighted Swap](https://carbon.sevenlabs.org/decoders/stabble-weighted-swap.md). To decode several in one pipeline, see [dEX and AMM decoders](https://carbon.sevenlabs.org/decoders/dex-and-amm.md).

The `serde` feature derives `Serialize`/`Deserialize` on every type, `postgres` adds tables and processors for [Postgres](https://carbon.sevenlabs.org/guides/postgres.md), and `graphql` adds a schema for the [GraphQL server](https://carbon.sevenlabs.org/guides/graphql.md).

## Usage

This program crawls recent PancakeSwap transactions from the public RPC and prints every decoded `Swap` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-pancake-swap-decoder@2.0.0 carbon-rpc-transaction-crawler-datasource@2.0.0 carbon-log-metrics@2.0.0 env_logger tokio --features tokio/full
```

`src/main.rs`:

```rust
use {
    carbon_core::{
        error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_pancake_swap_decoder::{
        instructions::PancakeSwapInstruction, PancakeSwapDecoder, PROGRAM_ID,
    },
    carbon_rpc_transaction_crawler_datasource::{ConnectionConfig, Filters, RpcTransactionCrawler},
    std::sync::Arc,
};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    env_logger::init();

    // Fetches the program's recent transactions over JSON-RPC, newest first.
    let datasource = RpcTransactionCrawler::new(
        "https://api.mainnet-beta.solana.com".to_string(),
        PROGRAM_ID,
        ConnectionConfig::default(),
        Filters::new(None, None, None),
        None,
    );

    Pipeline::builder()
        .datasource(datasource)
        .metrics(Arc::new(LogMetrics::new()))
        .instruction(PancakeSwapDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, PancakeSwapInstruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, PancakeSwapInstruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let PancakeSwapInstruction::Swap { data, accounts, .. } = input.decoded_instruction {
            println!("swap {signature}: {data:?} payer={}", accounts.payer);
        }
        Ok(())
    }
}
```

```sh
RUST_LOG=info cargo run
```

Each `Swap` instruction prints one line with the transaction signature and the decoded `Swap` data. The public endpoint rate-limits requests, so the first lines can take a while; use your own RPC URL for anything beyond a test. See [stream with RPC](https://carbon.sevenlabs.org/guides/stream-with-rpc.md) for the crawler options.

Events published with Anchor's `emit_cpi!` arrive as the `CpiEvent` instruction. Match them with `PancakeSwapInstruction::CpiEvent { data: CpiEvent::CollectPersonalFeeEvent(event), .. }` (import `instructions::CpiEvent`); see [Events](#events). If `CpiEvent` never arrives, the program logs its events with `emit!` instead: decode them with [`decode_log_events`](https://carbon.sevenlabs.org/concepts/instructions.md#log-events).

### Decode accounts

The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with `programSubscribe` on the public WebSocket endpoint and prints every decoded `PoolState` account as it changes. Add the datasource and the Solana RPC types it takes:

```sh
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2
```

`src/main.rs`:

```rust
use {
    carbon_core::{
        account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_pancake_swap_decoder::{accounts::PancakeSwapAccount, PancakeSwapDecoder, PROGRAM_ID},
    carbon_rpc_program_subscribe_datasource::{Filters, RpcProgramSubscribe},
    solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, UiAccountEncoding},
    std::sync::Arc,
};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    env_logger::init();

    // Streams every change to an account owned by the program (programSubscribe).
    let config = RpcProgramAccountsConfig {
        account_config: RpcAccountInfoConfig {
            encoding: Some(UiAccountEncoding::Base64),
            ..Default::default()
        },
        ..Default::default()
    };
    let datasource = RpcProgramSubscribe::new(
        "wss://api.mainnet-beta.solana.com".to_string(),
        Filters::new(PROGRAM_ID, Some(config)),
    );

    Pipeline::builder()
        .datasource(datasource)
        .metrics(Arc::new(LogMetrics::new()))
        .account(PancakeSwapDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

impl Processor<AccountProcessorInputType<'_, PancakeSwapAccount>> for AccountLogger {
    async fn process(
        &mut self,
        input: &AccountProcessorInputType<'_, PancakeSwapAccount>,
    ) -> CarbonResult<()> {
        if let PancakeSwapAccount::PoolState(pool_state) = &input.decoded_account.data {
            println!("pool_state {}: {pool_state:?}", input.metadata.pubkey);
        }
        Ok(())
    }
}
```

```sh
RUST_LOG=info cargo run
```

Each update to a `PoolState` account prints its address and decoded fields; the program runs until you stop it. Cargo resolves `solana-client` to 4.2.2, the exact version the datasource pins, so both use the same `RpcProgramAccountsConfig` type. To load every existing account once instead of streaming changes, see [load account state](https://carbon.sevenlabs.org/guides/load-account-state.md).

## Instructions

Variants of `PancakeSwapInstruction`. Each is `PancakeSwapInstruction::<Variant> { program_id, data, accounts }`, where `data` and `accounts` are the types listed under the variant, exported from `carbon_pancake_swap_decoder::instructions`. Discriminators are the leading bytes of the instruction data, in hex.

**How an instruction decodes.** The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:

1. The instruction's program ID is `HpNfyc2Saw7RKkQd8nEL4khUcuPhQ7WwY1B2qjx8jxFq`.
2. The data starts with the variant's discriminator, and the rest deserializes into its data type.
3. The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).

**Accounts.** They are matched by position, in the order listed. An account marked _optional_ is `None` only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for `Some(PROGRAM_ID)` too. Accounts after the listed ones are in `accounts.remaining` as `AccountMeta`s. The decoder doesn't record whether an account signed or was writable: read that from `input.raw_instruction.accounts[i].is_signer` and `.is_writable`, which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.

### `ClosePosition`

> _From the program's IDL:_
>
> Close the user's position and NFT account. If the NFT mint belongs to token2022, it will also be closed and the funds returned to the NFT owner. # Arguments
>
> - `ctx` - The context of accounts

Discriminator `7b86510031446262` · data `ClosePosition` · accounts `ClosePositionInstructionAccounts`.

No data fields.

Required accounts: 6; extras go to `remaining`.

Fields of `ClosePositionInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `nft_owner`            | `Pubkey`           |
| 1  | `position_nft_mint`    | `Pubkey`           |
| 2  | `position_nft_account` | `Pubkey`           |
| 3  | `personal_position`    | `Pubkey`           |
| 4  | `system_program`       | `Pubkey`           |
| 5  | `token_program`        | `Pubkey`           |
| 6… | `remaining`            | `Vec<AccountMeta>` |

### `CollectFundFee`

> _From the program's IDL:_
>
> Collect the fund fee accrued to the pool
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to
>   collect fees in only token_1
> - `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0

Discriminator `a78a4e95dfc2067e` · data `CollectFundFee` · accounts `CollectFundFeeInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `amount0_requested` | `u64` |
| `amount1_requested` | `u64` |

Required accounts: 11; extras go to `remaining`.

Fields of `CollectFundFeeInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `owner`                    | `Pubkey`           |
| 1   | `pool_state`               | `Pubkey`           |
| 2   | `amm_config`               | `Pubkey`           |
| 3   | `token_vault0`             | `Pubkey`           |
| 4   | `token_vault1`             | `Pubkey`           |
| 5   | `vault0_mint`              | `Pubkey`           |
| 6   | `vault1_mint`              | `Pubkey`           |
| 7   | `recipient_token_account0` | `Pubkey`           |
| 8   | `recipient_token_account1` | `Pubkey`           |
| 9   | `token_program`            | `Pubkey`           |
| 10  | `token_program2022`        | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `CollectProtocolFee`

> _From the program's IDL:_
>
> Collect the protocol fee accrued to the pool
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to
>   collect fees in only token_1
> - `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0

Discriminator `8888fcddc2427e59` · data `CollectProtocolFee` · accounts `CollectProtocolFeeInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `amount0_requested` | `u64` |
| `amount1_requested` | `u64` |

Required accounts: 11; extras go to `remaining`.

Fields of `CollectProtocolFeeInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `owner`                    | `Pubkey`           |
| 1   | `pool_state`               | `Pubkey`           |
| 2   | `amm_config`               | `Pubkey`           |
| 3   | `token_vault0`             | `Pubkey`           |
| 4   | `token_vault1`             | `Pubkey`           |
| 5   | `vault0_mint`              | `Pubkey`           |
| 6   | `vault1_mint`              | `Pubkey`           |
| 7   | `recipient_token_account0` | `Pubkey`           |
| 8   | `recipient_token_account1` | `Pubkey`           |
| 9   | `token_program`            | `Pubkey`           |
| 10  | `token_program2022`        | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `CollectRemainingRewards`

> _From the program's IDL:_
>
> Collect remaining reward token for reward founder
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `reward_index` - the index to reward info

Discriminator `12eda6c52210d590` · data `CollectRemainingRewards` · accounts `CollectRemainingRewardsInstructionAccounts`.

| Field          | Type |
| -------------- | ---- |
| `reward_index` | `u8` |

Required accounts: 8; extras go to `remaining`.

Fields of `CollectRemainingRewardsInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `reward_funder`        | `Pubkey`           |
| 1  | `funder_token_account` | `Pubkey`           |
| 2  | `pool_state`           | `Pubkey`           |
| 3  | `reward_token_vault`   | `Pubkey`           |
| 4  | `reward_vault_mint`    | `Pubkey`           |
| 5  | `token_program`        | `Pubkey`           |
| 6  | `token_program2022`    | `Pubkey`           |
| 7  | `memo_program`         | `Pubkey`           |
| 8… | `remaining`            | `Vec<AccountMeta>` |

### `CreateAmmConfig`

> _From the program's IDL:_
>
> **Arguments**
>
> - `ctx`- The accounts needed by instruction.
> - `index` - The index of amm config, there may be multiple config.
> - `tick_spacing` - The tickspacing binding with config, cannot be changed.
> - `trade_fee_rate` - Trade fee rate, can be changed.
> - `protocol_fee_rate` - The rate of protocol fee within trade fee.
> - `fund_fee_rate` - The rate of fund fee within trade fee.

Discriminator `8934edd4d7756c68` · data `CreateAmmConfig` · accounts `CreateAmmConfigInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `index`             | `u16` |
| `tick_spacing`      | `u16` |
| `trade_fee_rate`    | `u32` |
| `protocol_fee_rate` | `u32` |
| `fund_fee_rate`     | `u32` |

Required accounts: 3; extras go to `remaining`.

Fields of `CreateAmmConfigInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `owner`          | `Pubkey`           |
| 1  | `amm_config`     | `Pubkey`           |
| 2  | `system_program` | `Pubkey`           |
| 3… | `remaining`      | `Vec<AccountMeta>` |

### `CreateOperationAccount`

> _From the program's IDL:_
>
> Creates an operation account for the program
>
> **Arguments**
>
> - `ctx`- The context of accounts

Discriminator `3f5794216d230868` · data `CreateOperationAccount` · accounts `CreateOperationAccountInstructionAccounts`.

No data fields.

Required accounts: 3; extras go to `remaining`.

Fields of `CreateOperationAccountInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `owner`           | `Pubkey`           |
| 1  | `operation_state` | `Pubkey`           |
| 2  | `system_program`  | `Pubkey`           |
| 3… | `remaining`       | `Vec<AccountMeta>` |

### `CreatePermissionlessFarmSwitch`

> _From the program's IDL:_
>
> Creates a permissionless farm switch account for the program
>
> **Arguments**
>
> - `ctx`- The context of accounts

Discriminator `58f2c646f106c4fb` · data `CreatePermissionlessFarmSwitch` · accounts `CreatePermissionlessFarmSwitchInstructionAccounts`.

No data fields.

Required accounts: 3; extras go to `remaining`.

Fields of `CreatePermissionlessFarmSwitchInstructionAccounts`, in account order:

| #  | Field                        | Type               |
| -- | ---------------------------- | ------------------ |
| 0  | `owner`                      | `Pubkey`           |
| 1  | `permissionless_farm_switch` | `Pubkey`           |
| 2  | `system_program`             | `Pubkey`           |
| 3… | `remaining`                  | `Vec<AccountMeta>` |

### `CreatePool`

> _From the program's IDL:_
>
> Creates a pool for the given token pair and the initial price
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `sqrt_price_x64` - the initial sqrt price (amount_token_1 /
>   amount_token_0) of the pool as a Q64.64
>
> Note: The open_time must be smaller than the current block_timestamp on chain.

Discriminator `e992d18ecf6840bc` · data `CreatePool` · accounts `CreatePoolInstructionAccounts`.

| Field            | Type   |
| ---------------- | ------ |
| `sqrt_price_x64` | `u128` |
| `open_time`      | `u64`  |

Required accounts: 13; extras go to `remaining`.

Fields of `CreatePoolInstructionAccounts`, in account order:

| #   | Field               | Type               |
| --- | ------------------- | ------------------ |
| 0   | `pool_creator`      | `Pubkey`           |
| 1   | `amm_config`        | `Pubkey`           |
| 2   | `pool_state`        | `Pubkey`           |
| 3   | `token_mint0`       | `Pubkey`           |
| 4   | `token_mint1`       | `Pubkey`           |
| 5   | `token_vault0`      | `Pubkey`           |
| 6   | `token_vault1`      | `Pubkey`           |
| 7   | `observation_state` | `Pubkey`           |
| 8   | `tick_array_bitmap` | `Pubkey`           |
| 9   | `token_program0`    | `Pubkey`           |
| 10  | `token_program1`    | `Pubkey`           |
| 11  | `system_program`    | `Pubkey`           |
| 12  | `rent`              | `Pubkey`           |
| 13… | `remaining`         | `Vec<AccountMeta>` |

### `CreateSupportMintAssociated`

> _From the program's IDL:_
>
> Create support token22 mint account which can create pool and send rewards with ignoring the not support extensions.

Discriminator `11fb415c88f20ea9` · data `CreateSupportMintAssociated` · accounts `CreateSupportMintAssociatedInstructionAccounts`.

No data fields.

Required accounts: 4; extras go to `remaining`.

Fields of `CreateSupportMintAssociatedInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `owner`                   | `Pubkey`           |
| 1  | `token_mint`              | `Pubkey`           |
| 2  | `support_mint_associated` | `Pubkey`           |
| 3  | `system_program`          | `Pubkey`           |
| 4… | `remaining`               | `Vec<AccountMeta>` |

### `DecreaseLiquidity`

> _From the program's IDL:_
>
> `#[deprecated(note = "Use `decrease_liquidity_v2` instead.")]`
> Decreases liquidity for an existing position
>
> **Arguments**
>
> - `ctx` -  The context of accounts
> - `liquidity` - The amount by which liquidity will be decreased
> - `amount_0_min` - The minimum amount of token_0 that should be accounted
>   for the burned liquidity
> - `amount_1_min` - The minimum amount of token_1 that should be accounted for the burned liquidity

Discriminator `a026d06f685b2c01` · data `DecreaseLiquidity` · accounts `DecreaseLiquidityInstructionAccounts`.

| Field         | Type   |
| ------------- | ------ |
| `liquidity`   | `u128` |
| `amount0_min` | `u64`  |
| `amount1_min` | `u64`  |

Required accounts: 12; extras go to `remaining`.

Fields of `DecreaseLiquidityInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `nft_owner`                | `Pubkey`           |
| 1   | `nft_account`              | `Pubkey`           |
| 2   | `personal_position`        | `Pubkey`           |
| 3   | `pool_state`               | `Pubkey`           |
| 4   | `protocol_position`        | `Pubkey`           |
| 5   | `token_vault0`             | `Pubkey`           |
| 6   | `token_vault1`             | `Pubkey`           |
| 7   | `tick_array_lower`         | `Pubkey`           |
| 8   | `tick_array_upper`         | `Pubkey`           |
| 9   | `recipient_token_account0` | `Pubkey`           |
| 10  | `recipient_token_account1` | `Pubkey`           |
| 11  | `token_program`            | `Pubkey`           |
| 12… | `remaining`                | `Vec<AccountMeta>` |

### `DecreaseLiquidityV2`

> _From the program's IDL:_
>
> Decreases liquidity for an existing position, support Token2022
>
> **Arguments**
>
> - `ctx` -  The context of accounts
> - `liquidity` - The amount by which liquidity will be decreased
> - `amount_0_min` - The minimum amount of token_0 that should be accounted
>   for the burned liquidity
> - `amount_1_min` - The minimum amount of token_1 that should be accounted for the burned liquidity

Discriminator `3a7fbc3e4f52c460` · data `DecreaseLiquidityV2` · accounts `DecreaseLiquidityV2InstructionAccounts`.

| Field         | Type   |
| ------------- | ------ |
| `liquidity`   | `u128` |
| `amount0_min` | `u64`  |
| `amount1_min` | `u64`  |

Required accounts: 16; extras go to `remaining`.

Fields of `DecreaseLiquidityV2InstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `nft_owner`                | `Pubkey`           |
| 1   | `nft_account`              | `Pubkey`           |
| 2   | `personal_position`        | `Pubkey`           |
| 3   | `pool_state`               | `Pubkey`           |
| 4   | `protocol_position`        | `Pubkey`           |
| 5   | `token_vault0`             | `Pubkey`           |
| 6   | `token_vault1`             | `Pubkey`           |
| 7   | `tick_array_lower`         | `Pubkey`           |
| 8   | `tick_array_upper`         | `Pubkey`           |
| 9   | `recipient_token_account0` | `Pubkey`           |
| 10  | `recipient_token_account1` | `Pubkey`           |
| 11  | `token_program`            | `Pubkey`           |
| 12  | `token_program2022`        | `Pubkey`           |
| 13  | `memo_program`             | `Pubkey`           |
| 14  | `vault0_mint`              | `Pubkey`           |
| 15  | `vault1_mint`              | `Pubkey`           |
| 16… | `remaining`                | `Vec<AccountMeta>` |

### `IncreaseLiquidity`

> _From the program's IDL:_
>
> `#[deprecated(note = "Use `increase_liquidity_v2` instead.")]`
> Increases liquidity for an existing position, with amount paid by `payer`
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `liquidity` - The desired liquidity to be added, can't be zero
> - `amount_0_max` - The max amount of token_0 to spend, which serves as a
>   slippage check
> - `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check

Discriminator `2e9cf3760dcdfbb2` · data `IncreaseLiquidity` · accounts `IncreaseLiquidityInstructionAccounts`.

| Field         | Type   |
| ------------- | ------ |
| `liquidity`   | `u128` |
| `amount0_max` | `u64`  |
| `amount1_max` | `u64`  |

Required accounts: 12; extras go to `remaining`.

Fields of `IncreaseLiquidityInstructionAccounts`, in account order:

| #   | Field               | Type               |
| --- | ------------------- | ------------------ |
| 0   | `nft_owner`         | `Pubkey`           |
| 1   | `nft_account`       | `Pubkey`           |
| 2   | `pool_state`        | `Pubkey`           |
| 3   | `protocol_position` | `Pubkey`           |
| 4   | `personal_position` | `Pubkey`           |
| 5   | `tick_array_lower`  | `Pubkey`           |
| 6   | `tick_array_upper`  | `Pubkey`           |
| 7   | `token_account0`    | `Pubkey`           |
| 8   | `token_account1`    | `Pubkey`           |
| 9   | `token_vault0`      | `Pubkey`           |
| 10  | `token_vault1`      | `Pubkey`           |
| 11  | `token_program`     | `Pubkey`           |
| 12… | `remaining`         | `Vec<AccountMeta>` |

### `IncreaseLiquidityV2`

> _From the program's IDL:_
>
> Increases liquidity for an existing position, with amount paid by `payer`, support Token2022 # Arguments
>
> - `ctx` - The context of accounts
> - `liquidity` - The desired liquidity to be added, if zero, calculate liquidity base amount_0 or amount_1 according base_flag
> - `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check
> - `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check
> - `base_flag` - must be specified if liquidity is zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max

Discriminator `851d59df45eeb00a` · data `IncreaseLiquidityV2` · accounts `IncreaseLiquidityV2InstructionAccounts`.

| Field         | Type           |
| ------------- | -------------- |
| `liquidity`   | `u128`         |
| `amount0_max` | `u64`          |
| `amount1_max` | `u64`          |
| `base_flag`   | `Option<bool>` |

Required accounts: 15; extras go to `remaining`.

Fields of `IncreaseLiquidityV2InstructionAccounts`, in account order:

| #   | Field               | Type               |
| --- | ------------------- | ------------------ |
| 0   | `nft_owner`         | `Pubkey`           |
| 1   | `nft_account`       | `Pubkey`           |
| 2   | `pool_state`        | `Pubkey`           |
| 3   | `protocol_position` | `Pubkey`           |
| 4   | `personal_position` | `Pubkey`           |
| 5   | `tick_array_lower`  | `Pubkey`           |
| 6   | `tick_array_upper`  | `Pubkey`           |
| 7   | `token_account0`    | `Pubkey`           |
| 8   | `token_account1`    | `Pubkey`           |
| 9   | `token_vault0`      | `Pubkey`           |
| 10  | `token_vault1`      | `Pubkey`           |
| 11  | `token_program`     | `Pubkey`           |
| 12  | `token_program2022` | `Pubkey`           |
| 13  | `vault0_mint`       | `Pubkey`           |
| 14  | `vault1_mint`       | `Pubkey`           |
| 15… | `remaining`         | `Vec<AccountMeta>` |

### `InitializeReward`

> _From the program's IDL:_
>
> Initialize a reward info for a given pool and reward index
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `reward_index` - the index to reward info
> - `open_time` - reward open timestamp
> - `end_time` - reward end timestamp
> - `emissions_per_second_x64` - Token reward per second are earned per unit
>   of liquidity.

Discriminator `5f87c0c4f281e644` · data `InitializeReward` · accounts `InitializeRewardInstructionAccounts`.

| Field   | Type                                              |
| ------- | ------------------------------------------------- |
| `param` | [`InitializeRewardParam`](#initializerewardparam) |

Required accounts: 11; extras go to `remaining`.

Fields of `InitializeRewardInstructionAccounts`, in account order:

| #   | Field                        | Type               |
| --- | ---------------------------- | ------------------ |
| 0   | `reward_funder`              | `Pubkey`           |
| 1   | `funder_token_account`       | `Pubkey`           |
| 2   | `amm_config`                 | `Pubkey`           |
| 3   | `pool_state`                 | `Pubkey`           |
| 4   | `operation_state`            | `Pubkey`           |
| 5   | `permissionless_farm_switch` | `Pubkey`           |
| 6   | `reward_token_mint`          | `Pubkey`           |
| 7   | `reward_token_vault`         | `Pubkey`           |
| 8   | `reward_token_program`       | `Pubkey`           |
| 9   | `system_program`             | `Pubkey`           |
| 10  | `rent`                       | `Pubkey`           |
| 11… | `remaining`                  | `Vec<AccountMeta>` |

### `OpenPosition`

> _From the program's IDL:_
>
> `#[deprecated(note = "Use `open_position_with_token22_nft` instead.")]`
> Creates a new position wrapped in a NFT
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `tick_lower_index` - The low boundary of market
> - `tick_upper_index` - The upper boundary of market
> - `tick_array_lower_start_index` - The start index of tick array which
>   include tick low
> - `tick_array_upper_start_index` - The start index of tick array which include tick upper
> - `liquidity` - The liquidity to be added
> - `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check
> - `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check

Discriminator `87802f4d0f98f031` · data `OpenPosition` · accounts `OpenPositionInstructionAccounts`.

| Field                          | Type   |
| ------------------------------ | ------ |
| `tick_lower_index`             | `i32`  |
| `tick_upper_index`             | `i32`  |
| `tick_array_lower_start_index` | `i32`  |
| `tick_array_upper_start_index` | `i32`  |
| `liquidity`                    | `u128` |
| `amount0_max`                  | `u64`  |
| `amount1_max`                  | `u64`  |

Required accounts: 19; extras go to `remaining`.

Fields of `OpenPositionInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `payer`                    | `Pubkey`           |
| 1   | `position_nft_owner`       | `Pubkey`           |
| 2   | `position_nft_mint`        | `Pubkey`           |
| 3   | `position_nft_account`     | `Pubkey`           |
| 4   | `metadata_account`         | `Pubkey`           |
| 5   | `pool_state`               | `Pubkey`           |
| 6   | `protocol_position`        | `Pubkey`           |
| 7   | `tick_array_lower`         | `Pubkey`           |
| 8   | `tick_array_upper`         | `Pubkey`           |
| 9   | `personal_position`        | `Pubkey`           |
| 10  | `token_account0`           | `Pubkey`           |
| 11  | `token_account1`           | `Pubkey`           |
| 12  | `token_vault0`             | `Pubkey`           |
| 13  | `token_vault1`             | `Pubkey`           |
| 14  | `rent`                     | `Pubkey`           |
| 15  | `system_program`           | `Pubkey`           |
| 16  | `token_program`            | `Pubkey`           |
| 17  | `associated_token_program` | `Pubkey`           |
| 18  | `metadata_program`         | `Pubkey`           |
| 19… | `remaining`                | `Vec<AccountMeta>` |

### `OpenPositionV2`

> _From the program's IDL:_
>
> `#[deprecated(note = "Use `open_position_with_token22_nft` instead.")]`
> Creates a new position wrapped in a NFT, support Token2022
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `tick_lower_index` - The low boundary of market
> - `tick_upper_index` - The upper boundary of market
> - `tick_array_lower_start_index` - The start index of tick array which
>   include tick low
> - `tick_array_upper_start_index` - The start index of tick array which include tick upper
> - `liquidity` - The liquidity to be added, if zero, and the base_flag is specified, calculate liquidity base amount_0_max or amount_1_max according base_flag, otherwise open position with zero liquidity
> - `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check
> - `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check
> - `with_metadata` - The flag indicating whether to create NFT mint metadata
> - `base_flag` - if the liquidity specified as zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max

Discriminator `4db84ad67056f1c7` · data `OpenPositionV2` · accounts `OpenPositionV2InstructionAccounts`.

| Field                          | Type           |
| ------------------------------ | -------------- |
| `tick_lower_index`             | `i32`          |
| `tick_upper_index`             | `i32`          |
| `tick_array_lower_start_index` | `i32`          |
| `tick_array_upper_start_index` | `i32`          |
| `liquidity`                    | `u128`         |
| `amount0_max`                  | `u64`          |
| `amount1_max`                  | `u64`          |
| `with_metadata`                | `bool`         |
| `base_flag`                    | `Option<bool>` |

Required accounts: 22; extras go to `remaining`.

Fields of `OpenPositionV2InstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `payer`                    | `Pubkey`           |
| 1   | `position_nft_owner`       | `Pubkey`           |
| 2   | `position_nft_mint`        | `Pubkey`           |
| 3   | `position_nft_account`     | `Pubkey`           |
| 4   | `metadata_account`         | `Pubkey`           |
| 5   | `pool_state`               | `Pubkey`           |
| 6   | `protocol_position`        | `Pubkey`           |
| 7   | `tick_array_lower`         | `Pubkey`           |
| 8   | `tick_array_upper`         | `Pubkey`           |
| 9   | `personal_position`        | `Pubkey`           |
| 10  | `token_account0`           | `Pubkey`           |
| 11  | `token_account1`           | `Pubkey`           |
| 12  | `token_vault0`             | `Pubkey`           |
| 13  | `token_vault1`             | `Pubkey`           |
| 14  | `rent`                     | `Pubkey`           |
| 15  | `system_program`           | `Pubkey`           |
| 16  | `token_program`            | `Pubkey`           |
| 17  | `associated_token_program` | `Pubkey`           |
| 18  | `metadata_program`         | `Pubkey`           |
| 19  | `token_program2022`        | `Pubkey`           |
| 20  | `vault0_mint`              | `Pubkey`           |
| 21  | `vault1_mint`              | `Pubkey`           |
| 22… | `remaining`                | `Vec<AccountMeta>` |

### `OpenPositionWithToken22Nft`

> _From the program's IDL:_
>
> Creates a new position wrapped in a Token2022 NFT without relying on metadata_program and metadata_account, reduce the cost for user to create a personal position. # Arguments
>
> - `ctx` - The context of accounts
> - `tick_lower_index` - The low boundary of market
> - `tick_upper_index` - The upper boundary of market
> - `tick_array_lower_start_index` - The start index of tick array which include tick low
> - `tick_array_upper_start_index` - The start index of tick array which include tick upper
> - `liquidity` - The liquidity to be added, if zero, and the base_flag is specified, calculate liquidity base amount_0_max or amount_1_max according base_flag, otherwise open position with zero liquidity
> - `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check
> - `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check
> - `with_metadata` - The flag indicating whether to create NFT mint metadata
> - `base_flag` - if the liquidity specified as zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max

Discriminator `4dffae527d1dc92e` · data `OpenPositionWithToken22Nft` · accounts `OpenPositionWithToken22NftInstructionAccounts`.

| Field                          | Type           |
| ------------------------------ | -------------- |
| `tick_lower_index`             | `i32`          |
| `tick_upper_index`             | `i32`          |
| `tick_array_lower_start_index` | `i32`          |
| `tick_array_upper_start_index` | `i32`          |
| `liquidity`                    | `u128`         |
| `amount0_max`                  | `u64`          |
| `amount1_max`                  | `u64`          |
| `with_metadata`                | `bool`         |
| `base_flag`                    | `Option<bool>` |

Required accounts: 20; extras go to `remaining`.

Fields of `OpenPositionWithToken22NftInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `payer`                    | `Pubkey`           |
| 1   | `position_nft_owner`       | `Pubkey`           |
| 2   | `position_nft_mint`        | `Pubkey`           |
| 3   | `position_nft_account`     | `Pubkey`           |
| 4   | `pool_state`               | `Pubkey`           |
| 5   | `protocol_position`        | `Pubkey`           |
| 6   | `tick_array_lower`         | `Pubkey`           |
| 7   | `tick_array_upper`         | `Pubkey`           |
| 8   | `personal_position`        | `Pubkey`           |
| 9   | `token_account0`           | `Pubkey`           |
| 10  | `token_account1`           | `Pubkey`           |
| 11  | `token_vault0`             | `Pubkey`           |
| 12  | `token_vault1`             | `Pubkey`           |
| 13  | `rent`                     | `Pubkey`           |
| 14  | `system_program`           | `Pubkey`           |
| 15  | `token_program`            | `Pubkey`           |
| 16  | `associated_token_program` | `Pubkey`           |
| 17  | `token_program2022`        | `Pubkey`           |
| 18  | `vault0_mint`              | `Pubkey`           |
| 19  | `vault1_mint`              | `Pubkey`           |
| 20… | `remaining`                | `Vec<AccountMeta>` |

### `SetRewardParams`

> _From the program's IDL:_
>
> Reset reward param, start a new reward cycle or extend the current cycle.
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `reward_index` - The index of reward token in the pool.
> - `emissions_per_second_x64` - The per second emission reward, when extend
>   the current cycle,
>
> new value can't be less than old value
>
> - `open_time` - reward open timestamp, must be set when starting a new cycle
> - `end_time` - reward end timestamp

Discriminator `7034a74b20c9d389` · data `SetRewardParams` · accounts `SetRewardParamsInstructionAccounts`.

| Field                      | Type   |
| -------------------------- | ------ |
| `reward_index`             | `u8`   |
| `emissions_per_second_x64` | `u128` |
| `open_time`                | `u64`  |
| `end_time`                 | `u64`  |

Required accounts: 6; extras go to `remaining`.

Fields of `SetRewardParamsInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `authority`         | `Pubkey`           |
| 1  | `amm_config`        | `Pubkey`           |
| 2  | `pool_state`        | `Pubkey`           |
| 3  | `operation_state`   | `Pubkey`           |
| 4  | `token_program`     | `Pubkey`           |
| 5  | `token_program2022` | `Pubkey`           |
| 6… | `remaining`         | `Vec<AccountMeta>` |

### `Swap`

> _From the program's IDL:_
>
> `#[deprecated(note = "Use `swap_v2` instead.")]`
> Swaps one token for as much as possible of another token across a single pool # Arguments
>
> - `ctx` - The context of accounts
> - `amount` - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)
> - `other_amount_threshold` - For slippage check
> - `sqrt_price_limit` - The Q64.64 sqrt price √P limit. If zero for one, the price cannot
> - `is_base_input` - swap base input or swap base output

Discriminator `f8c69e91e17587c8` · data `Swap` · accounts `SwapInstructionAccounts`.

| Field                    | Type   |
| ------------------------ | ------ |
| `amount`                 | `u64`  |
| `other_amount_threshold` | `u64`  |
| `sqrt_price_limit_x64`   | `u128` |
| `is_base_input`          | `bool` |

Required accounts: 10; extras go to `remaining`.

Fields of `SwapInstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `payer`                | `Pubkey`           |
| 1   | `amm_config`           | `Pubkey`           |
| 2   | `pool_state`           | `Pubkey`           |
| 3   | `input_token_account`  | `Pubkey`           |
| 4   | `output_token_account` | `Pubkey`           |
| 5   | `input_vault`          | `Pubkey`           |
| 6   | `output_vault`         | `Pubkey`           |
| 7   | `observation_state`    | `Pubkey`           |
| 8   | `token_program`        | `Pubkey`           |
| 9   | `tick_array`           | `Pubkey`           |
| 10… | `remaining`            | `Vec<AccountMeta>` |

### `SwapRouterBaseIn`

> _From the program's IDL:_
>
> Swap token for as much as possible of another token across the path provided, base input # Arguments
>
> - `ctx` - The context of accounts
> - `amount_in` - Token amount to be swapped in
> - `amount_out_minimum` - Panic if output amount is below minimum amount. For slippage.

Discriminator `457d73daf5baf2c4` · data `SwapRouterBaseIn` · accounts `SwapRouterBaseInInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `amount_in`          | `u64` |
| `amount_out_minimum` | `u64` |

Required accounts: 6; extras go to `remaining`.

Fields of `SwapRouterBaseInInstructionAccounts`, in account order:

| #  | Field                 | Type               |
| -- | --------------------- | ------------------ |
| 0  | `payer`               | `Pubkey`           |
| 1  | `input_token_account` | `Pubkey`           |
| 2  | `input_token_mint`    | `Pubkey`           |
| 3  | `token_program`       | `Pubkey`           |
| 4  | `token_program2022`   | `Pubkey`           |
| 5  | `memo_program`        | `Pubkey`           |
| 6… | `remaining`           | `Vec<AccountMeta>` |

### `SwapV2`

> _From the program's IDL:_
>
> Swaps one token for as much as possible of another token across a single pool, support token program 2022 # Arguments
>
> - `ctx` - The context of accounts
> - `amount` - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)
> - `other_amount_threshold` - For slippage check
> - `sqrt_price_limit` - The Q64.64 sqrt price √P limit. If zero for one, the price cannot
> - `is_base_input` - swap base input or swap base output

Discriminator `2b04ed0b1ac91e62` · data `SwapV2` · accounts `SwapV2InstructionAccounts`.

| Field                    | Type   |
| ------------------------ | ------ |
| `amount`                 | `u64`  |
| `other_amount_threshold` | `u64`  |
| `sqrt_price_limit_x64`   | `u128` |
| `is_base_input`          | `bool` |

Required accounts: 13; extras go to `remaining`.

Fields of `SwapV2InstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `payer`                | `Pubkey`           |
| 1   | `amm_config`           | `Pubkey`           |
| 2   | `pool_state`           | `Pubkey`           |
| 3   | `input_token_account`  | `Pubkey`           |
| 4   | `output_token_account` | `Pubkey`           |
| 5   | `input_vault`          | `Pubkey`           |
| 6   | `output_vault`         | `Pubkey`           |
| 7   | `observation_state`    | `Pubkey`           |
| 8   | `token_program`        | `Pubkey`           |
| 9   | `token_program2022`    | `Pubkey`           |
| 10  | `memo_program`         | `Pubkey`           |
| 11  | `input_vault_mint`     | `Pubkey`           |
| 12  | `output_vault_mint`    | `Pubkey`           |
| 13… | `remaining`            | `Vec<AccountMeta>` |

### `TogglePermissionlessFarmSwitch`

> _From the program's IDL:_
>
> Toggle the permissionless farm switch account
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `is_on`- Is the permissionless farm allowed or not

Discriminator `967036e9eea10756` · data `TogglePermissionlessFarmSwitch` · accounts `TogglePermissionlessFarmSwitchInstructionAccounts`.

| Field   | Type   |
| ------- | ------ |
| `is_on` | `bool` |

Required accounts: 3; extras go to `remaining`.

Fields of `TogglePermissionlessFarmSwitchInstructionAccounts`, in account order:

| #  | Field                        | Type               |
| -- | ---------------------------- | ------------------ |
| 0  | `owner`                      | `Pubkey`           |
| 1  | `permissionless_farm_switch` | `Pubkey`           |
| 2  | `system_program`             | `Pubkey`           |
| 3… | `remaining`                  | `Vec<AccountMeta>` |

### `TransferRewardOwner`

> _From the program's IDL:_
>
> Transfer reward owner
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `new_owner`- new owner pubkey

Discriminator `07160c53f22b3079` · data `TransferRewardOwner` · accounts `TransferRewardOwnerInstructionAccounts`.

| Field       | Type     |
| ----------- | -------- |
| `new_owner` | `Pubkey` |

Required accounts: 2; extras go to `remaining`.

Fields of `TransferRewardOwnerInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `authority`  | `Pubkey`           |
| 1  | `pool_state` | `Pubkey`           |
| 2… | `remaining`  | `Vec<AccountMeta>` |

### `UpdateAmmConfig`

> _From the program's IDL:_
>
> Updates the owner of the amm config\
> Must be called by the current owner or admin
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `trade_fee_rate`- The new trade fee rate of amm config, be set when
>   `param` is 0
> - `protocol_fee_rate`- The new protocol fee rate of amm config, be set when `param` is 1
> - `fund_fee_rate`- The new fund fee rate of amm config, be set when `param` is 2
> - `new_owner`- The config's new owner, be set when `param` is 3
> - `new_fund_owner`- The config's new fund owner, be set when `param` is 4
> - `param`- The value can be 0 | 1 | 2 | 3 | 4, otherwise will report a error

Discriminator `313cae889a1c74c8` · data `UpdateAmmConfig` · accounts `UpdateAmmConfigInstructionAccounts`.

| Field   | Type  |
| ------- | ----- |
| `param` | `u8`  |
| `value` | `u32` |

Required accounts: 2; extras go to `remaining`.

Fields of `UpdateAmmConfigInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `owner`      | `Pubkey`           |
| 1  | `amm_config` | `Pubkey`           |
| 2… | `remaining`  | `Vec<AccountMeta>` |

### `UpdateOperationAccount`

> _From the program's IDL:_
>
> Update the operation account
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `param`- The value can be 0 | 1 | 2 | 3, otherwise will report a error
> - `keys`- update operation owner when the `param` is 0
>
> remove operation owner when the `param` is 1 update whitelist mint when the `param` is 2 remove whitelist mint when the `param` is 3

Discriminator `7f467728bce33d07` · data `UpdateOperationAccount` · accounts `UpdateOperationAccountInstructionAccounts`.

| Field   | Type          |
| ------- | ------------- |
| `param` | `u8`          |
| `keys`  | `Vec<Pubkey>` |

Required accounts: 3; extras go to `remaining`.

Fields of `UpdateOperationAccountInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `owner`           | `Pubkey`           |
| 1  | `operation_state` | `Pubkey`           |
| 2  | `system_program`  | `Pubkey`           |
| 3… | `remaining`       | `Vec<AccountMeta>` |

### `UpdatePoolStatus`

> _From the program's IDL:_
>
> Update pool status for given value
>
> **Arguments**
>
> - `ctx`- The context of accounts
> - `status` - The value of status

Discriminator `82576c062ee0757b` · data `UpdatePoolStatus` · accounts `UpdatePoolStatusInstructionAccounts`.

| Field    | Type |
| -------- | ---- |
| `status` | `u8` |

Required accounts: 2; extras go to `remaining`.

Fields of `UpdatePoolStatusInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `authority`  | `Pubkey`           |
| 1  | `pool_state` | `Pubkey`           |
| 2… | `remaining`  | `Vec<AccountMeta>` |

### `UpdateRewardInfos`

> _From the program's IDL:_
>
> Update rewards info of the given pool, can be called for everyone
>
> **Arguments**
>
> - `ctx`- The context of accounts

Discriminator `a3ace0340b9a6adf` · data `UpdateRewardInfos` · accounts `UpdateRewardInfosInstructionAccounts`.

No data fields.

Required accounts: 1; extras go to `remaining`.

Fields of `UpdateRewardInfosInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `pool_state` | `Pubkey`           |
| 1… | `remaining`  | `Vec<AccountMeta>` |

### `CpiEvent`

Anchor self-CPI that carries one of the program's [events](#events). `data` is the `CpiEvent` enum.

Discriminator `e445a52e51cb9a1d` · data `CpiEvent` · accounts `CpiEventInstructionAccounts`.

Required accounts: 2; extras go to `remaining`.

Fields of `CpiEventInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `program`         | `Pubkey`           |
| 1  | `event_authority` | `Pubkey`           |
| 2… | `remaining`       | `Vec<AccountMeta>` |

## Accounts

Variants of `PancakeSwapAccount`. Each wraps a boxed struct from `carbon_pancake_swap_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `AmmConfig`

Discriminator `daf42168cbcb2b6f` · `accounts::amm_config::AmmConfig`.

| Field               | Type       | Description                                               |
| ------------------- | ---------- | --------------------------------------------------------- |
| `bump`              | `u8`       | Bump to identify PDA                                      |
| `index`             | `u16`      |                                                           |
| `owner`             | `Pubkey`   | Address of the protocol owner                             |
| `protocol_fee_rate` | `u32`      | The protocol fee                                          |
| `trade_fee_rate`    | `u32`      | The trade fee, denominated in hundredths of a bip (10^-6) |
| `tick_spacing`      | `u16`      | The tick spacing                                          |
| `fund_fee_rate`     | `u32`      | The fund fee, denominated in hundredths of a bip (10^-6)  |
| `padding_u32`       | `u32`      |                                                           |
| `fund_owner`        | `Pubkey`   |                                                           |
| `padding`           | `[u64; 3]` |                                                           |

### `ObservationState`

Discriminator `7aaec5358109a584` · `accounts::observation_state::ObservationState`.

| Field               | Type                                 | Description                                               |
| ------------------- | ------------------------------------ | --------------------------------------------------------- |
| `initialized`       | `bool`                               | Whether the ObservationState is initialized               |
| `recent_epoch`      | `u64`                                | recent update epoch                                       |
| `observation_index` | `u16`                                | the most-recently updated index of the observations array |
| `pool_id`           | `Pubkey`                             | belongs to which pool                                     |
| `observations`      | [`[Observation; 100]`](#observation) | observation array                                         |
| `padding`           | `[u64; 4]`                           | padding for feature update                                |

### `OperationState`

Discriminator `13ec3aed51deb7fc` · `accounts::operation_state::OperationState`.

| Field              | Type            | Description                                  |
| ------------------ | --------------- | -------------------------------------------- |
| `bump`             | `u8`            | Bump to identify PDA                         |
| `operation_owners` | `[Pubkey; 10]`  | Address of the operation owner               |
| `whitelist_mints`  | `[Pubkey; 100]` | The mint address of whitelist to emit reward |

### `PermissionlessFarmSwitch`

Discriminator `255c934efa649389` · `accounts::permissionless_farm_switch::PermissionlessFarmSwitch`.

| Field   | Type   | Description                               |
| ------- | ------ | ----------------------------------------- |
| `bump`  | `u8`   | Bump to identify PDA                      |
| `is_on` | `bool` | Is the permissionless farm allowed or not |

### `PersonalPositionState`

Discriminator `466f967ee60f1975` · `accounts::personal_position_state::PersonalPositionState`.

| Field                         | Type                                             | Description                                                                                       |
| ----------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| `bump`                        | `[u8; 1]`                                        | Bump to identify PDA                                                                              |
| `nft_mint`                    | `Pubkey`                                         | Mint address of the tokenized position                                                            |
| `pool_id`                     | `Pubkey`                                         | The ID of the pool with which this token is connected                                             |
| `tick_lower_index`            | `i32`                                            | The lower bound tick of the position                                                              |
| `tick_upper_index`            | `i32`                                            | The upper bound tick of the position                                                              |
| `liquidity`                   | `u128`                                           | The amount of liquidity owned by this position                                                    |
| `fee_growth_inside0_last_x64` | `u128`                                           | The token_0 fee growth of the aggregate position as of the last action on the individual position |
| `fee_growth_inside1_last_x64` | `u128`                                           | The token_1 fee growth of the aggregate position as of the last action on the individual position |
| `token_fees_owed0`            | `u64`                                            | The fees owed to the position owner in token_0, as of the last computation                        |
| `token_fees_owed1`            | `u64`                                            | The fees owed to the position owner in token_1, as of the last computation                        |
| `reward_infos`                | [`[PositionRewardInfo; 3]`](#positionrewardinfo) |                                                                                                   |
| `recent_epoch`                | `u64`                                            |                                                                                                   |
| `padding`                     | `[u64; 7]`                                       |                                                                                                   |

### `PoolState`

Discriminator `f7ede3f5d7c3de46` · `accounts::pool_state::PoolState`.

| Field                       | Type                             | Description                                                                                                                                                                                                                                                                         |
| --------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bump`                      | `[u8; 1]`                        | Bump to identify PDA                                                                                                                                                                                                                                                                |
| `amm_config`                | `Pubkey`                         |                                                                                                                                                                                                                                                                                     |
| `owner`                     | `Pubkey`                         |                                                                                                                                                                                                                                                                                     |
| `token_mint0`               | `Pubkey`                         | Token pair of the pool, where token_mint_0 address < token_mint_1 address                                                                                                                                                                                                           |
| `token_mint1`               | `Pubkey`                         |                                                                                                                                                                                                                                                                                     |
| `token_vault0`              | `Pubkey`                         | Token pair vault                                                                                                                                                                                                                                                                    |
| `token_vault1`              | `Pubkey`                         |                                                                                                                                                                                                                                                                                     |
| `observation_key`           | `Pubkey`                         | observation account key                                                                                                                                                                                                                                                             |
| `mint_decimals0`            | `u8`                             | mint0 and mint1 decimals                                                                                                                                                                                                                                                            |
| `mint_decimals1`            | `u8`                             |                                                                                                                                                                                                                                                                                     |
| `tick_spacing`              | `u16`                            | The minimum number of ticks between initialized ticks                                                                                                                                                                                                                               |
| `liquidity`                 | `u128`                           | The currently in range liquidity available to the pool.                                                                                                                                                                                                                             |
| `sqrt_price_x64`            | `u128`                           | The current price of the pool as a sqrt(token_1/token_0) Q64.64 value                                                                                                                                                                                                               |
| `tick_current`              | `i32`                            | The current tick of the pool, i.e. according to the last tick transition that was run.                                                                                                                                                                                              |
| `padding3`                  | `u16`                            |                                                                                                                                                                                                                                                                                     |
| `padding4`                  | `u16`                            |                                                                                                                                                                                                                                                                                     |
| `fee_growth_global0_x64`    | `u128`                           | The fee growth as a Q64.64 number, i.e. fees of token_0 and token_1 collected per unit of liquidity for the entire life of the pool.                                                                                                                                                |
| `fee_growth_global1_x64`    | `u128`                           |                                                                                                                                                                                                                                                                                     |
| `protocol_fees_token0`      | `u64`                            | The amounts of token_0 and token_1 that are owed to the protocol.                                                                                                                                                                                                                   |
| `protocol_fees_token1`      | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `swap_in_amount_token0`     | `u128`                           | The amounts in and out of swap token_0 and token_1                                                                                                                                                                                                                                  |
| `swap_out_amount_token1`    | `u128`                           |                                                                                                                                                                                                                                                                                     |
| `swap_in_amount_token1`     | `u128`                           |                                                                                                                                                                                                                                                                                     |
| `swap_out_amount_token0`    | `u128`                           |                                                                                                                                                                                                                                                                                     |
| `status`                    | `u8`                             | Bitwise representation of the state of the pool bit0, 1: disable open position and increase liquidity, 0: normal bit1, 1: disable decrease liquidity, 0: normal bit2, 1: disable collect fee, 0: normal bit3, 1: disable collect reward, 0: normal bit4, 1: disable swap, 0: normal |
| `padding`                   | `[u8; 7]`                        | Leave blank for future use                                                                                                                                                                                                                                                          |
| `reward_infos`              | [`[RewardInfo; 3]`](#rewardinfo) |                                                                                                                                                                                                                                                                                     |
| `tick_array_bitmap`         | `[u64; 16]`                      | Packed initialized tick array state                                                                                                                                                                                                                                                 |
| `total_fees_token0`         | `u64`                            | except protocol_fee and fund_fee                                                                                                                                                                                                                                                    |
| `total_fees_claimed_token0` | `u64`                            | except protocol_fee and fund_fee                                                                                                                                                                                                                                                    |
| `total_fees_token1`         | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `total_fees_claimed_token1` | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `fund_fees_token0`          | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `fund_fees_token1`          | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `open_time`                 | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `recent_epoch`              | `u64`                            |                                                                                                                                                                                                                                                                                     |
| `padding1`                  | `[u64; 24]`                      |                                                                                                                                                                                                                                                                                     |
| `padding2`                  | `[u64; 32]`                      |                                                                                                                                                                                                                                                                                     |

### `ProtocolPositionState`

Discriminator `64e2916392daa06a` · `accounts::protocol_position_state::ProtocolPositionState`.

| Field                         | Type        | Description                                                                                  |
| ----------------------------- | ----------- | -------------------------------------------------------------------------------------------- |
| `bump`                        | `u8`        | Bump to identify PDA                                                                         |
| `pool_id`                     | `Pubkey`    | The ID of the pool with which this token is connected                                        |
| `tick_lower_index`            | `i32`       | The lower bound tick of the position                                                         |
| `tick_upper_index`            | `i32`       | The upper bound tick of the position                                                         |
| `liquidity`                   | `u128`      | The amount of liquidity owned by this position                                               |
| `fee_growth_inside0_last_x64` | `u128`      | The token_0 fee growth per unit of liquidity as of the last update to liquidity or fees owed |
| `fee_growth_inside1_last_x64` | `u128`      | The token_1 fee growth per unit of liquidity as of the last update to liquidity or fees owed |
| `token_fees_owed0`            | `u64`       | The fees owed to the position owner in token_0                                               |
| `token_fees_owed1`            | `u64`       | The fees owed to the position owner in token_1                                               |
| `reward_growth_inside`        | `[u128; 3]` | The reward growth per unit of liquidity as of the last update to liquidity                   |
| `recent_epoch`                | `u64`       |                                                                                              |
| `padding`                     | `[u64; 7]`  |                                                                                              |

### `SupportMintAssociated`

Discriminator `8628b74f0c70a235` · `accounts::support_mint_associated::SupportMintAssociated`.

| Field     | Type       | Description                           |
| --------- | ---------- | ------------------------------------- |
| `bump`    | `u8`       | Bump to identify PDA                  |
| `mint`    | `Pubkey`   | Address of the supported token22 mint |
| `padding` | `[u64; 8]` |                                       |

### `TickArrayBitmapExtension`

Discriminator `3c9624db61808b99` · `accounts::tick_array_bitmap_extension::TickArrayBitmapExtension`.

| Field                        | Type             | Description                                                          |
| ---------------------------- | ---------------- | -------------------------------------------------------------------- |
| `pool_id`                    | `Pubkey`         |                                                                      |
| `positive_tick_array_bitmap` | `[[u64; 8]; 14]` | Packed initialized tick array state for start_tick_index is positive |
| `negative_tick_array_bitmap` | `[[u64; 8]; 14]` | Packed initialized tick array state for start_tick_index is negitive |

### `TickArrayState`

Discriminator `c09b55cd31f9812a` · `accounts::tick_array_state::TickArrayState`.

| Field                    | Type                            |
| ------------------------ | ------------------------------- |
| `pool_id`                | `Pubkey`                        |
| `start_tick_index`       | `i32`                           |
| `ticks`                  | [`[TickState; 60]`](#tickstate) |
| `initialized_tick_count` | `u8`                            |
| `recent_epoch`           | `u64`                           |
| `padding`                | `[u8; 107]`                     |

## Events

Variants of `instructions::CpiEvent`, decoded from the `CpiEvent` instruction. Each wraps a struct from `carbon_pancake_swap_decoder::events::<module>`. The discriminator is the 8-byte event discriminator that follows the `e445a52e51cb9a1d` CPI-event tag.

### `CollectPersonalFeeEvent`

Discriminator `a6ae69c051a15369` · `events::collect_personal_fee_event::CollectPersonalFeeEventEvent`.

| Field                      | Type     | Description                                                    |
| -------------------------- | -------- | -------------------------------------------------------------- |
| `position_nft_mint`        | `Pubkey` | The ID of the token for which underlying tokens were collected |
| `recipient_token_account0` | `Pubkey` | The token account that received the collected token_0 tokens   |
| `recipient_token_account1` | `Pubkey` | The token account that received the collected token_1 tokens   |
| `amount0`                  | `u64`    | The amount of token_0 owed to the position that was collected  |
| `amount1`                  | `u64`    | The amount of token_1 owed to the position that was collected  |

### `CollectProtocolFeeEvent`

Discriminator `ce57114f2d29d53d` · `events::collect_protocol_fee_event::CollectProtocolFeeEventEvent`.

| Field                      | Type     | Description                                                   |
| -------------------------- | -------- | ------------------------------------------------------------- |
| `pool_state`               | `Pubkey` | The pool whose protocol fee is collected                      |
| `recipient_token_account0` | `Pubkey` | The address that receives the collected token_0 protocol fees |
| `recipient_token_account1` | `Pubkey` | The address that receives the collected token_1 protocol fees |
| `amount0`                  | `u64`    | The amount of token_0 protocol fees that is withdrawn         |
| `amount1`                  | `u64`    | The amount of token_0 protocol fees that is withdrawn         |

### `ConfigChangeEvent`

Discriminator `f7bd07776a705f97` · `events::config_change_event::ConfigChangeEventEvent`.

| Field               | Type     |
| ------------------- | -------- |
| `index`             | `u16`    |
| `owner`             | `Pubkey` |
| `protocol_fee_rate` | `u32`    |
| `trade_fee_rate`    | `u32`    |
| `tick_spacing`      | `u16`    |
| `fund_fee_rate`     | `u32`    |
| `fund_owner`        | `Pubkey` |

### `CreatePersonalPositionEvent`

Discriminator `641e57f9c4df9ace` · `events::create_personal_position_event::CreatePersonalPositionEventEvent`.

| Field                          | Type     | Description                                                     |
| ------------------------------ | -------- | --------------------------------------------------------------- |
| `pool_state`                   | `Pubkey` | The pool for which liquidity was added                          |
| `minter`                       | `Pubkey` | The address that create the position                            |
| `nft_owner`                    | `Pubkey` | The owner of the position and recipient of any minted liquidity |
| `tick_lower_index`             | `i32`    | The lower tick of the position                                  |
| `tick_upper_index`             | `i32`    | The upper tick of the position                                  |
| `liquidity`                    | `u128`   | The amount of liquidity minted to the position range            |
| `deposit_amount0`              | `u64`    | The amount of token_0 was deposit for the liquidity             |
| `deposit_amount1`              | `u64`    | The amount of token_1 was deposit for the liquidity             |
| `deposit_amount0_transfer_fee` | `u64`    | The token transfer fee for deposit_amount_0                     |
| `deposit_amount1_transfer_fee` | `u64`    | The token transfer fee for deposit_amount_1                     |

### `DecreaseLiquidityEvent`

Discriminator `3ade563a44325538` · `events::decrease_liquidity_event::DecreaseLiquidityEventEvent`.

| Field               | Type       | Description                                                       |
| ------------------- | ---------- | ----------------------------------------------------------------- |
| `position_nft_mint` | `Pubkey`   | The ID of the token for which liquidity was decreased             |
| `liquidity`         | `u128`     | The amount by which liquidity for the position was decreased      |
| `decrease_amount0`  | `u64`      | The amount of token_0 that was paid for the decrease in liquidity |
| `decrease_amount1`  | `u64`      | The amount of token_1 that was paid for the decrease in liquidity |
| `fee_amount0`       | `u64`      |                                                                   |
| `fee_amount1`       | `u64`      | The amount of token_1 fee                                         |
| `reward_amounts`    | `[u64; 3]` | The amount of rewards                                             |
| `transfer_fee0`     | `u64`      | The amount of token_0 transfer fee                                |
| `transfer_fee1`     | `u64`      | The amount of token_1 transfer fee                                |

### `IncreaseLiquidityEvent`

Discriminator `314f69d420221e54` · `events::increase_liquidity_event::IncreaseLiquidityEventEvent`.

| Field                  | Type     | Description                                                       |
| ---------------------- | -------- | ----------------------------------------------------------------- |
| `position_nft_mint`    | `Pubkey` | The ID of the token for which liquidity was increased             |
| `liquidity`            | `u128`   | The amount by which liquidity for the NFT position was increased  |
| `amount0`              | `u64`    | The amount of token_0 that was paid for the increase in liquidity |
| `amount1`              | `u64`    | The amount of token_1 that was paid for the increase in liquidity |
| `amount0_transfer_fee` | `u64`    | The token transfer fee for amount_0                               |
| `amount1_transfer_fee` | `u64`    | The token transfer fee for amount_1                               |

### `LiquidityCalculateEvent`

Discriminator `ed7094e63954b4a2` · `events::liquidity_calculate_event::LiquidityCalculateEventEvent`.

| Field                 | Type   | Description                                                                         |
| --------------------- | ------ | ----------------------------------------------------------------------------------- |
| `pool_liquidity`      | `u128` | The pool liquidity before decrease or increase                                      |
| `pool_sqrt_price_x64` | `u128` | The pool price when decrease or increase in liquidity                               |
| `pool_tick`           | `i32`  | The pool tick when decrease or increase in liquidity                                |
| `calc_amount0`        | `u64`  | The amount of token_0 that was calculated for the decrease or increase in liquidity |
| `calc_amount1`        | `u64`  | The amount of token_1 that was calculated for the decrease or increase in liquidity |
| `trade_fee_owed0`     | `u64`  |                                                                                     |
| `trade_fee_owed1`     | `u64`  | The amount of token_1 fee                                                           |
| `transfer_fee0`       | `u64`  | The amount of token_0 transfer fee without trade_fee_amount_0                       |
| `transfer_fee1`       | `u64`  | The amount of token_1 transfer fee without trade_fee_amount_0                       |

### `LiquidityChangeEvent`

Discriminator `7ef0afce9e58996b` · `events::liquidity_change_event::LiquidityChangeEventEvent`.

| Field              | Type     | Description                                       |
| ------------------ | -------- | ------------------------------------------------- |
| `pool_state`       | `Pubkey` | The pool for swap                                 |
| `tick`             | `i32`    | The tick of the pool                              |
| `tick_lower`       | `i32`    | The tick lower of position                        |
| `tick_upper`       | `i32`    | The tick lower of position                        |
| `liquidity_before` | `u128`   | The liquidity of the pool before liquidity change |
| `liquidity_after`  | `u128`   | The liquidity of the pool after liquidity change  |

### `PoolCreatedEvent`

Discriminator `195e4b2f7063353f` · `events::pool_created_event::PoolCreatedEventEvent`.

| Field            | Type     | Description                                                                          |
| ---------------- | -------- | ------------------------------------------------------------------------------------ |
| `token_mint0`    | `Pubkey` | The first token of the pool by address sort order                                    |
| `token_mint1`    | `Pubkey` | The second token of the pool by address sort order                                   |
| `tick_spacing`   | `u16`    | The minimum number of ticks between initialized ticks                                |
| `pool_state`     | `Pubkey` | The address of the created pool                                                      |
| `sqrt_price_x64` | `u128`   | The initial sqrt price of the pool, as a Q64.64                                      |
| `tick`           | `i32`    | The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool |
| `token_vault0`   | `Pubkey` | Vault of token_0                                                                     |
| `token_vault1`   | `Pubkey` | Vault of token_1                                                                     |

### `SwapEvent`

Discriminator `40c6cde8260871e2` · `events::swap_event::SwapEventEvent`.

| Field            | Type     | Description                                                                                         |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------- |
| `pool_state`     | `Pubkey` | The pool for which token_0 and token_1 were swapped                                                 |
| `sender`         | `Pubkey` | The address that initiated the swap call, and that received the callback                            |
| `token_account0` | `Pubkey` | The payer token account in zero for one swaps, or the recipient token account in one for zero swaps |
| `token_account1` | `Pubkey` | The payer token account in one for zero swaps, or the recipient token account in zero for one swaps |
| `amount0`        | `u64`    | The real delta amount of the token_0 of the pool or user                                            |
| `transfer_fee0`  | `u64`    | The transfer fee charged by the withheld_amount of the token_0                                      |
| `amount1`        | `u64`    | The real delta of the token_1 of the pool or user                                                   |
| `transfer_fee1`  | `u64`    | The transfer fee charged by the withheld_amount of the token_1                                      |
| `zero_for_one`   | `bool`   | if true, amount_0 is negtive and amount_1 is positive                                               |
| `sqrt_price_x64` | `u128`   | The sqrt(price) of the pool after the swap, as a Q64.64                                             |
| `liquidity`      | `u128`   | The liquidity of the pool after the swap                                                            |
| `tick`           | `i32`    | The log base 1.0001 of price of the pool after the swap                                             |

### `UpdateRewardInfosEvent`

Discriminator `6d7fba4e724125ec` · `events::update_reward_infos_event::UpdateRewardInfosEventEvent`.

| Field                      | Type        | Description |
| -------------------------- | ----------- | ----------- |
| `reward_growth_global_x64` | `[u128; 3]` | Reward info |

## Types

Types used by the instructions, accounts and events above, exported from `carbon_pancake_swap_decoder::types`.

### `CollectPersonalFeeEvent`

> _From the program's IDL:_
>
> Emitted when tokens are collected for a position

Struct `types::CollectPersonalFeeEvent`. Same fields as the [`CollectPersonalFeeEvent`](#collectpersonalfeeevent) event.

### `CollectProtocolFeeEvent`

> _From the program's IDL:_
>
> Emitted when the collected protocol fees are withdrawn by the factory owner

Struct `types::CollectProtocolFeeEvent`. Same fields as the [`CollectProtocolFeeEvent`](#collectprotocolfeeevent) event.

### `ConfigChangeEvent`

> _From the program's IDL:_
>
> Emitted when create or update a config

Struct `types::ConfigChangeEvent`. Same fields as the [`ConfigChangeEvent`](#configchangeevent) event.

### `CreatePersonalPositionEvent`

> _From the program's IDL:_
>
> Emitted when create a new position

Struct `types::CreatePersonalPositionEvent`. Same fields as the [`CreatePersonalPositionEvent`](#createpersonalpositionevent) event.

### `DecreaseLiquidityEvent`

> _From the program's IDL:_
>
> Emitted when liquidity is decreased.

Struct `types::DecreaseLiquidityEvent`. Same fields as the [`DecreaseLiquidityEvent`](#decreaseliquidityevent) event.

### `IncreaseLiquidityEvent`

> _From the program's IDL:_
>
> Emitted when liquidity is increased.

Struct `types::IncreaseLiquidityEvent`. Same fields as the [`IncreaseLiquidityEvent`](#increaseliquidityevent) event.

### `InitializeRewardParam`

Struct `types::InitializeRewardParam`.

| Field                      | Type   | Description                                              |
| -------------------------- | ------ | -------------------------------------------------------- |
| `open_time`                | `u64`  | Reward open time                                         |
| `end_time`                 | `u64`  | Reward end time                                          |
| `emissions_per_second_x64` | `u128` | Token reward per second are earned per unit of liquidity |

### `LiquidityCalculateEvent`

> _From the program's IDL:_
>
> Emitted when liquidity decreased or increase.

Struct `types::LiquidityCalculateEvent`. Same fields as the [`LiquidityCalculateEvent`](#liquiditycalculateevent) event.

### `LiquidityChangeEvent`

> _From the program's IDL:_
>
> Emitted pool liquidity change when increase and decrease liquidity

Struct `types::LiquidityChangeEvent`. Same fields as the [`LiquidityChangeEvent`](#liquiditychangeevent) event.

### `Observation`

> _From the program's IDL:_
>
> The element of observations in ObservationState

Struct `types::Observation`.

| Field             | Type       | Description                                     |
| ----------------- | ---------- | ----------------------------------------------- |
| `block_timestamp` | `u32`      | The block timestamp of the observation          |
| `tick_cumulative` | `i64`      | the cumulative of tick during the duration time |
| `padding`         | `[u64; 4]` | padding for feature update                      |

### `PoolCreatedEvent`

> _From the program's IDL:_
>
> Emitted when a pool is created and initialized with a starting price

Struct `types::PoolCreatedEvent`. Same fields as the [`PoolCreatedEvent`](#poolcreatedevent) event.

### `PositionRewardInfo`

Struct `types::PositionRewardInfo`.

| Field                    | Type   |
| ------------------------ | ------ |
| `growth_inside_last_x64` | `u128` |
| `reward_amount_owed`     | `u64`  |

### `RewardInfo`

Struct `types::RewardInfo`.

| Field                      | Type     | Description                                                                                                        |
| -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| `reward_state`             | `u8`     | Reward state                                                                                                       |
| `open_time`                | `u64`    | Reward open time                                                                                                   |
| `end_time`                 | `u64`    | Reward end time                                                                                                    |
| `last_update_time`         | `u64`    | Reward last update time                                                                                            |
| `emissions_per_second_x64` | `u128`   | Q64.64 number indicates how many tokens per second are earned per unit of liquidity.                               |
| `reward_total_emissioned`  | `u64`    | The total amount of reward emissioned                                                                              |
| `reward_claimed`           | `u64`    | The total amount of claimed reward                                                                                 |
| `token_mint`               | `Pubkey` | Reward token mint.                                                                                                 |
| `token_vault`              | `Pubkey` | Reward vault token account.                                                                                        |
| `authority`                | `Pubkey` | The owner that has permission to set reward param                                                                  |
| `reward_growth_global_x64` | `u128`   | Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward emissions were turned on. |

### `SwapEvent`

> _From the program's IDL:_
>
> Emitted by when a swap is performed for a pool

Struct `types::SwapEvent`. Same fields as the [`SwapEvent`](#swapevent) event.

### `TickState`

Struct `types::TickState`.

| Field                        | Type        | Description                                                                                                                                                                                  |
| ---------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tick`                       | `i32`       |                                                                                                                                                                                              |
| `liquidity_net`              | `i128`      | Amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left)                                                                                           |
| `liquidity_gross`            | `u128`      | The total position liquidity that references this tick                                                                                                                                       |
| `fee_growth_outside0_x64`    | `u128`      | Fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick) only has relative meaning, not absolute — the value depends on when the tick is initialized |
| `fee_growth_outside1_x64`    | `u128`      |                                                                                                                                                                                              |
| `reward_growths_outside_x64` | `[u128; 3]` |                                                                                                                                                                                              |
| `padding`                    | `[u32; 13]` |                                                                                                                                                                                              |

### `UpdateRewardInfosEvent`

> _From the program's IDL:_
>
> Emitted when Reward are updated for a pool

Struct `types::UpdateRewardInfosEvent`. Same fields as the [`UpdateRewardInfosEvent`](#updaterewardinfosevent) event.

---

Carbon 2.0.0 documentation · Web: https://carbon.sevenlabs.org/decoders/pancake-swap · Last updated 2026-11-09 · Index of all pages: https://carbon.sevenlabs.org/llms.txt
