# Orca Whirlpools decoder (Carbon 2.0)

> Decode Orca Whirlpools instructions, accounts and events in Rust with the carbon-orca-whirlpool-decoder crate.

`carbon-orca-whirlpool-decoder` decodes the instructions, accounts and events of the Orca Whirlpools program (`whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc`): 66 instructions, 12 account types, 6 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-orca-whirlpool-decoder`](https://crates.io/crates/carbon-orca-whirlpool-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-orca-whirlpool-decoder@2.0.0`                                                                       |
| Program ID       | `whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc` (`carbon_orca_whirlpool_decoder::PROGRAM_ID`)                           |
| Category         | [DEX & AMM](https://carbon.sevenlabs.org/decoders/dex-and-amm.md)                                                     |
| Decoder          | `carbon_orca_whirlpool_decoder::OrcaWhirlpoolDecoder`                                                                 |
| Instruction enum | `instructions::OrcaWhirlpoolInstruction`                                                                              |
| Account enum     | `accounts::OrcaWhirlpoolAccount`                                                                                      |
| Event enum       | `instructions::CpiEvent`                                                                                              |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                              |
| API docs         | [docs.rs/carbon-orca-whirlpool-decoder/2.0.0](https://docs.rs/carbon-orca-whirlpool-decoder/2.0.0)                    |
| Source           | [decoders/orca-whirlpool-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/orca-whirlpool-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), [PancakeSwap](https://carbon.sevenlabs.org/decoders/pancake-swap.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 Orca Whirlpools transactions from the public RPC and prints every decoded `Swap` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-orca-whirlpool-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_orca_whirlpool_decoder::{
        instructions::OrcaWhirlpoolInstruction, OrcaWhirlpoolDecoder, 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(OrcaWhirlpoolDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, OrcaWhirlpoolInstruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, OrcaWhirlpoolInstruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let OrcaWhirlpoolInstruction::Swap { data, accounts, .. } = input.decoded_instruction {
            println!("swap {signature}: {data:?} token_program={}", accounts.token_program);
        }
        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 `OrcaWhirlpoolInstruction::CpiEvent { data: CpiEvent::LiquidityDecreased(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 `Whirlpool` 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_orca_whirlpool_decoder::{
        accounts::OrcaWhirlpoolAccount, OrcaWhirlpoolDecoder, 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(OrcaWhirlpoolDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

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

Each update to a `Whirlpool` 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 `OrcaWhirlpoolInstruction`. Each is `OrcaWhirlpoolInstruction::<Variant> { program_id, data, accounts }`, where `data` and `accounts` are the types listed under the variant, exported from `carbon_orca_whirlpool_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 `whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc`.
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.

### `CloseBundledPosition`

> _From the program's IDL:_
>
> Close a bundled position in a Whirlpool.
>
> **Authority**
>
> - `position_bundle_authority` - authority that owns the token corresponding
>   to this desired position bundle.
>
> **Parameters**
>
> - `bundle_index` - The bundle index that we'd like to close.
>
> **Special Errors**
>
> - `InvalidBundleIndex` - If the provided bundle index is out of bounds.
> - `ClosePositionNotEmpty` - The provided position account is not empty.

Discriminator `2924d8f51b556743` · data `CloseBundledPosition` · accounts `CloseBundledPositionInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `bundle_index` | `u16` |

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

Fields of `CloseBundledPositionInstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `bundled_position`              | `Pubkey`           |
| 1  | `position_bundle`               | `Pubkey`           |
| 2  | `position_bundle_token_account` | `Pubkey`           |
| 3  | `position_bundle_authority`     | `Pubkey`           |
| 4  | `receiver`                      | `Pubkey`           |
| 5… | `remaining`                     | `Vec<AccountMeta>` |

### `ClosePosition`

> _From the program's IDL:_
>
> Close a position in a Whirlpool. Burns the position token in the owner's wallet. ### Authority
>
> - "position_authority" - The authority that owns the position token.
>
> **Special Errors**
>
> - `ClosePositionNotEmpty` - The provided position account is not empty.

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  | `position_authority`     | `Pubkey`           |
| 1  | `receiver`               | `Pubkey`           |
| 2  | `position`               | `Pubkey`           |
| 3  | `position_mint`          | `Pubkey`           |
| 4  | `position_token_account` | `Pubkey`           |
| 5  | `token_program`          | `Pubkey`           |
| 6… | `remaining`              | `Vec<AccountMeta>` |

### `ClosePositionWithTokenExtensions`

> _From the program's IDL:_
>
> Close a position in a Whirlpool. Burns the position token in the owner's wallet. Mint and TokenAccount are based on Token-2022. And Mint accout will be also closed. ### Authority
>
> - "position_authority" - The authority that owns the position token.
>
> **Special Errors**
>
> - `ClosePositionNotEmpty` - The provided position account is not empty.

Discriminator `01b6873b9b1963df` · data `ClosePositionWithTokenExtensions` · accounts `ClosePositionWithTokenExtensionsInstructionAccounts`.

No data fields.

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

Fields of `ClosePositionWithTokenExtensionsInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `position_authority`     | `Pubkey`           |
| 1  | `receiver`               | `Pubkey`           |
| 2  | `position`               | `Pubkey`           |
| 3  | `position_mint`          | `Pubkey`           |
| 4  | `position_token_account` | `Pubkey`           |
| 5  | `token2022_program`      | `Pubkey`           |
| 6… | `remaining`              | `Vec<AccountMeta>` |

### `CollectFees`

> _From the program's IDL:_
>
> Collect fees accrued for this position.
>
> **Authority**
>
> - `position_authority` - authority that owns the token corresponding to this
>   desired position.

Discriminator `a498cf631eba13b6` · data `CollectFees` · accounts `CollectFeesInstructionAccounts`.

No data fields.

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

Fields of `CollectFeesInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `whirlpool`              | `Pubkey`           |
| 1  | `position_authority`     | `Pubkey`           |
| 2  | `position`               | `Pubkey`           |
| 3  | `position_token_account` | `Pubkey`           |
| 4  | `token_owner_account_a`  | `Pubkey`           |
| 5  | `token_vault_a`          | `Pubkey`           |
| 6  | `token_owner_account_b`  | `Pubkey`           |
| 7  | `token_vault_b`          | `Pubkey`           |
| 8  | `token_program`          | `Pubkey`           |
| 9… | `remaining`              | `Vec<AccountMeta>` |

### `CollectFeesV2`

> _From the program's IDL:_
>
> Collect fees accrued for this position.\
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - `position_authority` - authority that owns the token corresponding to this
>   desired position.

Discriminator `cf755fbfe5b4e20f` · data `CollectFeesV2` · accounts `CollectFeesV2InstructionAccounts`.

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `CollectFeesV2InstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `whirlpool`              | `Pubkey`           |
| 1   | `position_authority`     | `Pubkey`           |
| 2   | `position`               | `Pubkey`           |
| 3   | `position_token_account` | `Pubkey`           |
| 4   | `token_mint_a`           | `Pubkey`           |
| 5   | `token_mint_b`           | `Pubkey`           |
| 6   | `token_owner_account_a`  | `Pubkey`           |
| 7   | `token_vault_a`          | `Pubkey`           |
| 8   | `token_owner_account_b`  | `Pubkey`           |
| 9   | `token_vault_b`          | `Pubkey`           |
| 10  | `token_program_a`        | `Pubkey`           |
| 11  | `token_program_b`        | `Pubkey`           |
| 12  | `memo_program`           | `Pubkey`           |
| 13… | `remaining`              | `Vec<AccountMeta>` |

### `CollectProtocolFees`

> _From the program's IDL:_
>
> Collect the protocol fees accrued in this Whirlpool
>
> **Authority**
>
> - `collect_protocol_fees_authority` - assigned authority in the
>   WhirlpoolConfig that can collect protocol fees

Discriminator `1643176296b246dc` · data `CollectProtocolFees` · accounts `CollectProtocolFeesInstructionAccounts`.

No data fields.

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

Fields of `CollectProtocolFeesInstructionAccounts`, in account order:

| #  | Field                             | Type               |
| -- | --------------------------------- | ------------------ |
| 0  | `whirlpools_config`               | `Pubkey`           |
| 1  | `whirlpool`                       | `Pubkey`           |
| 2  | `collect_protocol_fees_authority` | `Pubkey`           |
| 3  | `token_vault_a`                   | `Pubkey`           |
| 4  | `token_vault_b`                   | `Pubkey`           |
| 5  | `token_destination_a`             | `Pubkey`           |
| 6  | `token_destination_b`             | `Pubkey`           |
| 7  | `token_program`                   | `Pubkey`           |
| 8… | `remaining`                       | `Vec<AccountMeta>` |

### `CollectProtocolFeesV2`

> _From the program's IDL:_
>
> Collect the protocol fees accrued in this Whirlpool\
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - `collect_protocol_fees_authority` - assigned authority in the
>   WhirlpoolConfig that can collect protocol fees

Discriminator `6780de8672c816c8` · data `CollectProtocolFeesV2` · accounts `CollectProtocolFeesV2InstructionAccounts`.

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `CollectProtocolFeesV2InstructionAccounts`, in account order:

| #   | Field                             | Type               |
| --- | --------------------------------- | ------------------ |
| 0   | `whirlpools_config`               | `Pubkey`           |
| 1   | `whirlpool`                       | `Pubkey`           |
| 2   | `collect_protocol_fees_authority` | `Pubkey`           |
| 3   | `token_mint_a`                    | `Pubkey`           |
| 4   | `token_mint_b`                    | `Pubkey`           |
| 5   | `token_vault_a`                   | `Pubkey`           |
| 6   | `token_vault_b`                   | `Pubkey`           |
| 7   | `token_destination_a`             | `Pubkey`           |
| 8   | `token_destination_b`             | `Pubkey`           |
| 9   | `token_program_a`                 | `Pubkey`           |
| 10  | `token_program_b`                 | `Pubkey`           |
| 11  | `memo_program`                    | `Pubkey`           |
| 12… | `remaining`                       | `Vec<AccountMeta>` |

### `CollectReward`

> _From the program's IDL:_
>
> Collect rewards accrued for this position.
>
> **Authority**
>
> - `position_authority` - authority that owns the token corresponding to this
>   desired position.

Discriminator `4605845756ebb122` · data `CollectReward` · accounts `CollectRewardInstructionAccounts`.

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

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

Fields of `CollectRewardInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `whirlpool`              | `Pubkey`           |
| 1  | `position_authority`     | `Pubkey`           |
| 2  | `position`               | `Pubkey`           |
| 3  | `position_token_account` | `Pubkey`           |
| 4  | `reward_owner_account`   | `Pubkey`           |
| 5  | `reward_vault`           | `Pubkey`           |
| 6  | `token_program`          | `Pubkey`           |
| 7… | `remaining`              | `Vec<AccountMeta>` |

### `CollectRewardV2`

> _From the program's IDL:_
>
> Collect rewards accrued for this position.\
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - `position_authority` - authority that owns the token corresponding to this
>   desired position.

Discriminator `b16b25b4a01331d1` · data `CollectRewardV2` · accounts `CollectRewardV2InstructionAccounts`.

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `reward_index`            | `u8`                                                      |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `CollectRewardV2InstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `whirlpool`              | `Pubkey`           |
| 1  | `position_authority`     | `Pubkey`           |
| 2  | `position`               | `Pubkey`           |
| 3  | `position_token_account` | `Pubkey`           |
| 4  | `reward_owner_account`   | `Pubkey`           |
| 5  | `reward_mint`            | `Pubkey`           |
| 6  | `reward_vault`           | `Pubkey`           |
| 7  | `reward_token_program`   | `Pubkey`           |
| 8  | `memo_program`           | `Pubkey`           |
| 9… | `remaining`              | `Vec<AccountMeta>` |

### `DecreaseLiquidity`

> _From the program's IDL:_
>
> Withdraw liquidity from a position in the Whirlpool. This call also updates the position's accrued fees and rewards. ### Authority
>
> - `position_authority` - authority that owns the token corresponding to this desired position.
>
> **Parameters**
>
> - `liquidity_amount` - The total amount of Liquidity the user desires to
>   withdraw.
> - `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.
> - `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.
>
> **Special Errors**
>
> - `LiquidityZero` - Provided liquidity amount is zero.
> - `LiquidityTooHigh` - Provided liquidity exceeds u128::max.
> - `TokenMinSubceeded` - The required token to perform this operation
>   subceeds the user defined amount.

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

| Field              | Type   |
| ------------------ | ------ |
| `liquidity_amount` | `u128` |
| `token_min_a`      | `u64`  |
| `token_min_b`      | `u64`  |

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

Fields of `DecreaseLiquidityInstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `whirlpool`              | `Pubkey`           |
| 1   | `token_program`          | `Pubkey`           |
| 2   | `position_authority`     | `Pubkey`           |
| 3   | `position`               | `Pubkey`           |
| 4   | `position_token_account` | `Pubkey`           |
| 5   | `token_owner_account_a`  | `Pubkey`           |
| 6   | `token_owner_account_b`  | `Pubkey`           |
| 7   | `token_vault_a`          | `Pubkey`           |
| 8   | `token_vault_b`          | `Pubkey`           |
| 9   | `tick_array_lower`       | `Pubkey`           |
| 10  | `tick_array_upper`       | `Pubkey`           |
| 11… | `remaining`              | `Vec<AccountMeta>` |

### `DecreaseLiquidityV2`

> _From the program's IDL:_
>
> Withdraw liquidity from a position in the Whirlpool. This call also updates the position's accrued fees and rewards. This instruction works with both\
> Token and Token-2022. ### Authority
>
> - `position_authority` - authority that owns the token corresponding to this desired position.
>
> **Parameters**
>
> - `liquidity_amount` - The total amount of Liquidity the user desires to
>   withdraw.
> - `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.
> - `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.
>
> **Special Errors**
>
> - `LiquidityZero` - Provided liquidity amount is zero.
> - `LiquidityTooHigh` - Provided liquidity exceeds u128::max.
> - `TokenMinSubceeded` - The required token to perform this operation
>   subceeds the user defined amount.

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

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `liquidity_amount`        | `u128`                                                    |
| `token_min_a`             | `u64`                                                     |
| `token_min_b`             | `u64`                                                     |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `DecreaseLiquidityV2InstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `whirlpool`              | `Pubkey`           |
| 1   | `token_program_a`        | `Pubkey`           |
| 2   | `token_program_b`        | `Pubkey`           |
| 3   | `memo_program`           | `Pubkey`           |
| 4   | `position_authority`     | `Pubkey`           |
| 5   | `position`               | `Pubkey`           |
| 6   | `position_token_account` | `Pubkey`           |
| 7   | `token_mint_a`           | `Pubkey`           |
| 8   | `token_mint_b`           | `Pubkey`           |
| 9   | `token_owner_account_a`  | `Pubkey`           |
| 10  | `token_owner_account_b`  | `Pubkey`           |
| 11  | `token_vault_a`          | `Pubkey`           |
| 12  | `token_vault_b`          | `Pubkey`           |
| 13  | `tick_array_lower`       | `Pubkey`           |
| 14  | `tick_array_upper`       | `Pubkey`           |
| 15… | `remaining`              | `Vec<AccountMeta>` |

### `DeletePositionBundle`

> _From the program's IDL:_
>
> Delete a PositionBundle account. Burns the position bundle token in the owner's wallet. ### Authority
>
> - `position_bundle_owner` - The owner that owns the position bundle token.
>
> **Special Errors**
>
> - `PositionBundleNotDeletable` - The provided position bundle has open
>   positions.

Discriminator `64196302d9ef7cad` · data `DeletePositionBundle` · accounts `DeletePositionBundleInstructionAccounts`.

No data fields.

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

Fields of `DeletePositionBundleInstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `position_bundle`               | `Pubkey`           |
| 1  | `position_bundle_mint`          | `Pubkey`           |
| 2  | `position_bundle_token_account` | `Pubkey`           |
| 3  | `position_bundle_owner`         | `Pubkey`           |
| 4  | `receiver`                      | `Pubkey`           |
| 5  | `token_program`                 | `Pubkey`           |
| 6… | `remaining`                     | `Vec<AccountMeta>` |

### `DeleteTokenBadge`

> _From the program's IDL:_
>
> Delete a TokenBadge account.
>
> **Authority**
>
> - "token_badge_authority" - Set authority in the WhirlpoolConfigExtension
>
> **Special Errors**
>
> - `FeatureIsNotEnabled` - If the feature flag for token badges is not
>   enabled.

Discriminator `35924408127511b9` · data `DeleteTokenBadge` · accounts `DeleteTokenBadgeInstructionAccounts`.

No data fields.

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

Fields of `DeleteTokenBadgeInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `whirlpools_config`           | `Pubkey`           |
| 1  | `whirlpools_config_extension` | `Pubkey`           |
| 2  | `token_badge_authority`       | `Pubkey`           |
| 3  | `token_mint`                  | `Pubkey`           |
| 4  | `token_badge`                 | `Pubkey`           |
| 5  | `receiver`                    | `Pubkey`           |
| 6… | `remaining`                   | `Vec<AccountMeta>` |

### `IdlInclude`

Discriminator `dffd79793cc1811f` · data `IdlInclude` · accounts `IdlIncludeInstructionAccounts`.

No data fields.

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

Fields of `IdlIncludeInstructionAccounts`, in account order:

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

### `IncreaseLiquidity`

> _From the program's IDL:_
>
> Add liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards. ### Authority
>
> - `position_authority` - authority that owns the token corresponding to this desired position.
>
> **Parameters**
>
> - `liquidity_amount` - The total amount of Liquidity the user is willing to
>   deposit.
> - `token_max_a` - The maximum amount of tokenA the user is willing to deposit.
> - `token_max_b` - The maximum amount of tokenB the user is willing to deposit.
>
> **Special Errors**
>
> - `LiquidityZero` - Provided liquidity amount is zero.
> - `LiquidityTooHigh` - Provided liquidity exceeds u128::max.
> - `TokenMaxExceeded` - The required token to perform this operation exceeds
>   the user defined amount.

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

| Field              | Type   |
| ------------------ | ------ |
| `liquidity_amount` | `u128` |
| `token_max_a`      | `u64`  |
| `token_max_b`      | `u64`  |

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

Fields of `IncreaseLiquidityInstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `whirlpool`              | `Pubkey`           |
| 1   | `token_program`          | `Pubkey`           |
| 2   | `position_authority`     | `Pubkey`           |
| 3   | `position`               | `Pubkey`           |
| 4   | `position_token_account` | `Pubkey`           |
| 5   | `token_owner_account_a`  | `Pubkey`           |
| 6   | `token_owner_account_b`  | `Pubkey`           |
| 7   | `token_vault_a`          | `Pubkey`           |
| 8   | `token_vault_b`          | `Pubkey`           |
| 9   | `tick_array_lower`       | `Pubkey`           |
| 10  | `tick_array_upper`       | `Pubkey`           |
| 11… | `remaining`              | `Vec<AccountMeta>` |

### `IncreaseLiquidityByTokenAmountsV2`

> _From the program's IDL:_
>
> Add liquidity to a position by specifying token maxima, not liquidity.\
> This instruction works with both Token and Token-2022.\
> NOTE: This instruction is only implemented in Pinocchio, not Anchor.
>
> **Authority**
>
> - `position_authority` - authority that owns the token corresponding to this
>   desired position.
>
> **Parameters**
>
> - `token_max_a` - The maximum amount of tokenA the user is willing to
>   deposit.
> - `token_max_b` - The maximum amount of tokenB the user is willing to deposit.
> - `min_sqrt_price` - The minimum sqrt price allowed.
> - `max_sqrt_price` - The maximum sqrt price allowed.
>
> **Special Errors**
>
> - `LiquidityZero` - Computed liquidity amount is zero.
> - `LiquidityTooHigh` - Computed liquidity exceeds u128::max.
> - `TokenMaxExceeded` - The required token to perform this operation exceeds
>   the user defined amount.

Discriminator `effb097cd2c6352b` · data `IncreaseLiquidityByTokenAmountsV2` · accounts `IncreaseLiquidityByTokenAmountsV2InstructionAccounts`.

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `method`                  | [`IncreaseLiquidityMethod`](#increaseliquiditymethod)     |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `IncreaseLiquidityByTokenAmountsV2InstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `whirlpool`              | `Pubkey`           |
| 1   | `token_program_a`        | `Pubkey`           |
| 2   | `token_program_b`        | `Pubkey`           |
| 3   | `memo_program`           | `Pubkey`           |
| 4   | `position_authority`     | `Pubkey`           |
| 5   | `position`               | `Pubkey`           |
| 6   | `position_token_account` | `Pubkey`           |
| 7   | `token_mint_a`           | `Pubkey`           |
| 8   | `token_mint_b`           | `Pubkey`           |
| 9   | `token_owner_account_a`  | `Pubkey`           |
| 10  | `token_owner_account_b`  | `Pubkey`           |
| 11  | `token_vault_a`          | `Pubkey`           |
| 12  | `token_vault_b`          | `Pubkey`           |
| 13  | `tick_array_lower`       | `Pubkey`           |
| 14  | `tick_array_upper`       | `Pubkey`           |
| 15… | `remaining`              | `Vec<AccountMeta>` |

### `IncreaseLiquidityV2`

> _From the program's IDL:_
>
> Add liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards. This instruction works with both Token and Token-2022. ### Authority
>
> - `position_authority` - authority that owns the token corresponding to this desired position.
>
> **Parameters**
>
> - `liquidity_amount` - The total amount of Liquidity the user is willing to
>   deposit.
> - `token_max_a` - The maximum amount of tokenA the user is willing to deposit.
> - `token_max_b` - The maximum amount of tokenB the user is willing to deposit.
>
> **Special Errors**
>
> - `LiquidityZero` - Provided liquidity amount is zero.
> - `LiquidityTooHigh` - Provided liquidity exceeds u128::max.
> - `TokenMaxExceeded` - The required token to perform this operation exceeds
>   the user defined amount.

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

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `liquidity_amount`        | `u128`                                                    |
| `token_max_a`             | `u64`                                                     |
| `token_max_b`             | `u64`                                                     |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `IncreaseLiquidityV2InstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `whirlpool`              | `Pubkey`           |
| 1   | `token_program_a`        | `Pubkey`           |
| 2   | `token_program_b`        | `Pubkey`           |
| 3   | `memo_program`           | `Pubkey`           |
| 4   | `position_authority`     | `Pubkey`           |
| 5   | `position`               | `Pubkey`           |
| 6   | `position_token_account` | `Pubkey`           |
| 7   | `token_mint_a`           | `Pubkey`           |
| 8   | `token_mint_b`           | `Pubkey`           |
| 9   | `token_owner_account_a`  | `Pubkey`           |
| 10  | `token_owner_account_b`  | `Pubkey`           |
| 11  | `token_vault_a`          | `Pubkey`           |
| 12  | `token_vault_b`          | `Pubkey`           |
| 13  | `tick_array_lower`       | `Pubkey`           |
| 14  | `tick_array_upper`       | `Pubkey`           |
| 15… | `remaining`              | `Vec<AccountMeta>` |

### `InitializeAdaptiveFeeTier`

> _From the program's IDL:_
>
> Initializes an adaptive_fee_tier account usable by Whirlpools in a\
> WhirlpoolConfig space. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig
>
> **Parameters**
>
> - `fee_tier_index` - The index of the fee-tier that this adaptive fee tier
>   will be initialized.
> - `tick_spacing` - The tick-spacing that this fee-tier suggests the default_fee_rate for.
> - `initialize_pool_authority` - The authority that can initialize pools with this adaptive fee-tier.
> - `delegated_fee_authority` - The authority that can set the base fee rate for pools using this adaptive fee-tier.
> - `default_fee_rate` - The default fee rate that a pool will use if the pool uses this
>
> fee tier during initialization.
>
> - `filter_period` - Period determine high frequency trading time window.\
>   (seconds)
> - `decay_period` - Period determine when the adaptive fee start decrease.\
>   (seconds)
> - `reduction_factor` - Adaptive fee rate decrement rate.
> - `adaptive_fee_control_factor` - Adaptive fee control factor.
> - `max_volatility_accumulator` - Max volatility accumulator.
> - `tick_group_size` - Tick group size to define tick group index.
> - `major_swap_threshold_ticks` - Major swap threshold ticks to define major swap.
>
> **Special Errors**
>
> - `InvalidTickSpacing` - If the provided tick_spacing is 0.
> - `InvalidFeeTierIndex` - If the provided fee_tier_index is same to
>   tick_spacing.
> - `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds\
>   MAX_FEE_RATE.
> - `InvalidAdaptiveFeeConstants` - If the provided adaptive fee constants are invalid.

Discriminator `4d63d0c88d7b7530` · data `InitializeAdaptiveFeeTier` · accounts `InitializeAdaptiveFeeTierInstructionAccounts`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `fee_tier_index`              | `u16`    |
| `tick_spacing`                | `u16`    |
| `initialize_pool_authority`   | `Pubkey` |
| `delegated_fee_authority`     | `Pubkey` |
| `default_base_fee_rate`       | `u16`    |
| `filter_period`               | `u16`    |
| `decay_period`                | `u16`    |
| `reduction_factor`            | `u16`    |
| `adaptive_fee_control_factor` | `u32`    |
| `max_volatility_accumulator`  | `u32`    |
| `tick_group_size`             | `u16`    |
| `major_swap_threshold_ticks`  | `u16`    |

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

Fields of `InitializeAdaptiveFeeTierInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `adaptive_fee_tier` | `Pubkey`           |
| 2  | `funder`            | `Pubkey`           |
| 3  | `fee_authority`     | `Pubkey`           |
| 4  | `system_program`    | `Pubkey`           |
| 5… | `remaining`         | `Vec<AccountMeta>` |

### `InitializeConfig`

> _From the program's IDL:_
>
> Initializes a WhirlpoolsConfig account that hosts info & authorities required to govern a set of Whirlpools.
>
> **Authority**
>
> - "authority" - Set authority that is one of ADMINS.
>
> **Parameters**
>
> - `fee_authority` - Authority authorized to initialize fee-tiers and set
>   customs fees.
> - `collect_protocol_fees_authority` - Authority authorized to collect protocol fees.
> - `reward_emissions_super_authority` - Authority authorized to set reward authorities in pools.

Discriminator `d07f1501c2bec446` · data `InitializeConfig` · accounts `InitializeConfigInstructionAccounts`.

| Field                              | Type     |
| ---------------------------------- | -------- |
| `fee_authority`                    | `Pubkey` |
| `collect_protocol_fees_authority`  | `Pubkey` |
| `reward_emissions_super_authority` | `Pubkey` |
| `default_protocol_fee_rate`        | `u16`    |

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

Fields of `InitializeConfigInstructionAccounts`, in account order:

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

### `InitializeConfigExtension`

> _From the program's IDL:_
>
> Initializes a WhirlpoolConfigExtension account that hosts info & authorities. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig

Discriminator `370935097239d134` · data `InitializeConfigExtension` · accounts `InitializeConfigExtensionInstructionAccounts`.

No data fields.

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

Fields of `InitializeConfigExtensionInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `config`           | `Pubkey`           |
| 1  | `config_extension` | `Pubkey`           |
| 2  | `funder`           | `Pubkey`           |
| 3  | `fee_authority`    | `Pubkey`           |
| 4  | `system_program`   | `Pubkey`           |
| 5… | `remaining`        | `Vec<AccountMeta>` |

### `InitializeDynamicTickArray`

> _From the program's IDL:_
>
> Initialize a variable-length tick array for a Whirlpool.
>
> **Parameters**
>
> - `start_tick_index` - The starting tick index for this tick-array.
>
> Has to be a multiple of TickArray size & the tick spacing of this pool.
>
> - `idempotent` - If true, the instruction will not fail if the tick array already exists.
>
> Note: The idempotent option exits successfully if a FixedTickArray is present as well as a DynamicTickArray. #### Special Errors
>
> - `InvalidStartTick` - if the provided start tick is out of bounds or is not a multiple of
>
> TICK_ARRAY_SIZE \* tick spacing.

Discriminator `2921a5c878e78e32` · data `InitializeDynamicTickArray` · accounts `InitializeDynamicTickArrayInstructionAccounts`.

| Field              | Type   |
| ------------------ | ------ |
| `start_tick_index` | `i32`  |
| `idempotent`       | `bool` |

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

Fields of `InitializeDynamicTickArrayInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `whirlpool`      | `Pubkey`           |
| 1  | `funder`         | `Pubkey`           |
| 2  | `tick_array`     | `Pubkey`           |
| 3  | `system_program` | `Pubkey`           |
| 4… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeFeeTier`

> _From the program's IDL:_
>
> Initializes a fee_tier account usable by Whirlpools in a WhirlpoolConfig space. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig
>
> **Parameters**
>
> - `tick_spacing` - The tick-spacing that this fee-tier suggests the
>   default_fee_rate for.
> - `default_fee_rate` - The default fee rate that a pool will use if the pool uses this
>
> fee tier during initialization.
>
> **Special Errors**
>
> - `InvalidTickSpacing` - If the provided tick_spacing is 0.
> - `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds
>   MAX_FEE_RATE.

Discriminator `b74a9ca070022a1e` · data `InitializeFeeTier` · accounts `InitializeFeeTierInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `tick_spacing`     | `u16` |
| `default_fee_rate` | `u16` |

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

Fields of `InitializeFeeTierInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `config`         | `Pubkey`           |
| 1  | `fee_tier`       | `Pubkey`           |
| 2  | `funder`         | `Pubkey`           |
| 3  | `fee_authority`  | `Pubkey`           |
| 4  | `system_program` | `Pubkey`           |
| 5… | `remaining`      | `Vec<AccountMeta>` |

### `InitializePool`

> _From the program's IDL:_
>
> Initializes a Whirlpool account.\
> Fee rate is set to the default values on the config and supplied fee_tier.
>
> **Parameters**
>
> - `bumps` - The bump value when deriving the PDA of the Whirlpool address.
> - `tick_spacing` - The desired tick spacing for this pool.
> - `initial_sqrt_price` - The desired initial sqrt-price for this pool
>
> **Special Errors**
>
> `InvalidTokenMintOrder` - The order of mints have to be ordered by `SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64

Discriminator `5fb40aac54aee828` · data `InitializePool` · accounts `InitializePoolInstructionAccounts`.

| Field                | Type                                |
| -------------------- | ----------------------------------- |
| `bumps`              | [`WhirlpoolBumps`](#whirlpoolbumps) |
| `tick_spacing`       | `u16`                               |
| `initial_sqrt_price` | `u128`                              |

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

Fields of `InitializePoolInstructionAccounts`, in account order:

| #   | Field               | Type               |
| --- | ------------------- | ------------------ |
| 0   | `whirlpools_config` | `Pubkey`           |
| 1   | `token_mint_a`      | `Pubkey`           |
| 2   | `token_mint_b`      | `Pubkey`           |
| 3   | `funder`            | `Pubkey`           |
| 4   | `whirlpool`         | `Pubkey`           |
| 5   | `token_vault_a`     | `Pubkey`           |
| 6   | `token_vault_b`     | `Pubkey`           |
| 7   | `fee_tier`          | `Pubkey`           |
| 8   | `token_program`     | `Pubkey`           |
| 9   | `system_program`    | `Pubkey`           |
| 10  | `rent`              | `Pubkey`           |
| 11… | `remaining`         | `Vec<AccountMeta>` |

### `InitializePoolV2`

> _From the program's IDL:_
>
> Initializes a Whirlpool account.\
> This instruction works with both Token and Token-2022.\
> Fee rate is set to the default values on the config and supplied fee_tier.
>
> **Parameters**
>
> - `bumps` - The bump value when deriving the PDA of the Whirlpool address.
> - `tick_spacing` - The desired tick spacing for this pool.
> - `initial_sqrt_price` - The desired initial sqrt-price for this pool
>
> **Special Errors**
>
> `InvalidTokenMintOrder` - The order of mints have to be ordered by `SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64

Discriminator `cf2d57f21b3fcc43` · data `InitializePoolV2` · accounts `InitializePoolV2InstructionAccounts`.

| Field                | Type   |
| -------------------- | ------ |
| `tick_spacing`       | `u16`  |
| `initial_sqrt_price` | `u128` |

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

Fields of `InitializePoolV2InstructionAccounts`, in account order:

| #   | Field               | Type               |
| --- | ------------------- | ------------------ |
| 0   | `whirlpools_config` | `Pubkey`           |
| 1   | `token_mint_a`      | `Pubkey`           |
| 2   | `token_mint_b`      | `Pubkey`           |
| 3   | `token_badge_a`     | `Pubkey`           |
| 4   | `token_badge_b`     | `Pubkey`           |
| 5   | `funder`            | `Pubkey`           |
| 6   | `whirlpool`         | `Pubkey`           |
| 7   | `token_vault_a`     | `Pubkey`           |
| 8   | `token_vault_b`     | `Pubkey`           |
| 9   | `fee_tier`          | `Pubkey`           |
| 10  | `token_program_a`   | `Pubkey`           |
| 11  | `token_program_b`   | `Pubkey`           |
| 12  | `system_program`    | `Pubkey`           |
| 13  | `rent`              | `Pubkey`           |
| 14… | `remaining`         | `Vec<AccountMeta>` |

### `InitializePoolWithAdaptiveFee`

> _From the program's IDL:_
>
> Initializes a Whirlpool account and Oracle account with adaptive fee.
>
> **Parameters**
>
> - `initial_sqrt_price` - The desired initial sqrt-price for this pool
> - `trade_enable_timestamp` - The timestamp when trading is enabled for this
>   pool (within 72 hours)
>
> **Special Errors**
>
> `InvalidTokenMintOrder` - The order of mints have to be ordered by `SqrtPriceOutOfBounds` - provided initial_sqrt_price is not between 2^-64 to 2^64 `InvalidTradeEnableTimestamp` - provided trade_enable_timestamp is not within 72 hours or the adaptive fee-tier is permission-less `UnsupportedTokenMint` - The provided token mint is not supported by the program (e.g. it has risky token extensions)

Discriminator `8f5e604cac7c77c7` · data `InitializePoolWithAdaptiveFee` · accounts `InitializePoolWithAdaptiveFeeInstructionAccounts`.

| Field                    | Type          |
| ------------------------ | ------------- |
| `initial_sqrt_price`     | `u128`        |
| `trade_enable_timestamp` | `Option<u64>` |

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

Fields of `InitializePoolWithAdaptiveFeeInstructionAccounts`, in account order:

| #   | Field                       | Type               |
| --- | --------------------------- | ------------------ |
| 0   | `whirlpools_config`         | `Pubkey`           |
| 1   | `token_mint_a`              | `Pubkey`           |
| 2   | `token_mint_b`              | `Pubkey`           |
| 3   | `token_badge_a`             | `Pubkey`           |
| 4   | `token_badge_b`             | `Pubkey`           |
| 5   | `funder`                    | `Pubkey`           |
| 6   | `initialize_pool_authority` | `Pubkey`           |
| 7   | `whirlpool`                 | `Pubkey`           |
| 8   | `oracle`                    | `Pubkey`           |
| 9   | `token_vault_a`             | `Pubkey`           |
| 10  | `token_vault_b`             | `Pubkey`           |
| 11  | `adaptive_fee_tier`         | `Pubkey`           |
| 12  | `token_program_a`           | `Pubkey`           |
| 13  | `token_program_b`           | `Pubkey`           |
| 14  | `system_program`            | `Pubkey`           |
| 15  | `rent`                      | `Pubkey`           |
| 16… | `remaining`                 | `Vec<AccountMeta>` |

### `InitializePositionBundle`

> _From the program's IDL:_
>
> Initializes a PositionBundle account that bundles several positions.\
> A unique token will be minted to represent the position bundle in the users wallet.

Discriminator `752df1951812c241` · data `InitializePositionBundle` · accounts `InitializePositionBundleInstructionAccounts`.

No data fields.

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

Fields of `InitializePositionBundleInstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `position_bundle`               | `Pubkey`           |
| 1  | `position_bundle_mint`          | `Pubkey`           |
| 2  | `position_bundle_token_account` | `Pubkey`           |
| 3  | `position_bundle_owner`         | `Pubkey`           |
| 4  | `funder`                        | `Pubkey`           |
| 5  | `token_program`                 | `Pubkey`           |
| 6  | `system_program`                | `Pubkey`           |
| 7  | `rent`                          | `Pubkey`           |
| 8  | `associated_token_program`      | `Pubkey`           |
| 9… | `remaining`                     | `Vec<AccountMeta>` |

### `InitializePositionBundleWithMetadata`

> _From the program's IDL:_
>
> Initializes a PositionBundle account that bundles several positions.\
> A unique token will be minted to represent the position bundle in the users wallet. Additional Metaplex metadata is appended to identify the token.

Discriminator `5d7c10b3f98373f5` · data `InitializePositionBundleWithMetadata` · accounts `InitializePositionBundleWithMetadataInstructionAccounts`.

No data fields.

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

Fields of `InitializePositionBundleWithMetadataInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `position_bundle`               | `Pubkey`           |
| 1   | `position_bundle_mint`          | `Pubkey`           |
| 2   | `position_bundle_metadata`      | `Pubkey`           |
| 3   | `position_bundle_token_account` | `Pubkey`           |
| 4   | `position_bundle_owner`         | `Pubkey`           |
| 5   | `funder`                        | `Pubkey`           |
| 6   | `metadata_update_auth`          | `Pubkey`           |
| 7   | `token_program`                 | `Pubkey`           |
| 8   | `system_program`                | `Pubkey`           |
| 9   | `rent`                          | `Pubkey`           |
| 10  | `associated_token_program`      | `Pubkey`           |
| 11  | `metadata_program`              | `Pubkey`           |
| 12… | `remaining`                     | `Vec<AccountMeta>` |

### `InitializeReward`

> _From the program's IDL:_
>
> Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards. ### Authority
>
> - "reward_authority" - assigned authority by the reward_super_authority for the specified
>
> reward-index in this Whirlpool
>
> **Parameters**
>
> - `reward_index` - The reward index that we'd like to initialize. (0 <=
>   index <= NUM_REWARDS)
>
> **Special Errors**
>
> - `InvalidRewardIndex` - If the provided reward index doesn't match the
>   lowest uninitialized
>
> index in this pool, or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.

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

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

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

Fields of `InitializeRewardInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `reward_authority` | `Pubkey`           |
| 1  | `funder`           | `Pubkey`           |
| 2  | `whirlpool`        | `Pubkey`           |
| 3  | `reward_mint`      | `Pubkey`           |
| 4  | `reward_vault`     | `Pubkey`           |
| 5  | `token_program`    | `Pubkey`           |
| 6  | `system_program`   | `Pubkey`           |
| 7  | `rent`             | `Pubkey`           |
| 8… | `remaining`        | `Vec<AccountMeta>` |

### `InitializeRewardV2`

> _From the program's IDL:_
>
> Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards. This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - "reward_authority" - assigned authority by the reward_super_authority for
>   the specified
>
> reward-index in this Whirlpool
>
> **Parameters**
>
> - `reward_index` - The reward index that we'd like to initialize. (0 <=
>   index <= NUM_REWARDS)
>
> **Special Errors**
>
> - `InvalidRewardIndex` - If the provided reward index doesn't match the
>   lowest uninitialized
>
> index in this pool, or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.

Discriminator `5b014d32ebe58531` · data `InitializeRewardV2` · accounts `InitializeRewardV2InstructionAccounts`.

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

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

Fields of `InitializeRewardV2InstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `reward_authority`     | `Pubkey`           |
| 1  | `funder`               | `Pubkey`           |
| 2  | `whirlpool`            | `Pubkey`           |
| 3  | `reward_mint`          | `Pubkey`           |
| 4  | `reward_token_badge`   | `Pubkey`           |
| 5  | `reward_vault`         | `Pubkey`           |
| 6  | `reward_token_program` | `Pubkey`           |
| 7  | `system_program`       | `Pubkey`           |
| 8  | `rent`                 | `Pubkey`           |
| 9… | `remaining`            | `Vec<AccountMeta>` |

### `InitializeTickArray`

> _From the program's IDL:_
>
> Initializes a fixed-length tick_array account to represent a tick-range in a\
> Whirlpool. ### Parameters
>
> - `start_tick_index` - The starting tick index for this tick-array.
>
> Has to be a multiple of TickArray size & the tick spacing of this pool.
>
> **Special Errors**
>
> - `InvalidStartTick` - if the provided start tick is out of bounds or is not
>   a multiple of
>
> TICK_ARRAY_SIZE \* tick spacing.

Discriminator `0bbcc1d68d5b95b8` · data `InitializeTickArray` · accounts `InitializeTickArrayInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `start_tick_index` | `i32` |

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

Fields of `InitializeTickArrayInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `whirlpool`      | `Pubkey`           |
| 1  | `funder`         | `Pubkey`           |
| 2  | `tick_array`     | `Pubkey`           |
| 3  | `system_program` | `Pubkey`           |
| 4… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeTokenBadge`

> _From the program's IDL:_
>
> Initialize a TokenBadge account.
>
> **Authority**
>
> - "token_badge_authority" - Set authority in the WhirlpoolConfigExtension
>
> **Special Errors**
>
> - `FeatureIsNotEnabled` - If the feature flag for token badges is not
>   enabled.

Discriminator `fd4dcd5f1be059df` · data `InitializeTokenBadge` · accounts `InitializeTokenBadgeInstructionAccounts`.

No data fields.

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

Fields of `InitializeTokenBadgeInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `whirlpools_config`           | `Pubkey`           |
| 1  | `whirlpools_config_extension` | `Pubkey`           |
| 2  | `token_badge_authority`       | `Pubkey`           |
| 3  | `token_mint`                  | `Pubkey`           |
| 4  | `token_badge`                 | `Pubkey`           |
| 5  | `funder`                      | `Pubkey`           |
| 6  | `system_program`              | `Pubkey`           |
| 7… | `remaining`                   | `Vec<AccountMeta>` |

### `LockPosition`

> _From the program's IDL:_
>
> Lock the position to prevent any liquidity changes.
>
> **Authority**
>
> - `position_authority` - The authority that owns the position token.
>
> **Special Errors**
>
> - `PositionAlreadyLocked` - The provided position is already locked.
> - `PositionNotLockable` - The provided position is not lockable (e.g. An
>   empty position).

Discriminator `e33e02fcf70aabb9` · data `LockPosition` · accounts `LockPositionInstructionAccounts`.

| Field       | Type                    |
| ----------- | ----------------------- |
| `lock_type` | [`LockType`](#locktype) |

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

Fields of `LockPositionInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `funder`                 | `Pubkey`           |
| 1  | `position_authority`     | `Pubkey`           |
| 2  | `position`               | `Pubkey`           |
| 3  | `position_mint`          | `Pubkey`           |
| 4  | `position_token_account` | `Pubkey`           |
| 5  | `lock_config`            | `Pubkey`           |
| 6  | `whirlpool`              | `Pubkey`           |
| 7  | `token2022_program`      | `Pubkey`           |
| 8  | `system_program`         | `Pubkey`           |
| 9… | `remaining`              | `Vec<AccountMeta>` |

### `MigrateRepurposeRewardAuthoritySpace`

> _From the program's IDL:_
>
> Migration instruction to repurpose the reward authority space in the\
> Whirlpool. TODO: This instruction should be removed once all pools have been migrated.

Discriminator `d6a1f84f9862ace7` · data `MigrateRepurposeRewardAuthoritySpace` · accounts `MigrateRepurposeRewardAuthoritySpaceInstructionAccounts`.

No data fields.

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

Fields of `MigrateRepurposeRewardAuthoritySpaceInstructionAccounts`, in account order:

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

### `OpenBundledPosition`

> _From the program's IDL:_
>
> Open a bundled position in a Whirlpool. No new tokens are issued because the owner of the position bundle becomes the owner of the position.\
> The position will start off with 0 liquidity.
>
> **Authority**
>
> - `position_bundle_authority` - authority that owns the token corresponding
>   to this desired position bundle.
>
> **Parameters**
>
> - `bundle_index` - The bundle index that we'd like to open.
> - `tick_lower_index` - The tick specifying the lower end of the position
>   range.
> - `tick_upper_index` - The tick specifying the upper end of the position range.
>
> **Special Errors**
>
> - `InvalidBundleIndex` - If the provided bundle index is out of bounds.
> - `InvalidTickIndex` - If a provided tick is out of bounds, out of order or
>   not a multiple of
>
> the tick-spacing in this pool.

Discriminator `a9717eabd5acd431` · data `OpenBundledPosition` · accounts `OpenBundledPositionInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `bundle_index`     | `u16` |
| `tick_lower_index` | `i32` |
| `tick_upper_index` | `i32` |

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

Fields of `OpenBundledPositionInstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `bundled_position`              | `Pubkey`           |
| 1  | `position_bundle`               | `Pubkey`           |
| 2  | `position_bundle_token_account` | `Pubkey`           |
| 3  | `position_bundle_authority`     | `Pubkey`           |
| 4  | `whirlpool`                     | `Pubkey`           |
| 5  | `funder`                        | `Pubkey`           |
| 6  | `system_program`                | `Pubkey`           |
| 7  | `rent`                          | `Pubkey`           |
| 8… | `remaining`                     | `Vec<AccountMeta>` |

### `OpenPosition`

> _From the program's IDL:_
>
> Open a position in a Whirlpool. A unique token will be minted to represent the position in the users wallet. The position will start off with 0 liquidity. ### Parameters
>
> - `tick_lower_index` - The tick specifying the lower end of the position range.
> - `tick_upper_index` - The tick specifying the upper end of the position range.
>
> **Special Errors**
>
> - `InvalidTickIndex` - If a provided tick is out of bounds, out of order or
>   not a multiple of
>
> the tick-spacing in this pool.

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

| Field              | Type                                      |
| ------------------ | ----------------------------------------- |
| `bumps`            | [`OpenPositionBumps`](#openpositionbumps) |
| `tick_lower_index` | `i32`                                     |
| `tick_upper_index` | `i32`                                     |

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

Fields of `OpenPositionInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `funder`                   | `Pubkey`           |
| 1   | `owner`                    | `Pubkey`           |
| 2   | `position`                 | `Pubkey`           |
| 3   | `position_mint`            | `Pubkey`           |
| 4   | `position_token_account`   | `Pubkey`           |
| 5   | `whirlpool`                | `Pubkey`           |
| 6   | `token_program`            | `Pubkey`           |
| 7   | `system_program`           | `Pubkey`           |
| 8   | `rent`                     | `Pubkey`           |
| 9   | `associated_token_program` | `Pubkey`           |
| 10… | `remaining`                | `Vec<AccountMeta>` |

### `OpenPositionWithMetadata`

> _From the program's IDL:_
>
> Open a position in a Whirlpool. A unique token will be minted to represent the position in the users wallet. Additional Metaplex metadata is appended to identify the token. The position will start off with 0 liquidity.
>
> **Parameters**
>
> - `tick_lower_index` - The tick specifying the lower end of the position
>   range.
> - `tick_upper_index` - The tick specifying the upper end of the position range.
>
> **Special Errors**
>
> - `InvalidTickIndex` - If a provided tick is out of bounds, out of order or
>   not a multiple of
>
> the tick-spacing in this pool.

Discriminator `f21d86303a6e0e3c` · data `OpenPositionWithMetadata` · accounts `OpenPositionWithMetadataInstructionAccounts`.

| Field              | Type                                                              |
| ------------------ | ----------------------------------------------------------------- |
| `bumps`            | [`OpenPositionWithMetadataBumps`](#openpositionwithmetadatabumps) |
| `tick_lower_index` | `i32`                                                             |
| `tick_upper_index` | `i32`                                                             |

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

Fields of `OpenPositionWithMetadataInstructionAccounts`, in account order:

| #   | Field                       | Type               |
| --- | --------------------------- | ------------------ |
| 0   | `funder`                    | `Pubkey`           |
| 1   | `owner`                     | `Pubkey`           |
| 2   | `position`                  | `Pubkey`           |
| 3   | `position_mint`             | `Pubkey`           |
| 4   | `position_metadata_account` | `Pubkey`           |
| 5   | `position_token_account`    | `Pubkey`           |
| 6   | `whirlpool`                 | `Pubkey`           |
| 7   | `token_program`             | `Pubkey`           |
| 8   | `system_program`            | `Pubkey`           |
| 9   | `rent`                      | `Pubkey`           |
| 10  | `associated_token_program`  | `Pubkey`           |
| 11  | `metadata_program`          | `Pubkey`           |
| 12  | `metadata_update_auth`      | `Pubkey`           |
| 13… | `remaining`                 | `Vec<AccountMeta>` |

### `OpenPositionWithTokenExtensions`

> _From the program's IDL:_
>
> Open a position in a Whirlpool. A unique token will be minted to represent the position in the users wallet. Additional TokenMetadata extension is initialized to identify the token. Mint and TokenAccount are based on\
> Token-2022. The position will start off with 0 liquidity.
>
> **Parameters**
>
> - `tick_lower_index` - The tick specifying the lower end of the position
>   range.
> - `tick_upper_index` - The tick specifying the upper end of the position range.
> - `with_token_metadata_extension` - If true, the token metadata extension will be initialized.
>
> **Special Errors**
>
> - `InvalidTickIndex` - If a provided tick is out of bounds, out of order or
>   not a multiple of
>
> the tick-spacing in this pool.

Discriminator `d42f5f5c726683fa` · data `OpenPositionWithTokenExtensions` · accounts `OpenPositionWithTokenExtensionsInstructionAccounts`.

| Field                           | Type   |
| ------------------------------- | ------ |
| `tick_lower_index`              | `i32`  |
| `tick_upper_index`              | `i32`  |
| `with_token_metadata_extension` | `bool` |

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

Fields of `OpenPositionWithTokenExtensionsInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `funder`                   | `Pubkey`           |
| 1   | `owner`                    | `Pubkey`           |
| 2   | `position`                 | `Pubkey`           |
| 3   | `position_mint`            | `Pubkey`           |
| 4   | `position_token_account`   | `Pubkey`           |
| 5   | `whirlpool`                | `Pubkey`           |
| 6   | `token2022_program`        | `Pubkey`           |
| 7   | `system_program`           | `Pubkey`           |
| 8   | `associated_token_program` | `Pubkey`           |
| 9   | `metadata_update_auth`     | `Pubkey`           |
| 10… | `remaining`                | `Vec<AccountMeta>` |

### `RepositionLiquidityV2`

> _From the program's IDL:_
>
> An atomic instruction that repositions liquidity for a position through the following steps:
>
> - Withdraws liquidity from the current position range
> - Resets the position to a new tick range
> - Adds liquidity to the new position range
> - Restores fees and rewards
>
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - `position_authority` - authority that owns the token corresponding to this
>   desired position.
>
> **Parameters**
>
> - `new_tick_lower_index` - The new tick index for the lower end of the
>   position range.
> - `new_tick_upper_index` - The new tick index for the upper end of the position range.
> - `new_liquidity_amount` - The total amount of Liquidity the user is willing to deposit.
> - `existing_range_token_min_a` - The minimum amount of tokenA the user is willing to withdraw from the existing range.
> - `existing_range_token_min_b` - The minimum amount of tokenB the user is willing to withdraw from the existing range.
> - `new_range_token_max_a` - The maximum amount of tokenA the user is willing to deposit into the new range.
> - `new_range_token_max_b` - The maximum amount of tokenB the user is willing to deposit into the new range.
>
> **Special Errors**
>
> - `LiquidityZero` - Provided liquidity amount is zero.
> - `LiquidityTooHigh` - Provided liquidity exceeds u128::max.
> - `TokenMaxExceeded` - The required token to perform this operation exceeds
>   the user defined amount.
> - `TokenMinSubceeded` - The required token to perform this operation subceeds the user defined amount.
> - `InvalidTickIndex` - If a provided tick is out of bounds, out of order or not a multiple of
>
> the tick-spacing in this pool.
>
> - `SameTickRangeNotAllowed` - The provided tick range is the same as the current tick range.

Discriminator `bfa9e00b83139efd` · data `RepositionLiquidityV2` · accounts `RepositionLiquidityV2InstructionAccounts`.

| Field                     | Type                                                      |
| ------------------------- | --------------------------------------------------------- |
| `new_tick_lower_index`    | `i32`                                                     |
| `new_tick_upper_index`    | `i32`                                                     |
| `method`                  | [`RepositionLiquidityMethod`](#repositionliquiditymethod) |
| `remaining_accounts_info` | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `RepositionLiquidityV2InstructionAccounts`, in account order:

| #   | Field                       | Type               |
| --- | --------------------------- | ------------------ |
| 0   | `whirlpool`                 | `Pubkey`           |
| 1   | `token_program_a`           | `Pubkey`           |
| 2   | `token_program_b`           | `Pubkey`           |
| 3   | `memo_program`              | `Pubkey`           |
| 4   | `position_authority`        | `Pubkey`           |
| 5   | `funder`                    | `Pubkey`           |
| 6   | `position`                  | `Pubkey`           |
| 7   | `position_token_account`    | `Pubkey`           |
| 8   | `token_mint_a`              | `Pubkey`           |
| 9   | `token_mint_b`              | `Pubkey`           |
| 10  | `token_owner_account_a`     | `Pubkey`           |
| 11  | `token_owner_account_b`     | `Pubkey`           |
| 12  | `token_vault_a`             | `Pubkey`           |
| 13  | `token_vault_b`             | `Pubkey`           |
| 14  | `existing_tick_array_lower` | `Pubkey`           |
| 15  | `existing_tick_array_upper` | `Pubkey`           |
| 16  | `new_tick_array_lower`      | `Pubkey`           |
| 17  | `new_tick_array_upper`      | `Pubkey`           |
| 18  | `system_program`            | `Pubkey`           |
| 19… | `remaining`                 | `Vec<AccountMeta>` |

### `ResetPositionRange`

> _From the program's IDL:_
>
> Reset the position range to a new range.
>
> **Authority**
>
> - `position_authority` - The authority that owns the position token.
>
> **Parameters**
>
> - `new_tick_lower_index` - The new tick specifying the lower end of the
>   position range.
> - `new_tick_upper_index` - The new tick specifying the upper end of the position range.
>
> **Special Errors**
>
> - `InvalidTickIndex` - If a provided tick is out of bounds, out of order or
>   not a multiple of
>
> the tick-spacing in this pool.
>
> - `ClosePositionNotEmpty` - The provided position account is not empty.
> - `SameTickRangeNotAllowed` - The provided tick range is the same as the current tick range.

Discriminator `a47bb48dc264a0af` · data `ResetPositionRange` · accounts `ResetPositionRangeInstructionAccounts`.

| Field                  | Type  |
| ---------------------- | ----- |
| `new_tick_lower_index` | `i32` |
| `new_tick_upper_index` | `i32` |

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

Fields of `ResetPositionRangeInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `funder`                 | `Pubkey`           |
| 1  | `position_authority`     | `Pubkey`           |
| 2  | `whirlpool`              | `Pubkey`           |
| 3  | `position`               | `Pubkey`           |
| 4  | `position_token_account` | `Pubkey`           |
| 5  | `system_program`         | `Pubkey`           |
| 6… | `remaining`              | `Vec<AccountMeta>` |

### `SetAdaptiveFeeConstants`

> _From the program's IDL:_
>
> Sets specific adaptive fee constants for a pool. Only the provided constants will be updated, others remain unchanged. Caller should avoid invoking this instruction when a pool's adaptive fee is high to prevent LP revenue loss
>
> **Authority**
>
> - `fee_authority` - Set authority in the WhirlpoolsConfig
>
> **Parameters**
>
> All parameters are optional. Only provided values will be updated.
>
> - `filter_period` - Period determine high frequency trading time window.\
>   (seconds)
> - `decay_period` - Period determine when the adaptive fee start decrease.\
>   (seconds)
> - `reduction_factor` - Adaptive fee rate decrement rate.
> - `adaptive_fee_control_factor` - Adaptive fee control factor.
> - `max_volatility_accumulator` - Max volatility accumulator.
> - `tick_group_size` - Tick group size to define tick group index.
> - `major_swap_threshold_ticks` - Major swap threshold ticks to define major swap.
>
> **Special Errors**
>
> - `InvalidAdaptiveFeeConstants` - If the resulting constants are invalid for
>   the pool's tick_spacing.
> - `AdaptiveFeeConstantsUnchanged` - If the provided adaptive fee constants are unchanged from the existing constants.

Discriminator `859ed4bded0c4927` · data `SetAdaptiveFeeConstants` · accounts `SetAdaptiveFeeConstantsInstructionAccounts`.

| Field                         | Type          |
| ----------------------------- | ------------- |
| `filter_period`               | `Option<u16>` |
| `decay_period`                | `Option<u16>` |
| `reduction_factor`            | `Option<u16>` |
| `adaptive_fee_control_factor` | `Option<u32>` |
| `max_volatility_accumulator`  | `Option<u32>` |
| `tick_group_size`             | `Option<u16>` |
| `major_swap_threshold_ticks`  | `Option<u16>` |

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

Fields of `SetAdaptiveFeeConstantsInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpool`         | `Pubkey`           |
| 1  | `whirlpools_config` | `Pubkey`           |
| 2  | `oracle`            | `Pubkey`           |
| 3  | `fee_authority`     | `Pubkey`           |
| 4… | `remaining`         | `Vec<AccountMeta>` |

### `SetCollectProtocolFeesAuthority`

> _From the program's IDL:_
>
> Sets the fee authority to collect protocol fees for a WhirlpoolConfig.\
> Only the current collect protocol fee authority has permission to invoke this instruction. ### Authority
>
> - "fee_authority" - Set authority that can collect protocol fees in the\
>   WhirlpoolConfig

Discriminator `22965df48be1e943` · data `SetCollectProtocolFeesAuthority` · accounts `SetCollectProtocolFeesAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetCollectProtocolFeesAuthorityInstructionAccounts`, in account order:

| #  | Field                                 | Type               |
| -- | ------------------------------------- | ------------------ |
| 0  | `whirlpools_config`                   | `Pubkey`           |
| 1  | `collect_protocol_fees_authority`     | `Pubkey`           |
| 2  | `new_collect_protocol_fees_authority` | `Pubkey`           |
| 3… | `remaining`                           | `Vec<AccountMeta>` |

### `SetConfigExtensionAuthority`

> _From the program's IDL:_
>
> Sets the config extension authority for a WhirlpoolsConfigExtension.\
> Only the current config extension authority has permission to invoke this instruction. ### Authority
>
> - "config_extension_authority" - Set authority in the\
>   WhirlpoolConfigExtension

Discriminator `2c5ef17418bc3c8f` · data `SetConfigExtensionAuthority` · accounts `SetConfigExtensionAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetConfigExtensionAuthorityInstructionAccounts`, in account order:

| #  | Field                            | Type               |
| -- | -------------------------------- | ------------------ |
| 0  | `whirlpools_config`              | `Pubkey`           |
| 1  | `whirlpools_config_extension`    | `Pubkey`           |
| 2  | `config_extension_authority`     | `Pubkey`           |
| 3  | `new_config_extension_authority` | `Pubkey`           |
| 4… | `remaining`                      | `Vec<AccountMeta>` |

### `SetConfigFeatureFlag`

> _From the program's IDL:_
>
> Sets the feature flag for a WhirlpoolConfig.
>
> **Authority**
>
> - "authority" - Set authority that is one of ADMINS.
>
> **Parameters**
>
> - `feature_flag` - The feature flag that the WhirlpoolConfig will use.

Discriminator `47ade41243f7d239` · data `SetConfigFeatureFlag` · accounts `SetConfigFeatureFlagInstructionAccounts`.

| Field          | Type                                      |
| -------------- | ----------------------------------------- |
| `feature_flag` | [`ConfigFeatureFlag`](#configfeatureflag) |

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

Fields of `SetConfigFeatureFlagInstructionAccounts`, in account order:

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

### `SetDefaultBaseFeeRate`

> _From the program's IDL:_
>
> Set the default_base_fee_rate for an AdaptiveFeeTier\
> Only the current fee authority in WhirlpoolsConfig has permission to invoke this instruction. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig
>
> **Parameters**
>
> - `default_base_fee_rate` - The default base fee rate that a pool will use
>   if the pool uses this
>
> adaptive fee-tier during initialization.
>
> **Special Errors**
>
> - `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds
>   MAX_FEE_RATE.

Discriminator `e54254fba486b707` · data `SetDefaultBaseFeeRate` · accounts `SetDefaultBaseFeeRateInstructionAccounts`.

| Field                   | Type  |
| ----------------------- | ----- |
| `default_base_fee_rate` | `u16` |

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

Fields of `SetDefaultBaseFeeRateInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `adaptive_fee_tier` | `Pubkey`           |
| 2  | `fee_authority`     | `Pubkey`           |
| 3… | `remaining`         | `Vec<AccountMeta>` |

### `SetDefaultFeeRate`

> _From the program's IDL:_
>
> Set the default_fee_rate for a FeeTier\
> Only the current fee authority has permission to invoke this instruction.
>
> **Authority**
>
> - "fee_authority" - Set authority in the WhirlpoolConfig
>
> **Parameters**
>
> - `default_fee_rate` - The default fee rate that a pool will use if the pool
>   uses this
>
> fee tier during initialization.
>
> **Special Errors**
>
> - `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds
>   MAX_FEE_RATE.

Discriminator `76d7d69db6e5d0e4` · data `SetDefaultFeeRate` · accounts `SetDefaultFeeRateInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `default_fee_rate` | `u16` |

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

Fields of `SetDefaultFeeRateInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `fee_tier`          | `Pubkey`           |
| 2  | `fee_authority`     | `Pubkey`           |
| 3… | `remaining`         | `Vec<AccountMeta>` |

### `SetDefaultProtocolFeeRate`

> _From the program's IDL:_
>
> Sets the default protocol fee rate for a WhirlpoolConfig\
> Protocol fee rate is represented as a basis point.\
> Only the current fee authority has permission to invoke this instruction.
>
> **Authority**
>
> - "fee_authority" - Set authority that can modify pool fees in the
>   WhirlpoolConfig
>
> **Parameters**
>
> - `default_protocol_fee_rate` - Rate that is referenced during the
>   initialization of a Whirlpool using this config.
>
> **Special Errors**
>
> - `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate
>   exceeds MAX_PROTOCOL_FEE_RATE.

Discriminator `6bcdf9e297235600` · data `SetDefaultProtocolFeeRate` · accounts `SetDefaultProtocolFeeRateInstructionAccounts`.

| Field                       | Type  |
| --------------------------- | ----- |
| `default_protocol_fee_rate` | `u16` |

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

Fields of `SetDefaultProtocolFeeRateInstructionAccounts`, in account order:

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

### `SetDelegatedFeeAuthority`

> _From the program's IDL:_
>
> Sets the delegated fee authority for an AdaptiveFeeTier.\
> The delegated fee authority can set the fee rate for individual pools initialized with the adaptive fee-tier. Only the current fee authority in\
> WhirlpoolsConfig has permission to invoke this instruction. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig

Discriminator `c1eae7938a39037a` · data `SetDelegatedFeeAuthority` · accounts `SetDelegatedFeeAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetDelegatedFeeAuthorityInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `whirlpools_config`           | `Pubkey`           |
| 1  | `adaptive_fee_tier`           | `Pubkey`           |
| 2  | `fee_authority`               | `Pubkey`           |
| 3  | `new_delegated_fee_authority` | `Pubkey`           |
| 4… | `remaining`                   | `Vec<AccountMeta>` |

### `SetFeeAuthority`

> _From the program's IDL:_
>
> Sets the fee authority for a WhirlpoolConfig.\
> The fee authority can set the fee & protocol fee rate for individual pools or set the default fee rate for newly minted pools.\
> Only the current fee authority has permission to invoke this instruction.
>
> **Authority**
>
> - "fee_authority" - Set authority that can modify pool fees in the
>   WhirlpoolConfig

Discriminator `1f013257ed656184` · data `SetFeeAuthority` · accounts `SetFeeAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetFeeAuthorityInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `fee_authority`     | `Pubkey`           |
| 2  | `new_fee_authority` | `Pubkey`           |
| 3… | `remaining`         | `Vec<AccountMeta>` |

### `SetFeeRate`

> _From the program's IDL:_
>
> Sets the fee rate for a Whirlpool.\
> Fee rate is represented as hundredths of a basis point.\
> Only the current fee authority has permission to invoke this instruction.
>
> **Authority**
>
> - "fee_authority" - Set authority that can modify pool fees in the
>   WhirlpoolConfig
>
> **Parameters**
>
> - `fee_rate` - The rate that the pool will use to calculate fees going
>   onwards.
>
> **Special Errors**
>
> - `FeeRateMaxExceeded` - If the provided fee_rate exceeds MAX_FEE_RATE.

Discriminator `35f38941088c9e06` · data `SetFeeRate` · accounts `SetFeeRateInstructionAccounts`.

| Field      | Type  |
| ---------- | ----- |
| `fee_rate` | `u16` |

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

Fields of `SetFeeRateInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `whirlpool`         | `Pubkey`           |
| 2  | `fee_authority`     | `Pubkey`           |
| 3… | `remaining`         | `Vec<AccountMeta>` |

### `SetFeeRateByDelegatedFeeAuthority`

> _From the program's IDL:_
>
> Sets the fee rate for a Whirlpool by the delegated fee authority in\
> AdaptiveFeeTier. Fee rate is represented as hundredths of a basis point.
>
> **Authority**
>
> - "delegated_fee_authority" - Set authority that can modify pool fees in the
>   AdaptiveFeeTier
>
> **Parameters**
>
> - `fee_rate` - The rate that the pool will use to calculate fees going
>   onwards.
>
> **Special Errors**
>
> - `FeeRateMaxExceeded` - If the provided fee_rate exceeds MAX_FEE_RATE.

Discriminator `7979367283e6a268` · data `SetFeeRateByDelegatedFeeAuthority` · accounts `SetFeeRateByDelegatedFeeAuthorityInstructionAccounts`.

| Field      | Type  |
| ---------- | ----- |
| `fee_rate` | `u16` |

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

Fields of `SetFeeRateByDelegatedFeeAuthorityInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `whirlpool`               | `Pubkey`           |
| 1  | `adaptive_fee_tier`       | `Pubkey`           |
| 2  | `delegated_fee_authority` | `Pubkey`           |
| 3… | `remaining`               | `Vec<AccountMeta>` |

### `SetInitializePoolAuthority`

> _From the program's IDL:_
>
> Sets the initialize pool authority for an AdaptiveFeeTier.\
> Only the initialize pool authority can initialize pools with the adaptive fee-tier. Only the current fee authority in WhirlpoolsConfig has permission to invoke this instruction. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig

Discriminator `7d2b7feb951a6aec` · data `SetInitializePoolAuthority` · accounts `SetInitializePoolAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetInitializePoolAuthorityInstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `whirlpools_config`             | `Pubkey`           |
| 1  | `adaptive_fee_tier`             | `Pubkey`           |
| 2  | `fee_authority`                 | `Pubkey`           |
| 3  | `new_initialize_pool_authority` | `Pubkey`           |
| 4… | `remaining`                     | `Vec<AccountMeta>` |

### `SetPresetAdaptiveFeeConstants`

> _From the program's IDL:_
>
> Sets the adaptive fee constants for an AdaptiveFeeTier.\
> Only the current fee authority in WhirlpoolsConfig has permission to invoke this instruction. ### Authority
>
> - "fee_authority" - Set authority in the WhirlpoolConfig
>
> **Parameters**
>
> - `filter_period` - Period determine high frequency trading time window.
>   (seconds)
> - `decay_period` - Period determine when the adaptive fee start decrease.\
>   (seconds)
> - `reduction_factor` - Adaptive fee rate decrement rate.
> - `adaptive_fee_control_factor` - Adaptive fee control factor.
> - `max_volatility_accumulator` - Max volatility accumulator.
> - `tick_group_size` - Tick group size to define tick group index.
> - `major_swap_threshold_ticks` - Major swap threshold ticks to define major swap.

Discriminator `84b94294535886c6` · data `SetPresetAdaptiveFeeConstants` · accounts `SetPresetAdaptiveFeeConstantsInstructionAccounts`.

| Field                         | Type  |
| ----------------------------- | ----- |
| `filter_period`               | `u16` |
| `decay_period`                | `u16` |
| `reduction_factor`            | `u16` |
| `adaptive_fee_control_factor` | `u32` |
| `max_volatility_accumulator`  | `u32` |
| `tick_group_size`             | `u16` |
| `major_swap_threshold_ticks`  | `u16` |

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

Fields of `SetPresetAdaptiveFeeConstantsInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `adaptive_fee_tier` | `Pubkey`           |
| 2  | `fee_authority`     | `Pubkey`           |
| 3… | `remaining`         | `Vec<AccountMeta>` |

### `SetProtocolFeeRate`

> _From the program's IDL:_
>
> Sets the protocol fee rate for a Whirlpool.\
> Protocol fee rate is represented as a basis point.\
> Only the current fee authority has permission to invoke this instruction.
>
> **Authority**
>
> - "fee_authority" - Set authority that can modify pool fees in the
>   WhirlpoolConfig
>
> **Parameters**
>
> - `protocol_fee_rate` - The rate that the pool will use to calculate
>   protocol fees going onwards.
>
> **Special Errors**
>
> - `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate
>   exceeds MAX_PROTOCOL_FEE_RATE.

Discriminator `5f0704329a4f9c83` · data `SetProtocolFeeRate` · accounts `SetProtocolFeeRateInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `protocol_fee_rate` | `u16` |

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

Fields of `SetProtocolFeeRateInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `whirlpools_config` | `Pubkey`           |
| 1  | `whirlpool`         | `Pubkey`           |
| 2  | `fee_authority`     | `Pubkey`           |
| 3… | `remaining`         | `Vec<AccountMeta>` |

### `SetRewardAuthority`

> _From the program's IDL:_
>
> Set the whirlpool reward authority at the provided `reward_index`.\
> Only the current reward authority for this reward index has permission to invoke this instruction. ### Authority
>
> - "reward_authority" - Set authority that can control reward emission for this particular reward.
>
> **Special Errors**
>
> - `InvalidRewardIndex` - If the provided reward index doesn't match the
>   lowest uninitialized
>
> index in this pool, or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.

Discriminator `2227b7fc531c557f` · data `SetRewardAuthority` · accounts `SetRewardAuthorityInstructionAccounts`.

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

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

Fields of `SetRewardAuthorityInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `whirlpool`            | `Pubkey`           |
| 1  | `reward_authority`     | `Pubkey`           |
| 2  | `new_reward_authority` | `Pubkey`           |
| 3… | `remaining`            | `Vec<AccountMeta>` |

### `SetRewardAuthorityBySuperAuthority`

> _From the program's IDL:_
>
> Set the whirlpool reward authority at the provided `reward_index`.\
> Only the current reward super authority has permission to invoke this instruction. ### Authority
>
> - "reward_authority" - Set authority that can control reward emission for this particular reward.
>
> **Special Errors**
>
> - `InvalidRewardIndex` - If the provided reward index doesn't match the
>   lowest uninitialized
>
> index in this pool, or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.

Discriminator `f09ac9c6945d3819` · data `SetRewardAuthorityBySuperAuthority` · accounts `SetRewardAuthorityBySuperAuthorityInstructionAccounts`.

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

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

Fields of `SetRewardAuthorityBySuperAuthorityInstructionAccounts`, in account order:

| #  | Field                              | Type               |
| -- | ---------------------------------- | ------------------ |
| 0  | `whirlpools_config`                | `Pubkey`           |
| 1  | `whirlpool`                        | `Pubkey`           |
| 2  | `reward_emissions_super_authority` | `Pubkey`           |
| 3  | `new_reward_authority`             | `Pubkey`           |
| 4… | `remaining`                        | `Vec<AccountMeta>` |

### `SetRewardEmissions`

> _From the program's IDL:_
>
> Set the reward emissions for a reward in a Whirlpool.
>
> **Authority**
>
> - "reward_authority" - assigned authority by the reward_super_authority for
>   the specified
>
> reward-index in this Whirlpool
>
> **Parameters**
>
> - `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we'd
>   like to modify.
> - `emissions_per_second_x64` - The amount of rewards emitted in this pool.
>
> **Special Errors**
>
> - `RewardVaultAmountInsufficient` - The amount of rewards in the reward
>   vault cannot emit
>
> more than a day of desired emissions.
>
> - `InvalidTimestamp` - Provided timestamp is not in order with the previous timestamp.
> - `InvalidRewardIndex` - If the provided reward index doesn't match the lowest uninitialized
>
> index in this pool, or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.

Discriminator `0dc556a86db01bf4` · data `SetRewardEmissions` · accounts `SetRewardEmissionsInstructionAccounts`.

| Field                      | Type   |
| -------------------------- | ------ |
| `reward_index`             | `u8`   |
| `emissions_per_second_x64` | `u128` |

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

Fields of `SetRewardEmissionsInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `whirlpool`        | `Pubkey`           |
| 1  | `reward_authority` | `Pubkey`           |
| 2  | `reward_vault`     | `Pubkey`           |
| 3… | `remaining`        | `Vec<AccountMeta>` |

### `SetRewardEmissionsSuperAuthority`

> _From the program's IDL:_
>
> Set the whirlpool reward super authority for a WhirlpoolConfig\
> Only the current reward super authority has permission to invoke this instruction. This instruction will not change the authority on any `WhirlpoolRewardInfo` whirlpool rewards. ### Authority
>
> - "reward_emissions_super_authority" - Set authority that can control reward authorities for all pools in this config space.

Discriminator `cf05c8d17a3852b7` · data `SetRewardEmissionsSuperAuthority` · accounts `SetRewardEmissionsSuperAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetRewardEmissionsSuperAuthorityInstructionAccounts`, in account order:

| #  | Field                                  | Type               |
| -- | -------------------------------------- | ------------------ |
| 0  | `whirlpools_config`                    | `Pubkey`           |
| 1  | `reward_emissions_super_authority`     | `Pubkey`           |
| 2  | `new_reward_emissions_super_authority` | `Pubkey`           |
| 3… | `remaining`                            | `Vec<AccountMeta>` |

### `SetRewardEmissionsV2`

> _From the program's IDL:_
>
> Set the reward emissions for a reward in a Whirlpool.\
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - "reward_authority" - assigned authority by the reward_super_authority for
>   the specified
>
> reward-index in this Whirlpool
>
> **Parameters**
>
> - `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we'd
>   like to modify.
> - `emissions_per_second_x64` - The amount of rewards emitted in this pool.
>
> **Special Errors**
>
> - `RewardVaultAmountInsufficient` - The amount of rewards in the reward
>   vault cannot emit
>
> more than a day of desired emissions.
>
> - `InvalidTimestamp` - Provided timestamp is not in order with the previous timestamp.
> - `InvalidRewardIndex` - If the provided reward index doesn't match the lowest uninitialized
>
> index in this pool, or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.

Discriminator `72e44820c130a066` · data `SetRewardEmissionsV2` · accounts `SetRewardEmissionsV2InstructionAccounts`.

| Field                      | Type   |
| -------------------------- | ------ |
| `reward_index`             | `u8`   |
| `emissions_per_second_x64` | `u128` |

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

Fields of `SetRewardEmissionsV2InstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `whirlpool`        | `Pubkey`           |
| 1  | `reward_authority` | `Pubkey`           |
| 2  | `reward_vault`     | `Pubkey`           |
| 3… | `remaining`        | `Vec<AccountMeta>` |

### `SetTokenBadgeAttribute`

> _From the program's IDL:_
>
> Set an attribute on a TokenBadge account.
>
> **Authority**
>
> - "token_badge_authority" - Set authority in the WhirlpoolConfigExtension
>
> **Parameters**
>
> - `attribute` - The attribute to set on the TokenBadge account.
>
> **Special Errors**
>
> - `FeatureIsNotEnabled` - If the feature flag for token badges is not
>   enabled.

Discriminator `e05841218a93f689` · data `SetTokenBadgeAttribute` · accounts `SetTokenBadgeAttributeInstructionAccounts`.

| Field       | Type                                          |
| ----------- | --------------------------------------------- |
| `attribute` | [`TokenBadgeAttribute`](#tokenbadgeattribute) |

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

Fields of `SetTokenBadgeAttributeInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `whirlpools_config`           | `Pubkey`           |
| 1  | `whirlpools_config_extension` | `Pubkey`           |
| 2  | `token_badge_authority`       | `Pubkey`           |
| 3  | `token_mint`                  | `Pubkey`           |
| 4  | `token_badge`                 | `Pubkey`           |
| 5… | `remaining`                   | `Vec<AccountMeta>` |

### `SetTokenBadgeAuthority`

> _From the program's IDL:_
>
> Sets the token badge authority for a WhirlpoolsConfigExtension.\
> Only the config extension authority has permission to invoke this instruction. ### Authority
>
> - "config_extension_authority" - Set authority in the\
>   WhirlpoolConfigExtension

Discriminator `cfca0420cd4f0db2` · data `SetTokenBadgeAuthority` · accounts `SetTokenBadgeAuthorityInstructionAccounts`.

No data fields.

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

Fields of `SetTokenBadgeAuthorityInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `whirlpools_config`           | `Pubkey`           |
| 1  | `whirlpools_config_extension` | `Pubkey`           |
| 2  | `config_extension_authority`  | `Pubkey`           |
| 3  | `new_token_badge_authority`   | `Pubkey`           |
| 4… | `remaining`                   | `Vec<AccountMeta>` |

### `Swap`

> _From the program's IDL:_
>
> Perform a swap in this Whirlpool
>
> **Authority**
>
> - "token_authority" - The authority to withdraw tokens from the input token
>   account.
>
> **Parameters**
>
> - `amount` - The amount of input or output token to swap from (depending on
>   amount_specified_is_input).
> - `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).
> - `sqrt_price_limit` - The maximum/minimum price the swap will swap to.
> - `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.
> - `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.
>
> **Special Errors**
>
> - `ZeroTradableAmount` - User provided parameter `amount` is 0.
> - `InvalidSqrtPriceLimitDirection` - User provided parameter
>   `sqrt_price_limit` does not match the direction of the trade.
> - `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool's max/min bounds for sqrt-price.
> - `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.
> - `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.
> - `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.
> - `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.
> - `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.

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

| Field                       | Type   |
| --------------------------- | ------ |
| `amount`                    | `u64`  |
| `other_amount_threshold`    | `u64`  |
| `sqrt_price_limit`          | `u128` |
| `amount_specified_is_input` | `bool` |
| `a_to_b`                    | `bool` |

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

Fields of `SwapInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `token_program`         | `Pubkey`           |
| 1   | `token_authority`       | `Pubkey`           |
| 2   | `whirlpool`             | `Pubkey`           |
| 3   | `token_owner_account_a` | `Pubkey`           |
| 4   | `token_vault_a`         | `Pubkey`           |
| 5   | `token_owner_account_b` | `Pubkey`           |
| 6   | `token_vault_b`         | `Pubkey`           |
| 7   | `tick_array0`           | `Pubkey`           |
| 8   | `tick_array1`           | `Pubkey`           |
| 9   | `tick_array2`           | `Pubkey`           |
| 10  | `oracle`                | `Pubkey`           |
| 11… | `remaining`             | `Vec<AccountMeta>` |

### `SwapV2`

> _From the program's IDL:_
>
> Perform a swap in this Whirlpool\
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - "token_authority" - The authority to withdraw tokens from the input token
>   account.
>
> **Parameters**
>
> - `amount` - The amount of input or output token to swap from (depending on
>   amount_specified_is_input).
> - `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).
> - `sqrt_price_limit` - The maximum/minimum price the swap will swap to.
> - `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.
> - `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.
>
> **Special Errors**
>
> - `ZeroTradableAmount` - User provided parameter `amount` is 0.
> - `InvalidSqrtPriceLimitDirection` - User provided parameter
>   `sqrt_price_limit` does not match the direction of the trade.
> - `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool's max/min bounds for sqrt-price.
> - `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.
> - `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.
> - `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.
> - `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.
> - `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.

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

| Field                       | Type                                                      |
| --------------------------- | --------------------------------------------------------- |
| `amount`                    | `u64`                                                     |
| `other_amount_threshold`    | `u64`                                                     |
| `sqrt_price_limit`          | `u128`                                                    |
| `amount_specified_is_input` | `bool`                                                    |
| `a_to_b`                    | `bool`                                                    |
| `remaining_accounts_info`   | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `SwapV2InstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `token_program_a`       | `Pubkey`           |
| 1   | `token_program_b`       | `Pubkey`           |
| 2   | `memo_program`          | `Pubkey`           |
| 3   | `token_authority`       | `Pubkey`           |
| 4   | `whirlpool`             | `Pubkey`           |
| 5   | `token_mint_a`          | `Pubkey`           |
| 6   | `token_mint_b`          | `Pubkey`           |
| 7   | `token_owner_account_a` | `Pubkey`           |
| 8   | `token_vault_a`         | `Pubkey`           |
| 9   | `token_owner_account_b` | `Pubkey`           |
| 10  | `token_vault_b`         | `Pubkey`           |
| 11  | `tick_array0`           | `Pubkey`           |
| 12  | `tick_array1`           | `Pubkey`           |
| 13  | `tick_array2`           | `Pubkey`           |
| 14  | `oracle`                | `Pubkey`           |
| 15… | `remaining`             | `Vec<AccountMeta>` |

### `TransferLockedPosition`

> _From the program's IDL:_
>
> Transfer a locked position to a different token account.
>
> **Authority**
>
> - `position_authority` - The authority that owns the position token.

Discriminator `b379e52e438ac28a` · data `TransferLockedPosition` · accounts `TransferLockedPositionInstructionAccounts`.

No data fields.

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

Fields of `TransferLockedPositionInstructionAccounts`, in account order:

| #  | Field                       | Type               |
| -- | --------------------------- | ------------------ |
| 0  | `position_authority`        | `Pubkey`           |
| 1  | `receiver`                  | `Pubkey`           |
| 2  | `position`                  | `Pubkey`           |
| 3  | `position_mint`             | `Pubkey`           |
| 4  | `position_token_account`    | `Pubkey`           |
| 5  | `destination_token_account` | `Pubkey`           |
| 6  | `lock_config`               | `Pubkey`           |
| 7  | `token2022_program`         | `Pubkey`           |
| 8… | `remaining`                 | `Vec<AccountMeta>` |

### `TwoHopSwap`

> _From the program's IDL:_
>
> Perform a two-hop swap in this Whirlpool
>
> **Authority**
>
> - "token_authority" - The authority to withdraw tokens from the input token
>   account.
>
> **Parameters**
>
> - `amount` - The amount of input or output token to swap from (depending on
>   amount_specified_is_input).
> - `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).
> - `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.
> - `a_to_b_one` - The direction of the swap of hop one. True if swapping from\
>   A to B. False if swapping from B to A.
> - `a_to_b_two` - The direction of the swap of hop two. True if swapping from\
>   A to B. False if swapping from B to A.
> - `sqrt_price_limit_one` - The maximum/minimum price the swap will swap to in the first hop.
> - `sqrt_price_limit_two` - The maximum/minimum price the swap will swap to in the second hop.
>
> **Special Errors**
>
> - `ZeroTradableAmount` - User provided parameter `amount` is 0.
> - `InvalidSqrtPriceLimitDirection` - User provided parameter
>   `sqrt_price_limit` does not match the direction of the trade.
> - `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool's max/min bounds for sqrt-price.
> - `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.
> - `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.
> - `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.
> - `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.
> - `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.
> - `InvalidIntermediaryMint` - Error if the intermediary mint between hop one and two do not equal.
> - `DuplicateTwoHopPool` - Error if whirlpool one & two are the same pool.

Discriminator `c360ed6c44a2dbe6` · data `TwoHopSwap` · accounts `TwoHopSwapInstructionAccounts`.

| Field                       | Type   |
| --------------------------- | ------ |
| `amount`                    | `u64`  |
| `other_amount_threshold`    | `u64`  |
| `amount_specified_is_input` | `bool` |
| `a_to_b_one`                | `bool` |
| `a_to_b_two`                | `bool` |
| `sqrt_price_limit_one`      | `u128` |
| `sqrt_price_limit_two`      | `u128` |

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

Fields of `TwoHopSwapInstructionAccounts`, in account order:

| #   | Field                       | Type               |
| --- | --------------------------- | ------------------ |
| 0   | `token_program`             | `Pubkey`           |
| 1   | `token_authority`           | `Pubkey`           |
| 2   | `whirlpool_one`             | `Pubkey`           |
| 3   | `whirlpool_two`             | `Pubkey`           |
| 4   | `token_owner_account_one_a` | `Pubkey`           |
| 5   | `token_vault_one_a`         | `Pubkey`           |
| 6   | `token_owner_account_one_b` | `Pubkey`           |
| 7   | `token_vault_one_b`         | `Pubkey`           |
| 8   | `token_owner_account_two_a` | `Pubkey`           |
| 9   | `token_vault_two_a`         | `Pubkey`           |
| 10  | `token_owner_account_two_b` | `Pubkey`           |
| 11  | `token_vault_two_b`         | `Pubkey`           |
| 12  | `tick_array_one0`           | `Pubkey`           |
| 13  | `tick_array_one1`           | `Pubkey`           |
| 14  | `tick_array_one2`           | `Pubkey`           |
| 15  | `tick_array_two0`           | `Pubkey`           |
| 16  | `tick_array_two1`           | `Pubkey`           |
| 17  | `tick_array_two2`           | `Pubkey`           |
| 18  | `oracle_one`                | `Pubkey`           |
| 19  | `oracle_two`                | `Pubkey`           |
| 20… | `remaining`                 | `Vec<AccountMeta>` |

### `TwoHopSwapV2`

> _From the program's IDL:_
>
> Perform a two-hop swap in this Whirlpool\
> This instruction works with both Token and Token-2022.
>
> **Authority**
>
> - "token_authority" - The authority to withdraw tokens from the input token
>   account.
>
> **Parameters**
>
> - `amount` - The amount of input or output token to swap from (depending on
>   amount_specified_is_input).
> - `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).
> - `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.
> - `a_to_b_one` - The direction of the swap of hop one. True if swapping from\
>   A to B. False if swapping from B to A.
> - `a_to_b_two` - The direction of the swap of hop two. True if swapping from\
>   A to B. False if swapping from B to A.
> - `sqrt_price_limit_one` - The maximum/minimum price the swap will swap to in the first hop.
> - `sqrt_price_limit_two` - The maximum/minimum price the swap will swap to in the second hop.
>
> **Special Errors**
>
> - `ZeroTradableAmount` - User provided parameter `amount` is 0.
> - `InvalidSqrtPriceLimitDirection` - User provided parameter
>   `sqrt_price_limit` does not match the direction of the trade.
> - `SqrtPriceOutOfBounds` - User provided parameter `sqrt_price_limit` is over Whirlppool's max/min bounds for sqrt-price.
> - `InvalidTickArraySequence` - User provided tick-arrays are not in sequential order required to proceed in this trade direction.
> - `TickArraySequenceInvalidIndex` - The swap loop attempted to access an invalid array index during the query of the next initialized tick.
> - `TickArrayIndexOutofBounds` - The swap loop attempted to access an invalid array index during tick crossing.
> - `LiquidityOverflow` - Liquidity value overflowed 128bits during tick crossing.
> - `InvalidTickSpacing` - The swap pool was initialized with tick-spacing of 0.
> - `InvalidIntermediaryMint` - Error if the intermediary mint between hop one and two do not equal.
> - `DuplicateTwoHopPool` - Error if whirlpool one & two are the same pool.

Discriminator `ba8fd11dfe02c275` · data `TwoHopSwapV2` · accounts `TwoHopSwapV2InstructionAccounts`.

| Field                       | Type                                                      |
| --------------------------- | --------------------------------------------------------- |
| `amount`                    | `u64`                                                     |
| `other_amount_threshold`    | `u64`                                                     |
| `amount_specified_is_input` | `bool`                                                    |
| `a_to_b_one`                | `bool`                                                    |
| `a_to_b_two`                | `bool`                                                    |
| `sqrt_price_limit_one`      | `u128`                                                    |
| `sqrt_price_limit_two`      | `u128`                                                    |
| `remaining_accounts_info`   | [`Option<RemainingAccountsInfo>`](#remainingaccountsinfo) |

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

Fields of `TwoHopSwapV2InstructionAccounts`, in account order:

| #   | Field                          | Type               |
| --- | ------------------------------ | ------------------ |
| 0   | `whirlpool_one`                | `Pubkey`           |
| 1   | `whirlpool_two`                | `Pubkey`           |
| 2   | `token_mint_input`             | `Pubkey`           |
| 3   | `token_mint_intermediate`      | `Pubkey`           |
| 4   | `token_mint_output`            | `Pubkey`           |
| 5   | `token_program_input`          | `Pubkey`           |
| 6   | `token_program_intermediate`   | `Pubkey`           |
| 7   | `token_program_output`         | `Pubkey`           |
| 8   | `token_owner_account_input`    | `Pubkey`           |
| 9   | `token_vault_one_input`        | `Pubkey`           |
| 10  | `token_vault_one_intermediate` | `Pubkey`           |
| 11  | `token_vault_two_intermediate` | `Pubkey`           |
| 12  | `token_vault_two_output`       | `Pubkey`           |
| 13  | `token_owner_account_output`   | `Pubkey`           |
| 14  | `token_authority`              | `Pubkey`           |
| 15  | `tick_array_one0`              | `Pubkey`           |
| 16  | `tick_array_one1`              | `Pubkey`           |
| 17  | `tick_array_one2`              | `Pubkey`           |
| 18  | `tick_array_two0`              | `Pubkey`           |
| 19  | `tick_array_two1`              | `Pubkey`           |
| 20  | `tick_array_two2`              | `Pubkey`           |
| 21  | `oracle_one`                   | `Pubkey`           |
| 22  | `oracle_two`                   | `Pubkey`           |
| 23  | `memo_program`                 | `Pubkey`           |
| 24… | `remaining`                    | `Vec<AccountMeta>` |

### `UpdateFeesAndRewards`

> _From the program's IDL:_
>
> Update the accrued fees and rewards for a position.
>
> **Special Errors**
>
> - `TickNotFound` - Provided tick array account does not contain the tick for
>   this position.
> - `LiquidityZero` - Position has zero liquidity and therefore already has the most updated fees and reward values.

Discriminator `9ae6fa0decd14bdf` · data `UpdateFeesAndRewards` · accounts `UpdateFeesAndRewardsInstructionAccounts`.

No data fields.

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

Fields of `UpdateFeesAndRewardsInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `whirlpool`        | `Pubkey`           |
| 1  | `position`         | `Pubkey`           |
| 2  | `tick_array_lower` | `Pubkey`           |
| 3  | `tick_array_upper` | `Pubkey`           |
| 4… | `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 `OrcaWhirlpoolAccount`. Each wraps a boxed struct from `carbon_orca_whirlpool_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `AdaptiveFeeTier`

Discriminator `931090742f92952e` · `accounts::adaptive_fee_tier::AdaptiveFeeTier`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `whirlpools_config`           | `Pubkey` |
| `fee_tier_index`              | `u16`    |
| `tick_spacing`                | `u16`    |
| `initialize_pool_authority`   | `Pubkey` |
| `delegated_fee_authority`     | `Pubkey` |
| `default_base_fee_rate`       | `u16`    |
| `filter_period`               | `u16`    |
| `decay_period`                | `u16`    |
| `reduction_factor`            | `u16`    |
| `adaptive_fee_control_factor` | `u32`    |
| `max_volatility_accumulator`  | `u32`    |
| `tick_group_size`             | `u16`    |
| `major_swap_threshold_ticks`  | `u16`    |

### `DynamicTickArray`

Discriminator `11d8f68ee1c7da38` · `accounts::dynamic_tick_array::DynamicTickArray`.

| Field              | Type                                |
| ------------------ | ----------------------------------- |
| `start_tick_index` | `i32`                               |
| `whirlpool`        | `Pubkey`                            |
| `tick_bitmap`      | `u128`                              |
| `ticks`            | [`[DynamicTick; 88]`](#dynamictick) |

### `FeeTier`

Discriminator `384b9f4c8e44be69` · `accounts::fee_tier::FeeTier`.

| Field               | Type     |
| ------------------- | -------- |
| `whirlpools_config` | `Pubkey` |
| `tick_spacing`      | `u16`    |
| `default_fee_rate`  | `u16`    |

### `LockConfig`

Discriminator `6a2fee9f7c0ca0c0` · `accounts::lock_config::LockConfig`.

| Field              | Type                              |
| ------------------ | --------------------------------- |
| `position`         | `Pubkey`                          |
| `position_owner`   | `Pubkey`                          |
| `whirlpool`        | `Pubkey`                          |
| `locked_timestamp` | `u64`                             |
| `lock_type`        | [`LockTypeLabel`](#locktypelabel) |

### `Oracle`

Discriminator `8bc283b38cb3e5f4` · `accounts::oracle::Oracle`.

| Field                    | Type                                            |
| ------------------------ | ----------------------------------------------- |
| `whirlpool`              | `Pubkey`                                        |
| `trade_enable_timestamp` | `u64`                                           |
| `adaptive_fee_constants` | [`AdaptiveFeeConstants`](#adaptivefeeconstants) |
| `adaptive_fee_variables` | [`AdaptiveFeeVariables`](#adaptivefeevariables) |
| `reserved`               | `[u8; 128]`                                     |

### `Position`

Discriminator `aabc8fe47a40f7d0` · `accounts::position::Position`.

| Field                     | Type                                             |
| ------------------------- | ------------------------------------------------ |
| `whirlpool`               | `Pubkey`                                         |
| `position_mint`           | `Pubkey`                                         |
| `liquidity`               | `u128`                                           |
| `tick_lower_index`        | `i32`                                            |
| `tick_upper_index`        | `i32`                                            |
| `fee_growth_checkpoint_a` | `u128`                                           |
| `fee_owed_a`              | `u64`                                            |
| `fee_growth_checkpoint_b` | `u128`                                           |
| `fee_owed_b`              | `u64`                                            |
| `reward_infos`            | [`[PositionRewardInfo; 3]`](#positionrewardinfo) |

### `PositionBundle`

Discriminator `81a9af41b95f2064` · `accounts::position_bundle::PositionBundle`.

| Field                  | Type       |
| ---------------------- | ---------- |
| `position_bundle_mint` | `Pubkey`   |
| `position_bitmap`      | `[u8; 32]` |

### `TickArray`

Discriminator `4561bdbe6e0742bb` · `accounts::tick_array::TickArray`.

| Field              | Type                  |
| ------------------ | --------------------- |
| `start_tick_index` | `i32`                 |
| `ticks`            | [`[Tick; 88]`](#tick) |
| `whirlpool`        | `Pubkey`              |

### `TokenBadge`

Discriminator `74dbcce5f974ff96` · `accounts::token_badge::TokenBadge`.

| Field                                         | Type     |
| --------------------------------------------- | -------- |
| `whirlpools_config`                           | `Pubkey` |
| `token_mint`                                  | `Pubkey` |
| `attribute_require_non_transferable_position` | `bool`   |

### `Whirlpool`

Discriminator `3f95d10ce1806309` · `accounts::whirlpool::Whirlpool`.

| Field                           | Type                                               |
| ------------------------------- | -------------------------------------------------- |
| `whirlpools_config`             | `Pubkey`                                           |
| `whirlpool_bump`                | `[u8; 1]`                                          |
| `tick_spacing`                  | `u16`                                              |
| `fee_tier_index_seed`           | `[u8; 2]`                                          |
| `fee_rate`                      | `u16`                                              |
| `protocol_fee_rate`             | `u16`                                              |
| `liquidity`                     | `u128`                                             |
| `sqrt_price`                    | `u128`                                             |
| `tick_current_index`            | `i32`                                              |
| `protocol_fee_owed_a`           | `u64`                                              |
| `protocol_fee_owed_b`           | `u64`                                              |
| `token_mint_a`                  | `Pubkey`                                           |
| `token_vault_a`                 | `Pubkey`                                           |
| `fee_growth_global_a`           | `u128`                                             |
| `token_mint_b`                  | `Pubkey`                                           |
| `token_vault_b`                 | `Pubkey`                                           |
| `fee_growth_global_b`           | `u128`                                             |
| `reward_last_updated_timestamp` | `u64`                                              |
| `reward_infos`                  | [`[WhirlpoolRewardInfo; 3]`](#whirlpoolrewardinfo) |

### `WhirlpoolsConfig`

Discriminator `9d1431e0d957c1fe` · `accounts::whirlpools_config::WhirlpoolsConfig`.

| Field                              | Type     |
| ---------------------------------- | -------- |
| `fee_authority`                    | `Pubkey` |
| `collect_protocol_fees_authority`  | `Pubkey` |
| `reward_emissions_super_authority` | `Pubkey` |
| `default_protocol_fee_rate`        | `u16`    |
| `feature_flags`                    | `u16`    |

### `WhirlpoolsConfigExtension`

Discriminator `0263d7a3f01a993a` · `accounts::whirlpools_config_extension::WhirlpoolsConfigExtension`.

| Field                        | Type     |
| ---------------------------- | -------- |
| `whirlpools_config`          | `Pubkey` |
| `config_extension_authority` | `Pubkey` |
| `token_badge_authority`      | `Pubkey` |

## Events

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

### `LiquidityDecreased`

Discriminator `a601244770cab5ab` · `events::liquidity_decreased::LiquidityDecreasedEvent`.

| Field                  | Type     |
| ---------------------- | -------- |
| `whirlpool`            | `Pubkey` |
| `position`             | `Pubkey` |
| `tick_lower_index`     | `i32`    |
| `tick_upper_index`     | `i32`    |
| `liquidity`            | `u128`   |
| `token_a_amount`       | `u64`    |
| `token_b_amount`       | `u64`    |
| `token_a_transfer_fee` | `u64`    |
| `token_b_transfer_fee` | `u64`    |

### `LiquidityIncreased`

Discriminator `1e0790b566fe9ba1` · `events::liquidity_increased::LiquidityIncreasedEvent`.

| Field                  | Type     |
| ---------------------- | -------- |
| `whirlpool`            | `Pubkey` |
| `position`             | `Pubkey` |
| `tick_lower_index`     | `i32`    |
| `tick_upper_index`     | `i32`    |
| `liquidity`            | `u128`   |
| `token_a_amount`       | `u64`    |
| `token_b_amount`       | `u64`    |
| `token_a_transfer_fee` | `u64`    |
| `token_b_transfer_fee` | `u64`    |

### `LiquidityRepositioned`

Discriminator `5f82b584fb32c326` · `events::liquidity_repositioned::LiquidityRepositionedEvent`.

| Field                             | Type     |
| --------------------------------- | -------- |
| `whirlpool`                       | `Pubkey` |
| `position`                        | `Pubkey` |
| `existing_range_tick_lower_index` | `i32`    |
| `existing_range_tick_upper_index` | `i32`    |
| `new_range_tick_lower_index`      | `i32`    |
| `new_range_tick_upper_index`      | `i32`    |
| `existing_range_liquidity`        | `u128`   |
| `new_range_liquidity`             | `u128`   |
| `existing_range_token_a_amount`   | `u64`    |
| `existing_range_token_b_amount`   | `u64`    |
| `new_range_token_a_amount`        | `u64`    |
| `new_range_token_b_amount`        | `u64`    |
| `token_a_transfer_amount`         | `u64`    |
| `token_a_transfer_fee`            | `u64`    |
| `is_token_a_transfer_from_owner`  | `bool`   |
| `token_b_transfer_amount`         | `u64`    |
| `token_b_transfer_fee`            | `u64`    |
| `is_token_b_transfer_from_owner`  | `bool`   |

### `PoolInitialized`

Discriminator `6476ad570cc6fee5` · `events::pool_initialized::PoolInitializedEvent`.

| Field                | Type     |
| -------------------- | -------- |
| `whirlpool`          | `Pubkey` |
| `whirlpools_config`  | `Pubkey` |
| `token_mint_a`       | `Pubkey` |
| `token_mint_b`       | `Pubkey` |
| `tick_spacing`       | `u16`    |
| `token_program_a`    | `Pubkey` |
| `token_program_b`    | `Pubkey` |
| `decimals_a`         | `u8`     |
| `decimals_b`         | `u8`     |
| `initial_sqrt_price` | `u128`   |

### `PositionOpened`

Discriminator `edaff3e693756579` · `events::position_opened::PositionOpenedEvent`.

| Field              | Type     |
| ------------------ | -------- |
| `whirlpool`        | `Pubkey` |
| `position`         | `Pubkey` |
| `tick_lower_index` | `i32`    |
| `tick_upper_index` | `i32`    |

### `Traded`

Discriminator `e1ca49af932ba096` · `events::traded::TradedEvent`.

| Field                 | Type     |
| --------------------- | -------- |
| `whirlpool`           | `Pubkey` |
| `a_to_b`              | `bool`   |
| `pre_sqrt_price`      | `u128`   |
| `post_sqrt_price`     | `u128`   |
| `input_amount`        | `u64`    |
| `output_amount`       | `u64`    |
| `input_transfer_fee`  | `u64`    |
| `output_transfer_fee` | `u64`    |
| `lp_fee`              | `u64`    |
| `protocol_fee`        | `u64`    |

## Types

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

### `AccountsType`

Enum `types::AccountsType`.

| Variant                     |
| --------------------------- |
| `TransferHookA`             |
| `TransferHookB`             |
| `TransferHookReward`        |
| `TransferHookInput`         |
| `TransferHookIntermediate`  |
| `TransferHookOutput`        |
| `SupplementalTickArrays`    |
| `SupplementalTickArraysOne` |
| `SupplementalTickArraysTwo` |
| `TransferHookDepositA`      |
| `TransferHookDepositB`      |
| `TransferHookWithdrawalA`   |
| `TransferHookWithdrawalB`   |

### `AdaptiveFeeConstants`

Struct `types::AdaptiveFeeConstants`.

| Field                         | Type       |
| ----------------------------- | ---------- |
| `filter_period`               | `u16`      |
| `decay_period`                | `u16`      |
| `reduction_factor`            | `u16`      |
| `adaptive_fee_control_factor` | `u32`      |
| `max_volatility_accumulator`  | `u32`      |
| `tick_group_size`             | `u16`      |
| `major_swap_threshold_ticks`  | `u16`      |
| `reserved`                    | `[u8; 16]` |

### `AdaptiveFeeVariables`

Struct `types::AdaptiveFeeVariables`.

| Field                             | Type       |
| --------------------------------- | ---------- |
| `last_reference_update_timestamp` | `u64`      |
| `last_major_swap_timestamp`       | `u64`      |
| `volatility_reference`            | `u32`      |
| `tick_group_index_reference`      | `i32`      |
| `volatility_accumulator`          | `u32`      |
| `reserved`                        | `[u8; 16]` |

### `ConfigFeatureFlag`

Enum `types::ConfigFeatureFlag`.

| Variant      | Fields |
| ------------ | ------ |
| `TokenBadge` | `bool` |

### `DynamicTick`

Enum `types::DynamicTick`.

| Variant         | Fields                                |
| --------------- | ------------------------------------- |
| `Uninitialized` |                                       |
| `Initialized`   | [`DynamicTickData`](#dynamictickdata) |

### `DynamicTickData`

Struct `types::DynamicTickData`.

| Field                    | Type        |
| ------------------------ | ----------- |
| `liquidity_net`          | `i128`      |
| `liquidity_gross`        | `u128`      |
| `fee_growth_outside_a`   | `u128`      |
| `fee_growth_outside_b`   | `u128`      |
| `reward_growths_outside` | `[u128; 3]` |

### `IncreaseLiquidityMethod`

Enum `types::IncreaseLiquidityMethod`.

| Variant          | Fields                                                                                         |
| ---------------- | ---------------------------------------------------------------------------------------------- |
| `ByTokenAmounts` | `token_max_a`: `u64`, `token_max_b`: `u64`, `min_sqrt_price`: `u128`, `max_sqrt_price`: `u128` |

### `LiquidityDecreased`

Struct `types::LiquidityDecreased`. Same fields as the [`LiquidityDecreased`](#liquiditydecreased) event.

### `LiquidityIncreased`

Struct `types::LiquidityIncreased`. Same fields as the [`LiquidityIncreased`](#liquidityincreased) event.

### `LiquidityRepositioned`

Struct `types::LiquidityRepositioned`. Same fields as the [`LiquidityRepositioned`](#liquidityrepositioned) event.

### `LockType`

Enum `types::LockType`.

| Variant     |
| ----------- |
| `Permanent` |

### `LockTypeLabel`

Enum `types::LockTypeLabel`.

| Variant     |
| ----------- |
| `Permanent` |

### `OpenPositionBumps`

Struct `types::OpenPositionBumps`.

| Field           | Type |
| --------------- | ---- |
| `position_bump` | `u8` |

### `OpenPositionWithMetadataBumps`

Struct `types::OpenPositionWithMetadataBumps`.

| Field           | Type |
| --------------- | ---- |
| `position_bump` | `u8` |
| `metadata_bump` | `u8` |

### `PoolInitialized`

Struct `types::PoolInitialized`. Same fields as the [`PoolInitialized`](#poolinitialized) event.

### `PositionOpened`

Struct `types::PositionOpened`. Same fields as the [`PositionOpened`](#positionopened) event.

### `PositionRewardInfo`

Struct `types::PositionRewardInfo`.

| Field                      | Type   |
| -------------------------- | ------ |
| `growth_inside_checkpoint` | `u128` |
| `amount_owed`              | `u64`  |

### `RemainingAccountsInfo`

Struct `types::RemainingAccountsInfo`.

| Field    | Type                                                     |
| -------- | -------------------------------------------------------- |
| `slices` | [`Vec<RemainingAccountsSlice>`](#remainingaccountsslice) |

### `RemainingAccountsSlice`

Struct `types::RemainingAccountsSlice`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `accounts_type` | [`AccountsType`](#accountstype) |
| `length`        | `u8`                            |

### `RepositionLiquidityMethod`

Enum `types::RepositionLiquidityMethod`.

| Variant       | Fields                                                                                                                                                                   |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ByLiquidity` | `new_liquidity_amount`: `u128`, `existing_range_token_min_a`: `u64`, `existing_range_token_min_b`: `u64`, `new_range_token_max_a`: `u64`, `new_range_token_max_b`: `u64` |

### `Tick`

Struct `types::Tick`.

| Field                    | Type        |
| ------------------------ | ----------- |
| `initialized`            | `bool`      |
| `liquidity_net`          | `i128`      |
| `liquidity_gross`        | `u128`      |
| `fee_growth_outside_a`   | `u128`      |
| `fee_growth_outside_b`   | `u128`      |
| `reward_growths_outside` | `[u128; 3]` |

### `TokenBadgeAttribute`

Enum `types::TokenBadgeAttribute`.

| Variant                          | Fields |
| -------------------------------- | ------ |
| `RequireNonTransferablePosition` | `bool` |

### `Traded`

Struct `types::Traded`. Same fields as the [`Traded`](#traded) event.

### `WhirlpoolBumps`

Struct `types::WhirlpoolBumps`.

| Field            | Type |
| ---------------- | ---- |
| `whirlpool_bump` | `u8` |

### `WhirlpoolRewardInfo`

> _From the program's IDL:_
>
> Stores the state relevant for tracking liquidity mining rewards at the `Whirlpool` level. These values are used in conjunction with `PositionRewardInfo`, `Tick.reward_growths_outside`, and `Whirlpool.\
> reward_last_updated_timestamp` to determine how many rewards are earned by open positions.

Struct `types::WhirlpoolRewardInfo`.

| Field                      | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mint`                     | `Pubkey`   | Reward token mint.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `vault`                    | `Pubkey`   | Reward vault token account.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `extension`                | `[u8; 32]` | reward_infos\[0]: Authority account that has permission to initialize the reward and set emissions. reward_infos\[1]: used for a struct that contains fields for extending the functionality of Whirlpool. reward_infos\[2]: reserved for future use. Historical notes: Originally, this was a field named "authority", but it was found that there was no opportunity to set different authorities for the three rewards. Therefore, the use of this field was changed for Whirlpool's future extensibility. |
| `emissions_per_second_x64` | `u128`     | Q64.64 number that indicates how many tokens per second are earned per unit of liquidity.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `growth_global_x64`        | `u128`     | Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward emissions were turned on.                                                                                                                                                                                                                                                                                                                                                                                            |

---

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