# Phoenix v1 decoder (Carbon 2.0)

> Decode Phoenix v1 instructions in Rust with carbon-phoenix-v1-decoder 2.0.0. Program ID PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY.

`carbon-phoenix-v1-decoder` decodes the instructions of the Phoenix v1 program (`PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY`): 28 instructions. It decodes no accounts: `PhoenixV1Account` has no variants. 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-phoenix-v1-decoder`](https://crates.io/crates/carbon-phoenix-v1-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-phoenix-v1-decoder@2.0.0`                                                                   |
| Program ID       | `PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY` (`carbon_phoenix_v1_decoder::PROGRAM_ID`)                       |
| Category         | [DEX & AMM](https://carbon.sevenlabs.org/decoders/dex-and-amm.md)                                             |
| Decoder          | `carbon_phoenix_v1_decoder::PhoenixV1Decoder`                                                                 |
| Instruction enum | `instructions::PhoenixV1Instruction`                                                                          |
| Account enum     | `accounts::PhoenixV1Account` (no variants)                                                                    |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                      |
| API docs         | [docs.rs/carbon-phoenix-v1-decoder/2.0.0](https://docs.rs/carbon-phoenix-v1-decoder/2.0.0)                    |
| Source           | [decoders/phoenix-v1-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/phoenix-v1-decoder) |

Other DEX and AMM decoders: [BonkSwap](https://carbon.sevenlabs.org/decoders/bonkswap.md), [FluxBeam](https://carbon.sevenlabs.org/decoders/fluxbeam.md), [Gavel](https://carbon.sevenlabs.org/decoders/gavel.md), [Heaven](https://carbon.sevenlabs.org/decoders/heaven.md), [Jupiter Limit Order](https://carbon.sevenlabs.org/decoders/jupiter-limit-order.md), [Jupiter Limit Order v2](https://carbon.sevenlabs.org/decoders/jupiter-limit-order-2.md), [Kamino Limit Order](https://carbon.sevenlabs.org/decoders/kamino-limit-order.md), [Lifinity AMM v2](https://carbon.sevenlabs.org/decoders/lifinity-amm-v2.md), [Meteora DAMM v2](https://carbon.sevenlabs.org/decoders/meteora-damm-v2.md), [Meteora DLMM](https://carbon.sevenlabs.org/decoders/meteora-dlmm.md), [Meteora Pools](https://carbon.sevenlabs.org/decoders/meteora-pools.md), [OpenBook v2](https://carbon.sevenlabs.org/decoders/openbook-v2.md), [Orca Whirlpools](https://carbon.sevenlabs.org/decoders/orca-whirlpool.md), [PancakeSwap](https://carbon.sevenlabs.org/decoders/pancake-swap.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 Phoenix v1 transactions from the public RPC and prints every decoded `Swap` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-phoenix-v1-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_phoenix_v1_decoder::{instructions::PhoenixV1Instruction, PhoenixV1Decoder, 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(PhoenixV1Decoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, PhoenixV1Instruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, PhoenixV1Instruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let PhoenixV1Instruction::Swap { data, accounts, .. } = input.decoded_instruction {
            println!("swap {signature}: {data:?} phoenix_program={}", accounts.phoenix_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.

## Instructions

Variants of `PhoenixV1Instruction`. Each is `PhoenixV1Instruction::<Variant> { program_id, data, accounts }`, where `data` and `accounts` are the types listed under the variant, exported from `carbon_phoenix_v1_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 `PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY`.
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.

### `CancelAllOrders`

Discriminator `06` · data `CancelAllOrders` · accounts `CancelAllOrdersInstructionAccounts`.

No data fields.

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

Fields of `CancelAllOrdersInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `base_account`    | `Pubkey`           |
| 5  | `quote_account`   | `Pubkey`           |
| 6  | `base_vault`      | `Pubkey`           |
| 7  | `quote_vault`     | `Pubkey`           |
| 8  | `token_program`   | `Pubkey`           |
| 9… | `remaining`       | `Vec<AccountMeta>` |

### `CancelAllOrdersWithFreeFunds`

Discriminator `07` · data `CancelAllOrdersWithFreeFunds` · accounts `CancelAllOrdersWithFreeFundsInstructionAccounts`.

No data fields.

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

Fields of `CancelAllOrdersWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4… | `remaining`       | `Vec<AccountMeta>` |

### `CancelMultipleOrdersById`

Discriminator `0a` · data `CancelMultipleOrdersById` · accounts `CancelMultipleOrdersByIdInstructionAccounts`.

| Field    | Type                                                                |
| -------- | ------------------------------------------------------------------- |
| `params` | [`CancelMultipleOrdersByIdParams`](#cancelmultipleordersbyidparams) |

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

Fields of `CancelMultipleOrdersByIdInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `base_account`    | `Pubkey`           |
| 5  | `quote_account`   | `Pubkey`           |
| 6  | `base_vault`      | `Pubkey`           |
| 7  | `quote_vault`     | `Pubkey`           |
| 8  | `token_program`   | `Pubkey`           |
| 9… | `remaining`       | `Vec<AccountMeta>` |

### `CancelMultipleOrdersByIdWithFreeFunds`

Discriminator `0b` · data `CancelMultipleOrdersByIdWithFreeFunds` · accounts `CancelMultipleOrdersByIdWithFreeFundsInstructionAccounts`.

| Field    | Type                                                                |
| -------- | ------------------------------------------------------------------- |
| `params` | [`CancelMultipleOrdersByIdParams`](#cancelmultipleordersbyidparams) |

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

Fields of `CancelMultipleOrdersByIdWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4… | `remaining`       | `Vec<AccountMeta>` |

### `CancelUpTo`

Discriminator `08` · data `CancelUpTo` · accounts `CancelUpToInstructionAccounts`.

| Field    | Type                                    |
| -------- | --------------------------------------- |
| `params` | [`CancelUpToParams`](#canceluptoparams) |

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

Fields of `CancelUpToInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `base_account`    | `Pubkey`           |
| 5  | `quote_account`   | `Pubkey`           |
| 6  | `base_vault`      | `Pubkey`           |
| 7  | `quote_vault`     | `Pubkey`           |
| 8  | `token_program`   | `Pubkey`           |
| 9… | `remaining`       | `Vec<AccountMeta>` |

### `CancelUpToWithFreeFunds`

Discriminator `09` · data `CancelUpToWithFreeFunds` · accounts `CancelUpToWithFreeFundsInstructionAccounts`.

| Field    | Type                                    |
| -------- | --------------------------------------- |
| `params` | [`CancelUpToParams`](#canceluptoparams) |

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

Fields of `CancelUpToWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4… | `remaining`       | `Vec<AccountMeta>` |

### `ChangeFeeRecipient`

Discriminator `6d` · data `ChangeFeeRecipient` · accounts `ChangeFeeRecipientInstructionAccounts`.

No data fields.

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

Fields of `ChangeFeeRecipientInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `phoenix_program`   | `Pubkey`           |
| 1  | `log_authority`     | `Pubkey`           |
| 2  | `market`            | `Pubkey`           |
| 3  | `market_authority`  | `Pubkey`           |
| 4  | `new_fee_recipient` | `Pubkey`           |
| 5… | `remaining`         | `Vec<AccountMeta>` |

### `ChangeMarketStatus`

Discriminator `67` · data `ChangeMarketStatus` · accounts `ChangeMarketStatusInstructionAccounts`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `market_status` | [`MarketStatus`](#marketstatus) |

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

Fields of `ChangeMarketStatusInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `phoenix_program`  | `Pubkey`           |
| 1  | `log_authority`    | `Pubkey`           |
| 2  | `market`           | `Pubkey`           |
| 3  | `market_authority` | `Pubkey`           |
| 4… | `remaining`        | `Vec<AccountMeta>` |

### `ChangeSeatStatus`

Discriminator `68` · data `ChangeSeatStatus` · accounts `ChangeSeatStatusInstructionAccounts`.

| Field             | Type                                        |
| ----------------- | ------------------------------------------- |
| `approval_status` | [`SeatApprovalStatus`](#seatapprovalstatus) |

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

Fields of `ChangeSeatStatusInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `phoenix_program`  | `Pubkey`           |
| 1  | `log_authority`    | `Pubkey`           |
| 2  | `market`           | `Pubkey`           |
| 3  | `market_authority` | `Pubkey`           |
| 4  | `seat`             | `Pubkey`           |
| 5… | `remaining`        | `Vec<AccountMeta>` |

### `ClaimAuthority`

Discriminator `65` · data `ClaimAuthority` · accounts `ClaimAuthorityInstructionAccounts`.

No data fields.

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

Fields of `ClaimAuthorityInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `successor`       | `Pubkey`           |
| 4… | `remaining`       | `Vec<AccountMeta>` |

### `CollectFees`

Discriminator `6c` · data `CollectFees` · accounts `CollectFeesInstructionAccounts`.

No data fields.

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

Fields of `CollectFeesInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `sweeper`         | `Pubkey`           |
| 4  | `fee_recipient`   | `Pubkey`           |
| 5  | `quote_vault`     | `Pubkey`           |
| 6  | `token_program`   | `Pubkey`           |
| 7… | `remaining`       | `Vec<AccountMeta>` |

### `DepositFunds`

Discriminator `0d` · data `DepositFunds` · accounts `DepositFundsInstructionAccounts`.

| Field                  | Type                              |
| ---------------------- | --------------------------------- |
| `deposit_funds_params` | [`DepositParams`](#depositparams) |

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

Fields of `DepositFundsInstructionAccounts`, in account order:

| #   | Field             | Type               |
| --- | ----------------- | ------------------ |
| 0   | `phoenix_program` | `Pubkey`           |
| 1   | `log_authority`   | `Pubkey`           |
| 2   | `market`          | `Pubkey`           |
| 3   | `trader`          | `Pubkey`           |
| 4   | `seat`            | `Pubkey`           |
| 5   | `base_account`    | `Pubkey`           |
| 6   | `quote_account`   | `Pubkey`           |
| 7   | `base_vault`      | `Pubkey`           |
| 8   | `quote_vault`     | `Pubkey`           |
| 9   | `token_program`   | `Pubkey`           |
| 10… | `remaining`       | `Vec<AccountMeta>` |

### `EvictSeat`

Discriminator `6a` · data `EvictSeat` · accounts `EvictSeatInstructionAccounts`.

No data fields.

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

Fields of `EvictSeatInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `phoenix_program`  | `Pubkey`           |
| 1   | `log_authority`    | `Pubkey`           |
| 2   | `market`           | `Pubkey`           |
| 3   | `market_authority` | `Pubkey`           |
| 4   | `trader`           | `Pubkey`           |
| 5   | `seat`             | `Pubkey`           |
| 6   | `base_account`     | `Pubkey`           |
| 7   | `quote_account`    | `Pubkey`           |
| 8   | `base_vault`       | `Pubkey`           |
| 9   | `quote_vault`      | `Pubkey`           |
| 10  | `token_program`    | `Pubkey`           |
| 11… | `remaining`        | `Vec<AccountMeta>` |

### `ForceCancelOrders`

Discriminator `6b` · data `ForceCancelOrders` · accounts `ForceCancelOrdersInstructionAccounts`.

| Field    | Type                                    |
| -------- | --------------------------------------- |
| `params` | [`CancelUpToParams`](#canceluptoparams) |

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

Fields of `ForceCancelOrdersInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `phoenix_program`  | `Pubkey`           |
| 1   | `log_authority`    | `Pubkey`           |
| 2   | `market`           | `Pubkey`           |
| 3   | `market_authority` | `Pubkey`           |
| 4   | `trader`           | `Pubkey`           |
| 5   | `seat`             | `Pubkey`           |
| 6   | `base_account`     | `Pubkey`           |
| 7   | `quote_account`    | `Pubkey`           |
| 8   | `base_vault`       | `Pubkey`           |
| 9   | `quote_vault`      | `Pubkey`           |
| 10  | `token_program`    | `Pubkey`           |
| 11… | `remaining`        | `Vec<AccountMeta>` |

### `InitializeMarket`

Discriminator `64` · data `InitializeMarket` · accounts `InitializeMarketInstructionAccounts`.

| Field               | Type                                    |
| ------------------- | --------------------------------------- |
| `initialize_params` | [`InitializeParams`](#initializeparams) |

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

Fields of `InitializeMarketInstructionAccounts`, in account order:

| #   | Field             | Type               |
| --- | ----------------- | ------------------ |
| 0   | `phoenix_program` | `Pubkey`           |
| 1   | `log_authority`   | `Pubkey`           |
| 2   | `market`          | `Pubkey`           |
| 3   | `market_creator`  | `Pubkey`           |
| 4   | `base_mint`       | `Pubkey`           |
| 5   | `quote_mint`      | `Pubkey`           |
| 6   | `base_vault`      | `Pubkey`           |
| 7   | `quote_vault`     | `Pubkey`           |
| 8   | `system_program`  | `Pubkey`           |
| 9   | `token_program`   | `Pubkey`           |
| 10… | `remaining`       | `Vec<AccountMeta>` |

### `Log`

Discriminator `0f` · data `Log` · accounts `LogInstructionAccounts`.

No data fields.

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

Fields of `LogInstructionAccounts`, in account order:

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

### `NameSuccessor`

Discriminator `66` · data `NameSuccessor` · accounts `NameSuccessorInstructionAccounts`.

| Field       | Type     |
| ----------- | -------- |
| `successor` | `Pubkey` |

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

Fields of `NameSuccessorInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `phoenix_program`  | `Pubkey`           |
| 1  | `log_authority`    | `Pubkey`           |
| 2  | `market`           | `Pubkey`           |
| 3  | `market_authority` | `Pubkey`           |
| 4… | `remaining`        | `Vec<AccountMeta>` |

### `PlaceLimitOrder`

Discriminator `02` · data `PlaceLimitOrder` · accounts `PlaceLimitOrderInstructionAccounts`.

| Field          | Type                          |
| -------------- | ----------------------------- |
| `order_packet` | [`OrderPacket`](#orderpacket) |

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

Fields of `PlaceLimitOrderInstructionAccounts`, in account order:

| #   | Field             | Type               |
| --- | ----------------- | ------------------ |
| 0   | `phoenix_program` | `Pubkey`           |
| 1   | `log_authority`   | `Pubkey`           |
| 2   | `market`          | `Pubkey`           |
| 3   | `trader`          | `Pubkey`           |
| 4   | `seat`            | `Pubkey`           |
| 5   | `base_account`    | `Pubkey`           |
| 6   | `quote_account`   | `Pubkey`           |
| 7   | `base_vault`      | `Pubkey`           |
| 8   | `quote_vault`     | `Pubkey`           |
| 9   | `token_program`   | `Pubkey`           |
| 10… | `remaining`       | `Vec<AccountMeta>` |

### `PlaceLimitOrderWithFreeFunds`

Discriminator `03` · data `PlaceLimitOrderWithFreeFunds` · accounts `PlaceLimitOrderWithFreeFundsInstructionAccounts`.

| Field          | Type                          |
| -------------- | ----------------------------- |
| `order_packet` | [`OrderPacket`](#orderpacket) |

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

Fields of `PlaceLimitOrderWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `seat`            | `Pubkey`           |
| 5… | `remaining`       | `Vec<AccountMeta>` |

### `PlaceMultiplePostOnlyOrders`

Discriminator `10` · data `PlaceMultiplePostOnlyOrders` · accounts `PlaceMultiplePostOnlyOrdersInstructionAccounts`.

| Field                   | Type                                          |
| ----------------------- | --------------------------------------------- |
| `multiple_order_packet` | [`MultipleOrderPacket`](#multipleorderpacket) |

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

Fields of `PlaceMultiplePostOnlyOrdersInstructionAccounts`, in account order:

| #   | Field             | Type               |
| --- | ----------------- | ------------------ |
| 0   | `phoenix_program` | `Pubkey`           |
| 1   | `log_authority`   | `Pubkey`           |
| 2   | `market`          | `Pubkey`           |
| 3   | `trader`          | `Pubkey`           |
| 4   | `seat`            | `Pubkey`           |
| 5   | `base_account`    | `Pubkey`           |
| 6   | `quote_account`   | `Pubkey`           |
| 7   | `base_vault`      | `Pubkey`           |
| 8   | `quote_vault`     | `Pubkey`           |
| 9   | `token_program`   | `Pubkey`           |
| 10… | `remaining`       | `Vec<AccountMeta>` |

### `PlaceMultiplePostOnlyOrdersWithFreeFunds`

Discriminator `11` · data `PlaceMultiplePostOnlyOrdersWithFreeFunds` · accounts `PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionAccounts`.

| Field                   | Type                                          |
| ----------------------- | --------------------------------------------- |
| `multiple_order_packet` | [`MultipleOrderPacket`](#multipleorderpacket) |

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

Fields of `PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `seat`            | `Pubkey`           |
| 5… | `remaining`       | `Vec<AccountMeta>` |

### `ReduceOrder`

Discriminator `04` · data `ReduceOrder` · accounts `ReduceOrderInstructionAccounts`.

| Field    | Type                                      |
| -------- | ----------------------------------------- |
| `params` | [`ReduceOrderParams`](#reduceorderparams) |

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

Fields of `ReduceOrderInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `base_account`    | `Pubkey`           |
| 5  | `quote_account`   | `Pubkey`           |
| 6  | `base_vault`      | `Pubkey`           |
| 7  | `quote_vault`     | `Pubkey`           |
| 8  | `token_program`   | `Pubkey`           |
| 9… | `remaining`       | `Vec<AccountMeta>` |

### `ReduceOrderWithFreeFunds`

Discriminator `05` · data `ReduceOrderWithFreeFunds` · accounts `ReduceOrderWithFreeFundsInstructionAccounts`.

| Field    | Type                                      |
| -------- | ----------------------------------------- |
| `params` | [`ReduceOrderParams`](#reduceorderparams) |

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

Fields of `ReduceOrderWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4… | `remaining`       | `Vec<AccountMeta>` |

### `RequestSeat`

Discriminator `0e` · data `RequestSeat` · accounts `RequestSeatInstructionAccounts`.

No data fields.

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

Fields of `RequestSeatInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `payer`           | `Pubkey`           |
| 4  | `seat`            | `Pubkey`           |
| 5  | `system_program`  | `Pubkey`           |
| 6… | `remaining`       | `Vec<AccountMeta>` |

### `RequestSeatAuthorized`

Discriminator `69` · data `RequestSeatAuthorized` · accounts `RequestSeatAuthorizedInstructionAccounts`.

No data fields.

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

Fields of `RequestSeatAuthorizedInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `phoenix_program`  | `Pubkey`           |
| 1  | `log_authority`    | `Pubkey`           |
| 2  | `market`           | `Pubkey`           |
| 3  | `market_authority` | `Pubkey`           |
| 4  | `payer`            | `Pubkey`           |
| 5  | `trader`           | `Pubkey`           |
| 6  | `seat`             | `Pubkey`           |
| 7  | `system_program`   | `Pubkey`           |
| 8… | `remaining`        | `Vec<AccountMeta>` |

### `Swap`

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

| Field          | Type                          |
| -------------- | ----------------------------- |
| `order_packet` | [`OrderPacket`](#orderpacket) |

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

Fields of `SwapInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `base_account`    | `Pubkey`           |
| 5  | `quote_account`   | `Pubkey`           |
| 6  | `base_vault`      | `Pubkey`           |
| 7  | `quote_vault`     | `Pubkey`           |
| 8  | `token_program`   | `Pubkey`           |
| 9… | `remaining`       | `Vec<AccountMeta>` |

### `SwapWithFreeFunds`

Discriminator `01` · data `SwapWithFreeFunds` · accounts `SwapWithFreeFundsInstructionAccounts`.

| Field          | Type                          |
| -------------- | ----------------------------- |
| `order_packet` | [`OrderPacket`](#orderpacket) |

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

Fields of `SwapWithFreeFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `seat`            | `Pubkey`           |
| 5… | `remaining`       | `Vec<AccountMeta>` |

### `WithdrawFunds`

Discriminator `0c` · data `WithdrawFunds` · accounts `WithdrawFundsInstructionAccounts`.

| Field                   | Type                                |
| ----------------------- | ----------------------------------- |
| `withdraw_funds_params` | [`WithdrawParams`](#withdrawparams) |

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

Fields of `WithdrawFundsInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `phoenix_program` | `Pubkey`           |
| 1  | `log_authority`   | `Pubkey`           |
| 2  | `market`          | `Pubkey`           |
| 3  | `trader`          | `Pubkey`           |
| 4  | `base_account`    | `Pubkey`           |
| 5  | `quote_account`   | `Pubkey`           |
| 6  | `base_vault`      | `Pubkey`           |
| 7  | `quote_vault`     | `Pubkey`           |
| 8  | `token_program`   | `Pubkey`           |
| 9… | `remaining`       | `Vec<AccountMeta>` |

## Types

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

### `AuditLogHeader`

Struct `types::AuditLogHeader`.

| Field             | Type     |
| ----------------- | -------- |
| `instruction`     | `u8`     |
| `sequence_number` | `u64`    |
| `timestamp`       | `i64`    |
| `slot`            | `u64`    |
| `market`          | `Pubkey` |
| `signer`          | `Pubkey` |
| `total_events`    | `u16`    |

### `CancelMultipleOrdersByIdParams`

Struct `types::CancelMultipleOrdersByIdParams`.

| Field    | Type                                           |
| -------- | ---------------------------------------------- |
| `orders` | [`Vec<CancelOrderParams>`](#cancelorderparams) |

### `CancelOrderParams`

Struct `types::CancelOrderParams`.

| Field                   | Type            |
| ----------------------- | --------------- |
| `side`                  | [`Side`](#side) |
| `price_in_ticks`        | `u64`           |
| `order_sequence_number` | `u64`           |

### `CancelUpToParams`

Struct `types::CancelUpToParams`.

| Field                  | Type            |
| ---------------------- | --------------- |
| `side`                 | [`Side`](#side) |
| `tick_limit`           | `Option<u64>`   |
| `num_orders_to_search` | `Option<u32>`   |
| `num_orders_to_cancel` | `Option<u32>`   |

### `CondensedOrder`

Struct `types::CondensedOrder`.

| Field                                  | Type          |
| -------------------------------------- | ------------- |
| `price_in_ticks`                       | `u64`         |
| `size_in_base_lots`                    | `u64`         |
| `last_valid_slot`                      | `Option<u64>` |
| `last_valid_unix_timestamp_in_seconds` | `Option<u64>` |

### `DepositParams`

Struct `types::DepositParams`.

| Field                   | Type  |
| ----------------------- | ----- |
| `quote_lots_to_deposit` | `u64` |
| `base_lots_to_deposit`  | `u64` |

### `EvictEvent`

Struct `types::EvictEvent`.

| Field                   | Type     |
| ----------------------- | -------- |
| `index`                 | `u16`    |
| `maker_id`              | `Pubkey` |
| `order_sequence_number` | `u64`    |
| `price_in_ticks`        | `u64`    |
| `base_lots_evicted`     | `u64`    |

### `ExpiredOrderEvent`

Struct `types::ExpiredOrderEvent`.

| Field                   | Type     |
| ----------------------- | -------- |
| `index`                 | `u16`    |
| `maker_id`              | `Pubkey` |
| `order_sequence_number` | `u64`    |
| `price_in_ticks`        | `u64`    |
| `base_lots_removed`     | `u64`    |

### `FailedMultipleLimitOrderBehavior`

Enum `types::FailedMultipleLimitOrderBehavior`.

| Variant                                  |
| ---------------------------------------- |
| `FailOnInsufficientFundsAndAmendOnCross` |
| `FailOnInsufficientFundsAndFailOnCross`  |
| `SkipOnInsufficientFundsAndAmendOnCross` |
| `SkipOnInsufficientFundsAndFailOnCross`  |

### `FeeEvent`

Struct `types::FeeEvent`.

| Field                          | Type  |
| ------------------------------ | ----- |
| `index`                        | `u16` |
| `fees_collected_in_quote_lots` | `u64` |

### `FillEvent`

Struct `types::FillEvent`.

| Field                   | Type     |
| ----------------------- | -------- |
| `index`                 | `u16`    |
| `maker_id`              | `Pubkey` |
| `order_sequence_number` | `u64`    |
| `price_in_ticks`        | `u64`    |
| `base_lots_filled`      | `u64`    |
| `base_lots_remaining`   | `u64`    |

### `FillSummaryEvent`

Struct `types::FillSummaryEvent`.

| Field                     | Type   |
| ------------------------- | ------ |
| `index`                   | `u16`  |
| `client_order_id`         | `u128` |
| `total_base_lots_filled`  | `u64`  |
| `total_quote_lots_filled` | `u64`  |
| `total_fee_in_quote_lots` | `u64`  |

### `InitializeParams`

Struct `types::InitializeParams`.

| Field                                   | Type                                    |
| --------------------------------------- | --------------------------------------- |
| `market_size_params`                    | [`MarketSizeParams`](#marketsizeparams) |
| `num_quote_lots_per_quote_unit`         | `u64`                                   |
| `tick_size_in_quote_lots_per_base_unit` | `u64`                                   |
| `num_base_lots_per_base_unit`           | `u64`                                   |
| `taker_fee_bps`                         | `u16`                                   |
| `fee_collector`                         | `Pubkey`                                |
| `raw_base_units_per_base_unit`          | `Option<u32>`                           |

### `MarketHeader`

Struct `types::MarketHeader`.

| Field                                    | Type                                    |
| ---------------------------------------- | --------------------------------------- |
| `discriminant`                           | `u64`                                   |
| `status`                                 | `u64`                                   |
| `market_size_params`                     | [`MarketSizeParams`](#marketsizeparams) |
| `base_params`                            | [`TokenParams`](#tokenparams)           |
| `base_lot_size`                          | `u64`                                   |
| `quote_params`                           | [`TokenParams`](#tokenparams)           |
| `quote_lot_size`                         | `u64`                                   |
| `tick_size_in_quote_atoms_per_base_unit` | `u64`                                   |
| `authority`                              | `Pubkey`                                |
| `fee_recipient`                          | `Pubkey`                                |
| `market_sequence_number`                 | `u64`                                   |
| `successor`                              | `Pubkey`                                |
| `raw_base_units_per_base_unit`           | `u32`                                   |
| `padding1`                               | `u32`                                   |
| `padding2`                               | `[u64; 32]`                             |

### `MarketSizeParams`

Struct `types::MarketSizeParams`.

| Field       | Type  |
| ----------- | ----- |
| `bids_size` | `u64` |
| `asks_size` | `u64` |
| `num_seats` | `u64` |

### `MarketStatus`

Enum `types::MarketStatus`.

| Variant         |
| --------------- |
| `Uninitialized` |
| `Active`        |
| `PostOnly`      |
| `Paused`        |
| `Closed`        |
| `Tombstoned`    |

### `MultipleOrderPacket`

Struct `types::MultipleOrderPacket`.

| Field                                  | Type                                                                    |
| -------------------------------------- | ----------------------------------------------------------------------- |
| `bids`                                 | [`Vec<CondensedOrder>`](#condensedorder)                                |
| `asks`                                 | [`Vec<CondensedOrder>`](#condensedorder)                                |
| `client_order_id`                      | `Option<u128>`                                                          |
| `failed_multiple_limit_order_behavior` | [`FailedMultipleLimitOrderBehavior`](#failedmultiplelimitorderbehavior) |

### `OrderPacket`

Enum `types::OrderPacket`.

| Variant             | Fields                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PostOnly`          | `side`: [`Side`](#side), `price_in_ticks`: `u64`, `num_base_lots`: `u64`, `client_order_id`: `u128`, `reject_post_only`: `bool`, `use_only_deposited_funds`: `bool`, `last_valid_slot`: `Option<u64>`, `last_valid_unix_timestamp_in_seconds`: `Option<u64>`, `fail_silently_on_insufficient_funds`: `bool`                                                                                                                        |
| `Limit`             | `side`: [`Side`](#side), `price_in_ticks`: `u64`, `num_base_lots`: `u64`, `self_trade_behavior`: [`SelfTradeBehavior`](#selftradebehavior), `match_limit`: `Option<u64>`, `client_order_id`: `u128`, `use_only_deposited_funds`: `bool`, `last_valid_slot`: `Option<u64>`, `last_valid_unix_timestamp_in_seconds`: `Option<u64>`, `fail_silently_on_insufficient_funds`: `bool`                                                    |
| `ImmediateOrCancel` | `side`: [`Side`](#side), `price_in_ticks`: `Option<u64>`, `num_base_lots`: `u64`, `num_quote_lots`: `u64`, `min_base_lots_to_fill`: `u64`, `min_quote_lots_to_fill`: `u64`, `self_trade_behavior`: [`SelfTradeBehavior`](#selftradebehavior), `match_limit`: `Option<u64>`, `client_order_id`: `u128`, `use_only_deposited_funds`: `bool`, `last_valid_slot`: `Option<u64>`, `last_valid_unix_timestamp_in_seconds`: `Option<u64>` |

### `PhoenixMarketEvent`

Enum `types::PhoenixMarketEvent`.

| Variant         | Fields                                    |
| --------------- | ----------------------------------------- |
| `Uninitialized` |                                           |
| `Header`        | [`AuditLogHeader`](#auditlogheader)       |
| `Fill`          | [`FillEvent`](#fillevent)                 |
| `Place`         | [`PlaceEvent`](#placeevent)               |
| `Reduce`        | [`ReduceEvent`](#reduceevent)             |
| `Evict`         | [`EvictEvent`](#evictevent)               |
| `FillSummary`   | [`FillSummaryEvent`](#fillsummaryevent)   |
| `Fee`           | [`FeeEvent`](#feeevent)                   |
| `TimeInForce`   | [`TimeInForceEvent`](#timeinforceevent)   |
| `ExpiredOrder`  | [`ExpiredOrderEvent`](#expiredorderevent) |

### `PlaceEvent`

Struct `types::PlaceEvent`.

| Field                   | Type   |
| ----------------------- | ------ |
| `index`                 | `u16`  |
| `order_sequence_number` | `u64`  |
| `client_order_id`       | `u128` |
| `price_in_ticks`        | `u64`  |
| `base_lots_placed`      | `u64`  |

### `ReduceEvent`

Struct `types::ReduceEvent`.

| Field                   | Type  |
| ----------------------- | ----- |
| `index`                 | `u16` |
| `order_sequence_number` | `u64` |
| `price_in_ticks`        | `u64` |
| `base_lots_removed`     | `u64` |
| `base_lots_remaining`   | `u64` |

### `ReduceOrderParams`

Struct `types::ReduceOrderParams`.

| Field         | Type                                      |
| ------------- | ----------------------------------------- |
| `base_params` | [`CancelOrderParams`](#cancelorderparams) |
| `size`        | `u64`                                     |

### `Seat`

Struct `types::Seat`.

| Field             | Type       |
| ----------------- | ---------- |
| `discriminant`    | `u64`      |
| `market`          | `Pubkey`   |
| `trader`          | `Pubkey`   |
| `approval_status` | `u64`      |
| `padding`         | `[u64; 6]` |

### `SeatApprovalStatus`

Enum `types::SeatApprovalStatus`.

| Variant       |
| ------------- |
| `NotApproved` |
| `Approved`    |
| `Retired`     |

### `SelfTradeBehavior`

Enum `types::SelfTradeBehavior`.

| Variant         |
| --------------- |
| `Abort`         |
| `CancelProvide` |
| `DecrementTake` |

### `Side`

Enum `types::Side`.

| Variant |
| ------- |
| `Bid`   |
| `Ask`   |

### `TimeInForceEvent`

Struct `types::TimeInForceEvent`.

| Field                                  | Type  |
| -------------------------------------- | ----- |
| `index`                                | `u16` |
| `order_sequence_number`                | `u64` |
| `last_valid_slot`                      | `u64` |
| `last_valid_unix_timestamp_in_seconds` | `u64` |

### `TokenParams`

Struct `types::TokenParams`.

| Field        | Type     |
| ------------ | -------- |
| `decimals`   | `u32`    |
| `vault_bump` | `u32`    |
| `mint_key`   | `Pubkey` |
| `vault_key`  | `Pubkey` |

### `WithdrawParams`

Struct `types::WithdrawParams`.

| Field                    | Type          |
| ------------------------ | ------------- |
| `quote_lots_to_withdraw` | `Option<u64>` |
| `base_lots_to_withdraw`  | `Option<u64>` |

---

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