# Drift v2 decoder (Carbon 2.0)

> Decode Drift v2 instructions, accounts and events in Rust with carbon-drift-v2-decoder 2.0.0. Program ID dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH.

`carbon-drift-v2-decoder` decodes the instructions, accounts and events of the Drift v2 program (`dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH`): 249 instructions, 27 account types, 26 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-drift-v2-decoder`](https://crates.io/crates/carbon-drift-v2-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-drift-v2-decoder@2.0.0`                                                                 |
| Program ID       | `dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH` (`carbon_drift_v2_decoder::PROGRAM_ID`)                     |
| Category         | [Perpetuals & derivatives](https://carbon.sevenlabs.org/decoders/perpetuals.md)                           |
| Decoder          | `carbon_drift_v2_decoder::DriftV2Decoder`                                                                 |
| Instruction enum | `instructions::DriftV2Instruction`                                                                        |
| Account enum     | `accounts::DriftV2Account`                                                                                |
| Event enum       | `instructions::CpiEvent`                                                                                  |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                  |
| API docs         | [docs.rs/carbon-drift-v2-decoder/2.0.0](https://docs.rs/carbon-drift-v2-decoder/2.0.0)                    |
| Source           | [decoders/drift-v2-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/drift-v2-decoder) |

Other perpetuals and derivatives decoders: [Jupiter Perpetuals](https://carbon.sevenlabs.org/decoders/jupiter-perpetuals.md), [Zeta Markets](https://carbon.sevenlabs.org/decoders/zeta.md). To decode several in one pipeline, see [perpetuals and derivatives decoders](https://carbon.sevenlabs.org/decoders/perpetuals.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 Drift v2 transactions from the public RPC and prints every decoded `PlaceAndTakePerpOrder` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-drift-v2-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_drift_v2_decoder::{instructions::DriftV2Instruction, DriftV2Decoder, 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(DriftV2Decoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

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

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

Each `PlaceAndTakePerpOrder` instruction prints one line with the transaction signature and the decoded `PlaceAndTakePerpOrder` 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 `DriftV2Instruction::CpiEvent { data: CpiEvent::NewUserRecord(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 `PerpMarket` 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_drift_v2_decoder::{accounts::DriftV2Account, DriftV2Decoder, 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(DriftV2Decoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

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

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

### `AddAmmConstituentMappingData`

Discriminator `a4ec822876b32eeb` · data `AddAmmConstituentMappingData` · accounts `AddAmmConstituentMappingDataInstructionAccounts`.

| Field                          | Type                                                                   |
| ------------------------------ | ---------------------------------------------------------------------- |
| `amm_constituent_mapping_data` | [`Vec<AddAmmConstituentMappingDatum>`](#addammconstituentmappingdatum) |

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

Fields of `AddAmmConstituentMappingDataInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `admin`                   | `Pubkey`           |
| 1  | `lp_pool`                 | `Pubkey`           |
| 2  | `amm_constituent_mapping` | `Pubkey`           |
| 3  | `constituent_target_base` | `Pubkey`           |
| 4  | `state`                   | `Pubkey`           |
| 5  | `system_program`          | `Pubkey`           |
| 6… | `remaining`               | `Vec<AccountMeta>` |

### `AddInsuranceFundStake`

Discriminator `fb90730bde2f3eec` · data `AddInsuranceFundStake` · accounts `AddInsuranceFundStakeInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `AddInsuranceFundStakeInstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `state`                | `Pubkey`           |
| 1   | `spot_market`          | `Pubkey`           |
| 2   | `insurance_fund_stake` | `Pubkey`           |
| 3   | `user_stats`           | `Pubkey`           |
| 4   | `authority`            | `Pubkey`           |
| 5   | `spot_market_vault`    | `Pubkey`           |
| 6   | `insurance_fund_vault` | `Pubkey`           |
| 7   | `drift_signer`         | `Pubkey`           |
| 8   | `user_token_account`   | `Pubkey`           |
| 9   | `token_program`        | `Pubkey`           |
| 10… | `remaining`            | `Vec<AccountMeta>` |

### `AddMarketToAmmCache`

Discriminator `7095c3de7c0757ed` · data `AddMarketToAmmCache` · accounts `AddMarketToAmmCacheInstructionAccounts`.

No data fields.

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

Fields of `AddMarketToAmmCacheInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `admin`          | `Pubkey`           |
| 1  | `state`          | `Pubkey`           |
| 2  | `amm_cache`      | `Pubkey`           |
| 3  | `perp_market`    | `Pubkey`           |
| 4  | `rent`           | `Pubkey`           |
| 5  | `system_program` | `Pubkey`           |
| 6… | `remaining`      | `Vec<AccountMeta>` |

### `AdminDeposit`

Discriminator `d24241b666d6b01e` · data `AdminDeposit` · accounts `AdminDepositInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `AdminDepositInstructionAccounts`, in account order:

| #  | Field                 | Type               |
| -- | --------------------- | ------------------ |
| 0  | `state`               | `Pubkey`           |
| 1  | `user`                | `Pubkey`           |
| 2  | `admin`               | `Pubkey`           |
| 3  | `spot_market_vault`   | `Pubkey`           |
| 4  | `admin_token_account` | `Pubkey`           |
| 5  | `token_program`       | `Pubkey`           |
| 6… | `remaining`           | `Vec<AccountMeta>` |

### `AdminUpdateUserStatsPausedOperations`

Discriminator `b7683f96f0c7030a` · data `AdminUpdateUserStatsPausedOperations` · accounts `AdminUpdateUserStatsPausedOperationsInstructionAccounts`.

| Field               | Type |
| ------------------- | ---- |
| `paused_operations` | `u8` |

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

Fields of `AdminUpdateUserStatsPausedOperationsInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `admin`      | `Pubkey`           |
| 1  | `state`      | `Pubkey`           |
| 2  | `user_stats` | `Pubkey`           |
| 3… | `remaining`  | `Vec<AccountMeta>` |

### `AdminWithdrawFromInsuranceFundVault`

Discriminator `e4d0bff6a93abdd5` · data `AdminWithdrawFromInsuranceFundVault` · accounts `AdminWithdrawFromInsuranceFundVaultInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `AdminWithdrawFromInsuranceFundVaultInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `state`                   | `Pubkey`           |
| 1  | `authority`               | `Pubkey`           |
| 2  | `spot_market`             | `Pubkey`           |
| 3  | `insurance_fund_vault`    | `Pubkey`           |
| 4  | `recipient_token_account` | `Pubkey`           |
| 5  | `token_program`           | `Pubkey`           |
| 6  | `drift_signer`            | `Pubkey`           |
| 7… | `remaining`               | `Vec<AccountMeta>` |

### `BeginInsuranceFundSwap`

Discriminator `b0458fcd2084a300` · data `BeginInsuranceFundSwap` · accounts `BeginInsuranceFundSwapInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `in_market_index`  | `u16` |
| `out_market_index` | `u16` |
| `amount_in`        | `u64` |

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

Fields of `BeginInsuranceFundSwapInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `authority`                | `Pubkey`           |
| 2   | `out_insurance_fund_vault` | `Pubkey`           |
| 3   | `in_insurance_fund_vault`  | `Pubkey`           |
| 4   | `out_token_account`        | `Pubkey`           |
| 5   | `in_token_account`         | `Pubkey`           |
| 6   | `if_rebalance_config`      | `Pubkey`           |
| 7   | `token_program`            | `Pubkey`           |
| 8   | `drift_signer`             | `Pubkey`           |
| 9   | `instructions`             | `Pubkey`           |
| 10… | `remaining`                | `Vec<AccountMeta>` |

### `BeginLpSwap`

Discriminator `402c18c7307d435b` · data `BeginLpSwap` · accounts `BeginLpSwapInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `in_market_index`  | `u16` |
| `out_market_index` | `u16` |
| `amount_in`        | `u64` |

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

Fields of `BeginLpSwapInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `state`                         | `Pubkey`           |
| 1   | `admin`                         | `Pubkey`           |
| 2   | `signer_out_token_account`      | `Pubkey`           |
| 3   | `signer_in_token_account`       | `Pubkey`           |
| 4   | `constituent_out_token_account` | `Pubkey`           |
| 5   | `constituent_in_token_account`  | `Pubkey`           |
| 6   | `out_constituent`               | `Pubkey`           |
| 7   | `in_constituent`                | `Pubkey`           |
| 8   | `lp_pool`                       | `Pubkey`           |
| 9   | `instructions`                  | `Pubkey`           |
| 10  | `token_program`                 | `Pubkey`           |
| 11… | `remaining`                     | `Vec<AccountMeta>` |

### `BeginSwap`

Discriminator `ae6de401f269e869` · data `BeginSwap` · accounts `BeginSwapInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `in_market_index`  | `u16` |
| `out_market_index` | `u16` |
| `amount_in`        | `u64` |

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

Fields of `BeginSwapInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `state`                 | `Pubkey`           |
| 1   | `user`                  | `Pubkey`           |
| 2   | `user_stats`            | `Pubkey`           |
| 3   | `authority`             | `Pubkey`           |
| 4   | `out_spot_market_vault` | `Pubkey`           |
| 5   | `in_spot_market_vault`  | `Pubkey`           |
| 6   | `out_token_account`     | `Pubkey`           |
| 7   | `in_token_account`      | `Pubkey`           |
| 8   | `token_program`         | `Pubkey`           |
| 9   | `drift_signer`          | `Pubkey`           |
| 10  | `instructions`          | `Pubkey`           |
| 11… | `remaining`             | `Vec<AccountMeta>` |

### `CancelOrder`

Discriminator `5f81edf00831df84` · data `CancelOrder` · accounts `CancelOrderInstructionAccounts`.

| Field      | Type          |
| ---------- | ------------- |
| `order_id` | `Option<u32>` |

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

Fields of `CancelOrderInstructionAccounts`, in account order:

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

### `CancelOrderByUserId`

Discriminator `6bd3fa8512253964` · data `CancelOrderByUserId` · accounts `CancelOrderByUserIdInstructionAccounts`.

| Field           | Type |
| --------------- | ---- |
| `user_order_id` | `u8` |

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

Fields of `CancelOrderByUserIdInstructionAccounts`, in account order:

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

### `CancelOrders`

Discriminator `eee15f9ee36708c2` · data `CancelOrders` · accounts `CancelOrdersInstructionAccounts`.

| Field          | Type                                              |
| -------------- | ------------------------------------------------- |
| `market_type`  | [`Option<MarketType>`](#markettype)               |
| `market_index` | `Option<u16>`                                     |
| `direction`    | [`Option<PositionDirection>`](#positiondirection) |

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

Fields of `CancelOrdersInstructionAccounts`, in account order:

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

### `CancelOrdersByIds`

Discriminator `861390a55ef0d25e` · data `CancelOrdersByIds` · accounts `CancelOrdersByIdsInstructionAccounts`.

| Field       | Type       |
| ----------- | ---------- |
| `order_ids` | `Vec<u32>` |

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

Fields of `CancelOrdersByIdsInstructionAccounts`, in account order:

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

### `CancelRequestRemoveInsuranceFundStake`

Discriminator `61eb4e3ed42af17f` · data `CancelRequestRemoveInsuranceFundStake` · accounts `CancelRequestRemoveInsuranceFundStakeInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `CancelRequestRemoveInsuranceFundStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `spot_market`          | `Pubkey`           |
| 1  | `insurance_fund_stake` | `Pubkey`           |
| 2  | `user_stats`           | `Pubkey`           |
| 3  | `authority`            | `Pubkey`           |
| 4  | `insurance_fund_vault` | `Pubkey`           |
| 5… | `remaining`            | `Vec<AccountMeta>` |

### `ChangeApprovedBuilder`

Discriminator `b386d32dc305bdad` · data `ChangeApprovedBuilder` · accounts `ChangeApprovedBuilderInstructionAccounts`.

| Field         | Type     |
| ------------- | -------- |
| `builder`     | `Pubkey` |
| `max_fee_bps` | `u16`    |
| `add`         | `bool`   |

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

Fields of `ChangeApprovedBuilderInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `escrow`         | `Pubkey`           |
| 1  | `authority`      | `Pubkey`           |
| 2  | `payer`          | `Pubkey`           |
| 3  | `system_program` | `Pubkey`           |
| 4… | `remaining`      | `Vec<AccountMeta>` |

### `ChangeSignedMsgWsDelegateStatus`

Discriminator `fccafcdbb31b548a` · data `ChangeSignedMsgWsDelegateStatus` · accounts `ChangeSignedMsgWsDelegateStatusInstructionAccounts`.

| Field      | Type     |
| ---------- | -------- |
| `delegate` | `Pubkey` |
| `add`      | `bool`   |

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

Fields of `ChangeSignedMsgWsDelegateStatusInstructionAccounts`, in account order:

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

### `DeleteAmmCache`

Discriminator `d882d7cee9e8bf58` · data `DeleteAmmCache` · accounts `DeleteAmmCacheInstructionAccounts`.

No data fields.

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

Fields of `DeleteAmmCacheInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `admin`     | `Pubkey`           |
| 1  | `state`     | `Pubkey`           |
| 2  | `amm_cache` | `Pubkey`           |
| 3… | `remaining` | `Vec<AccountMeta>` |

### `DeleteInitializedPerpMarket`

Discriminator `5b9a18576a3bbe42` · data `DeleteInitializedPerpMarket` · accounts `DeleteInitializedPerpMarketInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `DeleteInitializedPerpMarketInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `DeleteInitializedSpotMarket`

Discriminator `1f8c43bfbd1465dd` · data `DeleteInitializedSpotMarket` · accounts `DeleteInitializedSpotMarketInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `DeleteInitializedSpotMarketInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `admin`                | `Pubkey`           |
| 1  | `state`                | `Pubkey`           |
| 2  | `spot_market`          | `Pubkey`           |
| 3  | `spot_market_vault`    | `Pubkey`           |
| 4  | `insurance_fund_vault` | `Pubkey`           |
| 5  | `drift_signer`         | `Pubkey`           |
| 6  | `token_program`        | `Pubkey`           |
| 7… | `remaining`            | `Vec<AccountMeta>` |

### `DeleteOpenbookV2FulfillmentConfig`

Discriminator `12c68a8e8a304fbb` · data `DeleteOpenbookV2FulfillmentConfig` · accounts `DeleteOpenbookV2FulfillmentConfigInstructionAccounts`.

No data fields.

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

Fields of `DeleteOpenbookV2FulfillmentConfigInstructionAccounts`, in account order:

| #  | Field                            | Type               |
| -- | -------------------------------- | ------------------ |
| 0  | `state`                          | `Pubkey`           |
| 1  | `openbook_v2_fulfillment_config` | `Pubkey`           |
| 2  | `admin`                          | `Pubkey`           |
| 3… | `remaining`                      | `Vec<AccountMeta>` |

### `DeletePrelaunchOracle`

Discriminator `3ba964314511adfd` · data `DeletePrelaunchOracle` · accounts `DeletePrelaunchOracleInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `perp_market_index` | `u16` |

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

Fields of `DeletePrelaunchOracleInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `admin`            | `Pubkey`           |
| 1  | `prelaunch_oracle` | `Pubkey`           |
| 2  | `perp_market`      | `Pubkey`           |
| 3  | `state`            | `Pubkey`           |
| 4… | `remaining`        | `Vec<AccountMeta>` |

### `DeleteSerumFulfillmentConfig`

Discriminator `1e8f5830f9679aff` · data `DeleteSerumFulfillmentConfig` · accounts `DeleteSerumFulfillmentConfigInstructionAccounts`.

No data fields.

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

Fields of `DeleteSerumFulfillmentConfigInstructionAccounts`, in account order:

| #  | Field                      | Type               |
| -- | -------------------------- | ------------------ |
| 0  | `state`                    | `Pubkey`           |
| 1  | `serum_fulfillment_config` | `Pubkey`           |
| 2  | `admin`                    | `Pubkey`           |
| 3… | `remaining`                | `Vec<AccountMeta>` |

### `DeleteSignedMsgUserOrders`

Discriminator `ddf780fdd4fe2e99` · data `DeleteSignedMsgUserOrders` · accounts `DeleteSignedMsgUserOrdersInstructionAccounts`.

No data fields.

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

Fields of `DeleteSignedMsgUserOrdersInstructionAccounts`, in account order:

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

### `DeleteUser`

Discriminator `ba5511f9dbe762fb` · data `DeleteUser` · accounts `DeleteUserInstructionAccounts`.

No data fields.

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

Fields of `DeleteUserInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `user`       | `Pubkey`           |
| 1  | `user_stats` | `Pubkey`           |
| 2  | `state`      | `Pubkey`           |
| 3  | `authority`  | `Pubkey`           |
| 4… | `remaining`  | `Vec<AccountMeta>` |

### `Deposit`

Discriminator `f223c68952e1f2b6` · data `Deposit` · accounts `DepositInstructionAccounts`.

| Field          | Type   |
| -------------- | ------ |
| `market_index` | `u16`  |
| `amount`       | `u64`  |
| `reduce_only`  | `bool` |

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

Fields of `DepositInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `state`              | `Pubkey`           |
| 1  | `user`               | `Pubkey`           |
| 2  | `user_stats`         | `Pubkey`           |
| 3  | `authority`          | `Pubkey`           |
| 4  | `spot_market_vault`  | `Pubkey`           |
| 5  | `user_token_account` | `Pubkey`           |
| 6  | `token_program`      | `Pubkey`           |
| 7… | `remaining`          | `Vec<AccountMeta>` |

### `DepositIntoInsuranceFundStake`

Discriminator `0416e2c97c2c52e6` · data `DepositIntoInsuranceFundStake` · accounts `DepositIntoInsuranceFundStakeInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `DepositIntoInsuranceFundStakeInstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `signer`               | `Pubkey`           |
| 1   | `state`                | `Pubkey`           |
| 2   | `spot_market`          | `Pubkey`           |
| 3   | `insurance_fund_stake` | `Pubkey`           |
| 4   | `user_stats`           | `Pubkey`           |
| 5   | `spot_market_vault`    | `Pubkey`           |
| 6   | `insurance_fund_vault` | `Pubkey`           |
| 7   | `user_token_account`   | `Pubkey`           |
| 8   | `token_program`        | `Pubkey`           |
| 9   | `drift_signer`         | `Pubkey`           |
| 10… | `remaining`            | `Vec<AccountMeta>` |

### `DepositIntoIsolatedPerpPosition`

Discriminator `6530ff997f79aa1a` · data `DepositIntoIsolatedPerpPosition` · accounts `DepositIntoIsolatedPerpPositionInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `spot_market_index` | `u16` |
| `perp_market_index` | `u16` |
| `amount`            | `u64` |

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

Fields of `DepositIntoIsolatedPerpPositionInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `state`              | `Pubkey`           |
| 1  | `user`               | `Pubkey`           |
| 2  | `user_stats`         | `Pubkey`           |
| 3  | `authority`          | `Pubkey`           |
| 4  | `spot_market_vault`  | `Pubkey`           |
| 5  | `user_token_account` | `Pubkey`           |
| 6  | `token_program`      | `Pubkey`           |
| 7… | `remaining`          | `Vec<AccountMeta>` |

### `DepositIntoPerpMarketFeePool`

Discriminator `223a39446150f406` · data `DepositIntoPerpMarketFeePool` · accounts `DepositIntoPerpMarketFeePoolInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `amount` | `u64` |

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

Fields of `DepositIntoPerpMarketFeePoolInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `perp_market`       | `Pubkey`           |
| 2  | `admin`             | `Pubkey`           |
| 3  | `source_vault`      | `Pubkey`           |
| 4  | `drift_signer`      | `Pubkey`           |
| 5  | `quote_spot_market` | `Pubkey`           |
| 6  | `spot_market_vault` | `Pubkey`           |
| 7  | `token_program`     | `Pubkey`           |
| 8… | `remaining`         | `Vec<AccountMeta>` |

### `DepositIntoSpotMarketRevenuePool`

Discriminator `5c28972a7afe8bf6` · data `DepositIntoSpotMarketRevenuePool` · accounts `DepositIntoSpotMarketRevenuePoolInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `amount` | `u64` |

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

Fields of `DepositIntoSpotMarketRevenuePoolInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `state`              | `Pubkey`           |
| 1  | `spot_market`        | `Pubkey`           |
| 2  | `authority`          | `Pubkey`           |
| 3  | `spot_market_vault`  | `Pubkey`           |
| 4  | `user_token_account` | `Pubkey`           |
| 5  | `token_program`      | `Pubkey`           |
| 6… | `remaining`          | `Vec<AccountMeta>` |

### `DepositIntoSpotMarketVault`

Discriminator `30fc7749ffcdaef7` · data `DepositIntoSpotMarketVault` · accounts `DepositIntoSpotMarketVaultInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `amount` | `u64` |

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

Fields of `DepositIntoSpotMarketVaultInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `spot_market`       | `Pubkey`           |
| 2  | `admin`             | `Pubkey`           |
| 3  | `source_vault`      | `Pubkey`           |
| 4  | `spot_market_vault` | `Pubkey`           |
| 5  | `token_program`     | `Pubkey`           |
| 6… | `remaining`         | `Vec<AccountMeta>` |

### `DepositToProgramVault`

Discriminator `ebab795039ef93dc` · data `DepositToProgramVault` · accounts `DepositToProgramVaultInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `amount` | `u64` |

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

Fields of `DepositToProgramVaultInstructionAccounts`, in account order:

| #  | Field                       | Type               |
| -- | --------------------------- | ------------------ |
| 0  | `state`                     | `Pubkey`           |
| 1  | `admin`                     | `Pubkey`           |
| 2  | `constituent`               | `Pubkey`           |
| 3  | `constituent_token_account` | `Pubkey`           |
| 4  | `spot_market`               | `Pubkey`           |
| 5  | `spot_market_vault`         | `Pubkey`           |
| 6  | `token_program`             | `Pubkey`           |
| 7  | `mint`                      | `Pubkey`           |
| 8  | `oracle`                    | `Pubkey`           |
| 9… | `remaining`                 | `Vec<AccountMeta>` |

### `DisableUserHighLeverageMode`

Discriminator `b79b2d00e255d545` · data `DisableUserHighLeverageMode` · accounts `DisableUserHighLeverageModeInstructionAccounts`.

| Field                 | Type   |
| --------------------- | ------ |
| `disable_maintenance` | `bool` |

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

Fields of `DisableUserHighLeverageModeInstructionAccounts`, in account order:

| #  | Field                       | Type               |
| -- | --------------------------- | ------------------ |
| 0  | `state`                     | `Pubkey`           |
| 1  | `authority`                 | `Pubkey`           |
| 2  | `user`                      | `Pubkey`           |
| 3  | `high_leverage_mode_config` | `Pubkey`           |
| 4… | `remaining`                 | `Vec<AccountMeta>` |

### `EnableUserHighLeverageMode`

Discriminator `e718e670c9ad49b8` · data `EnableUserHighLeverageMode` · accounts `EnableUserHighLeverageModeInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `sub_account_id` | `u16` |

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

Fields of `EnableUserHighLeverageModeInstructionAccounts`, in account order:

| #  | Field                       | Type               |
| -- | --------------------------- | ------------------ |
| 0  | `state`                     | `Pubkey`           |
| 1  | `user`                      | `Pubkey`           |
| 2  | `authority`                 | `Pubkey`           |
| 3  | `high_leverage_mode_config` | `Pubkey`           |
| 4… | `remaining`                 | `Vec<AccountMeta>` |

### `EndInsuranceFundSwap`

Discriminator `cee66208f99ea9a7` · data `EndInsuranceFundSwap` · accounts `EndInsuranceFundSwapInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `in_market_index`  | `u16` |
| `out_market_index` | `u16` |

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

Fields of `EndInsuranceFundSwapInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `authority`                | `Pubkey`           |
| 2   | `out_insurance_fund_vault` | `Pubkey`           |
| 3   | `in_insurance_fund_vault`  | `Pubkey`           |
| 4   | `out_token_account`        | `Pubkey`           |
| 5   | `in_token_account`         | `Pubkey`           |
| 6   | `if_rebalance_config`      | `Pubkey`           |
| 7   | `token_program`            | `Pubkey`           |
| 8   | `drift_signer`             | `Pubkey`           |
| 9   | `instructions`             | `Pubkey`           |
| 10… | `remaining`                | `Vec<AccountMeta>` |

### `EndLpSwap`

Discriminator `637dd6a581affd87` · data `EndLpSwap` · accounts `EndLpSwapInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `in_market_index`  | `u16` |
| `out_market_index` | `u16` |

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

Fields of `EndLpSwapInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `state`                         | `Pubkey`           |
| 1   | `admin`                         | `Pubkey`           |
| 2   | `signer_out_token_account`      | `Pubkey`           |
| 3   | `signer_in_token_account`       | `Pubkey`           |
| 4   | `constituent_out_token_account` | `Pubkey`           |
| 5   | `constituent_in_token_account`  | `Pubkey`           |
| 6   | `out_constituent`               | `Pubkey`           |
| 7   | `in_constituent`                | `Pubkey`           |
| 8   | `lp_pool`                       | `Pubkey`           |
| 9   | `instructions`                  | `Pubkey`           |
| 10  | `token_program`                 | `Pubkey`           |
| 11… | `remaining`                     | `Vec<AccountMeta>` |

### `EndSwap`

Discriminator `b1b81bc1220dd291` · data `EndSwap` · accounts `EndSwapInstructionAccounts`.

| Field              | Type                                        |
| ------------------ | ------------------------------------------- |
| `in_market_index`  | `u16`                                       |
| `out_market_index` | `u16`                                       |
| `limit_price`      | `Option<u64>`                               |
| `reduce_only`      | [`Option<SwapReduceOnly>`](#swapreduceonly) |

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

Fields of `EndSwapInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `state`                 | `Pubkey`           |
| 1   | `user`                  | `Pubkey`           |
| 2   | `user_stats`            | `Pubkey`           |
| 3   | `authority`             | `Pubkey`           |
| 4   | `out_spot_market_vault` | `Pubkey`           |
| 5   | `in_spot_market_vault`  | `Pubkey`           |
| 6   | `out_token_account`     | `Pubkey`           |
| 7   | `in_token_account`      | `Pubkey`           |
| 8   | `token_program`         | `Pubkey`           |
| 9   | `drift_signer`          | `Pubkey`           |
| 10  | `instructions`          | `Pubkey`           |
| 11… | `remaining`             | `Vec<AccountMeta>` |

### `FillPerpOrder`

Discriminator `0dbcf86786d96af0` · data `FillPerpOrder` · accounts `FillPerpOrderInstructionAccounts`.

| Field            | Type          |
| ---------------- | ------------- |
| `order_id`       | `Option<u32>` |
| `maker_order_id` | `Option<u32>` |

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

Fields of `FillPerpOrderInstructionAccounts`, in account order:

| #  | Field          | Type               |
| -- | -------------- | ------------------ |
| 0  | `state`        | `Pubkey`           |
| 1  | `authority`    | `Pubkey`           |
| 2  | `filler`       | `Pubkey`           |
| 3  | `filler_stats` | `Pubkey`           |
| 4  | `user`         | `Pubkey`           |
| 5  | `user_stats`   | `Pubkey`           |
| 6… | `remaining`    | `Vec<AccountMeta>` |

### `FillSpotOrder`

Discriminator `d4ce82ad1522c728` · data `FillSpotOrder` · accounts `FillSpotOrderInstructionAccounts`.

| Field              | Type                                                  |
| ------------------ | ----------------------------------------------------- |
| `order_id`         | `Option<u32>`                                         |
| `fulfillment_type` | [`Option<SpotFulfillmentType>`](#spotfulfillmenttype) |
| `maker_order_id`   | `Option<u32>`                                         |

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

Fields of `FillSpotOrderInstructionAccounts`, in account order:

| #  | Field          | Type               |
| -- | -------------- | ------------------ |
| 0  | `state`        | `Pubkey`           |
| 1  | `authority`    | `Pubkey`           |
| 2  | `filler`       | `Pubkey`           |
| 3  | `filler_stats` | `Pubkey`           |
| 4  | `user`         | `Pubkey`           |
| 5  | `user_stats`   | `Pubkey`           |
| 6… | `remaining`    | `Vec<AccountMeta>` |

### `ForceCancelOrders`

Discriminator `40b5c43fde4840e8` · data `ForceCancelOrders` · accounts `ForceCancelOrdersInstructionAccounts`.

No data fields.

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

Fields of `ForceCancelOrdersInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `state`     | `Pubkey`           |
| 1  | `authority` | `Pubkey`           |
| 2  | `filler`    | `Pubkey`           |
| 3  | `user`      | `Pubkey`           |
| 4… | `remaining` | `Vec<AccountMeta>` |

### `ForceDeleteUser`

Discriminator `02f1c3ace318fe9e` · data `ForceDeleteUser` · accounts `ForceDeleteUserInstructionAccounts`.

No data fields.

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

Fields of `ForceDeleteUserInstructionAccounts`, in account order:

| #  | Field          | Type               |
| -- | -------------- | ------------------ |
| 0  | `user`         | `Pubkey`           |
| 1  | `user_stats`   | `Pubkey`           |
| 2  | `state`        | `Pubkey`           |
| 3  | `authority`    | `Pubkey`           |
| 4  | `keeper`       | `Pubkey`           |
| 5  | `drift_signer` | `Pubkey`           |
| 6… | `remaining`    | `Vec<AccountMeta>` |

### `Initialize`

Discriminator `afaf6d1f0d989bed` · data `Initialize` · accounts `InitializeInstructionAccounts`.

No data fields.

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

Fields of `InitializeInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `admin`            | `Pubkey`           |
| 1  | `state`            | `Pubkey`           |
| 2  | `quote_asset_mint` | `Pubkey`           |
| 3  | `drift_signer`     | `Pubkey`           |
| 4  | `rent`             | `Pubkey`           |
| 5  | `system_program`   | `Pubkey`           |
| 6  | `token_program`    | `Pubkey`           |
| 7… | `remaining`        | `Vec<AccountMeta>` |

### `InitializeAmmCache`

Discriminator `263cab9ecb3a8908` · data `InitializeAmmCache` · accounts `InitializeAmmCacheInstructionAccounts`.

No data fields.

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

Fields of `InitializeAmmCacheInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `admin`          | `Pubkey`           |
| 1  | `state`          | `Pubkey`           |
| 2  | `amm_cache`      | `Pubkey`           |
| 3  | `rent`           | `Pubkey`           |
| 4  | `system_program` | `Pubkey`           |
| 5… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeConstituent`

Discriminator `0cc42dda5d590021` · data `InitializeConstituent` · accounts `InitializeConstituentInstructionAccounts`.

| Field                                    | Type          |
| ---------------------------------------- | ------------- |
| `spot_market_index`                      | `u16`         |
| `decimals`                               | `u8`          |
| `max_weight_deviation`                   | `i64`         |
| `swap_fee_min`                           | `i64`         |
| `swap_fee_max`                           | `i64`         |
| `max_borrow_token_amount`                | `u64`         |
| `oracle_staleness_threshold`             | `u64`         |
| `cost_to_trade`                          | `i32`         |
| `constituent_derivative_index`           | `Option<i16>` |
| `constituent_derivative_depeg_threshold` | `u64`         |
| `derivative_weight`                      | `u64`         |
| `volatility`                             | `u64`         |
| `gamma_execution`                        | `u8`          |
| `gamma_inventory`                        | `u8`          |
| `xi`                                     | `u8`          |
| `new_constituent_correlations`           | `Vec<i64>`    |

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

Fields of `InitializeConstituentInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `admin`                    | `Pubkey`           |
| 2   | `lp_pool`                  | `Pubkey`           |
| 3   | `constituent_target_base`  | `Pubkey`           |
| 4   | `constituent_correlations` | `Pubkey`           |
| 5   | `constituent`              | `Pubkey`           |
| 6   | `spot_market`              | `Pubkey`           |
| 7   | `spot_market_mint`         | `Pubkey`           |
| 8   | `constituent_vault`        | `Pubkey`           |
| 9   | `rent`                     | `Pubkey`           |
| 10  | `system_program`           | `Pubkey`           |
| 11  | `token_program`            | `Pubkey`           |
| 12… | `remaining`                | `Vec<AccountMeta>` |

### `InitializeFuelOverflow`

Discriminator `58df84a1d0588e2a` · data `InitializeFuelOverflow` · accounts `InitializeFuelOverflowInstructionAccounts`.

No data fields.

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

Fields of `InitializeFuelOverflowInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `fuel_overflow`  | `Pubkey`           |
| 1  | `user_stats`     | `Pubkey`           |
| 2  | `authority`      | `Pubkey`           |
| 3  | `payer`          | `Pubkey`           |
| 4  | `rent`           | `Pubkey`           |
| 5  | `system_program` | `Pubkey`           |
| 6… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeHighLeverageModeConfig`

Discriminator `d5a75df6d0825af8` · data `InitializeHighLeverageModeConfig` · accounts `InitializeHighLeverageModeConfigInstructionAccounts`.

| Field       | Type  |
| ----------- | ----- |
| `max_users` | `u32` |

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

Fields of `InitializeHighLeverageModeConfigInstructionAccounts`, in account order:

| #  | Field                       | Type               |
| -- | --------------------------- | ------------------ |
| 0  | `admin`                     | `Pubkey`           |
| 1  | `high_leverage_mode_config` | `Pubkey`           |
| 2  | `state`                     | `Pubkey`           |
| 3  | `rent`                      | `Pubkey`           |
| 4  | `system_program`            | `Pubkey`           |
| 5… | `remaining`                 | `Vec<AccountMeta>` |

### `InitializeIfRebalanceConfig`

Discriminator `0855b8a7b03dade2` · data `InitializeIfRebalanceConfig` · accounts `InitializeIfRebalanceConfigInstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`IfRebalanceConfigParams`](#ifrebalanceconfigparams) |

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

Fields of `InitializeIfRebalanceConfigInstructionAccounts`, in account order:

| #  | Field                 | Type               |
| -- | --------------------- | ------------------ |
| 0  | `admin`               | `Pubkey`           |
| 1  | `if_rebalance_config` | `Pubkey`           |
| 2  | `state`               | `Pubkey`           |
| 3  | `rent`                | `Pubkey`           |
| 4  | `system_program`      | `Pubkey`           |
| 5… | `remaining`           | `Vec<AccountMeta>` |

### `InitializeInsuranceFundStake`

Discriminator `bbb3f346f85a5c93` · data `InitializeInsuranceFundStake` · accounts `InitializeInsuranceFundStakeInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `InitializeInsuranceFundStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `spot_market`          | `Pubkey`           |
| 1  | `insurance_fund_stake` | `Pubkey`           |
| 2  | `user_stats`           | `Pubkey`           |
| 3  | `state`                | `Pubkey`           |
| 4  | `authority`            | `Pubkey`           |
| 5  | `payer`                | `Pubkey`           |
| 6  | `rent`                 | `Pubkey`           |
| 7  | `system_program`       | `Pubkey`           |
| 8… | `remaining`            | `Vec<AccountMeta>` |

### `InitializeLpPool`

Discriminator `f24001de8e2ecce3` · data `InitializeLpPool` · accounts `InitializeLpPoolInstructionAccounts`.

| Field                                | Type     |
| ------------------------------------ | -------- |
| `lp_pool_id`                         | `u8`     |
| `min_mint_fee`                       | `i64`    |
| `max_aum`                            | `u128`   |
| `max_settle_quote_amount_per_market` | `u64`    |
| `whitelist_mint`                     | `Pubkey` |

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

Fields of `InitializeLpPoolInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `admin`                    | `Pubkey`           |
| 1   | `lp_pool`                  | `Pubkey`           |
| 2   | `mint`                     | `Pubkey`           |
| 3   | `lp_pool_token_vault`      | `Pubkey`           |
| 4   | `amm_constituent_mapping`  | `Pubkey`           |
| 5   | `constituent_target_base`  | `Pubkey`           |
| 6   | `constituent_correlations` | `Pubkey`           |
| 7   | `state`                    | `Pubkey`           |
| 8   | `token_program`            | `Pubkey`           |
| 9   | `rent`                     | `Pubkey`           |
| 10  | `system_program`           | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `InitializeOpenbookV2FulfillmentConfig`

Discriminator `07dd67996b391bc5` · data `InitializeOpenbookV2FulfillmentConfig` · accounts `InitializeOpenbookV2FulfillmentConfigInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `InitializeOpenbookV2FulfillmentConfigInstructionAccounts`, in account order:

| #   | Field                            | Type               |
| --- | -------------------------------- | ------------------ |
| 0   | `base_spot_market`               | `Pubkey`           |
| 1   | `quote_spot_market`              | `Pubkey`           |
| 2   | `state`                          | `Pubkey`           |
| 3   | `openbook_v2_program`            | `Pubkey`           |
| 4   | `openbook_v2_market`             | `Pubkey`           |
| 5   | `drift_signer`                   | `Pubkey`           |
| 6   | `openbook_v2_fulfillment_config` | `Pubkey`           |
| 7   | `admin`                          | `Pubkey`           |
| 8   | `rent`                           | `Pubkey`           |
| 9   | `system_program`                 | `Pubkey`           |
| 10… | `remaining`                      | `Vec<AccountMeta>` |

### `InitializePerpMarket`

Discriminator `8409e5767576753e` · data `InitializePerpMarket` · accounts `InitializePerpMarketInstructionAccounts`.

| Field                             | Type                            |
| --------------------------------- | ------------------------------- |
| `market_index`                    | `u16`                           |
| `amm_base_asset_reserve`          | `u128`                          |
| `amm_quote_asset_reserve`         | `u128`                          |
| `amm_periodicity`                 | `i64`                           |
| `amm_peg_multiplier`              | `u128`                          |
| `oracle_source`                   | [`OracleSource`](#oraclesource) |
| `contract_tier`                   | [`ContractTier`](#contracttier) |
| `margin_ratio_initial`            | `u32`                           |
| `margin_ratio_maintenance`        | `u32`                           |
| `liquidator_fee`                  | `u32`                           |
| `if_liquidation_fee`              | `u32`                           |
| `imf_factor`                      | `u32`                           |
| `active_status`                   | `bool`                          |
| `base_spread`                     | `u32`                           |
| `max_spread`                      | `u32`                           |
| `max_open_interest`               | `u128`                          |
| `max_revenue_withdraw_per_period` | `u64`                           |
| `quote_max_insurance`             | `u64`                           |
| `order_step_size`                 | `u64`                           |
| `order_tick_size`                 | `u64`                           |
| `min_order_size`                  | `u64`                           |
| `concentration_coef_scale`        | `u128`                          |
| `curve_update_intensity`          | `u8`                            |
| `amm_jit_intensity`               | `u8`                            |
| `name`                            | `[u8; 32]`                      |
| `lp_pool_id`                      | `u8`                            |

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

Fields of `InitializePerpMarketInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `admin`          | `Pubkey`           |
| 1  | `state`          | `Pubkey`           |
| 2  | `perp_market`    | `Pubkey`           |
| 3  | `oracle`         | `Pubkey`           |
| 4  | `rent`           | `Pubkey`           |
| 5  | `system_program` | `Pubkey`           |
| 6… | `remaining`      | `Vec<AccountMeta>` |

### `InitializePhoenixFulfillmentConfig`

Discriminator `87846e6bb9a0a99a` · data `InitializePhoenixFulfillmentConfig` · accounts `InitializePhoenixFulfillmentConfigInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `InitializePhoenixFulfillmentConfigInstructionAccounts`, in account order:

| #   | Field                        | Type               |
| --- | ---------------------------- | ------------------ |
| 0   | `base_spot_market`           | `Pubkey`           |
| 1   | `quote_spot_market`          | `Pubkey`           |
| 2   | `state`                      | `Pubkey`           |
| 3   | `phoenix_program`            | `Pubkey`           |
| 4   | `phoenix_market`             | `Pubkey`           |
| 5   | `drift_signer`               | `Pubkey`           |
| 6   | `phoenix_fulfillment_config` | `Pubkey`           |
| 7   | `admin`                      | `Pubkey`           |
| 8   | `rent`                       | `Pubkey`           |
| 9   | `system_program`             | `Pubkey`           |
| 10… | `remaining`                  | `Vec<AccountMeta>` |

### `InitializePredictionMarket`

Discriminator `f846c6e0e0697dc3` · data `InitializePredictionMarket` · accounts `InitializePredictionMarketInstructionAccounts`.

No data fields.

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

Fields of `InitializePredictionMarketInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `InitializePrelaunchOracle`

Discriminator `a9b25419af3e1df7` · data `InitializePrelaunchOracle` · accounts `InitializePrelaunchOracleInstructionAccounts`.

| Field    | Type                                              |
| -------- | ------------------------------------------------- |
| `params` | [`PrelaunchOracleParams`](#prelaunchoracleparams) |

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

Fields of `InitializePrelaunchOracleInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `admin`            | `Pubkey`           |
| 1  | `prelaunch_oracle` | `Pubkey`           |
| 2  | `state`            | `Pubkey`           |
| 3  | `rent`             | `Pubkey`           |
| 4  | `system_program`   | `Pubkey`           |
| 5… | `remaining`        | `Vec<AccountMeta>` |

### `InitializeProtectedMakerModeConfig`

Discriminator `4367dc435820fc08` · data `InitializeProtectedMakerModeConfig` · accounts `InitializeProtectedMakerModeConfigInstructionAccounts`.

| Field       | Type  |
| ----------- | ----- |
| `max_users` | `u32` |

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

Fields of `InitializeProtectedMakerModeConfigInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `admin`                       | `Pubkey`           |
| 1  | `protected_maker_mode_config` | `Pubkey`           |
| 2  | `state`                       | `Pubkey`           |
| 3  | `rent`                        | `Pubkey`           |
| 4  | `system_program`              | `Pubkey`           |
| 5… | `remaining`                   | `Vec<AccountMeta>` |

### `InitializePythLazerOracle`

Discriminator `8c6b21d6ebdb6714` · data `InitializePythLazerOracle` · accounts `InitializePythLazerOracleInstructionAccounts`.

| Field     | Type  |
| --------- | ----- |
| `feed_id` | `u32` |

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

Fields of `InitializePythLazerOracleInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `admin`          | `Pubkey`           |
| 1  | `lazer_oracle`   | `Pubkey`           |
| 2  | `state`          | `Pubkey`           |
| 3  | `rent`           | `Pubkey`           |
| 4  | `system_program` | `Pubkey`           |
| 5… | `remaining`      | `Vec<AccountMeta>` |

### `InitializePythPullOracle`

Discriminator `f98cfdf3f84af0ee` · data `InitializePythPullOracle` · accounts `InitializePythPullOracleInstructionAccounts`.

| Field     | Type       |
| --------- | ---------- |
| `feed_id` | `[u8; 32]` |

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

Fields of `InitializePythPullOracleInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `admin`                | `Pubkey`           |
| 1  | `pyth_solana_receiver` | `Pubkey`           |
| 2  | `price_feed`           | `Pubkey`           |
| 3  | `system_program`       | `Pubkey`           |
| 4  | `state`                | `Pubkey`           |
| 5… | `remaining`            | `Vec<AccountMeta>` |

### `InitializeReferrerName`

Discriminator `eb7ee70a2aa41a3d` · data `InitializeReferrerName` · accounts `InitializeReferrerNameInstructionAccounts`.

| Field  | Type       |
| ------ | ---------- |
| `name` | `[u8; 32]` |

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

Fields of `InitializeReferrerNameInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `referrer_name`  | `Pubkey`           |
| 1  | `user`           | `Pubkey`           |
| 2  | `user_stats`     | `Pubkey`           |
| 3  | `authority`      | `Pubkey`           |
| 4  | `payer`          | `Pubkey`           |
| 5  | `rent`           | `Pubkey`           |
| 6  | `system_program` | `Pubkey`           |
| 7… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeRevenueShare`

Discriminator `39097b835234320d` · data `InitializeRevenueShare` · accounts `InitializeRevenueShareInstructionAccounts`.

No data fields.

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

Fields of `InitializeRevenueShareInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `revenue_share`  | `Pubkey`           |
| 1  | `authority`      | `Pubkey`           |
| 2  | `payer`          | `Pubkey`           |
| 3  | `rent`           | `Pubkey`           |
| 4  | `system_program` | `Pubkey`           |
| 5… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeRevenueShareEscrow`

Discriminator `bb127b58ee68549a` · data `InitializeRevenueShareEscrow` · accounts `InitializeRevenueShareEscrowInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `num_orders` | `u16` |

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

Fields of `InitializeRevenueShareEscrowInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `escrow`         | `Pubkey`           |
| 1  | `authority`      | `Pubkey`           |
| 2  | `user_stats`     | `Pubkey`           |
| 3  | `state`          | `Pubkey`           |
| 4  | `payer`          | `Pubkey`           |
| 5  | `rent`           | `Pubkey`           |
| 6  | `system_program` | `Pubkey`           |
| 7… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeSerumFulfillmentConfig`

Discriminator `c1d384ac46ab075e` · data `InitializeSerumFulfillmentConfig` · accounts `InitializeSerumFulfillmentConfigInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `InitializeSerumFulfillmentConfigInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `base_spot_market`         | `Pubkey`           |
| 1   | `quote_spot_market`        | `Pubkey`           |
| 2   | `state`                    | `Pubkey`           |
| 3   | `serum_program`            | `Pubkey`           |
| 4   | `serum_market`             | `Pubkey`           |
| 5   | `serum_open_orders`        | `Pubkey`           |
| 6   | `drift_signer`             | `Pubkey`           |
| 7   | `serum_fulfillment_config` | `Pubkey`           |
| 8   | `admin`                    | `Pubkey`           |
| 9   | `rent`                     | `Pubkey`           |
| 10  | `system_program`           | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `InitializeSignedMsgUserOrders`

Discriminator `a4639c7e9c3963b4` · data `InitializeSignedMsgUserOrders` · accounts `InitializeSignedMsgUserOrdersInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `num_orders` | `u16` |

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

Fields of `InitializeSignedMsgUserOrdersInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `signed_msg_user_orders` | `Pubkey`           |
| 1  | `authority`              | `Pubkey`           |
| 2  | `payer`                  | `Pubkey`           |
| 3  | `rent`                   | `Pubkey`           |
| 4  | `system_program`         | `Pubkey`           |
| 5… | `remaining`              | `Vec<AccountMeta>` |

### `InitializeSignedMsgWsDelegates`

Discriminator `288460dbb8c15008` · data `InitializeSignedMsgWsDelegates` · accounts `InitializeSignedMsgWsDelegatesInstructionAccounts`.

| Field       | Type          |
| ----------- | ------------- |
| `delegates` | `Vec<Pubkey>` |

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

Fields of `InitializeSignedMsgWsDelegatesInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `signed_msg_ws_delegates` | `Pubkey`           |
| 1  | `authority`               | `Pubkey`           |
| 2  | `rent`                    | `Pubkey`           |
| 3  | `system_program`          | `Pubkey`           |
| 4… | `remaining`               | `Vec<AccountMeta>` |

### `InitializeSpotMarket`

Discriminator `eac4802c5e0f30c9` · data `InitializeSpotMarket` · accounts `InitializeSpotMarketInstructionAccounts`.

| Field                              | Type                            |
| ---------------------------------- | ------------------------------- |
| `optimal_utilization`              | `u32`                           |
| `optimal_borrow_rate`              | `u32`                           |
| `max_borrow_rate`                  | `u32`                           |
| `oracle_source`                    | [`OracleSource`](#oraclesource) |
| `initial_asset_weight`             | `u32`                           |
| `maintenance_asset_weight`         | `u32`                           |
| `initial_liability_weight`         | `u32`                           |
| `maintenance_liability_weight`     | `u32`                           |
| `imf_factor`                       | `u32`                           |
| `liquidator_fee`                   | `u32`                           |
| `if_liquidation_fee`               | `u32`                           |
| `active_status`                    | `bool`                          |
| `asset_tier`                       | [`AssetTier`](#assettier)       |
| `scale_initial_asset_weight_start` | `u64`                           |
| `withdraw_guard_threshold`         | `u64`                           |
| `order_tick_size`                  | `u64`                           |
| `order_step_size`                  | `u64`                           |
| `if_total_factor`                  | `u32`                           |
| `name`                             | `[u8; 32]`                      |

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

Fields of `InitializeSpotMarketInstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `spot_market`          | `Pubkey`           |
| 1   | `spot_market_mint`     | `Pubkey`           |
| 2   | `spot_market_vault`    | `Pubkey`           |
| 3   | `insurance_fund_vault` | `Pubkey`           |
| 4   | `drift_signer`         | `Pubkey`           |
| 5   | `state`                | `Pubkey`           |
| 6   | `oracle`               | `Pubkey`           |
| 7   | `admin`                | `Pubkey`           |
| 8   | `rent`                 | `Pubkey`           |
| 9   | `system_program`       | `Pubkey`           |
| 10  | `token_program`        | `Pubkey`           |
| 11… | `remaining`            | `Vec<AccountMeta>` |

### `InitializeUser`

Discriminator `6f11b9fa3c7a26fe` · data `InitializeUser` · accounts `InitializeUserInstructionAccounts`.

| Field            | Type       |
| ---------------- | ---------- |
| `sub_account_id` | `u16`      |
| `name`           | `[u8; 32]` |

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

Fields of `InitializeUserInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `user`           | `Pubkey`           |
| 1  | `user_stats`     | `Pubkey`           |
| 2  | `state`          | `Pubkey`           |
| 3  | `authority`      | `Pubkey`           |
| 4  | `payer`          | `Pubkey`           |
| 5  | `rent`           | `Pubkey`           |
| 6  | `system_program` | `Pubkey`           |
| 7… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeUserStats`

Discriminator `fef34862fb82a8d5` · data `InitializeUserStats` · accounts `InitializeUserStatsInstructionAccounts`.

No data fields.

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

Fields of `InitializeUserStatsInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `user_stats`     | `Pubkey`           |
| 1  | `state`          | `Pubkey`           |
| 2  | `authority`      | `Pubkey`           |
| 3  | `payer`          | `Pubkey`           |
| 4  | `rent`           | `Pubkey`           |
| 5  | `system_program` | `Pubkey`           |
| 6… | `remaining`      | `Vec<AccountMeta>` |

### `LiquidateBorrowForPerpPnl`

Discriminator `a911205acf94d11b` · data `LiquidateBorrowForPerpPnl` · accounts `LiquidateBorrowForPerpPnlInstructionAccounts`.

| Field                               | Type          |
| ----------------------------------- | ------------- |
| `perp_market_index`                 | `u16`         |
| `spot_market_index`                 | `u16`         |
| `liquidator_max_liability_transfer` | `u128`        |
| `limit_price`                       | `Option<u64>` |

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

Fields of `LiquidateBorrowForPerpPnlInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `state`            | `Pubkey`           |
| 1  | `authority`        | `Pubkey`           |
| 2  | `liquidator`       | `Pubkey`           |
| 3  | `liquidator_stats` | `Pubkey`           |
| 4  | `user`             | `Pubkey`           |
| 5  | `user_stats`       | `Pubkey`           |
| 6… | `remaining`        | `Vec<AccountMeta>` |

### `LiquidatePerp`

Discriminator `4b2377f7bf128b02` · data `LiquidatePerp` · accounts `LiquidatePerpInstructionAccounts`.

| Field                              | Type          |
| ---------------------------------- | ------------- |
| `market_index`                     | `u16`         |
| `liquidator_max_base_asset_amount` | `u64`         |
| `limit_price`                      | `Option<u64>` |

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

Fields of `LiquidatePerpInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `state`            | `Pubkey`           |
| 1  | `authority`        | `Pubkey`           |
| 2  | `liquidator`       | `Pubkey`           |
| 3  | `liquidator_stats` | `Pubkey`           |
| 4  | `user`             | `Pubkey`           |
| 5  | `user_stats`       | `Pubkey`           |
| 6… | `remaining`        | `Vec<AccountMeta>` |

### `LiquidatePerpPnlForDeposit`

Discriminator `ed4bc6ebe9ba4b23` · data `LiquidatePerpPnlForDeposit` · accounts `LiquidatePerpPnlForDepositInstructionAccounts`.

| Field                         | Type          |
| ----------------------------- | ------------- |
| `perp_market_index`           | `u16`         |
| `spot_market_index`           | `u16`         |
| `liquidator_max_pnl_transfer` | `u128`        |
| `limit_price`                 | `Option<u64>` |

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

Fields of `LiquidatePerpPnlForDepositInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `state`            | `Pubkey`           |
| 1  | `authority`        | `Pubkey`           |
| 2  | `liquidator`       | `Pubkey`           |
| 3  | `liquidator_stats` | `Pubkey`           |
| 4  | `user`             | `Pubkey`           |
| 5  | `user_stats`       | `Pubkey`           |
| 6… | `remaining`        | `Vec<AccountMeta>` |

### `LiquidatePerpWithFill`

Discriminator `5f6f7c6956a9bb22` · data `LiquidatePerpWithFill` · accounts `LiquidatePerpWithFillInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `LiquidatePerpWithFillInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `state`            | `Pubkey`           |
| 1  | `authority`        | `Pubkey`           |
| 2  | `liquidator`       | `Pubkey`           |
| 3  | `liquidator_stats` | `Pubkey`           |
| 4  | `user`             | `Pubkey`           |
| 5  | `user_stats`       | `Pubkey`           |
| 6… | `remaining`        | `Vec<AccountMeta>` |

### `LiquidateSpot`

Discriminator `6b00802923e5fb12` · data `LiquidateSpot` · accounts `LiquidateSpotInstructionAccounts`.

| Field                               | Type          |
| ----------------------------------- | ------------- |
| `asset_market_index`                | `u16`         |
| `liability_market_index`            | `u16`         |
| `liquidator_max_liability_transfer` | `u128`        |
| `limit_price`                       | `Option<u64>` |

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

Fields of `LiquidateSpotInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `state`            | `Pubkey`           |
| 1  | `authority`        | `Pubkey`           |
| 2  | `liquidator`       | `Pubkey`           |
| 3  | `liquidator_stats` | `Pubkey`           |
| 4  | `user`             | `Pubkey`           |
| 5  | `user_stats`       | `Pubkey`           |
| 6… | `remaining`        | `Vec<AccountMeta>` |

### `LiquidateSpotWithSwapBegin`

Discriminator `0c2bb0539cfb750d` · data `LiquidateSpotWithSwapBegin` · accounts `LiquidateSpotWithSwapBeginInstructionAccounts`.

| Field                    | Type  |
| ------------------------ | ----- |
| `asset_market_index`     | `u16` |
| `liability_market_index` | `u16` |
| `swap_amount`            | `u64` |

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

Fields of `LiquidateSpotWithSwapBeginInstructionAccounts`, in account order:

| #   | Field                         | Type               |
| --- | ----------------------------- | ------------------ |
| 0   | `state`                       | `Pubkey`           |
| 1   | `authority`                   | `Pubkey`           |
| 2   | `liquidator`                  | `Pubkey`           |
| 3   | `liquidator_stats`            | `Pubkey`           |
| 4   | `user`                        | `Pubkey`           |
| 5   | `user_stats`                  | `Pubkey`           |
| 6   | `liability_spot_market_vault` | `Pubkey`           |
| 7   | `asset_spot_market_vault`     | `Pubkey`           |
| 8   | `liability_token_account`     | `Pubkey`           |
| 9   | `asset_token_account`         | `Pubkey`           |
| 10  | `token_program`               | `Pubkey`           |
| 11  | `drift_signer`                | `Pubkey`           |
| 12  | `instructions`                | `Pubkey`           |
| 13… | `remaining`                   | `Vec<AccountMeta>` |

### `LiquidateSpotWithSwapEnd`

Discriminator `8e58a3a0df4b37e1` · data `LiquidateSpotWithSwapEnd` · accounts `LiquidateSpotWithSwapEndInstructionAccounts`.

| Field                    | Type  |
| ------------------------ | ----- |
| `asset_market_index`     | `u16` |
| `liability_market_index` | `u16` |

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

Fields of `LiquidateSpotWithSwapEndInstructionAccounts`, in account order:

| #   | Field                         | Type               |
| --- | ----------------------------- | ------------------ |
| 0   | `state`                       | `Pubkey`           |
| 1   | `authority`                   | `Pubkey`           |
| 2   | `liquidator`                  | `Pubkey`           |
| 3   | `liquidator_stats`            | `Pubkey`           |
| 4   | `user`                        | `Pubkey`           |
| 5   | `user_stats`                  | `Pubkey`           |
| 6   | `liability_spot_market_vault` | `Pubkey`           |
| 7   | `asset_spot_market_vault`     | `Pubkey`           |
| 8   | `liability_token_account`     | `Pubkey`           |
| 9   | `asset_token_account`         | `Pubkey`           |
| 10  | `token_program`               | `Pubkey`           |
| 11  | `drift_signer`                | `Pubkey`           |
| 12  | `instructions`                | `Pubkey`           |
| 13… | `remaining`                   | `Vec<AccountMeta>` |

### `LogUserBalances`

Discriminator `a21523fb2039a1d2` · data `LogUserBalances` · accounts `LogUserBalancesInstructionAccounts`.

No data fields.

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

Fields of `LogUserBalancesInstructionAccounts`, in account order:

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

### `LpPoolAddLiquidity`

Discriminator `3187f6675d92dc8d` · data `LpPoolAddLiquidity` · accounts `LpPoolAddLiquidityInstructionAccounts`.

| Field             | Type   |
| ----------------- | ------ |
| `in_market_index` | `u16`  |
| `in_amount`       | `u128` |
| `min_mint_amount` | `u64`  |

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

Fields of `LpPoolAddLiquidityInstructionAccounts`, in account order:

| #   | Field                          | Type               |
| --- | ------------------------------ | ------------------ |
| 0   | `state`                        | `Pubkey`           |
| 1   | `lp_pool`                      | `Pubkey`           |
| 2   | `authority`                    | `Pubkey`           |
| 3   | `in_market_mint`               | `Pubkey`           |
| 4   | `in_constituent`               | `Pubkey`           |
| 5   | `user_in_token_account`        | `Pubkey`           |
| 6   | `constituent_in_token_account` | `Pubkey`           |
| 7   | `user_lp_token_account`        | `Pubkey`           |
| 8   | `lp_mint`                      | `Pubkey`           |
| 9   | `constituent_target_base`      | `Pubkey`           |
| 10  | `lp_pool_token_vault`          | `Pubkey`           |
| 11  | `token_program`                | `Pubkey`           |
| 12… | `remaining`                    | `Vec<AccountMeta>` |

### `LpPoolRemoveLiquidity`

Discriminator `a424c1fcc49d8a2b` · data `LpPoolRemoveLiquidity` · accounts `LpPoolRemoveLiquidityInstructionAccounts`.

| Field             | Type   |
| ----------------- | ------ |
| `in_market_index` | `u16`  |
| `in_amount`       | `u64`  |
| `min_out_amount`  | `u128` |

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

Fields of `LpPoolRemoveLiquidityInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `state`                         | `Pubkey`           |
| 1   | `drift_signer`                  | `Pubkey`           |
| 2   | `lp_pool`                       | `Pubkey`           |
| 3   | `authority`                     | `Pubkey`           |
| 4   | `out_market_mint`               | `Pubkey`           |
| 5   | `out_constituent`               | `Pubkey`           |
| 6   | `user_out_token_account`        | `Pubkey`           |
| 7   | `constituent_out_token_account` | `Pubkey`           |
| 8   | `user_lp_token_account`         | `Pubkey`           |
| 9   | `spot_market_token_account`     | `Pubkey`           |
| 10  | `lp_mint`                       | `Pubkey`           |
| 11  | `constituent_target_base`       | `Pubkey`           |
| 12  | `lp_pool_token_vault`           | `Pubkey`           |
| 13  | `token_program`                 | `Pubkey`           |
| 14  | `amm_cache`                     | `Pubkey`           |
| 15… | `remaining`                     | `Vec<AccountMeta>` |

### `LpPoolSwap`

Discriminator `24a12731e30123e2` · data `LpPoolSwap` · accounts `LpPoolSwapInstructionAccounts`.

| Field              | Type  |
| ------------------ | ----- |
| `in_market_index`  | `u16` |
| `out_market_index` | `u16` |
| `in_amount`        | `u64` |
| `min_out_amount`   | `u64` |

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

Fields of `LpPoolSwapInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `state`                         | `Pubkey`           |
| 1   | `lp_pool`                       | `Pubkey`           |
| 2   | `constituent_target_base`       | `Pubkey`           |
| 3   | `constituent_correlations`      | `Pubkey`           |
| 4   | `constituent_in_token_account`  | `Pubkey`           |
| 5   | `constituent_out_token_account` | `Pubkey`           |
| 6   | `user_in_token_account`         | `Pubkey`           |
| 7   | `user_out_token_account`        | `Pubkey`           |
| 8   | `in_constituent`                | `Pubkey`           |
| 9   | `out_constituent`               | `Pubkey`           |
| 10  | `in_market_mint`                | `Pubkey`           |
| 11  | `out_market_mint`               | `Pubkey`           |
| 12  | `authority`                     | `Pubkey`           |
| 13  | `token_program`                 | `Pubkey`           |
| 14… | `remaining`                     | `Vec<AccountMeta>` |

### `ModifyOrder`

Discriminator `2f7c75ffc9c5825e` · data `ModifyOrder` · accounts `ModifyOrderInstructionAccounts`.

| Field                 | Type                                      |
| --------------------- | ----------------------------------------- |
| `order_id`            | `Option<u32>`                             |
| `modify_order_params` | [`ModifyOrderParams`](#modifyorderparams) |

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

Fields of `ModifyOrderInstructionAccounts`, in account order:

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

### `ModifyOrderByUserId`

Discriminator `9e4d04fdfcc2a1b3` · data `ModifyOrderByUserId` · accounts `ModifyOrderByUserIdInstructionAccounts`.

| Field                 | Type                                      |
| --------------------- | ----------------------------------------- |
| `user_order_id`       | `u8`                                      |
| `modify_order_params` | [`ModifyOrderParams`](#modifyorderparams) |

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

Fields of `ModifyOrderByUserIdInstructionAccounts`, in account order:

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

### `MoveAmmPrice`

Discriminator `eb6d0252db76069f` · data `MoveAmmPrice` · accounts `MoveAmmPriceInstructionAccounts`.

| Field                 | Type   |
| --------------------- | ------ |
| `base_asset_reserve`  | `u128` |
| `quote_asset_reserve` | `u128` |
| `sqrt_k`              | `u128` |

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

Fields of `MoveAmmPriceInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `OpenbookV2FulfillmentConfigStatus`

Discriminator `19ad13bd04d340ee` · data `OpenbookV2FulfillmentConfigStatus` · accounts `OpenbookV2FulfillmentConfigStatusInstructionAccounts`.

| Field    | Type                                                          |
| -------- | ------------------------------------------------------------- |
| `status` | [`SpotFulfillmentConfigStatus`](#spotfulfillmentconfigstatus) |

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

Fields of `OpenbookV2FulfillmentConfigStatusInstructionAccounts`, in account order:

| #  | Field                            | Type               |
| -- | -------------------------------- | ------------------ |
| 0  | `state`                          | `Pubkey`           |
| 1  | `openbook_v2_fulfillment_config` | `Pubkey`           |
| 2  | `admin`                          | `Pubkey`           |
| 3… | `remaining`                      | `Vec<AccountMeta>` |

### `OverrideAmmCacheInfo`

Discriminator `bdc680093191c973` · data `OverrideAmmCacheInfo` · accounts `OverrideAmmCacheInfoInstructionAccounts`.

| Field             | Type                                                |
| ----------------- | --------------------------------------------------- |
| `market_index`    | `u16`                                               |
| `override_params` | [`OverrideAmmCacheParams`](#overrideammcacheparams) |

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

Fields of `OverrideAmmCacheInfoInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `state`     | `Pubkey`           |
| 1  | `admin`     | `Pubkey`           |
| 2  | `amm_cache` | `Pubkey`           |
| 3… | `remaining` | `Vec<AccountMeta>` |

### `PauseSpotMarketDepositWithdraw`

Discriminator `b7773baa8923f256` · data `PauseSpotMarketDepositWithdraw` · accounts `PauseSpotMarketDepositWithdrawInstructionAccounts`.

No data fields.

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

Fields of `PauseSpotMarketDepositWithdrawInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `keeper`            | `Pubkey`           |
| 2  | `spot_market`       | `Pubkey`           |
| 3  | `spot_market_vault` | `Pubkey`           |
| 4… | `remaining`         | `Vec<AccountMeta>` |

### `PhoenixFulfillmentConfigStatus`

Discriminator `601f71200ccb079a` · data `PhoenixFulfillmentConfigStatus` · accounts `PhoenixFulfillmentConfigStatusInstructionAccounts`.

| Field    | Type                                                          |
| -------- | ------------------------------------------------------------- |
| `status` | [`SpotFulfillmentConfigStatus`](#spotfulfillmentconfigstatus) |

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

Fields of `PhoenixFulfillmentConfigStatusInstructionAccounts`, in account order:

| #  | Field                        | Type               |
| -- | ---------------------------- | ------------------ |
| 0  | `state`                      | `Pubkey`           |
| 1  | `phoenix_fulfillment_config` | `Pubkey`           |
| 2  | `admin`                      | `Pubkey`           |
| 3… | `remaining`                  | `Vec<AccountMeta>` |

### `PlaceAndMakePerpOrder`

Discriminator `95750bed2f5f59ed` · data `PlaceAndMakePerpOrder` · accounts `PlaceAndMakePerpOrderInstructionAccounts`.

| Field            | Type                          |
| ---------------- | ----------------------------- |
| `params`         | [`OrderParams`](#orderparams) |
| `taker_order_id` | `u32`                         |

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

Fields of `PlaceAndMakePerpOrderInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `user`        | `Pubkey`           |
| 2  | `user_stats`  | `Pubkey`           |
| 3  | `taker`       | `Pubkey`           |
| 4  | `taker_stats` | `Pubkey`           |
| 5  | `authority`   | `Pubkey`           |
| 6… | `remaining`   | `Vec<AccountMeta>` |

### `PlaceAndMakeSignedMsgPerpOrder`

Discriminator `101a7b835e1daf62` · data `PlaceAndMakeSignedMsgPerpOrder` · accounts `PlaceAndMakeSignedMsgPerpOrderInstructionAccounts`.

| Field                   | Type                          |
| ----------------------- | ----------------------------- |
| `params`                | [`OrderParams`](#orderparams) |
| `signed_msg_order_uuid` | `[u8; 8]`                     |

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

Fields of `PlaceAndMakeSignedMsgPerpOrderInstructionAccounts`, in account order:

| #  | Field                          | Type               |
| -- | ------------------------------ | ------------------ |
| 0  | `state`                        | `Pubkey`           |
| 1  | `user`                         | `Pubkey`           |
| 2  | `user_stats`                   | `Pubkey`           |
| 3  | `taker`                        | `Pubkey`           |
| 4  | `taker_stats`                  | `Pubkey`           |
| 5  | `taker_signed_msg_user_orders` | `Pubkey`           |
| 6  | `authority`                    | `Pubkey`           |
| 7… | `remaining`                    | `Vec<AccountMeta>` |

### `PlaceAndMakeSpotOrder`

Discriminator `959e5542ef09f362` · data `PlaceAndMakeSpotOrder` · accounts `PlaceAndMakeSpotOrderInstructionAccounts`.

| Field              | Type                                                  |
| ------------------ | ----------------------------------------------------- |
| `params`           | [`OrderParams`](#orderparams)                         |
| `taker_order_id`   | `u32`                                                 |
| `fulfillment_type` | [`Option<SpotFulfillmentType>`](#spotfulfillmenttype) |

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

Fields of `PlaceAndMakeSpotOrderInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `user`        | `Pubkey`           |
| 2  | `user_stats`  | `Pubkey`           |
| 3  | `taker`       | `Pubkey`           |
| 4  | `taker_stats` | `Pubkey`           |
| 5  | `authority`   | `Pubkey`           |
| 6… | `remaining`   | `Vec<AccountMeta>` |

### `PlaceAndTakePerpOrder`

Discriminator `d53301bb6cdce6e0` · data `PlaceAndTakePerpOrder` · accounts `PlaceAndTakePerpOrderInstructionAccounts`.

| Field               | Type                          |
| ------------------- | ----------------------------- |
| `params`            | [`OrderParams`](#orderparams) |
| `success_condition` | `Option<u32>`                 |

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

Fields of `PlaceAndTakePerpOrderInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `state`      | `Pubkey`           |
| 1  | `user`       | `Pubkey`           |
| 2  | `user_stats` | `Pubkey`           |
| 3  | `authority`  | `Pubkey`           |
| 4… | `remaining`  | `Vec<AccountMeta>` |

### `PlaceAndTakeSpotOrder`

Discriminator `bf038a4772c6ca64` · data `PlaceAndTakeSpotOrder` · accounts `PlaceAndTakeSpotOrderInstructionAccounts`.

| Field              | Type                                                  |
| ------------------ | ----------------------------------------------------- |
| `params`           | [`OrderParams`](#orderparams)                         |
| `fulfillment_type` | [`Option<SpotFulfillmentType>`](#spotfulfillmenttype) |
| `maker_order_id`   | `Option<u32>`                                         |

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

Fields of `PlaceAndTakeSpotOrderInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `state`      | `Pubkey`           |
| 1  | `user`       | `Pubkey`           |
| 2  | `user_stats` | `Pubkey`           |
| 3  | `authority`  | `Pubkey`           |
| 4… | `remaining`  | `Vec<AccountMeta>` |

### `PlaceOrders`

Discriminator `3c3f327b0cc53cbe` · data `PlaceOrders` · accounts `PlaceOrdersInstructionAccounts`.

| Field    | Type                               |
| -------- | ---------------------------------- |
| `params` | [`Vec<OrderParams>`](#orderparams) |

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

Fields of `PlaceOrdersInstructionAccounts`, in account order:

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

### `PlacePerpOrder`

Discriminator `45a15dca787e4cb9` · data `PlacePerpOrder` · accounts `PlacePerpOrderInstructionAccounts`.

| Field    | Type                          |
| -------- | ----------------------------- |
| `params` | [`OrderParams`](#orderparams) |

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

Fields of `PlacePerpOrderInstructionAccounts`, in account order:

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

### `PlaceScaleOrders`

Discriminator `81f94637b1fafc5e` · data `PlaceScaleOrders` · accounts `PlaceScaleOrdersInstructionAccounts`.

| Field    | Type                                    |
| -------- | --------------------------------------- |
| `params` | [`ScaleOrderParams`](#scaleorderparams) |

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

Fields of `PlaceScaleOrdersInstructionAccounts`, in account order:

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

### `PlaceSignedMsgTakerOrder`

Discriminator `204f658b1906620f` · data `PlaceSignedMsgTakerOrder` · accounts `PlaceSignedMsgTakerOrderInstructionAccounts`.

| Field                                   | Type      |
| --------------------------------------- | --------- |
| `signed_msg_order_params_message_bytes` | `Vec<u8>` |
| `is_delegate_signer`                    | `bool`    |

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

Fields of `PlaceSignedMsgTakerOrderInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `state`                  | `Pubkey`           |
| 1  | `user`                   | `Pubkey`           |
| 2  | `user_stats`             | `Pubkey`           |
| 3  | `signed_msg_user_orders` | `Pubkey`           |
| 4  | `authority`              | `Pubkey`           |
| 5  | `ix_sysvar`              | `Pubkey`           |
| 6… | `remaining`              | `Vec<AccountMeta>` |

### `PlaceSpotOrder`

Discriminator `2d4f51a0f85a5bdc` · data `PlaceSpotOrder` · accounts `PlaceSpotOrderInstructionAccounts`.

| Field    | Type                          |
| -------- | ----------------------------- |
| `params` | [`OrderParams`](#orderparams) |

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

Fields of `PlaceSpotOrderInstructionAccounts`, in account order:

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

### `PostMultiPythPullOracleUpdatesAtomic`

Discriminator `f34fcce4e3d064f4` · data `PostMultiPythPullOracleUpdatesAtomic` · accounts `PostMultiPythPullOracleUpdatesAtomicInstructionAccounts`.

| Field    | Type      |
| -------- | --------- |
| `params` | `Vec<u8>` |

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

Fields of `PostMultiPythPullOracleUpdatesAtomicInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `keeper`               | `Pubkey`           |
| 1  | `pyth_solana_receiver` | `Pubkey`           |
| 2  | `guardian_set`         | `Pubkey`           |
| 3… | `remaining`            | `Vec<AccountMeta>` |

### `PostPythLazerOracleUpdate`

Discriminator `daedaaf5278fa621` · data `PostPythLazerOracleUpdate` · accounts `PostPythLazerOracleUpdateInstructionAccounts`.

| Field          | Type      |
| -------------- | --------- |
| `pyth_message` | `Vec<u8>` |

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

Fields of `PostPythLazerOracleUpdateInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `keeper`             | `Pubkey`           |
| 1  | `pyth_lazer_storage` | `Pubkey`           |
| 2  | `ix_sysvar`          | `Pubkey`           |
| 3… | `remaining`          | `Vec<AccountMeta>` |

### `PostPythPullOracleUpdateAtomic`

Discriminator `747a899ee0c3ad77` · data `PostPythPullOracleUpdateAtomic` · accounts `PostPythPullOracleUpdateAtomicInstructionAccounts`.

| Field     | Type       |
| --------- | ---------- |
| `feed_id` | `[u8; 32]` |
| `params`  | `Vec<u8>`  |

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

Fields of `PostPythPullOracleUpdateAtomicInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `keeper`               | `Pubkey`           |
| 1  | `pyth_solana_receiver` | `Pubkey`           |
| 2  | `guardian_set`         | `Pubkey`           |
| 3  | `price_feed`           | `Pubkey`           |
| 4… | `remaining`            | `Vec<AccountMeta>` |

### `RecenterPerpMarketAmm`

Discriminator `18570a73a5be508b` · data `RecenterPerpMarketAmm` · accounts `RecenterPerpMarketAmmInstructionAccounts`.

| Field            | Type   |
| ---------------- | ------ |
| `peg_multiplier` | `u128` |
| `sqrt_k`         | `u128` |

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

Fields of `RecenterPerpMarketAmmInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `RecenterPerpMarketAmmCrank`

Discriminator `a613400a0e33657a` · data `RecenterPerpMarketAmmCrank` · accounts `RecenterPerpMarketAmmCrankInstructionAccounts`.

| Field   | Type           |
| ------- | -------------- |
| `depth` | `Option<u128>` |

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

Fields of `RecenterPerpMarketAmmCrankInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3  | `spot_market` | `Pubkey`           |
| 4  | `oracle`      | `Pubkey`           |
| 5… | `remaining`   | `Vec<AccountMeta>` |

### `ReclaimRent`

Discriminator `dac813c5e359c016` · data `ReclaimRent` · accounts `ReclaimRentInstructionAccounts`.

No data fields.

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

Fields of `ReclaimRentInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `user`       | `Pubkey`           |
| 1  | `user_stats` | `Pubkey`           |
| 2  | `state`      | `Pubkey`           |
| 3  | `authority`  | `Pubkey`           |
| 4  | `rent`       | `Pubkey`           |
| 5… | `remaining`  | `Vec<AccountMeta>` |

### `RemoveAmmConstituentMappingData`

Discriminator `14b7d3a21034e573` · data `RemoveAmmConstituentMappingData` · accounts `RemoveAmmConstituentMappingDataInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `perp_market_index` | `u16` |
| `constituent_index` | `u16` |

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

Fields of `RemoveAmmConstituentMappingDataInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `admin`                   | `Pubkey`           |
| 1  | `lp_pool`                 | `Pubkey`           |
| 2  | `amm_constituent_mapping` | `Pubkey`           |
| 3  | `system_program`          | `Pubkey`           |
| 4  | `state`                   | `Pubkey`           |
| 5… | `remaining`               | `Vec<AccountMeta>` |

### `RemoveInsuranceFundStake`

Discriminator `80a68e09febb8fae` · data `RemoveInsuranceFundStake` · accounts `RemoveInsuranceFundStakeInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `RemoveInsuranceFundStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `spot_market`          | `Pubkey`           |
| 2  | `insurance_fund_stake` | `Pubkey`           |
| 3  | `user_stats`           | `Pubkey`           |
| 4  | `authority`            | `Pubkey`           |
| 5  | `insurance_fund_vault` | `Pubkey`           |
| 6  | `drift_signer`         | `Pubkey`           |
| 7  | `user_token_account`   | `Pubkey`           |
| 8  | `token_program`        | `Pubkey`           |
| 9… | `remaining`            | `Vec<AccountMeta>` |

### `RepegAmmCurve`

Discriminator `03246659b48078d5` · data `RepegAmmCurve` · accounts `RepegAmmCurveInstructionAccounts`.

| Field               | Type   |
| ------------------- | ------ |
| `new_peg_candidate` | `u128` |

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

Fields of `RepegAmmCurveInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `perp_market` | `Pubkey`           |
| 2  | `oracle`      | `Pubkey`           |
| 3  | `admin`       | `Pubkey`           |
| 4… | `remaining`   | `Vec<AccountMeta>` |

### `RequestRemoveInsuranceFundStake`

Discriminator `8e46cc5c496ab434` · data `RequestRemoveInsuranceFundStake` · accounts `RequestRemoveInsuranceFundStakeInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `RequestRemoveInsuranceFundStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `spot_market`          | `Pubkey`           |
| 1  | `insurance_fund_stake` | `Pubkey`           |
| 2  | `user_stats`           | `Pubkey`           |
| 3  | `authority`            | `Pubkey`           |
| 4  | `insurance_fund_vault` | `Pubkey`           |
| 5… | `remaining`            | `Vec<AccountMeta>` |

### `ResetFuelSeason`

Discriminator `c77ac0ff20633fc8` · data `ResetFuelSeason` · accounts `ResetFuelSeasonInstructionAccounts`.

No data fields.

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

Fields of `ResetFuelSeasonInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `user_stats` | `Pubkey`           |
| 1  | `authority`  | `Pubkey`           |
| 2  | `state`      | `Pubkey`           |
| 3  | `admin`      | `Pubkey`           |
| 4… | `remaining`  | `Vec<AccountMeta>` |

### `ResetPerpMarketAmmOracleTwap`

Discriminator `7f0a37a47be22f18` · data `ResetPerpMarketAmmOracleTwap` · accounts `ResetPerpMarketAmmOracleTwapInstructionAccounts`.

No data fields.

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

Fields of `ResetPerpMarketAmmOracleTwapInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `perp_market` | `Pubkey`           |
| 2  | `oracle`      | `Pubkey`           |
| 3  | `admin`       | `Pubkey`           |
| 4… | `remaining`   | `Vec<AccountMeta>` |

### `ResizeRevenueShareEscrowOrders`

Discriminator `207cf7e197d5e126` · data `ResizeRevenueShareEscrowOrders` · accounts `ResizeRevenueShareEscrowOrdersInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `num_orders` | `u16` |

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

Fields of `ResizeRevenueShareEscrowOrdersInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `escrow`         | `Pubkey`           |
| 1  | `authority`      | `Pubkey`           |
| 2  | `payer`          | `Pubkey`           |
| 3  | `system_program` | `Pubkey`           |
| 4… | `remaining`      | `Vec<AccountMeta>` |

### `ResizeSignedMsgUserOrders`

Discriminator `890a579612734fa8` · data `ResizeSignedMsgUserOrders` · accounts `ResizeSignedMsgUserOrdersInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `num_orders` | `u16` |

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

Fields of `ResizeSignedMsgUserOrdersInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `signed_msg_user_orders` | `Pubkey`           |
| 1  | `authority`              | `Pubkey`           |
| 2  | `user`                   | `Pubkey`           |
| 3  | `payer`                  | `Pubkey`           |
| 4  | `system_program`         | `Pubkey`           |
| 5… | `remaining`              | `Vec<AccountMeta>` |

### `ResolvePerpBankruptcy`

Discriminator `e010b0d6a2d5b7de` · data `ResolvePerpBankruptcy` · accounts `ResolvePerpBankruptcyInstructionAccounts`.

| Field                     | Type  |
| ------------------------- | ----- |
| `quote_spot_market_index` | `u16` |
| `market_index`            | `u16` |

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

Fields of `ResolvePerpBankruptcyInstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `state`                | `Pubkey`           |
| 1   | `authority`            | `Pubkey`           |
| 2   | `liquidator`           | `Pubkey`           |
| 3   | `liquidator_stats`     | `Pubkey`           |
| 4   | `user`                 | `Pubkey`           |
| 5   | `user_stats`           | `Pubkey`           |
| 6   | `spot_market_vault`    | `Pubkey`           |
| 7   | `insurance_fund_vault` | `Pubkey`           |
| 8   | `drift_signer`         | `Pubkey`           |
| 9   | `token_program`        | `Pubkey`           |
| 10… | `remaining`            | `Vec<AccountMeta>` |

### `ResolvePerpPnlDeficit`

Discriminator `a8cc44969f7e5f94` · data `ResolvePerpPnlDeficit` · accounts `ResolvePerpPnlDeficitInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `spot_market_index` | `u16` |
| `perp_market_index` | `u16` |

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

Fields of `ResolvePerpPnlDeficitInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `authority`            | `Pubkey`           |
| 2  | `spot_market_vault`    | `Pubkey`           |
| 3  | `insurance_fund_vault` | `Pubkey`           |
| 4  | `drift_signer`         | `Pubkey`           |
| 5  | `token_program`        | `Pubkey`           |
| 6… | `remaining`            | `Vec<AccountMeta>` |

### `ResolveSpotBankruptcy`

Discriminator `7cc2f0fec6d5347a` · data `ResolveSpotBankruptcy` · accounts `ResolveSpotBankruptcyInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `ResolveSpotBankruptcyInstructionAccounts`, in account order:

| #   | Field                  | Type               |
| --- | ---------------------- | ------------------ |
| 0   | `state`                | `Pubkey`           |
| 1   | `authority`            | `Pubkey`           |
| 2   | `liquidator`           | `Pubkey`           |
| 3   | `liquidator_stats`     | `Pubkey`           |
| 4   | `user`                 | `Pubkey`           |
| 5   | `user_stats`           | `Pubkey`           |
| 6   | `spot_market_vault`    | `Pubkey`           |
| 7   | `insurance_fund_vault` | `Pubkey`           |
| 8   | `drift_signer`         | `Pubkey`           |
| 9   | `token_program`        | `Pubkey`           |
| 10… | `remaining`            | `Vec<AccountMeta>` |

### `RevertFill`

Discriminator `eceeb045ef0ab5c1` · data `RevertFill` · accounts `RevertFillInstructionAccounts`.

No data fields.

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

Fields of `RevertFillInstructionAccounts`, in account order:

| #  | Field          | Type               |
| -- | -------------- | ------------------ |
| 0  | `state`        | `Pubkey`           |
| 1  | `authority`    | `Pubkey`           |
| 2  | `filler`       | `Pubkey`           |
| 3  | `filler_stats` | `Pubkey`           |
| 4… | `remaining`    | `Vec<AccountMeta>` |

### `SettleExpiredMarket`

Discriminator `78590b197a4d48c1` · data `SettleExpiredMarket` · accounts `SettleExpiredMarketInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `SettleExpiredMarketInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `SettleExpiredMarketPoolsToRevenuePool`

Discriminator `3713eea9e35ac8b8` · data `SettleExpiredMarketPoolsToRevenuePool` · accounts `SettleExpiredMarketPoolsToRevenuePoolInstructionAccounts`.

No data fields.

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

Fields of `SettleExpiredMarketPoolsToRevenuePoolInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `admin`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3  | `perp_market` | `Pubkey`           |
| 4… | `remaining`   | `Vec<AccountMeta>` |

### `SettleFundingPayment`

Discriminator `de5aca5e1c2d73b7` · data `SettleFundingPayment` · accounts `SettleFundingPaymentInstructionAccounts`.

No data fields.

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

Fields of `SettleFundingPaymentInstructionAccounts`, in account order:

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

### `SettleMultiplePnls`

Discriminator `7f4275392832987f` · data `SettleMultiplePnls` · accounts `SettleMultiplePnlsInstructionAccounts`.

| Field            | Type                              |
| ---------------- | --------------------------------- |
| `market_indexes` | `Vec<u16>`                        |
| `mode`           | [`SettlePnlMode`](#settlepnlmode) |

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

Fields of `SettleMultiplePnlsInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `user`              | `Pubkey`           |
| 2  | `authority`         | `Pubkey`           |
| 3  | `spot_market_vault` | `Pubkey`           |
| 4… | `remaining`         | `Vec<AccountMeta>` |

### `SettlePerpToLpPool`

Discriminator `05622ebc0a3b02f9` · data `SettlePerpToLpPool` · accounts `SettlePerpToLpPoolInstructionAccounts`.

No data fields.

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

Fields of `SettlePerpToLpPoolInstructionAccounts`, in account order:

| #   | Field                             | Type               |
| --- | --------------------------------- | ------------------ |
| 0   | `state`                           | `Pubkey`           |
| 1   | `lp_pool`                         | `Pubkey`           |
| 2   | `keeper`                          | `Pubkey`           |
| 3   | `amm_cache`                       | `Pubkey`           |
| 4   | `quote_market`                    | `Pubkey`           |
| 5   | `constituent`                     | `Pubkey`           |
| 6   | `constituent_quote_token_account` | `Pubkey`           |
| 7   | `quote_token_vault`               | `Pubkey`           |
| 8   | `token_program`                   | `Pubkey`           |
| 9   | `drift_signer`                    | `Pubkey`           |
| 10… | `remaining`                       | `Vec<AccountMeta>` |

### `SettlePnl`

Discriminator `2b3dea2d0f5f9899` · data `SettlePnl` · accounts `SettlePnlInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `SettlePnlInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `user`              | `Pubkey`           |
| 2  | `authority`         | `Pubkey`           |
| 3  | `spot_market_vault` | `Pubkey`           |
| 4… | `remaining`         | `Vec<AccountMeta>` |

### `SettleRevenueToInsuranceFund`

Discriminator `c8785d884526c79f` · data `SettleRevenueToInsuranceFund` · accounts `SettleRevenueToInsuranceFundInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `spot_market_index` | `u16` |

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

Fields of `SettleRevenueToInsuranceFundInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `spot_market`          | `Pubkey`           |
| 2  | `spot_market_vault`    | `Pubkey`           |
| 3  | `drift_signer`         | `Pubkey`           |
| 4  | `insurance_fund_vault` | `Pubkey`           |
| 5  | `token_program`        | `Pubkey`           |
| 6… | `remaining`            | `Vec<AccountMeta>` |

### `SetUserStatusToBeingLiquidated`

Discriminator `6a85a0cec1abc0c2` · data `SetUserStatusToBeingLiquidated` · accounts `SetUserStatusToBeingLiquidatedInstructionAccounts`.

No data fields.

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

Fields of `SetUserStatusToBeingLiquidatedInstructionAccounts`, in account order:

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

### `SweepFuel`

Discriminator `af6b1338a5f12b45` · data `SweepFuel` · accounts `SweepFuelInstructionAccounts`.

No data fields.

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

Fields of `SweepFuelInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `fuel_overflow` | `Pubkey`           |
| 1  | `user_stats`    | `Pubkey`           |
| 2  | `authority`     | `Pubkey`           |
| 3  | `signer`        | `Pubkey`           |
| 4… | `remaining`     | `Vec<AccountMeta>` |

### `TransferDeposit`

Discriminator `141493df293fcc6f` · data `TransferDeposit` · accounts `TransferDepositInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `TransferDepositInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `from_user`         | `Pubkey`           |
| 1  | `to_user`           | `Pubkey`           |
| 2  | `user_stats`        | `Pubkey`           |
| 3  | `authority`         | `Pubkey`           |
| 4  | `state`             | `Pubkey`           |
| 5  | `spot_market_vault` | `Pubkey`           |
| 6… | `remaining`         | `Vec<AccountMeta>` |

### `TransferIsolatedPerpPositionDeposit`

Discriminator `c983f2e455e246ed` · data `TransferIsolatedPerpPositionDeposit` · accounts `TransferIsolatedPerpPositionDepositInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `spot_market_index` | `u16` |
| `perp_market_index` | `u16` |
| `amount`            | `i64` |

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

Fields of `TransferIsolatedPerpPositionDepositInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `user`              | `Pubkey`           |
| 1  | `user_stats`        | `Pubkey`           |
| 2  | `authority`         | `Pubkey`           |
| 3  | `state`             | `Pubkey`           |
| 4  | `spot_market_vault` | `Pubkey`           |
| 5… | `remaining`         | `Vec<AccountMeta>` |

### `TransferPerpPosition`

Discriminator `17acbca886d2036c` · data `TransferPerpPosition` · accounts `TransferPerpPositionInstructionAccounts`.

| Field          | Type          |
| -------------- | ------------- |
| `market_index` | `u16`         |
| `amount`       | `Option<i64>` |

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

Fields of `TransferPerpPositionInstructionAccounts`, in account order:

| #  | Field        | Type               |
| -- | ------------ | ------------------ |
| 0  | `from_user`  | `Pubkey`           |
| 1  | `to_user`    | `Pubkey`           |
| 2  | `user_stats` | `Pubkey`           |
| 3  | `authority`  | `Pubkey`           |
| 4  | `state`      | `Pubkey`           |
| 5… | `remaining`  | `Vec<AccountMeta>` |

### `TransferPools`

Discriminator `c5679a196b5a3c5e` · data `TransferPools` · accounts `TransferPoolsInstructionAccounts`.

| Field                       | Type          |
| --------------------------- | ------------- |
| `deposit_from_market_index` | `u16`         |
| `deposit_to_market_index`   | `u16`         |
| `borrow_from_market_index`  | `u16`         |
| `borrow_to_market_index`    | `u16`         |
| `deposit_amount`            | `Option<u64>` |
| `borrow_amount`             | `Option<u64>` |

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

Fields of `TransferPoolsInstructionAccounts`, in account order:

| #   | Field                            | Type               |
| --- | -------------------------------- | ------------------ |
| 0   | `from_user`                      | `Pubkey`           |
| 1   | `to_user`                        | `Pubkey`           |
| 2   | `user_stats`                     | `Pubkey`           |
| 3   | `authority`                      | `Pubkey`           |
| 4   | `state`                          | `Pubkey`           |
| 5   | `deposit_from_spot_market_vault` | `Pubkey`           |
| 6   | `deposit_to_spot_market_vault`   | `Pubkey`           |
| 7   | `borrow_from_spot_market_vault`  | `Pubkey`           |
| 8   | `borrow_to_spot_market_vault`    | `Pubkey`           |
| 9   | `drift_signer`                   | `Pubkey`           |
| 10… | `remaining`                      | `Vec<AccountMeta>` |

### `TransferProtocolIfSharesToRevenuePool`

Discriminator `ec88939992cd681d` · data `TransferProtocolIfSharesToRevenuePool` · accounts `TransferProtocolIfSharesToRevenuePoolInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |
| `amount`       | `u64` |

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

Fields of `TransferProtocolIfSharesToRevenuePoolInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `authority`            | `Pubkey`           |
| 2  | `insurance_fund_vault` | `Pubkey`           |
| 3  | `spot_market_vault`    | `Pubkey`           |
| 4  | `if_rebalance_config`  | `Pubkey`           |
| 5  | `token_program`        | `Pubkey`           |
| 6  | `drift_signer`         | `Pubkey`           |
| 7… | `remaining`            | `Vec<AccountMeta>` |

### `TriggerOrder`

Discriminator `3f7033e9e82ff0c7` · data `TriggerOrder` · accounts `TriggerOrderInstructionAccounts`.

| Field      | Type  |
| ---------- | ----- |
| `order_id` | `u32` |

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

Fields of `TriggerOrderInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `state`     | `Pubkey`           |
| 1  | `authority` | `Pubkey`           |
| 2  | `filler`    | `Pubkey`           |
| 3  | `user`      | `Pubkey`           |
| 4… | `remaining` | `Vec<AccountMeta>` |

### `UpdateAdmin`

Discriminator `a1b028d53cb8b3e4` · data `UpdateAdmin` · accounts `UpdateAdminInstructionAccounts`.

| Field   | Type     |
| ------- | -------- |
| `admin` | `Pubkey` |

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

Fields of `UpdateAdminInstructionAccounts`, in account order:

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

### `UpdateAmmCache`

Discriminator `58043f5e53e0ff82` · data `UpdateAmmCache` · accounts `UpdateAmmCacheInstructionAccounts`.

No data fields.

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

Fields of `UpdateAmmCacheInstructionAccounts`, in account order:

| #  | Field          | Type               |
| -- | -------------- | ------------------ |
| 0  | `keeper`       | `Pubkey`           |
| 1  | `state`        | `Pubkey`           |
| 2  | `amm_cache`    | `Pubkey`           |
| 3  | `quote_market` | `Pubkey`           |
| 4… | `remaining`    | `Vec<AccountMeta>` |

### `UpdateAmmConstituentMappingData`

Discriminator `544621a7856b3b18` · data `UpdateAmmConstituentMappingData` · accounts `UpdateAmmConstituentMappingDataInstructionAccounts`.

| Field                          | Type                                                                   |
| ------------------------------ | ---------------------------------------------------------------------- |
| `amm_constituent_mapping_data` | [`Vec<AddAmmConstituentMappingDatum>`](#addammconstituentmappingdatum) |

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

Fields of `UpdateAmmConstituentMappingDataInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `admin`                   | `Pubkey`           |
| 1  | `lp_pool`                 | `Pubkey`           |
| 2  | `amm_constituent_mapping` | `Pubkey`           |
| 3  | `system_program`          | `Pubkey`           |
| 4  | `state`                   | `Pubkey`           |
| 5… | `remaining`               | `Vec<AccountMeta>` |

### `UpdateAmmJitIntensity`

Discriminator `b5bf356da6f9378e` · data `UpdateAmmJitIntensity` · accounts `UpdateAmmJitIntensityInstructionAccounts`.

| Field               | Type |
| ------------------- | ---- |
| `amm_jit_intensity` | `u8` |

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

Fields of `UpdateAmmJitIntensityInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateAmms`

Discriminator `c96ad9fd04afe461` · data `UpdateAmms` · accounts `UpdateAmmsInstructionAccounts`.

| Field            | Type       |
| ---------------- | ---------- |
| `market_indexes` | `Vec<u16>` |

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

Fields of `UpdateAmmsInstructionAccounts`, in account order:

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

### `UpdateConstituentCorrelationData`

Discriminator `4f0e1349dd6a3e6d` · data `UpdateConstituentCorrelationData` · accounts `UpdateConstituentCorrelationDataInstructionAccounts`.

| Field         | Type  |
| ------------- | ----- |
| `index1`      | `u16` |
| `index2`      | `u16` |
| `correlation` | `i64` |

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

Fields of `UpdateConstituentCorrelationDataInstructionAccounts`, in account order:

| #  | Field                      | Type               |
| -- | -------------------------- | ------------------ |
| 0  | `admin`                    | `Pubkey`           |
| 1  | `lp_pool`                  | `Pubkey`           |
| 2  | `constituent_correlations` | `Pubkey`           |
| 3  | `state`                    | `Pubkey`           |
| 4… | `remaining`                | `Vec<AccountMeta>` |

### `UpdateConstituentOracleInfo`

Discriminator `c675e7fa93217fa1` · data `UpdateConstituentOracleInfo` · accounts `UpdateConstituentOracleInfoInstructionAccounts`.

No data fields.

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

Fields of `UpdateConstituentOracleInfoInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `keeper`      | `Pubkey`           |
| 2  | `constituent` | `Pubkey`           |
| 3  | `spot_market` | `Pubkey`           |
| 4  | `oracle`      | `Pubkey`           |
| 5… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateConstituentParams`

Discriminator `ee827a1f0c68c07a` · data `UpdateConstituentParams` · accounts `UpdateConstituentParamsInstructionAccounts`.

| Field                | Type                                      |
| -------------------- | ----------------------------------------- |
| `constituent_params` | [`ConstituentParams`](#constituentparams) |

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

Fields of `UpdateConstituentParamsInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `lp_pool`                 | `Pubkey`           |
| 1  | `constituent_target_base` | `Pubkey`           |
| 2  | `admin`                   | `Pubkey`           |
| 3  | `state`                   | `Pubkey`           |
| 4  | `constituent`             | `Pubkey`           |
| 5… | `remaining`               | `Vec<AccountMeta>` |

### `UpdateConstituentPausedOperations`

Discriminator `b97a99bf83b184d0` · data `UpdateConstituentPausedOperations` · accounts `UpdateConstituentPausedOperationsInstructionAccounts`.

| Field               | Type |
| ------------------- | ---- |
| `paused_operations` | `u8` |

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

Fields of `UpdateConstituentPausedOperationsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `constituent` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateConstituentStatus`

Discriminator `4c9fd3efb6d6060f` · data `UpdateConstituentStatus` · accounts `UpdateConstituentStatusInstructionAccounts`.

| Field        | Type |
| ------------ | ---- |
| `new_status` | `u8` |

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

Fields of `UpdateConstituentStatusInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `constituent` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateDelegateUserGovTokenInsuranceStake`

Discriminator `f11dd7e48e7416a0` · data `UpdateDelegateUserGovTokenInsuranceStake` · accounts `UpdateDelegateUserGovTokenInsuranceStakeInstructionAccounts`.

No data fields.

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

Fields of `UpdateDelegateUserGovTokenInsuranceStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `spot_market`          | `Pubkey`           |
| 1  | `insurance_fund_stake` | `Pubkey`           |
| 2  | `user_stats`           | `Pubkey`           |
| 3  | `admin`                | `Pubkey`           |
| 4  | `insurance_fund_vault` | `Pubkey`           |
| 5  | `state`                | `Pubkey`           |
| 6… | `remaining`            | `Vec<AccountMeta>` |

### `UpdateDiscountMint`

Discriminator `20fc7ad3421f2ff1` · data `UpdateDiscountMint` · accounts `UpdateDiscountMintInstructionAccounts`.

| Field           | Type     |
| --------------- | -------- |
| `discount_mint` | `Pubkey` |

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

Fields of `UpdateDiscountMintInstructionAccounts`, in account order:

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

### `UpdateExchangeStatus`

Discriminator `53a0fcfa817431df` · data `UpdateExchangeStatus` · accounts `UpdateExchangeStatusInstructionAccounts`.

| Field             | Type |
| ----------------- | ---- |
| `exchange_status` | `u8` |

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

Fields of `UpdateExchangeStatusInstructionAccounts`, in account order:

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

### `UpdateFeatureBitFlagsBuilderCodes`

Discriminator `0180b133ad2d0b66` · data `UpdateFeatureBitFlagsBuilderCodes` · accounts `UpdateFeatureBitFlagsBuilderCodesInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `enable` | `bool` |

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

Fields of `UpdateFeatureBitFlagsBuilderCodesInstructionAccounts`, in account order:

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

### `UpdateFeatureBitFlagsMedianTriggerPrice`

Discriminator `40b9dd2d57930c13` · data `UpdateFeatureBitFlagsMedianTriggerPrice` · accounts `UpdateFeatureBitFlagsMedianTriggerPriceInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `enable` | `bool` |

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

Fields of `UpdateFeatureBitFlagsMedianTriggerPriceInstructionAccounts`, in account order:

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

### `UpdateFeatureBitFlagsMintRedeemLpPool`

Discriminator `1a0b8e7ace9f092d` · data `UpdateFeatureBitFlagsMintRedeemLpPool` · accounts `UpdateFeatureBitFlagsMintRedeemLpPoolInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `enable` | `bool` |

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

Fields of `UpdateFeatureBitFlagsMintRedeemLpPoolInstructionAccounts`, in account order:

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

### `UpdateFeatureBitFlagsMmOracle`

Discriminator `da8621bae73b8295` · data `UpdateFeatureBitFlagsMmOracle` · accounts `UpdateFeatureBitFlagsMmOracleInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `enable` | `bool` |

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

Fields of `UpdateFeatureBitFlagsMmOracleInstructionAccounts`, in account order:

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

### `UpdateFeatureBitFlagsSettleLpPool`

Discriminator `ba1c4ee69b53f21a` · data `UpdateFeatureBitFlagsSettleLpPool` · accounts `UpdateFeatureBitFlagsSettleLpPoolInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `enable` | `bool` |

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

Fields of `UpdateFeatureBitFlagsSettleLpPoolInstructionAccounts`, in account order:

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

### `UpdateFeatureBitFlagsSwapLpPool`

Discriminator `5310960c6603163a` · data `UpdateFeatureBitFlagsSwapLpPool` · accounts `UpdateFeatureBitFlagsSwapLpPoolInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `enable` | `bool` |

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

Fields of `UpdateFeatureBitFlagsSwapLpPoolInstructionAccounts`, in account order:

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

### `UpdateFundingRate`

Discriminator `c9b274d4a69048ee` · data `UpdateFundingRate` · accounts `UpdateFundingRateInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `market_index` | `u16` |

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

Fields of `UpdateFundingRateInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `perp_market` | `Pubkey`           |
| 2  | `oracle`      | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateHighLeverageModeConfig`

Discriminator `407ad45d8dd9ca37` · data `UpdateHighLeverageModeConfig` · accounts `UpdateHighLeverageModeConfigInstructionAccounts`.

| Field           | Type          |
| --------------- | ------------- |
| `max_users`     | `u32`         |
| `reduce_only`   | `bool`        |
| `current_users` | `Option<u32>` |

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

Fields of `UpdateHighLeverageModeConfigInstructionAccounts`, in account order:

| #  | Field                       | Type               |
| -- | --------------------------- | ------------------ |
| 0  | `admin`                     | `Pubkey`           |
| 1  | `high_leverage_mode_config` | `Pubkey`           |
| 2  | `state`                     | `Pubkey`           |
| 3… | `remaining`                 | `Vec<AccountMeta>` |

### `UpdateIfRebalanceConfig`

Discriminator `8ef5f942f9b51653` · data `UpdateIfRebalanceConfig` · accounts `UpdateIfRebalanceConfigInstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`IfRebalanceConfigParams`](#ifrebalanceconfigparams) |

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

Fields of `UpdateIfRebalanceConfigInstructionAccounts`, in account order:

| #  | Field                 | Type               |
| -- | --------------------- | ------------------ |
| 0  | `admin`               | `Pubkey`           |
| 1  | `if_rebalance_config` | `Pubkey`           |
| 2  | `state`               | `Pubkey`           |
| 3… | `remaining`           | `Vec<AccountMeta>` |

### `UpdateInitialAmmCacheInfo`

Discriminator `9dd26d43d4aa0c6b` · data `UpdateInitialAmmCacheInfo` · accounts `UpdateInitialAmmCacheInfoInstructionAccounts`.

No data fields.

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

Fields of `UpdateInitialAmmCacheInfoInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `state`     | `Pubkey`           |
| 1  | `admin`     | `Pubkey`           |
| 2  | `amm_cache` | `Pubkey`           |
| 3… | `remaining` | `Vec<AccountMeta>` |

### `UpdateInitialPctToLiquidate`

Discriminator `d285e180c2320d6d` · data `UpdateInitialPctToLiquidate` · accounts `UpdateInitialPctToLiquidateInstructionAccounts`.

| Field                      | Type  |
| -------------------------- | ----- |
| `initial_pct_to_liquidate` | `u16` |

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

Fields of `UpdateInitialPctToLiquidateInstructionAccounts`, in account order:

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

### `UpdateInsuranceFundUnstakingPeriod`

Discriminator `2c452be2ccdfca34` · data `UpdateInsuranceFundUnstakingPeriod` · accounts `UpdateInsuranceFundUnstakingPeriodInstructionAccounts`.

| Field                             | Type  |
| --------------------------------- | ----- |
| `insurance_fund_unstaking_period` | `i64` |

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

Fields of `UpdateInsuranceFundUnstakingPeriodInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateK`

Discriminator `4862098b81e5ac38` · data `UpdateK` · accounts `UpdateKInstructionAccounts`.

| Field    | Type   |
| -------- | ------ |
| `sqrt_k` | `u128` |

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

Fields of `UpdateKInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3  | `oracle`      | `Pubkey`           |
| 4… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateLiquidationDuration`

Discriminator `1c9a14f966c04947` · data `UpdateLiquidationDuration` · accounts `UpdateLiquidationDurationInstructionAccounts`.

| Field                  | Type |
| ---------------------- | ---- |
| `liquidation_duration` | `u8` |

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

Fields of `UpdateLiquidationDurationInstructionAccounts`, in account order:

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

### `UpdateLiquidationMarginBufferRatio`

Discriminator `84e0f3a09a5261d7` · data `UpdateLiquidationMarginBufferRatio` · accounts `UpdateLiquidationMarginBufferRatioInstructionAccounts`.

| Field                             | Type  |
| --------------------------------- | ----- |
| `liquidation_margin_buffer_ratio` | `u32` |

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

Fields of `UpdateLiquidationMarginBufferRatioInstructionAccounts`, in account order:

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

### `UpdateLpConstituentTargetBase`

Discriminator `9d4132cf3beca16e` · data `UpdateLpConstituentTargetBase` · accounts `UpdateLpConstituentTargetBaseInstructionAccounts`.

No data fields.

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

Fields of `UpdateLpConstituentTargetBaseInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `state`                   | `Pubkey`           |
| 1  | `keeper`                  | `Pubkey`           |
| 2  | `amm_constituent_mapping` | `Pubkey`           |
| 3  | `constituent_target_base` | `Pubkey`           |
| 4  | `amm_cache`               | `Pubkey`           |
| 5  | `lp_pool`                 | `Pubkey`           |
| 6… | `remaining`               | `Vec<AccountMeta>` |

### `UpdateLpPoolAum`

Discriminator `587189cef6f7ab8e` · data `UpdateLpPoolAum` · accounts `UpdateLpPoolAumInstructionAccounts`.

No data fields.

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

Fields of `UpdateLpPoolAumInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `state`                   | `Pubkey`           |
| 1  | `keeper`                  | `Pubkey`           |
| 2  | `lp_pool`                 | `Pubkey`           |
| 3  | `constituent_target_base` | `Pubkey`           |
| 4  | `amm_cache`               | `Pubkey`           |
| 5… | `remaining`               | `Vec<AccountMeta>` |

### `UpdateLpPoolParams`

Discriminator `d95c02ff1ba7b251` · data `UpdateLpPoolParams` · accounts `UpdateLpPoolParamsInstructionAccounts`.

| Field            | Type                            |
| ---------------- | ------------------------------- |
| `lp_pool_params` | [`LpPoolParams`](#lppoolparams) |

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

Fields of `UpdateLpPoolParamsInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `lp_pool`   | `Pubkey`           |
| 1  | `admin`     | `Pubkey`           |
| 2  | `state`     | `Pubkey`           |
| 3… | `remaining` | `Vec<AccountMeta>` |

### `UpdateOracleGuardRails`

Discriminator `83700a3b203628a4` · data `UpdateOracleGuardRails` · accounts `UpdateOracleGuardRailsInstructionAccounts`.

| Field                | Type                                    |
| -------------------- | --------------------------------------- |
| `oracle_guard_rails` | [`OracleGuardRails`](#oracleguardrails) |

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

Fields of `UpdateOracleGuardRailsInstructionAccounts`, in account order:

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

### `UpdatePerpAuctionDuration`

Discriminator `7e6e34ae1eced75a` · data `UpdatePerpAuctionDuration` · accounts `UpdatePerpAuctionDurationInstructionAccounts`.

| Field                       | Type |
| --------------------------- | ---- |
| `min_perp_auction_duration` | `u8` |

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

Fields of `UpdatePerpAuctionDurationInstructionAccounts`, in account order:

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

### `UpdatePerpBidAskTwap`

Discriminator `f717ff41d45addc2` · data `UpdatePerpBidAskTwap` · accounts `UpdatePerpBidAskTwapInstructionAccounts`.

No data fields.

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

Fields of `UpdatePerpBidAskTwapInstructionAccounts`, in account order:

| #  | Field          | Type               |
| -- | -------------- | ------------------ |
| 0  | `state`        | `Pubkey`           |
| 1  | `perp_market`  | `Pubkey`           |
| 2  | `oracle`       | `Pubkey`           |
| 3  | `keeper_stats` | `Pubkey`           |
| 4  | `authority`    | `Pubkey`           |
| 5… | `remaining`    | `Vec<AccountMeta>` |

### `UpdatePerpFeeStructure`

Discriminator `17b26fcb49168c4b` · data `UpdatePerpFeeStructure` · accounts `UpdatePerpFeeStructureInstructionAccounts`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `fee_structure` | [`FeeStructure`](#feestructure) |

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

Fields of `UpdatePerpFeeStructureInstructionAccounts`, in account order:

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

### `UpdatePerpMarketAmmOracleTwap`

Discriminator `f14a727bce9918ca` · data `UpdatePerpMarketAmmOracleTwap` · accounts `UpdatePerpMarketAmmOracleTwapInstructionAccounts`.

No data fields.

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

Fields of `UpdatePerpMarketAmmOracleTwapInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `perp_market` | `Pubkey`           |
| 2  | `oracle`      | `Pubkey`           |
| 3  | `admin`       | `Pubkey`           |
| 4… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketAmmSpreadAdjustment`

Discriminator `9bc3952bdc52adcd` · data `UpdatePerpMarketAmmSpreadAdjustment` · accounts `UpdatePerpMarketAmmSpreadAdjustmentInstructionAccounts`.

| Field                             | Type  |
| --------------------------------- | ----- |
| `amm_spread_adjustment`           | `i8`  |
| `amm_inventory_spread_adjustment` | `i8`  |
| `reference_price_offset`          | `i32` |

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

Fields of `UpdatePerpMarketAmmSpreadAdjustmentInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketAmmSummaryStats`

Discriminator `7a65f9eed109f1f5` · data `UpdatePerpMarketAmmSummaryStats` · accounts `UpdatePerpMarketAmmSummaryStatsInstructionAccounts`.

| Field    | Type                                                                        |
| -------- | --------------------------------------------------------------------------- |
| `params` | [`UpdatePerpMarketSummaryStatsParams`](#updateperpmarketsummarystatsparams) |

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

Fields of `UpdatePerpMarketAmmSummaryStatsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3  | `spot_market` | `Pubkey`           |
| 4  | `oracle`      | `Pubkey`           |
| 5… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketBaseSpread`

Discriminator `475f54a8099dc641` · data `UpdatePerpMarketBaseSpread` · accounts `UpdatePerpMarketBaseSpreadInstructionAccounts`.

| Field         | Type  |
| ------------- | ----- |
| `base_spread` | `u32` |

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

Fields of `UpdatePerpMarketBaseSpreadInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketConcentrationCoef`

Discriminator `184ee87ea9b0e610` · data `UpdatePerpMarketConcentrationCoef` · accounts `UpdatePerpMarketConcentrationCoefInstructionAccounts`.

| Field                 | Type   |
| --------------------- | ------ |
| `concentration_scale` | `u128` |

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

Fields of `UpdatePerpMarketConcentrationCoefInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketConfig`

Discriminator `865a062250a05ef5` · data `UpdatePerpMarketConfig` · accounts `UpdatePerpMarketConfigInstructionAccounts`.

| Field           | Type |
| --------------- | ---- |
| `market_config` | `u8` |

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

Fields of `UpdatePerpMarketConfigInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketContractTier`

Discriminator `ec800f5fcbd64475` · data `UpdatePerpMarketContractTier` · accounts `UpdatePerpMarketContractTierInstructionAccounts`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `contract_tier` | [`ContractTier`](#contracttier) |

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

Fields of `UpdatePerpMarketContractTierInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketCurveUpdateIntensity`

Discriminator `3283069ce2e7bd48` · data `UpdatePerpMarketCurveUpdateIntensity` · accounts `UpdatePerpMarketCurveUpdateIntensityInstructionAccounts`.

| Field                    | Type |
| ------------------------ | ---- |
| `curve_update_intensity` | `u8` |

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

Fields of `UpdatePerpMarketCurveUpdateIntensityInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketExpiry`

Discriminator `2cdde397838c166e` · data `UpdatePerpMarketExpiry` · accounts `UpdatePerpMarketExpiryInstructionAccounts`.

| Field       | Type  |
| ----------- | ----- |
| `expiry_ts` | `i64` |

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

Fields of `UpdatePerpMarketExpiryInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketFeeAdjustment`

Discriminator `c2ae57662b942070` · data `UpdatePerpMarketFeeAdjustment` · accounts `UpdatePerpMarketFeeAdjustmentInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `fee_adjustment` | `i16` |

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

Fields of `UpdatePerpMarketFeeAdjustmentInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketFundingPeriod`

Discriminator `aba1455b818ba11c` · data `UpdatePerpMarketFundingPeriod` · accounts `UpdatePerpMarketFundingPeriodInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `funding_period` | `i64` |

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

Fields of `UpdatePerpMarketFundingPeriodInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketHighLeverageMarginRatio`

Discriminator `5870563118744a9d` · data `UpdatePerpMarketHighLeverageMarginRatio` · accounts `UpdatePerpMarketHighLeverageMarginRatioInstructionAccounts`.

| Field                      | Type  |
| -------------------------- | ----- |
| `margin_ratio_initial`     | `u16` |
| `margin_ratio_maintenance` | `u16` |

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

Fields of `UpdatePerpMarketHighLeverageMarginRatioInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketImfFactor`

Discriminator `cfc23884234347f4` · data `UpdatePerpMarketImfFactor` · accounts `UpdatePerpMarketImfFactorInstructionAccounts`.

| Field                       | Type  |
| --------------------------- | ----- |
| `imf_factor`                | `u32` |
| `unrealized_pnl_imf_factor` | `u32` |

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

Fields of `UpdatePerpMarketImfFactorInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketLiquidationFee`

Discriminator `5a89099129089475` · data `UpdatePerpMarketLiquidationFee` · accounts `UpdatePerpMarketLiquidationFeeInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `liquidator_fee`     | `u32` |
| `if_liquidation_fee` | `u32` |

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

Fields of `UpdatePerpMarketLiquidationFeeInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketLpPoolFeeTransferScalar`

Discriminator `5ee4ed6d64b90451` · data `UpdatePerpMarketLpPoolFeeTransferScalar` · accounts `UpdatePerpMarketLpPoolFeeTransferScalarInstructionAccounts`.

| Field                                 | Type         |
| ------------------------------------- | ------------ |
| `optional_lp_fee_transfer_scalar`     | `Option<u8>` |
| `optional_lp_net_pnl_transfer_scalar` | `Option<u8>` |

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

Fields of `UpdatePerpMarketLpPoolFeeTransferScalarInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketLpPoolId`

Discriminator `77d09a58a55c15bc` · data `UpdatePerpMarketLpPoolId` · accounts `UpdatePerpMarketLpPoolIdInstructionAccounts`.

| Field        | Type |
| ------------ | ---- |
| `lp_pool_id` | `u8` |

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

Fields of `UpdatePerpMarketLpPoolIdInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketLpPoolPausedOperations`

Discriminator `b55e5d9233592087` · data `UpdatePerpMarketLpPoolPausedOperations` · accounts `UpdatePerpMarketLpPoolPausedOperationsInstructionAccounts`.

| Field                  | Type |
| ---------------------- | ---- |
| `lp_paused_operations` | `u8` |

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

Fields of `UpdatePerpMarketLpPoolPausedOperationsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketLpPoolStatus`

Discriminator `4306fc3d365859e9` · data `UpdatePerpMarketLpPoolStatus` · accounts `UpdatePerpMarketLpPoolStatusInstructionAccounts`.

| Field       | Type |
| ----------- | ---- |
| `lp_status` | `u8` |

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

Fields of `UpdatePerpMarketLpPoolStatusInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3  | `amm_cache`   | `Pubkey`           |
| 4… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMarginRatio`

Discriminator `82ad6b2d77691a71` · data `UpdatePerpMarketMarginRatio` · accounts `UpdatePerpMarketMarginRatioInstructionAccounts`.

| Field                      | Type  |
| -------------------------- | ----- |
| `margin_ratio_initial`     | `u32` |
| `margin_ratio_maintenance` | `u32` |

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

Fields of `UpdatePerpMarketMarginRatioInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMaxFillReserveFraction`

Discriminator `13ac729a2a87a185` · data `UpdatePerpMarketMaxFillReserveFraction` · accounts `UpdatePerpMarketMaxFillReserveFractionInstructionAccounts`.

| Field                       | Type  |
| --------------------------- | ----- |
| `max_fill_reserve_fraction` | `u16` |

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

Fields of `UpdatePerpMarketMaxFillReserveFractionInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMaxImbalances`

Discriminator `0fce49853c085659` · data `UpdatePerpMarketMaxImbalances` · accounts `UpdatePerpMarketMaxImbalancesInstructionAccounts`.

| Field                             | Type  |
| --------------------------------- | ----- |
| `unrealized_max_imbalance`        | `u64` |
| `max_revenue_withdraw_per_period` | `u64` |
| `quote_max_insurance`             | `u64` |

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

Fields of `UpdatePerpMarketMaxImbalancesInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMaxOpenInterest`

Discriminator `c24f95e0f666ba8c` · data `UpdatePerpMarketMaxOpenInterest` · accounts `UpdatePerpMarketMaxOpenInterestInstructionAccounts`.

| Field               | Type   |
| ------------------- | ------ |
| `max_open_interest` | `u128` |

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

Fields of `UpdatePerpMarketMaxOpenInterestInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMaxSlippageRatio`

Discriminator `eb2528c4469236c9` · data `UpdatePerpMarketMaxSlippageRatio` · accounts `UpdatePerpMarketMaxSlippageRatioInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `max_slippage_ratio` | `u16` |

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

Fields of `UpdatePerpMarketMaxSlippageRatioInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMaxSpread`

Discriminator `50fc7a3e28da5b64` · data `UpdatePerpMarketMaxSpread` · accounts `UpdatePerpMarketMaxSpreadInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `max_spread` | `u32` |

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

Fields of `UpdatePerpMarketMaxSpreadInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketMinOrderSize`

Discriminator `e24a05596cdf2e8d` · data `UpdatePerpMarketMinOrderSize` · accounts `UpdatePerpMarketMinOrderSizeInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `order_size` | `u64` |

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

Fields of `UpdatePerpMarketMinOrderSizeInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketName`

Discriminator `d31f15d2406c42c9` · data `UpdatePerpMarketName` · accounts `UpdatePerpMarketNameInstructionAccounts`.

| Field  | Type       |
| ------ | ---------- |
| `name` | `[u8; 32]` |

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

Fields of `UpdatePerpMarketNameInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketNumberOfUsers`

Discriminator `233e90b1b43ed7c4` · data `UpdatePerpMarketNumberOfUsers` · accounts `UpdatePerpMarketNumberOfUsersInstructionAccounts`.

| Field                       | Type          |
| --------------------------- | ------------- |
| `number_of_users`           | `Option<u32>` |
| `number_of_users_with_base` | `Option<u32>` |

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

Fields of `UpdatePerpMarketNumberOfUsersInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketOracle`

Discriminator `b6716fa043ae59bf` · data `UpdatePerpMarketOracle` · accounts `UpdatePerpMarketOracleInstructionAccounts`.

| Field                  | Type                            |
| ---------------------- | ------------------------------- |
| `oracle`               | `Pubkey`                        |
| `oracle_source`        | [`OracleSource`](#oraclesource) |
| `skip_invariant_check` | `bool`                          |

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

Fields of `UpdatePerpMarketOracleInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3  | `oracle`      | `Pubkey`           |
| 4  | `old_oracle`  | `Pubkey`           |
| 5  | `amm_cache`   | `Pubkey`           |
| 6… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketOracleLowRiskSlotDelayOverride`

Discriminator `7c6c93e56d757b03` · data `UpdatePerpMarketOracleLowRiskSlotDelayOverride` · accounts `UpdatePerpMarketOracleLowRiskSlotDelayOverrideInstructionAccounts`.

| Field                                 | Type |
| ------------------------------------- | ---- |
| `oracle_low_risk_slot_delay_override` | `i8` |

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

Fields of `UpdatePerpMarketOracleLowRiskSlotDelayOverrideInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketOracleSlotDelayOverride`

Discriminator `a55befe33face308` · data `UpdatePerpMarketOracleSlotDelayOverride` · accounts `UpdatePerpMarketOracleSlotDelayOverrideInstructionAccounts`.

| Field                        | Type |
| ---------------------------- | ---- |
| `oracle_slot_delay_override` | `i8` |

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

Fields of `UpdatePerpMarketOracleSlotDelayOverrideInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketPausedOperations`

Discriminator `351088841edc7955` · data `UpdatePerpMarketPausedOperations` · accounts `UpdatePerpMarketPausedOperationsInstructionAccounts`.

| Field               | Type |
| ------------------- | ---- |
| `paused_operations` | `u8` |

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

Fields of `UpdatePerpMarketPausedOperationsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketPnlPool`

Discriminator `32caf9e0a6b80d8f` · data `UpdatePerpMarketPnlPool` · accounts `UpdatePerpMarketPnlPoolInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `amount` | `u64` |

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

Fields of `UpdatePerpMarketPnlPoolInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `admin`             | `Pubkey`           |
| 2  | `spot_market`       | `Pubkey`           |
| 3  | `spot_market_vault` | `Pubkey`           |
| 4  | `perp_market`       | `Pubkey`           |
| 5… | `remaining`         | `Vec<AccountMeta>` |

### `UpdatePerpMarketProtectedMakerParams`

Discriminator `f9d57322fdef4bad` · data `UpdatePerpMarketProtectedMakerParams` · accounts `UpdatePerpMarketProtectedMakerParamsInstructionAccounts`.

| Field                                 | Type         |
| ------------------------------------- | ------------ |
| `protected_maker_limit_price_divisor` | `Option<u8>` |
| `protected_maker_dynamic_divisor`     | `Option<u8>` |

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

Fields of `UpdatePerpMarketProtectedMakerParamsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketReferencePriceOffsetDeadbandPct`

Discriminator `d649a60bda4c6ea3` · data `UpdatePerpMarketReferencePriceOffsetDeadbandPct` · accounts `UpdatePerpMarketReferencePriceOffsetDeadbandPctInstructionAccounts`.

| Field                                 | Type |
| ------------------------------------- | ---- |
| `reference_price_offset_deadband_pct` | `u8` |

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

Fields of `UpdatePerpMarketReferencePriceOffsetDeadbandPctInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketStatus`

Discriminator `47c9af7affcfc4cf` · data `UpdatePerpMarketStatus` · accounts `UpdatePerpMarketStatusInstructionAccounts`.

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

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

Fields of `UpdatePerpMarketStatusInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketStepSizeAndTickSize`

Discriminator `e7ff6119928bae04` · data `UpdatePerpMarketStepSizeAndTickSize` · accounts `UpdatePerpMarketStepSizeAndTickSizeInstructionAccounts`.

| Field       | Type  |
| ----------- | ----- |
| `step_size` | `u64` |
| `tick_size` | `u64` |

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

Fields of `UpdatePerpMarketStepSizeAndTickSizeInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePerpMarketUnrealizedAssetWeight`

Discriminator `8784cda56d96a66a` · data `UpdatePerpMarketUnrealizedAssetWeight` · accounts `UpdatePerpMarketUnrealizedAssetWeightInstructionAccounts`.

| Field                                 | Type  |
| ------------------------------------- | ----- |
| `unrealized_initial_asset_weight`     | `u32` |
| `unrealized_maintenance_asset_weight` | `u32` |

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

Fields of `UpdatePerpMarketUnrealizedAssetWeightInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePrelaunchOracle`

Discriminator `dc841b1be9dc3ddb` · data `UpdatePrelaunchOracle` · accounts `UpdatePrelaunchOracleInstructionAccounts`.

No data fields.

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

Fields of `UpdatePrelaunchOracleInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `state`       | `Pubkey`           |
| 1  | `perp_market` | `Pubkey`           |
| 2  | `oracle`      | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdatePrelaunchOracleParams`

Discriminator `62cd93f3124b53cf` · data `UpdatePrelaunchOracleParams` · accounts `UpdatePrelaunchOracleParamsInstructionAccounts`.

| Field    | Type                                              |
| -------- | ------------------------------------------------- |
| `params` | [`PrelaunchOracleParams`](#prelaunchoracleparams) |

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

Fields of `UpdatePrelaunchOracleParamsInstructionAccounts`, in account order:

| #  | Field              | Type               |
| -- | ------------------ | ------------------ |
| 0  | `admin`            | `Pubkey`           |
| 1  | `prelaunch_oracle` | `Pubkey`           |
| 2  | `perp_market`      | `Pubkey`           |
| 3  | `state`            | `Pubkey`           |
| 4… | `remaining`        | `Vec<AccountMeta>` |

### `UpdateProtectedMakerModeConfig`

Discriminator `56a6ebfd43cadf11` · data `UpdateProtectedMakerModeConfig` · accounts `UpdateProtectedMakerModeConfigInstructionAccounts`.

| Field           | Type          |
| --------------- | ------------- |
| `max_users`     | `u32`         |
| `reduce_only`   | `bool`        |
| `current_users` | `Option<u32>` |

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

Fields of `UpdateProtectedMakerModeConfigInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `admin`                       | `Pubkey`           |
| 1  | `protected_maker_mode_config` | `Pubkey`           |
| 2  | `state`                       | `Pubkey`           |
| 3… | `remaining`                   | `Vec<AccountMeta>` |

### `UpdatePythPullOracle`

Discriminator `e6bfbd5e6c3b4ac5` · data `UpdatePythPullOracle` · accounts `UpdatePythPullOracleInstructionAccounts`.

| Field     | Type       |
| --------- | ---------- |
| `feed_id` | `[u8; 32]` |
| `params`  | `Vec<u8>`  |

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

Fields of `UpdatePythPullOracleInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `keeper`               | `Pubkey`           |
| 1  | `pyth_solana_receiver` | `Pubkey`           |
| 2  | `encoded_vaa`          | `Pubkey`           |
| 3  | `price_feed`           | `Pubkey`           |
| 4… | `remaining`            | `Vec<AccountMeta>` |

### `UpdateSerumFulfillmentConfigStatus`

Discriminator `ab6df0fb5f019559` · data `UpdateSerumFulfillmentConfigStatus` · accounts `UpdateSerumFulfillmentConfigStatusInstructionAccounts`.

| Field    | Type                                                          |
| -------- | ------------------------------------------------------------- |
| `status` | [`SpotFulfillmentConfigStatus`](#spotfulfillmentconfigstatus) |

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

Fields of `UpdateSerumFulfillmentConfigStatusInstructionAccounts`, in account order:

| #  | Field                      | Type               |
| -- | -------------------------- | ------------------ |
| 0  | `state`                    | `Pubkey`           |
| 1  | `serum_fulfillment_config` | `Pubkey`           |
| 2  | `admin`                    | `Pubkey`           |
| 3… | `remaining`                | `Vec<AccountMeta>` |

### `UpdateSpotAuctionDuration`

Discriminator `b6b2cb48bb8f9d6b` · data `UpdateSpotAuctionDuration` · accounts `UpdateSpotAuctionDurationInstructionAccounts`.

| Field                           | Type |
| ------------------------------- | ---- |
| `default_spot_auction_duration` | `u8` |

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

Fields of `UpdateSpotAuctionDurationInstructionAccounts`, in account order:

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

### `UpdateSpotFeeStructure`

Discriminator `61d8698371f68e8d` · data `UpdateSpotFeeStructure` · accounts `UpdateSpotFeeStructureInstructionAccounts`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `fee_structure` | [`FeeStructure`](#feestructure) |

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

Fields of `UpdateSpotFeeStructureInstructionAccounts`, in account order:

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

### `UpdateSpotMarketAssetTier`

Discriminator `fdd1e70ef2d0f382` · data `UpdateSpotMarketAssetTier` · accounts `UpdateSpotMarketAssetTierInstructionAccounts`.

| Field        | Type                      |
| ------------ | ------------------------- |
| `asset_tier` | [`AssetTier`](#assettier) |

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

Fields of `UpdateSpotMarketAssetTierInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketBorrowRate`

Discriminator `47efec99d23efe4c` · data `UpdateSpotMarketBorrowRate` · accounts `UpdateSpotMarketBorrowRateInstructionAccounts`.

| Field                 | Type         |
| --------------------- | ------------ |
| `optimal_utilization` | `u32`        |
| `optimal_borrow_rate` | `u32`        |
| `max_borrow_rate`     | `u32`        |
| `min_borrow_rate`     | `Option<u8>` |

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

Fields of `UpdateSpotMarketBorrowRateInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketCumulativeInterest`

Discriminator `27a68bf39ea59be1` · data `UpdateSpotMarketCumulativeInterest` · accounts `UpdateSpotMarketCumulativeInterestInstructionAccounts`.

No data fields.

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

Fields of `UpdateSpotMarketCumulativeInterestInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `spot_market`       | `Pubkey`           |
| 2  | `oracle`            | `Pubkey`           |
| 3  | `spot_market_vault` | `Pubkey`           |
| 4… | `remaining`         | `Vec<AccountMeta>` |

### `UpdateSpotMarketExpiry`

Discriminator `d00bd39fe2180bf7` · data `UpdateSpotMarketExpiry` · accounts `UpdateSpotMarketExpiryInstructionAccounts`.

| Field       | Type  |
| ----------- | ----- |
| `expiry_ts` | `i64` |

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

Fields of `UpdateSpotMarketExpiryInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketFeeAdjustment`

Discriminator `94b6037e9d72dc63` · data `UpdateSpotMarketFeeAdjustment` · accounts `UpdateSpotMarketFeeAdjustmentInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `fee_adjustment` | `i16` |

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

Fields of `UpdateSpotMarketFeeAdjustmentInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketIfFactor`

Discriminator `931ee02212e66904` · data `UpdateSpotMarketIfFactor` · accounts `UpdateSpotMarketIfFactorInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `spot_market_index` | `u16` |
| `user_if_factor`    | `u32` |
| `total_if_factor`   | `u32` |

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

Fields of `UpdateSpotMarketIfFactorInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketIfPausedOperations`

Discriminator `65d74f4a3b294f0c` · data `UpdateSpotMarketIfPausedOperations` · accounts `UpdateSpotMarketIfPausedOperationsInstructionAccounts`.

| Field               | Type |
| ------------------- | ---- |
| `paused_operations` | `u8` |

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

Fields of `UpdateSpotMarketIfPausedOperationsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketLiquidationFee`

Discriminator `0b0dff35388868b1` · data `UpdateSpotMarketLiquidationFee` · accounts `UpdateSpotMarketLiquidationFeeInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `liquidator_fee`     | `u32` |
| `if_liquidation_fee` | `u32` |

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

Fields of `UpdateSpotMarketLiquidationFeeInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketMarginWeights`

Discriminator `6d2157c3ff240651` · data `UpdateSpotMarketMarginWeights` · accounts `UpdateSpotMarketMarginWeightsInstructionAccounts`.

| Field                          | Type  |
| ------------------------------ | ----- |
| `initial_asset_weight`         | `u32` |
| `maintenance_asset_weight`     | `u32` |
| `initial_liability_weight`     | `u32` |
| `maintenance_liability_weight` | `u32` |
| `imf_factor`                   | `u32` |

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

Fields of `UpdateSpotMarketMarginWeightsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketMaxTokenBorrows`

Discriminator `3966ccd4fd5f0dc7` · data `UpdateSpotMarketMaxTokenBorrows` · accounts `UpdateSpotMarketMaxTokenBorrowsInstructionAccounts`.

| Field                        | Type  |
| ---------------------------- | ----- |
| `max_token_borrows_fraction` | `u16` |

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

Fields of `UpdateSpotMarketMaxTokenBorrowsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketMaxTokenDeposits`

Discriminator `38bf4f121a7950d0` · data `UpdateSpotMarketMaxTokenDeposits` · accounts `UpdateSpotMarketMaxTokenDepositsInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `max_token_deposits` | `u64` |

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

Fields of `UpdateSpotMarketMaxTokenDepositsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketMinOrderSize`

Discriminator `5d800b771a14b532` · data `UpdateSpotMarketMinOrderSize` · accounts `UpdateSpotMarketMinOrderSizeInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `order_size` | `u64` |

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

Fields of `UpdateSpotMarketMinOrderSizeInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketName`

Discriminator `11d00101a2d3bce0` · data `UpdateSpotMarketName` · accounts `UpdateSpotMarketNameInstructionAccounts`.

| Field  | Type       |
| ------ | ---------- |
| `name` | `[u8; 32]` |

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

Fields of `UpdateSpotMarketNameInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketOracle`

Discriminator `72b86625f6bab463` · data `UpdateSpotMarketOracle` · accounts `UpdateSpotMarketOracleInstructionAccounts`.

| Field                  | Type                            |
| ---------------------- | ------------------------------- |
| `oracle`               | `Pubkey`                        |
| `oracle_source`        | [`OracleSource`](#oraclesource) |
| `skip_invariant_check` | `bool`                          |

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

Fields of `UpdateSpotMarketOracleInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3  | `oracle`      | `Pubkey`           |
| 4  | `old_oracle`  | `Pubkey`           |
| 5… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketOrdersEnabled`

Discriminator `be4fce0f1ae5e52b` · data `UpdateSpotMarketOrdersEnabled` · accounts `UpdateSpotMarketOrdersEnabledInstructionAccounts`.

| Field            | Type   |
| ---------------- | ------ |
| `orders_enabled` | `bool` |

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

Fields of `UpdateSpotMarketOrdersEnabledInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketPausedOperations`

Discriminator `643d9951b40c06f8` · data `UpdateSpotMarketPausedOperations` · accounts `UpdateSpotMarketPausedOperationsInstructionAccounts`.

| Field               | Type |
| ------------------- | ---- |
| `paused_operations` | `u8` |

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

Fields of `UpdateSpotMarketPausedOperationsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketPoolId`

Discriminator `16d5c5a08bc15195` · data `UpdateSpotMarketPoolId` · accounts `UpdateSpotMarketPoolIdInstructionAccounts`.

| Field     | Type |
| --------- | ---- |
| `pool_id` | `u8` |

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

Fields of `UpdateSpotMarketPoolIdInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketRevenueSettlePeriod`

Discriminator `515c7e29fae19cdb` · data `UpdateSpotMarketRevenueSettlePeriod` · accounts `UpdateSpotMarketRevenueSettlePeriodInstructionAccounts`.

| Field                   | Type  |
| ----------------------- | ----- |
| `revenue_settle_period` | `i64` |

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

Fields of `UpdateSpotMarketRevenueSettlePeriodInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketScaleInitialAssetWeightStart`

Discriminator `d9cccc76cc82e193` · data `UpdateSpotMarketScaleInitialAssetWeightStart` · accounts `UpdateSpotMarketScaleInitialAssetWeightStartInstructionAccounts`.

| Field                              | Type  |
| ---------------------------------- | ----- |
| `scale_initial_asset_weight_start` | `u64` |

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

Fields of `UpdateSpotMarketScaleInitialAssetWeightStartInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketStatus`

Discriminator `4e5e10bcc16ee71f` · data `UpdateSpotMarketStatus` · accounts `UpdateSpotMarketStatusInstructionAccounts`.

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

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

Fields of `UpdateSpotMarketStatusInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateSpotMarketStepSizeAndTickSize`

Discriminator `ee998950ce3bfa3d` · data `UpdateSpotMarketStepSizeAndTickSize` · accounts `UpdateSpotMarketStepSizeAndTickSizeInstructionAccounts`.

| Field       | Type  |
| ----------- | ----- |
| `step_size` | `u64` |
| `tick_size` | `u64` |

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

Fields of `UpdateSpotMarketStepSizeAndTickSizeInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `UpdateStateMaxInitializeUserFee`

Discriminator `ede119edc12d4d61` · data `UpdateStateMaxInitializeUserFee` · accounts `UpdateStateMaxInitializeUserFeeInstructionAccounts`.

| Field                     | Type  |
| ------------------------- | ----- |
| `max_initialize_user_fee` | `u16` |

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

Fields of `UpdateStateMaxInitializeUserFeeInstructionAccounts`, in account order:

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

### `UpdateStateMaxNumberOfSubAccounts`

Discriminator `9b7bd602dda6cc55` · data `UpdateStateMaxNumberOfSubAccounts` · accounts `UpdateStateMaxNumberOfSubAccountsInstructionAccounts`.

| Field                        | Type  |
| ---------------------------- | ----- |
| `max_number_of_sub_accounts` | `u16` |

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

Fields of `UpdateStateMaxNumberOfSubAccountsInstructionAccounts`, in account order:

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

### `UpdateStateSettlementDuration`

Discriminator `6144c7eb83503dad` · data `UpdateStateSettlementDuration` · accounts `UpdateStateSettlementDurationInstructionAccounts`.

| Field                 | Type  |
| --------------------- | ----- |
| `settlement_duration` | `u16` |

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

Fields of `UpdateStateSettlementDurationInstructionAccounts`, in account order:

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

### `UpdateUserCustomMarginRatio`

Discriminator `15dd8cbb20810b7b` · data `UpdateUserCustomMarginRatio` · accounts `UpdateUserCustomMarginRatioInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `sub_account_id` | `u16` |
| `margin_ratio`   | `u32` |

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

Fields of `UpdateUserCustomMarginRatioInstructionAccounts`, in account order:

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

### `UpdateUserDelegate`

Discriminator `8bcd8d8d71245ebb` · data `UpdateUserDelegate` · accounts `UpdateUserDelegateInstructionAccounts`.

| Field            | Type     |
| ---------------- | -------- |
| `sub_account_id` | `u16`    |
| `delegate`       | `Pubkey` |

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

Fields of `UpdateUserDelegateInstructionAccounts`, in account order:

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

### `UpdateUserGovTokenInsuranceStake`

Discriminator `8f63ebbb149fb854` · data `UpdateUserGovTokenInsuranceStake` · accounts `UpdateUserGovTokenInsuranceStakeInstructionAccounts`.

No data fields.

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

Fields of `UpdateUserGovTokenInsuranceStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `spot_market`          | `Pubkey`           |
| 2  | `insurance_fund_stake` | `Pubkey`           |
| 3  | `user_stats`           | `Pubkey`           |
| 4  | `signer`               | `Pubkey`           |
| 5  | `insurance_fund_vault` | `Pubkey`           |
| 6… | `remaining`            | `Vec<AccountMeta>` |

### `UpdateUserIdle`

Discriminator `fd85431667a11464` · data `UpdateUserIdle` · accounts `UpdateUserIdleInstructionAccounts`.

No data fields.

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

Fields of `UpdateUserIdleInstructionAccounts`, in account order:

| #  | Field       | Type               |
| -- | ----------- | ------------------ |
| 0  | `state`     | `Pubkey`           |
| 1  | `authority` | `Pubkey`           |
| 2  | `filler`    | `Pubkey`           |
| 3  | `user`      | `Pubkey`           |
| 4… | `remaining` | `Vec<AccountMeta>` |

### `UpdateUserMarginTradingEnabled`

Discriminator `c25cccdff6bc1fcb` · data `UpdateUserMarginTradingEnabled` · accounts `UpdateUserMarginTradingEnabledInstructionAccounts`.

| Field                    | Type   |
| ------------------------ | ------ |
| `sub_account_id`         | `u16`  |
| `margin_trading_enabled` | `bool` |

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

Fields of `UpdateUserMarginTradingEnabledInstructionAccounts`, in account order:

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

### `UpdateUserName`

Discriminator `8719b938a5352288` · data `UpdateUserName` · accounts `UpdateUserNameInstructionAccounts`.

| Field            | Type       |
| ---------------- | ---------- |
| `sub_account_id` | `u16`      |
| `name`           | `[u8; 32]` |

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

Fields of `UpdateUserNameInstructionAccounts`, in account order:

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

### `UpdateUserPerpPositionCustomMarginRatio`

Discriminator `79899d9b59ba9171` · data `UpdateUserPerpPositionCustomMarginRatio` · accounts `UpdateUserPerpPositionCustomMarginRatioInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `sub_account_id`    | `u16` |
| `perp_market_index` | `u16` |
| `margin_ratio`      | `u16` |

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

Fields of `UpdateUserPerpPositionCustomMarginRatioInstructionAccounts`, in account order:

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

### `UpdateUserPoolId`

Discriminator `db56496a38da806d` · data `UpdateUserPoolId` · accounts `UpdateUserPoolIdInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `sub_account_id` | `u16` |
| `pool_id`        | `u8`  |

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

Fields of `UpdateUserPoolIdInstructionAccounts`, in account order:

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

### `UpdateUserProtectedMakerOrders`

Discriminator `72277bc6bb195adb` · data `UpdateUserProtectedMakerOrders` · accounts `UpdateUserProtectedMakerOrdersInstructionAccounts`.

| Field                    | Type   |
| ------------------------ | ------ |
| `sub_account_id`         | `u16`  |
| `protected_maker_orders` | `bool` |

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

Fields of `UpdateUserProtectedMakerOrdersInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `state`                       | `Pubkey`           |
| 1  | `user`                        | `Pubkey`           |
| 2  | `authority`                   | `Pubkey`           |
| 3  | `protected_maker_mode_config` | `Pubkey`           |
| 4… | `remaining`                   | `Vec<AccountMeta>` |

### `UpdateUserQuoteAssetInsuranceStake`

Discriminator `fb659c07023f1e17` · data `UpdateUserQuoteAssetInsuranceStake` · accounts `UpdateUserQuoteAssetInsuranceStakeInstructionAccounts`.

No data fields.

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

Fields of `UpdateUserQuoteAssetInsuranceStakeInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `spot_market`          | `Pubkey`           |
| 2  | `insurance_fund_stake` | `Pubkey`           |
| 3  | `user_stats`           | `Pubkey`           |
| 4  | `signer`               | `Pubkey`           |
| 5  | `insurance_fund_vault` | `Pubkey`           |
| 6… | `remaining`            | `Vec<AccountMeta>` |

### `UpdateUserReduceOnly`

Discriminator `c7472a439013566d` · data `UpdateUserReduceOnly` · accounts `UpdateUserReduceOnlyInstructionAccounts`.

| Field            | Type   |
| ---------------- | ------ |
| `sub_account_id` | `u16`  |
| `reduce_only`    | `bool` |

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

Fields of `UpdateUserReduceOnlyInstructionAccounts`, in account order:

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

### `UpdateUserStatsReferrerStatus`

Discriminator `ae9a482abf9491cd` · data `UpdateUserStatsReferrerStatus` · accounts `UpdateUserStatsReferrerStatusInstructionAccounts`.

No data fields.

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

Fields of `UpdateUserStatsReferrerStatusInstructionAccounts`, in account order:

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

### `UpdateWithdrawGuardThreshold`

Discriminator `3812273d9bd32c85` · data `UpdateWithdrawGuardThreshold` · accounts `UpdateWithdrawGuardThresholdInstructionAccounts`.

| Field                      | Type  |
| -------------------------- | ----- |
| `withdraw_guard_threshold` | `u64` |

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

Fields of `UpdateWithdrawGuardThresholdInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `spot_market` | `Pubkey`           |
| 3… | `remaining`   | `Vec<AccountMeta>` |

### `ViewLpPoolAddLiquidityFees`

Discriminator `5042e2a1468e7754` · data `ViewLpPoolAddLiquidityFees` · accounts `ViewLpPoolAddLiquidityFeesInstructionAccounts`.

| Field             | Type   |
| ----------------- | ------ |
| `in_market_index` | `u16`  |
| `in_amount`       | `u128` |

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

Fields of `ViewLpPoolAddLiquidityFeesInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `state`                   | `Pubkey`           |
| 1  | `lp_pool`                 | `Pubkey`           |
| 2  | `authority`               | `Pubkey`           |
| 3  | `in_market_mint`          | `Pubkey`           |
| 4  | `in_constituent`          | `Pubkey`           |
| 5  | `lp_mint`                 | `Pubkey`           |
| 6  | `constituent_target_base` | `Pubkey`           |
| 7… | `remaining`               | `Vec<AccountMeta>` |

### `ViewLpPoolRemoveLiquidityFees`

Discriminator `2f0c09660ce2c559` · data `ViewLpPoolRemoveLiquidityFees` · accounts `ViewLpPoolRemoveLiquidityFeesInstructionAccounts`.

| Field             | Type  |
| ----------------- | ----- |
| `in_market_index` | `u16` |
| `in_amount`       | `u64` |

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

Fields of `ViewLpPoolRemoveLiquidityFeesInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `state`                   | `Pubkey`           |
| 1  | `lp_pool`                 | `Pubkey`           |
| 2  | `authority`               | `Pubkey`           |
| 3  | `out_market_mint`         | `Pubkey`           |
| 4  | `out_constituent`         | `Pubkey`           |
| 5  | `lp_mint`                 | `Pubkey`           |
| 6  | `constituent_target_base` | `Pubkey`           |
| 7… | `remaining`               | `Vec<AccountMeta>` |

### `ViewLpPoolSwapFees`

Discriminator `7ebd6dbdaa9c032e` · data `ViewLpPoolSwapFees` · accounts `ViewLpPoolSwapFeesInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `in_market_index`   | `u16` |
| `out_market_index`  | `u16` |
| `in_amount`         | `u64` |
| `in_target_weight`  | `i64` |
| `out_target_weight` | `i64` |

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

Fields of `ViewLpPoolSwapFeesInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `drift_signer`                  | `Pubkey`           |
| 1   | `state`                         | `Pubkey`           |
| 2   | `lp_pool`                       | `Pubkey`           |
| 3   | `constituent_target_base`       | `Pubkey`           |
| 4   | `constituent_correlations`      | `Pubkey`           |
| 5   | `constituent_in_token_account`  | `Pubkey`           |
| 6   | `constituent_out_token_account` | `Pubkey`           |
| 7   | `in_constituent`                | `Pubkey`           |
| 8   | `out_constituent`               | `Pubkey`           |
| 9   | `authority`                     | `Pubkey`           |
| 10  | `token_program`                 | `Pubkey`           |
| 11… | `remaining`                     | `Vec<AccountMeta>` |

### `Withdraw`

Discriminator `b712469c946da122` · data `Withdraw` · accounts `WithdrawInstructionAccounts`.

| Field          | Type   |
| -------------- | ------ |
| `market_index` | `u16`  |
| `amount`       | `u64`  |
| `reduce_only`  | `bool` |

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

Fields of `WithdrawInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `state`              | `Pubkey`           |
| 1  | `user`               | `Pubkey`           |
| 2  | `user_stats`         | `Pubkey`           |
| 3  | `authority`          | `Pubkey`           |
| 4  | `spot_market_vault`  | `Pubkey`           |
| 5  | `drift_signer`       | `Pubkey`           |
| 6  | `user_token_account` | `Pubkey`           |
| 7  | `token_program`      | `Pubkey`           |
| 8… | `remaining`          | `Vec<AccountMeta>` |

### `WithdrawFromIsolatedPerpPosition`

Discriminator `255cb2958c4c9f87` · data `WithdrawFromIsolatedPerpPosition` · accounts `WithdrawFromIsolatedPerpPositionInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `spot_market_index` | `u16` |
| `perp_market_index` | `u16` |
| `amount`            | `u64` |

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

Fields of `WithdrawFromIsolatedPerpPositionInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `state`              | `Pubkey`           |
| 1  | `user`               | `Pubkey`           |
| 2  | `user_stats`         | `Pubkey`           |
| 3  | `authority`          | `Pubkey`           |
| 4  | `spot_market_vault`  | `Pubkey`           |
| 5  | `drift_signer`       | `Pubkey`           |
| 6  | `user_token_account` | `Pubkey`           |
| 7  | `token_program`      | `Pubkey`           |
| 8… | `remaining`          | `Vec<AccountMeta>` |

### `WithdrawFromProgramVault`

Discriminator `7828b795e812e097` · data `WithdrawFromProgramVault` · accounts `WithdrawFromProgramVaultInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `amount` | `u64` |

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

Fields of `WithdrawFromProgramVaultInstructionAccounts`, in account order:

| #   | Field                       | Type               |
| --- | --------------------------- | ------------------ |
| 0   | `state`                     | `Pubkey`           |
| 1   | `admin`                     | `Pubkey`           |
| 2   | `drift_signer`              | `Pubkey`           |
| 3   | `constituent`               | `Pubkey`           |
| 4   | `constituent_token_account` | `Pubkey`           |
| 5   | `spot_market`               | `Pubkey`           |
| 6   | `spot_market_vault`         | `Pubkey`           |
| 7   | `token_program`             | `Pubkey`           |
| 8   | `mint`                      | `Pubkey`           |
| 9   | `oracle`                    | `Pubkey`           |
| 10… | `remaining`                 | `Vec<AccountMeta>` |

### `ZeroMmOracleFields`

Discriminator `c0e227cccf7894fa` · data `ZeroMmOracleFields` · accounts `ZeroMmOracleFieldsInstructionAccounts`.

No data fields.

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

Fields of `ZeroMmOracleFieldsInstructionAccounts`, in account order:

| #  | Field         | Type               |
| -- | ------------- | ------------------ |
| 0  | `admin`       | `Pubkey`           |
| 1  | `state`       | `Pubkey`           |
| 2  | `perp_market` | `Pubkey`           |
| 3… | `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 `DriftV2Account`. Each wraps a boxed struct from `carbon_drift_v2_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `AmmCache`

Discriminator `d572a1381416023b` · `accounts::amm_cache::AmmCache`.

| Field     | Type                           |
| --------- | ------------------------------ |
| `bump`    | `u8`                           |
| `padding` | `[u8; 3]`                      |
| `cache`   | [`Vec<CacheInfo>`](#cacheinfo) |

### `AmmConstituentMapping`

Discriminator `fe5905ad4236d6f7` · `accounts::amm_constituent_mapping::AmmConstituentMapping`.

| Field     | Type                                               |
| --------- | -------------------------------------------------- |
| `lp_pool` | `Pubkey`                                           |
| `bump`    | `u8`                                               |
| `padding` | `[u8; 3]`                                          |
| `weights` | [`Vec<AmmConstituentDatum>`](#ammconstituentdatum) |

### `Constituent`

Discriminator `003d2423b14cd8cd` · `accounts::constituent::Constituent`.

| Field                                           | Type                                                | Description                                                                                                                                                                                                                                                                      |
| ----------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pubkey`                                        | `Pubkey`                                            | address of the constituent                                                                                                                                                                                                                                                       |
| `mint`                                          | `Pubkey`                                            |                                                                                                                                                                                                                                                                                  |
| `lp_pool`                                       | `Pubkey`                                            |                                                                                                                                                                                                                                                                                  |
| `vault`                                         | `Pubkey`                                            |                                                                                                                                                                                                                                                                                  |
| `total_swap_fees`                               | `i128`                                              | total fees received by the constituent. Positive = fees received, Negative = fees paid                                                                                                                                                                                           |
| `spot_balance`                                  | [`ConstituentSpotBalance`](#constituentspotbalance) | spot borrow-lend balance for constituent                                                                                                                                                                                                                                         |
| `last_spot_balance_token_amount`                | `i64`                                               |                                                                                                                                                                                                                                                                                  |
| `cumulative_spot_interest_accrued_token_amount` | `i64`                                               |                                                                                                                                                                                                                                                                                  |
| `max_weight_deviation`                          | `i64`                                               | max deviation from target_weight allowed for the constituent precision: PERCENTAGE_PRECISION                                                                                                                                                                                     |
| `swap_fee_min`                                  | `i64`                                               | min fee charged on swaps to/from this constituent precision: PERCENTAGE_PRECISION                                                                                                                                                                                                |
| `swap_fee_max`                                  | `i64`                                               | max fee charged on swaps to/from this constituent precision: PERCENTAGE_PRECISION                                                                                                                                                                                                |
| `max_borrow_token_amount`                       | `u64`                                               | Max Borrow amount: precision: token precision                                                                                                                                                                                                                                    |
| `vault_token_balance`                           | `u64`                                               | ata token balance in token precision                                                                                                                                                                                                                                             |
| `last_oracle_price`                             | `i64`                                               |                                                                                                                                                                                                                                                                                  |
| `last_oracle_slot`                              | `u64`                                               |                                                                                                                                                                                                                                                                                  |
| `oracle_staleness_threshold`                    | `u64`                                               | Delay allowed for valid AUM calculation                                                                                                                                                                                                                                          |
| `flash_loan_initial_token_amount`               | `u64`                                               |                                                                                                                                                                                                                                                                                  |
| `next_swap_id`                                  | `u64`                                               | Every swap to/from this constituent has a monotonically increasing id. This is the next id to use                                                                                                                                                                                |
| `derivative_weight`                             | `u64`                                               | percentable of derivatve weight to go to this specific derivative PERCENTAGE_PRECISION. Zero if no derivative weight                                                                                                                                                             |
| `volatility`                                    | `u64`                                               |                                                                                                                                                                                                                                                                                  |
| `constituent_derivative_depeg_threshold`        | `u64`                                               |                                                                                                                                                                                                                                                                                  |
| `constituent_derivative_index`                  | `i16`                                               | The `constituent_index` of the parent constituent. -1 if it is a parent index Example: if in a pool with SOL (parent) and dSOL (derivative), SOL.constituent_index = 1, SOL.constituent_derivative_index = -1, dSOL.constituent_index = 2, dSOL.constituent_derivative_index = 1 |
| `spot_market_index`                             | `u16`                                               |                                                                                                                                                                                                                                                                                  |
| `constituent_index`                             | `u16`                                               |                                                                                                                                                                                                                                                                                  |
| `decimals`                                      | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `bump`                                          | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `vault_bump`                                    | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `gamma_inventory`                               | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `gamma_execution`                               | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `xi`                                            | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `status`                                        | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `paused_operations`                             | `u8`                                                |                                                                                                                                                                                                                                                                                  |
| `padding`                                       | `[u8; 162]`                                         |                                                                                                                                                                                                                                                                                  |

### `ConstituentCorrelations`

Discriminator `7ccb732112a243d8` · `accounts::constituent_correlations::ConstituentCorrelations`.

| Field          | Type       |
| -------------- | ---------- |
| `lp_pool`      | `Pubkey`   |
| `bump`         | `u8`       |
| `padding`      | `[u8; 3]`  |
| `correlations` | `Vec<i64>` |

### `ConstituentTargetBase`

Discriminator `ff8e86477d42c663` · `accounts::constituent_target_base::ConstituentTargetBase`.

| Field     | Type                                 |
| --------- | ------------------------------------ |
| `lp_pool` | `Pubkey`                             |
| `bump`    | `u8`                                 |
| `padding` | `[u8; 3]`                            |
| `targets` | [`Vec<TargetsDatum>`](#targetsdatum) |

### `FuelOverflow`

Discriminator `b640e7b1e28e453a` · `accounts::fuel_overflow::FuelOverflow`.

| Field                | Type        | Description                            |
| -------------------- | ----------- | -------------------------------------- |
| `authority`          | `Pubkey`    | The authority of this overflow account |
| `fuel_insurance`     | `u128`      |                                        |
| `fuel_deposits`      | `u128`      |                                        |
| `fuel_borrows`       | `u128`      |                                        |
| `fuel_positions`     | `u128`      |                                        |
| `fuel_taker`         | `u128`      |                                        |
| `fuel_maker`         | `u128`      |                                        |
| `last_fuel_sweep_ts` | `u32`       |                                        |
| `last_reset_ts`      | `u32`       |                                        |
| `padding`            | `[u128; 6]` |                                        |

### `HighLeverageModeConfig`

Discriminator `03c45abdc140e4ea` · `accounts::high_leverage_mode_config::HighLeverageModeConfig`.

| Field                       | Type       |
| --------------------------- | ---------- |
| `max_users`                 | `u32`      |
| `current_users`             | `u32`      |
| `reduce_only`               | `u8`       |
| `padding1`                  | `[u8; 3]`  |
| `current_maintenance_users` | `u32`      |
| `padding2`                  | `[u8; 24]` |

### `IfRebalanceConfig`

Discriminator `d65428fb6b90adef` · `accounts::if_rebalance_config::IfRebalanceConfig`.

| Field                                   | Type       | Description                                |
| --------------------------------------- | ---------- | ------------------------------------------ |
| `pubkey`                                | `Pubkey`   |                                            |
| `total_in_amount`                       | `u64`      | total amount to be sold                    |
| `current_in_amount`                     | `u64`      | amount already sold                        |
| `current_out_amount`                    | `u64`      | amount already bought                      |
| `current_out_amount_transferred`        | `u64`      | amount already transferred to revenue pool |
| `current_in_amount_since_last_transfer` | `u64`      | amount already bought in epoch             |
| `epoch_start_ts`                        | `i64`      | start time of epoch                        |
| `epoch_in_amount`                       | `u64`      | amount already bought in epoch             |
| `epoch_max_in_amount`                   | `u64`      | max amount to swap in epoch                |
| `epoch_duration`                        | `i64`      | duration of epoch                          |
| `out_market_index`                      | `u16`      | market index to sell                       |
| `in_market_index`                       | `u16`      | market index to buy                        |
| `max_slippage_bps`                      | `u16`      |                                            |
| `swap_mode`                             | `u8`       |                                            |
| `status`                                | `u8`       |                                            |
| `padding2`                              | `[u8; 32]` |                                            |

### `InsuranceFundStake`

Discriminator `6eca0e2a5f495a5f` · `accounts::insurance_fund_stake::InsuranceFundStake`.

| Field                          | Type       |
| ------------------------------ | ---------- |
| `authority`                    | `Pubkey`   |
| `if_shares`                    | `u128`     |
| `last_withdraw_request_shares` | `u128`     |
| `if_base`                      | `u128`     |
| `last_valid_ts`                | `i64`      |
| `last_withdraw_request_value`  | `u64`      |
| `last_withdraw_request_ts`     | `i64`      |
| `cost_basis`                   | `i64`      |
| `market_index`                 | `u16`      |
| `padding`                      | `[u8; 14]` |

### `LPPool`

Discriminator `e4988de0a1aa0b59` · `accounts::l_p_pool::LPPool`.

| Field                                         | Type        | Description                                                                                                                                                                                                                                                                                                                      |
| --------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pubkey`                                      | `Pubkey`    | address of the vault.                                                                                                                                                                                                                                                                                                            |
| `mint`                                        | `Pubkey`    |                                                                                                                                                                                                                                                                                                                                  |
| `whitelist_mint`                              | `Pubkey`    |                                                                                                                                                                                                                                                                                                                                  |
| `constituent_target_base`                     | `Pubkey`    |                                                                                                                                                                                                                                                                                                                                  |
| `constituent_correlations`                    | `Pubkey`    |                                                                                                                                                                                                                                                                                                                                  |
| `max_aum`                                     | `u128`      | The current number of VaultConstituents in the vault, each constituent is pda(LPPool.address, constituent_index) which constituent is the quote, receives revenue pool distributions. (maybe this should just be implied idx 0) pub quote_constituent_index: u16, QUOTE_PRECISION: Max AUM, Prohibit minting new DLP beyond this |
| `last_aum`                                    | `u128`      | QUOTE_PRECISION: AUM of the vault in USD, updated lazily                                                                                                                                                                                                                                                                         |
| `cumulative_quote_sent_to_perp_markets`       | `u128`      | QUOTE PRECISION: Cumulative quotes from settles                                                                                                                                                                                                                                                                                  |
| `cumulative_quote_received_from_perp_markets` | `u128`      |                                                                                                                                                                                                                                                                                                                                  |
| `total_mint_redeem_fees_paid`                 | `i128`      | QUOTE_PRECISION: Total fees paid for minting and redeeming LP tokens                                                                                                                                                                                                                                                             |
| `last_aum_slot`                               | `u64`       | timestamp of last AUM slot                                                                                                                                                                                                                                                                                                       |
| `max_settle_quote_amount`                     | `u64`       |                                                                                                                                                                                                                                                                                                                                  |
| `_padding`                                    | `u64`       | timestamp of last vAMM revenue rebalance                                                                                                                                                                                                                                                                                         |
| `mint_redeem_id`                              | `u64`       | Every mint/redeem has a monotonically increasing id. This is the next id to use                                                                                                                                                                                                                                                  |
| `settle_id`                                   | `u64`       |                                                                                                                                                                                                                                                                                                                                  |
| `min_mint_fee`                                | `i64`       | PERCENTAGE_PRECISION                                                                                                                                                                                                                                                                                                             |
| `token_supply`                                | `u64`       |                                                                                                                                                                                                                                                                                                                                  |
| `volatility`                                  | `u64`       |                                                                                                                                                                                                                                                                                                                                  |
| `constituents`                                | `u16`       |                                                                                                                                                                                                                                                                                                                                  |
| `quote_consituent_index`                      | `u16`       |                                                                                                                                                                                                                                                                                                                                  |
| `bump`                                        | `u8`        |                                                                                                                                                                                                                                                                                                                                  |
| `gamma_execution`                             | `u8`        |                                                                                                                                                                                                                                                                                                                                  |
| `xi`                                          | `u8`        |                                                                                                                                                                                                                                                                                                                                  |
| `target_oracle_delay_fee_bps_per10_slots`     | `u8`        |                                                                                                                                                                                                                                                                                                                                  |
| `target_position_delay_fee_bps_per10_slots`   | `u8`        |                                                                                                                                                                                                                                                                                                                                  |
| `lp_pool_id`                                  | `u8`        |                                                                                                                                                                                                                                                                                                                                  |
| `padding`                                     | `[u8; 174]` |                                                                                                                                                                                                                                                                                                                                  |

### `OpenbookV2FulfillmentConfig`

Discriminator `032b3a6a8384c7ab` · `accounts::openbook_v2_fulfillment_config::OpenbookV2FulfillmentConfig`.

| Field                          | Type                                                          |
| ------------------------------ | ------------------------------------------------------------- |
| `pubkey`                       | `Pubkey`                                                      |
| `openbook_v2_program_id`       | `Pubkey`                                                      |
| `openbook_v2_market`           | `Pubkey`                                                      |
| `openbook_v2_market_authority` | `Pubkey`                                                      |
| `openbook_v2_event_heap`       | `Pubkey`                                                      |
| `openbook_v2_bids`             | `Pubkey`                                                      |
| `openbook_v2_asks`             | `Pubkey`                                                      |
| `openbook_v2_base_vault`       | `Pubkey`                                                      |
| `openbook_v2_quote_vault`      | `Pubkey`                                                      |
| `market_index`                 | `u16`                                                         |
| `fulfillment_type`             | [`SpotFulfillmentType`](#spotfulfillmenttype)                 |
| `status`                       | [`SpotFulfillmentConfigStatus`](#spotfulfillmentconfigstatus) |
| `padding`                      | `[u8; 4]`                                                     |

### `PerpMarket`

Discriminator `0adf0c2c6bf537f7` · `accounts::perp_market::PerpMarket`.

| Field                                     | Type                                | Description                                                                                                                                                                                                                                                                 |
| ----------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pubkey`                                  | `Pubkey`                            | The perp market's address. It is a pda of the market index                                                                                                                                                                                                                  |
| `amm`                                     | [`AMM`](#amm)                       | The automated market maker                                                                                                                                                                                                                                                  |
| `pnl_pool`                                | [`PoolBalance`](#poolbalance)       | The market's pnl pool. When users settle negative pnl, the balance increases. When users settle positive pnl, the balance decreases. Can not go negative.                                                                                                                   |
| `name`                                    | `[u8; 32]`                          | Encoded display name for the perp market e.g. SOL-PERP                                                                                                                                                                                                                      |
| `insurance_claim`                         | [`InsuranceClaim`](#insuranceclaim) | The perp market's claim on the insurance fund                                                                                                                                                                                                                               |
| `unrealized_pnl_max_imbalance`            | `u64`                               | The max pnl imbalance before positive pnl asset weight is discounted pnl imbalance is the difference between long and short pnl. When it's greater than 0, the amm has negative pnl and the initial asset weight for positive pnl is discounted precision = QUOTE_PRECISION |
| `expiry_ts`                               | `i64`                               | The ts when the market will be expired. Only set if market is in reduce only mode                                                                                                                                                                                           |
| `expiry_price`                            | `i64`                               | The price at which positions will be settled. Only set if market is expired precision = PRICE_PRECISION                                                                                                                                                                     |
| `next_fill_record_id`                     | `u64`                               | Every trade has a fill record id. This is the next id to be used                                                                                                                                                                                                            |
| `next_funding_rate_record_id`             | `u64`                               | Every funding rate update has a record id. This is the next id to be used                                                                                                                                                                                                   |
| `next_curve_record_id`                    | `u64`                               | Every amm k updated has a record id. This is the next id to be used                                                                                                                                                                                                         |
| `imf_factor`                              | `u32`                               | The initial margin fraction factor. Used to increase margin ratio for large positions precision: MARGIN_PRECISION                                                                                                                                                           |
| `unrealized_pnl_imf_factor`               | `u32`                               | The imf factor for unrealized pnl. Used to discount asset weight for large positive pnl precision: MARGIN_PRECISION                                                                                                                                                         |
| `liquidator_fee`                          | `u32`                               | The fee the liquidator is paid for taking over perp position precision: LIQUIDATOR_FEE_PRECISION                                                                                                                                                                            |
| `if_liquidation_fee`                      | `u32`                               | The fee the insurance fund receives from liquidation precision: LIQUIDATOR_FEE_PRECISION                                                                                                                                                                                    |
| `margin_ratio_initial`                    | `u32`                               | The margin ratio which determines how much collateral is required to open a position e.g. margin ratio of .1 means a user must have $100 of total collateral to open a $1000 position precision: MARGIN_PRECISION                                                           |
| `margin_ratio_maintenance`                | `u32`                               | The margin ratio which determines when a user will be liquidated e.g. margin ratio of .05 means a user must have $50 of total collateral to maintain a $1000 position else they will be liquidated precision: MARGIN_PRECISION                                              |
| `unrealized_pnl_initial_asset_weight`     | `u32`                               | The initial asset weight for positive pnl. Negative pnl always has an asset weight of 1 precision: SPOT_WEIGHT_PRECISION                                                                                                                                                    |
| `unrealized_pnl_maintenance_asset_weight` | `u32`                               | The maintenance asset weight for positive pnl. Negative pnl always has an asset weight of 1 precision: SPOT_WEIGHT_PRECISION                                                                                                                                                |
| `number_of_users_with_base`               | `u32`                               | number of users in a position (base)                                                                                                                                                                                                                                        |
| `number_of_users`                         | `u32`                               | number of users in a position (pnl) or pnl (quote)                                                                                                                                                                                                                          |
| `market_index`                            | `u16`                               |                                                                                                                                                                                                                                                                             |
| `status`                                  | [`MarketStatus`](#marketstatus)     | Whether a market is active, reduce only, expired, etc Affects whether users can open/close positions                                                                                                                                                                        |
| `contract_type`                           | [`ContractType`](#contracttype)     | Currently only Perpetual markets are supported                                                                                                                                                                                                                              |
| `contract_tier`                           | [`ContractTier`](#contracttier)     | The contract tier determines how much insurance a market can receive, with more speculative markets receiving less insurance It also influences the order perp markets can be liquidated, with less speculative markets being liquidated first                              |
| `paused_operations`                       | `u8`                                |                                                                                                                                                                                                                                                                             |
| `quote_spot_market_index`                 | `u16`                               | The spot market that pnl is settled in                                                                                                                                                                                                                                      |
| `fee_adjustment`                          | `i16`                               | Between -100 and 100, represents what % to increase/decrease the fee by E.g. if this is -50 and the fee is 5bps, the new fee will be 2.5bps if this is 50 and the fee is 5bps, the new fee will be 7.5bps                                                                   |
| `fuel_boost_position`                     | `u8`                                | fuel multiplier for perp funding precision: 10                                                                                                                                                                                                                              |
| `fuel_boost_taker`                        | `u8`                                | fuel multiplier for perp taker precision: 10                                                                                                                                                                                                                                |
| `fuel_boost_maker`                        | `u8`                                | fuel multiplier for perp maker precision: 10                                                                                                                                                                                                                                |
| `pool_id`                                 | `u8`                                |                                                                                                                                                                                                                                                                             |
| `high_leverage_margin_ratio_initial`      | `u16`                               |                                                                                                                                                                                                                                                                             |
| `high_leverage_margin_ratio_maintenance`  | `u16`                               |                                                                                                                                                                                                                                                                             |
| `protected_maker_limit_price_divisor`     | `u8`                                |                                                                                                                                                                                                                                                                             |
| `protected_maker_dynamic_divisor`         | `u8`                                |                                                                                                                                                                                                                                                                             |
| `lp_fee_transfer_scalar`                  | `u8`                                |                                                                                                                                                                                                                                                                             |
| `lp_status`                               | `u8`                                |                                                                                                                                                                                                                                                                             |
| `lp_paused_operations`                    | `u8`                                |                                                                                                                                                                                                                                                                             |
| `lp_exchange_fee_excluscion_scalar`       | `u8`                                |                                                                                                                                                                                                                                                                             |
| `last_fill_price`                         | `u64`                               |                                                                                                                                                                                                                                                                             |
| `lp_pool_id`                              | `u8`                                |                                                                                                                                                                                                                                                                             |
| `market_config`                           | `u8`                                |                                                                                                                                                                                                                                                                             |
| `padding`                                 | `[u8; 22]`                          |                                                                                                                                                                                                                                                                             |

### `PhoenixV1FulfillmentConfig`

Discriminator `e92d3e2823813048` · `accounts::phoenix_v1_fulfillment_config::PhoenixV1FulfillmentConfig`.

| Field                   | Type                                                          |
| ----------------------- | ------------------------------------------------------------- |
| `pubkey`                | `Pubkey`                                                      |
| `phoenix_program_id`    | `Pubkey`                                                      |
| `phoenix_log_authority` | `Pubkey`                                                      |
| `phoenix_market`        | `Pubkey`                                                      |
| `phoenix_base_vault`    | `Pubkey`                                                      |
| `phoenix_quote_vault`   | `Pubkey`                                                      |
| `market_index`          | `u16`                                                         |
| `fulfillment_type`      | [`SpotFulfillmentType`](#spotfulfillmenttype)                 |
| `status`                | [`SpotFulfillmentConfigStatus`](#spotfulfillmentconfigstatus) |
| `padding`               | `[u8; 4]`                                                     |

### `PrelaunchOracle`

Discriminator `5c0e8bea48f4441a` · `accounts::prelaunch_oracle::PrelaunchOracle`.

| Field                  | Type       |
| ---------------------- | ---------- |
| `price`                | `i64`      |
| `max_price`            | `i64`      |
| `confidence`           | `u64`      |
| `last_update_slot`     | `u64`      |
| `amm_last_update_slot` | `u64`      |
| `perp_market_index`    | `u16`      |
| `padding`              | `[u8; 70]` |

### `ProtectedMakerModeConfig`

Discriminator `2f565a09e0ff0a45` · `accounts::protected_maker_mode_config::ProtectedMakerModeConfig`.

| Field           | Type       |
| --------------- | ---------- |
| `max_users`     | `u32`      |
| `current_users` | `u32`      |
| `reduce_only`   | `u8`       |
| `padding`       | `[u8; 31]` |

### `ProtocolIfSharesTransferConfig`

Discriminator `bc01d56217941e01` · `accounts::protocol_if_shares_transfer_config::ProtocolIfSharesTransferConfig`.

| Field                    | Type          |
| ------------------------ | ------------- |
| `whitelisted_signers`    | `[Pubkey; 4]` |
| `max_transfer_per_epoch` | `u128`        |
| `current_epoch_transfer` | `u128`        |
| `next_epoch_ts`          | `i64`         |
| `padding`                | `[u128; 8]`   |

### `PythLazerOracle`

Discriminator `9f07a1f922517985` · `accounts::pyth_lazer_oracle::PythLazerOracle`.

| Field          | Type      |
| -------------- | --------- |
| `price`        | `i64`     |
| `publish_time` | `u64`     |
| `posted_slot`  | `u64`     |
| `exponent`     | `i32`     |
| `padding`      | `[u8; 4]` |
| `conf`         | `u64`     |

### `ReferrerName`

Discriminator `6985aa6e342a1cb6` · `accounts::referrer_name::ReferrerName`.

| Field        | Type       |
| ------------ | ---------- |
| `authority`  | `Pubkey`   |
| `user`       | `Pubkey`   |
| `user_stats` | `Pubkey`   |
| `name`       | `[u8; 32]` |

### `RevenueShare`

Discriminator `3728e4078b34b46e` · `accounts::revenue_share::RevenueShare`.

| Field                    | Type       | Description                                      |
| ------------------------ | ---------- | ------------------------------------------------ |
| `authority`              | `Pubkey`   | the owner of this account, a builder or referrer |
| `total_referrer_rewards` | `u64`      |                                                  |
| `total_builder_rewards`  | `u64`      |                                                  |
| `padding`                | `[u8; 18]` |                                                  |

### `RevenueShareEscrow`

Discriminator `62a7032e4ab1adfc` · `accounts::revenue_share_escrow::RevenueShareEscrow`.

| Field                          | Type                                           | Description                       |
| ------------------------------ | ---------------------------------------------- | --------------------------------- |
| `authority`                    | `Pubkey`                                       | the owner of this account, a user |
| `referrer`                     | `Pubkey`                                       |                                   |
| `referrer_boost_expire_ts`     | `u32`                                          |                                   |
| `referrer_reward_offset`       | `i8`                                           |                                   |
| `referee_fee_numerator_offset` | `i8`                                           |                                   |
| `referrer_boost_numerator`     | `i8`                                           |                                   |
| `reserved_fixed`               | `[u8; 17]`                                     |                                   |
| `padding0`                     | `u32`                                          |                                   |
| `orders`                       | [`Vec<RevenueShareOrder>`](#revenueshareorder) |                                   |
| `padding1`                     | `u32`                                          |                                   |
| `approved_builders`            | [`Vec<BuilderInfo>`](#builderinfo)             |                                   |

### `SerumV3FulfillmentConfig`

Discriminator `41a0c570efa867b9` · `accounts::serum_v3_fulfillment_config::SerumV3FulfillmentConfig`.

| Field                 | Type                                                          |
| --------------------- | ------------------------------------------------------------- |
| `pubkey`              | `Pubkey`                                                      |
| `serum_program_id`    | `Pubkey`                                                      |
| `serum_market`        | `Pubkey`                                                      |
| `serum_request_queue` | `Pubkey`                                                      |
| `serum_event_queue`   | `Pubkey`                                                      |
| `serum_bids`          | `Pubkey`                                                      |
| `serum_asks`          | `Pubkey`                                                      |
| `serum_base_vault`    | `Pubkey`                                                      |
| `serum_quote_vault`   | `Pubkey`                                                      |
| `serum_open_orders`   | `Pubkey`                                                      |
| `serum_signer_nonce`  | `u64`                                                         |
| `market_index`        | `u16`                                                         |
| `fulfillment_type`    | [`SpotFulfillmentType`](#spotfulfillmenttype)                 |
| `status`              | [`SpotFulfillmentConfigStatus`](#spotfulfillmentconfigstatus) |
| `padding`             | `[u8; 4]`                                                     |

### `SignedMsgUserOrders`

> _From the program's IDL:_
>
> - This struct is a duplicate of SignedMsgUserOrdersZeroCopy
> - It is used to give anchor an struct to generate the idl for clients
> - The struct SignedMsgUserOrdersZeroCopy is used to load the data in
>   efficiently

Discriminator `460632f8de018f31` · `accounts::signed_msg_user_orders::SignedMsgUserOrders`.

| Field                   | Type                                         |
| ----------------------- | -------------------------------------------- |
| `authority_pubkey`      | `Pubkey`                                     |
| `padding`               | `u32`                                        |
| `signed_msg_order_data` | [`Vec<SignedMsgOrderId>`](#signedmsgorderid) |

### `SignedMsgWsDelegates`

> _From the program's IDL:_
>
> - Used to store authenticated delegates for swift-like ws connections

Discriminator `be736f2cd8fc6c55` · `accounts::signed_msg_ws_delegates::SignedMsgWsDelegates`.

| Field       | Type          |
| ----------- | ------------- |
| `delegates` | `Vec<Pubkey>` |

### `SpotMarket`

Discriminator `64b1086ba8414127` · `accounts::spot_market::SpotMarket`.

| Field                              | Type                                            | Description                                                                                                                                                                                                                                                          |
| ---------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pubkey`                           | `Pubkey`                                        | The address of the spot market. It is a pda of the market index                                                                                                                                                                                                      |
| `oracle`                           | `Pubkey`                                        | The oracle used to price the markets deposits/borrows                                                                                                                                                                                                                |
| `mint`                             | `Pubkey`                                        | The token mint of the market                                                                                                                                                                                                                                         |
| `vault`                            | `Pubkey`                                        | The vault used to store the market's deposits The amount in the vault should be equal to or greater than deposits - borrows                                                                                                                                          |
| `name`                             | `[u8; 32]`                                      | The encoded display name for the market e.g. SOL                                                                                                                                                                                                                     |
| `historical_oracle_data`           | [`HistoricalOracleData`](#historicaloracledata) |                                                                                                                                                                                                                                                                      |
| `historical_index_data`            | [`HistoricalIndexData`](#historicalindexdata)   |                                                                                                                                                                                                                                                                      |
| `revenue_pool`                     | [`PoolBalance`](#poolbalance)                   | Revenue the protocol has collected in this markets token e.g. for SOL-PERP, funds can be settled in usdc and will flow into the USDC revenue pool                                                                                                                    |
| `spot_fee_pool`                    | [`PoolBalance`](#poolbalance)                   | The fees collected from swaps between this market and the quote market Is settled to the quote markets revenue pool                                                                                                                                                  |
| `insurance_fund`                   | [`InsuranceFund`](#insurancefund)               | Details on the insurance fund covering bankruptcies in this markets token Covers bankruptcies for borrows with this markets token and perps settling in this markets token                                                                                           |
| `total_spot_fee`                   | `u128`                                          | The total spot fees collected for this market precision: QUOTE_PRECISION                                                                                                                                                                                             |
| `deposit_balance`                  | `u128`                                          | The sum of the scaled balances for deposits across users and pool balances To convert to the deposit token amount, multiply by the cumulative deposit interest precision: SPOT_BALANCE_PRECISION                                                                     |
| `borrow_balance`                   | `u128`                                          | The sum of the scaled balances for borrows across users and pool balances To convert to the borrow token amount, multiply by the cumulative borrow interest precision: SPOT_BALANCE_PRECISION                                                                        |
| `cumulative_deposit_interest`      | `u128`                                          | The cumulative interest earned by depositors Used to calculate the deposit token amount from the deposit balance precision: SPOT_CUMULATIVE_INTEREST_PRECISION                                                                                                       |
| `cumulative_borrow_interest`       | `u128`                                          | The cumulative interest earned by borrowers Used to calculate the borrow token amount from the borrow balance precision: SPOT_CUMULATIVE_INTEREST_PRECISION                                                                                                          |
| `total_social_loss`                | `u128`                                          | The total socialized loss from borrows, in the mint's token precision: token mint precision                                                                                                                                                                          |
| `total_quote_social_loss`          | `u128`                                          | The total socialized loss from borrows, in the quote market's token preicision: QUOTE_PRECISION                                                                                                                                                                      |
| `withdraw_guard_threshold`         | `u64`                                           | no withdraw limits/guards when deposits below this threshold precision: token mint precision                                                                                                                                                                         |
| `max_token_deposits`               | `u64`                                           | The max amount of token deposits in this market 0 if there is no limit precision: token mint precision                                                                                                                                                               |
| `deposit_token_twap`               | `u64`                                           | 24hr average of deposit token amount precision: token mint precision                                                                                                                                                                                                 |
| `borrow_token_twap`                | `u64`                                           | 24hr average of borrow token amount precision: token mint precision                                                                                                                                                                                                  |
| `utilization_twap`                 | `u64`                                           | 24hr average of utilization which is borrow amount over token amount precision: SPOT_UTILIZATION_PRECISION                                                                                                                                                           |
| `last_interest_ts`                 | `u64`                                           | Last time the cumulative deposit and borrow interest was updated                                                                                                                                                                                                     |
| `last_twap_ts`                     | `u64`                                           | Last time the deposit/borrow/utilization averages were updated                                                                                                                                                                                                       |
| `expiry_ts`                        | `i64`                                           | The time the market is set to expire. Only set if market is in reduce only mode                                                                                                                                                                                      |
| `order_step_size`                  | `u64`                                           | Spot orders must be a multiple of the step size precision: token mint precision                                                                                                                                                                                      |
| `order_tick_size`                  | `u64`                                           | Spot orders must be a multiple of the tick size precision: PRICE_PRECISION                                                                                                                                                                                           |
| `min_order_size`                   | `u64`                                           | The minimum order size precision: token mint precision                                                                                                                                                                                                               |
| `max_position_size`                | `u64`                                           | The maximum spot position size if the limit is 0, there is no limit precision: token mint precision                                                                                                                                                                  |
| `next_fill_record_id`              | `u64`                                           | Every spot trade has a fill record id. This is the next id to use                                                                                                                                                                                                    |
| `next_deposit_record_id`           | `u64`                                           | Every deposit has a deposit record id. This is the next id to use                                                                                                                                                                                                    |
| `initial_asset_weight`             | `u32`                                           | The initial asset weight used to calculate a deposits contribution to a users initial total collateral e.g. if the asset weight is .8, $100 of deposits contributes $80 to the users initial total collateral precision: SPOT_WEIGHT_PRECISION                       |
| `maintenance_asset_weight`         | `u32`                                           | The maintenance asset weight used to calculate a deposits contribution to a users maintenance total collateral e.g. if the asset weight is .9, $100 of deposits contributes $90 to the users maintenance total collateral precision: SPOT_WEIGHT_PRECISION           |
| `initial_liability_weight`         | `u32`                                           | The initial liability weight used to calculate a borrows contribution to a users initial margin requirement e.g. if the liability weight is .9, $100 of borrows contributes $90 to the users initial margin requirement precision: SPOT_WEIGHT_PRECISION             |
| `maintenance_liability_weight`     | `u32`                                           | The maintenance liability weight used to calculate a borrows contribution to a users maintenance margin requirement e.g. if the liability weight is .8, $100 of borrows contributes $80 to the users maintenance margin requirement precision: SPOT_WEIGHT_PRECISION |
| `imf_factor`                       | `u32`                                           | The initial margin fraction factor. Used to increase liability weight/decrease asset weight for large positions precision: MARGIN_PRECISION                                                                                                                          |
| `liquidator_fee`                   | `u32`                                           | The fee the liquidator is paid for taking over borrow/deposit precision: LIQUIDATOR_FEE_PRECISION                                                                                                                                                                    |
| `if_liquidation_fee`               | `u32`                                           | The fee the insurance fund receives from liquidation precision: LIQUIDATOR_FEE_PRECISION                                                                                                                                                                             |
| `optimal_utilization`              | `u32`                                           | The optimal utilization rate for this market. Used to determine the markets borrow rate precision: SPOT_UTILIZATION_PRECISION                                                                                                                                        |
| `optimal_borrow_rate`              | `u32`                                           | The borrow rate for this market when the market has optimal utilization precision: SPOT_RATE_PRECISION                                                                                                                                                               |
| `max_borrow_rate`                  | `u32`                                           | The borrow rate for this market when the market has 1000 utilization precision: SPOT_RATE_PRECISION                                                                                                                                                                  |
| `decimals`                         | `u32`                                           | The market's token mint's decimals. To from decimals to a precision, 10^decimals                                                                                                                                                                                     |
| `market_index`                     | `u16`                                           |                                                                                                                                                                                                                                                                      |
| `orders_enabled`                   | `bool`                                          | Whether or not spot trading is enabled                                                                                                                                                                                                                               |
| `oracle_source`                    | [`OracleSource`](#oraclesource)                 |                                                                                                                                                                                                                                                                      |
| `status`                           | [`MarketStatus`](#marketstatus)                 |                                                                                                                                                                                                                                                                      |
| `asset_tier`                       | [`AssetTier`](#assettier)                       | The asset tier affects how a deposit can be used as collateral and the priority for a borrow being liquidated                                                                                                                                                        |
| `paused_operations`                | `u8`                                            |                                                                                                                                                                                                                                                                      |
| `if_paused_operations`             | `u8`                                            |                                                                                                                                                                                                                                                                      |
| `fee_adjustment`                   | `i16`                                           |                                                                                                                                                                                                                                                                      |
| `max_token_borrows_fraction`       | `u16`                                           | What fraction of max_token_deposits disabled when 0, 1 => 1/10000 => .01% of max_token_deposits precision: X/10000                                                                                                                                                   |
| `flash_loan_amount`                | `u64`                                           | For swaps, the amount of token loaned out in the begin_swap ix precision: token mint precision                                                                                                                                                                       |
| `flash_loan_initial_token_amount`  | `u64`                                           | For swaps, the amount in the users token account in the begin_swap ix Used to calculate how much of the token left the system in end_swap ix precision: token mint precision                                                                                         |
| `total_swap_fee`                   | `u64`                                           | The total fees received from swaps precision: token mint precision                                                                                                                                                                                                   |
| `scale_initial_asset_weight_start` | `u64`                                           | When to begin scaling down the initial asset weight disabled when 0 precision: QUOTE_PRECISION                                                                                                                                                                       |
| `min_borrow_rate`                  | `u8`                                            | The min borrow rate for this market when the market regardless of utilization 1 => 1/200 => .5% precision: X/200                                                                                                                                                     |
| `fuel_boost_deposits`              | `u8`                                            | fuel multiplier for spot deposits precision: 10                                                                                                                                                                                                                      |
| `fuel_boost_borrows`               | `u8`                                            | fuel multiplier for spot borrows precision: 10                                                                                                                                                                                                                       |
| `fuel_boost_taker`                 | `u8`                                            | fuel multiplier for spot taker precision: 10                                                                                                                                                                                                                         |
| `fuel_boost_maker`                 | `u8`                                            | fuel multiplier for spot maker precision: 10                                                                                                                                                                                                                         |
| `fuel_boost_insurance`             | `u8`                                            | fuel multiplier for spot insurance stake precision: 10                                                                                                                                                                                                               |
| `token_program_flag`               | `u8`                                            |                                                                                                                                                                                                                                                                      |
| `pool_id`                          | `u8`                                            |                                                                                                                                                                                                                                                                      |
| `padding`                          | `[u8; 40]`                                      |                                                                                                                                                                                                                                                                      |

### `State`

Discriminator `d8926b5e684bb6b1` · `accounts::state::State`.

| Field                                | Type                                    |
| ------------------------------------ | --------------------------------------- |
| `admin`                              | `Pubkey`                                |
| `whitelist_mint`                     | `Pubkey`                                |
| `discount_mint`                      | `Pubkey`                                |
| `signer`                             | `Pubkey`                                |
| `srm_vault`                          | `Pubkey`                                |
| `perp_fee_structure`                 | [`FeeStructure`](#feestructure)         |
| `spot_fee_structure`                 | [`FeeStructure`](#feestructure)         |
| `oracle_guard_rails`                 | [`OracleGuardRails`](#oracleguardrails) |
| `number_of_authorities`              | `u64`                                   |
| `number_of_sub_accounts`             | `u64`                                   |
| `lp_cooldown_time`                   | `u64`                                   |
| `liquidation_margin_buffer_ratio`    | `u32`                                   |
| `settlement_duration`                | `u16`                                   |
| `number_of_markets`                  | `u16`                                   |
| `number_of_spot_markets`             | `u16`                                   |
| `signer_nonce`                       | `u8`                                    |
| `min_perp_auction_duration`          | `u8`                                    |
| `default_market_order_time_in_force` | `u8`                                    |
| `default_spot_auction_duration`      | `u8`                                    |
| `exchange_status`                    | `u8`                                    |
| `liquidation_duration`               | `u8`                                    |
| `initial_pct_to_liquidate`           | `u16`                                   |
| `max_number_of_sub_accounts`         | `u16`                                   |
| `max_initialize_user_fee`            | `u16`                                   |
| `feature_bit_flags`                  | `u8`                                    |
| `lp_pool_feature_bit_flags`          | `u8`                                    |
| `padding`                            | `[u8; 8]`                               |

### `User`

Discriminator `9f755fe3ef973aec` · `accounts::user::User`.

| Field                        | Type                                 | Description                                                                                                                                                                       |
| ---------------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `authority`                  | `Pubkey`                             | The owner/authority of the account                                                                                                                                                |
| `delegate`                   | `Pubkey`                             | An addresses that can control the account on the authority's behalf. Has limited power, cant withdraw                                                                             |
| `name`                       | `[u8; 32]`                           | Encoded display name e.g. "toly"                                                                                                                                                  |
| `spot_positions`             | [`[SpotPosition; 8]`](#spotposition) | The user's spot positions                                                                                                                                                         |
| `perp_positions`             | [`[PerpPosition; 8]`](#perpposition) | The user's perp positions                                                                                                                                                         |
| `orders`                     | [`[Order; 32]`](#order)              | The user's orders                                                                                                                                                                 |
| `last_add_perp_lp_shares_ts` | `i64`                                | The last time the user added perp lp positions                                                                                                                                    |
| `total_deposits`             | `u64`                                | The total values of deposits the user has made precision: QUOTE_PRECISION                                                                                                         |
| `total_withdraws`            | `u64`                                | The total values of withdrawals the user has made precision: QUOTE_PRECISION                                                                                                      |
| `total_social_loss`          | `u64`                                | The total socialized loss the users has incurred upon the protocol precision: QUOTE_PRECISION                                                                                     |
| `settled_perp_pnl`           | `i64`                                | Fees (taker fees, maker rebate, referrer reward, filler reward) and pnl for perps precision: QUOTE_PRECISION                                                                      |
| `cumulative_spot_fees`       | `i64`                                | Fees (taker fees, maker rebate, filler reward) for spot precision: QUOTE_PRECISION                                                                                                |
| `cumulative_perp_funding`    | `i64`                                | Cumulative funding paid/received for perps precision: QUOTE_PRECISION                                                                                                             |
| `liquidation_margin_freed`   | `u64`                                | The amount of margin freed during liquidation. Used to force the liquidation to occur over a period of time Defaults to zero when not being liquidated precision: QUOTE_PRECISION |
| `last_active_slot`           | `u64`                                | The last slot a user was active. Used to determine if a user is idle                                                                                                              |
| `next_order_id`              | `u32`                                | Every user order has an order id. This is the next order id to be used                                                                                                            |
| `max_margin_ratio`           | `u32`                                | Custom max initial margin ratio for the user                                                                                                                                      |
| `next_liquidation_id`        | `u16`                                | The next liquidation id to be used for user                                                                                                                                       |
| `sub_account_id`             | `u16`                                | The sub account id for this user                                                                                                                                                  |
| `status`                     | `u8`                                 | Whether the user is active, being liquidated or bankrupt                                                                                                                          |
| `is_margin_trading_enabled`  | `bool`                               | Whether the user has enabled margin trading                                                                                                                                       |
| `idle`                       | `bool`                               | User is idle if they haven't interacted with the protocol in 1 week and they have no orders, perp positions or borrows Off-chain keeper bots can ignore users that are idle       |
| `open_orders`                | `u8`                                 | number of open orders                                                                                                                                                             |
| `has_open_order`             | `bool`                               | Whether or not user has open order                                                                                                                                                |
| `open_auctions`              | `u8`                                 | number of open orders with auction                                                                                                                                                |
| `has_open_auction`           | `bool`                               | Whether or not user has open order with auction                                                                                                                                   |
| `margin_mode`                | [`MarginMode`](#marginmode)          |                                                                                                                                                                                   |
| `pool_id`                    | `u8`                                 |                                                                                                                                                                                   |
| `padding1`                   | `[u8; 3]`                            |                                                                                                                                                                                   |
| `last_fuel_bonus_update_ts`  | `u32`                                |                                                                                                                                                                                   |
| `padding`                    | `[u8; 12]`                           |                                                                                                                                                                                   |

### `UserStats`

Discriminator `b0df881b7a4f20e3` · `accounts::user_stats::UserStats`.

| Field                              | Type                    | Description                                                                                                                      |
| ---------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `authority`                        | `Pubkey`                | The authority for all of a users sub accounts                                                                                    |
| `referrer`                         | `Pubkey`                | The address that referred this user                                                                                              |
| `fees`                             | [`UserFees`](#userfees) | Stats on the fees paid by the user                                                                                               |
| `next_epoch_ts`                    | `i64`                   | The timestamp of the next epoch Epoch is used to limit referrer rewards earned in single epoch                                   |
| `maker_volume30d`                  | `u64`                   | Rolling 30day maker volume for user precision: QUOTE_PRECISION                                                                   |
| `taker_volume30d`                  | `u64`                   | Rolling 30day taker volume for user precision: QUOTE_PRECISION                                                                   |
| `filler_volume30d`                 | `u64`                   | Rolling 30day filler volume for user precision: QUOTE_PRECISION                                                                  |
| `last_maker_volume30d_ts`          | `i64`                   | last time the maker volume was updated                                                                                           |
| `last_taker_volume30d_ts`          | `i64`                   | last time the taker volume was updated                                                                                           |
| `last_filler_volume30d_ts`         | `i64`                   | last time the filler volume was updated                                                                                          |
| `if_staked_quote_asset_amount`     | `u64`                   | The amount of tokens staked in the quote spot markets if                                                                         |
| `number_of_sub_accounts`           | `u16`                   | The current number of sub accounts                                                                                               |
| `number_of_sub_accounts_created`   | `u16`                   | The number of sub accounts created. Can be greater than the number of sub accounts if user has deleted sub accounts              |
| `referrer_status`                  | `u8`                    | Flags for referrer status: First bit (LSB): 1 if user is a referrer, 0 otherwise Second bit: 1 if user was referred, 0 otherwise |
| `disable_update_perp_bid_ask_twap` | `u8`                    |                                                                                                                                  |
| `paused_operations`                | `u8`                    |                                                                                                                                  |
| `fuel_overflow_status`             | `u8`                    | whether the user has a FuelOverflow account                                                                                      |
| `fuel_insurance`                   | `u32`                   | accumulated fuel for token amounts of insurance                                                                                  |
| `fuel_deposits`                    | `u32`                   | accumulated fuel for notional of deposits                                                                                        |
| `fuel_borrows`                     | `u32`                   | accumulate fuel bonus for notional of borrows                                                                                    |
| `fuel_positions`                   | `u32`                   | accumulated fuel for perp open interest                                                                                          |
| `fuel_taker`                       | `u32`                   | accumulate fuel bonus for taker volume                                                                                           |
| `fuel_maker`                       | `u32`                   | accumulate fuel bonus for maker volume                                                                                           |
| `if_staked_gov_token_amount`       | `u64`                   | The amount of tokens staked in the governance spot markets if                                                                    |
| `last_fuel_if_bonus_update_ts`     | `u32`                   | last unix ts user stats data was used to update if fuel (u32 to save space)                                                      |
| `padding`                          | `[u8; 12]`              |                                                                                                                                  |

## Events

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

### `NewUserRecord`

Discriminator `ecba71db2a3395f9` · `events::new_user_record::NewUserRecordEvent`.

| Field            | Type       |
| ---------------- | ---------- |
| `ts`             | `i64`      |
| `user_authority` | `Pubkey`   |
| `user`           | `Pubkey`   |
| `sub_account_id` | `u16`      |
| `name`           | `[u8; 32]` |
| `referrer`       | `Pubkey`   |

### `DepositRecord`

Discriminator `b4f1dacf66872c86` · `events::deposit_record::DepositRecordEvent`.

| Field                                | Type                                        |
| ------------------------------------ | ------------------------------------------- |
| `ts`                                 | `i64`                                       |
| `user_authority`                     | `Pubkey`                                    |
| `user`                               | `Pubkey`                                    |
| `direction`                          | [`DepositDirection`](#depositdirection)     |
| `deposit_record_id`                  | `u64`                                       |
| `amount`                             | `u64`                                       |
| `market_index`                       | `u16`                                       |
| `oracle_price`                       | `i64`                                       |
| `market_deposit_balance`             | `u128`                                      |
| `market_withdraw_balance`            | `u128`                                      |
| `market_cumulative_deposit_interest` | `u128`                                      |
| `market_cumulative_borrow_interest`  | `u128`                                      |
| `total_deposits_after`               | `u64`                                       |
| `total_withdraws_after`              | `u64`                                       |
| `explanation`                        | [`DepositExplanation`](#depositexplanation) |
| `transfer_user`                      | `Option<Pubkey>`                            |
| `signer`                             | `Option<Pubkey>`                            |
| `user_token_amount_after`            | `i128`                                      |

### `SpotInterestRecord`

Discriminator `b7bacbbae1bb5f82` · `events::spot_interest_record::SpotInterestRecordEvent`.

| Field                         | Type   |
| ----------------------------- | ------ |
| `ts`                          | `i64`  |
| `market_index`                | `u16`  |
| `deposit_balance`             | `u128` |
| `cumulative_deposit_interest` | `u128` |
| `borrow_balance`              | `u128` |
| `cumulative_borrow_interest`  | `u128` |
| `optimal_utilization`         | `u32`  |
| `optimal_borrow_rate`         | `u32`  |
| `max_borrow_rate`             | `u32`  |

### `FundingPaymentRecord`

Discriminator `083b601489c9385f` · `events::funding_payment_record::FundingPaymentRecordEvent`.

| Field                          | Type     |
| ------------------------------ | -------- |
| `ts`                           | `i64`    |
| `user_authority`               | `Pubkey` |
| `user`                         | `Pubkey` |
| `market_index`                 | `u16`    |
| `funding_payment`              | `i64`    |
| `base_asset_amount`            | `i64`    |
| `user_last_cumulative_funding` | `i64`    |
| `amm_cumulative_funding_long`  | `i128`   |
| `amm_cumulative_funding_short` | `i128`   |

### `FundingRateRecord`

Discriminator `4403ff1a855b93fe` · `events::funding_rate_record::FundingRateRecordEvent`.

| Field                                 | Type   |
| ------------------------------------- | ------ |
| `ts`                                  | `i64`  |
| `record_id`                           | `u64`  |
| `market_index`                        | `u16`  |
| `funding_rate`                        | `i64`  |
| `funding_rate_long`                   | `i128` |
| `funding_rate_short`                  | `i128` |
| `cumulative_funding_rate_long`        | `i128` |
| `cumulative_funding_rate_short`       | `i128` |
| `oracle_price_twap`                   | `i64`  |
| `mark_price_twap`                     | `u64`  |
| `period_revenue`                      | `i64`  |
| `base_asset_amount_with_amm`          | `i128` |
| `base_asset_amount_with_unsettled_lp` | `i128` |

### `CurveRecord`

Discriminator `65ee28e4462e3d75` · `events::curve_record::CurveRecordEvent`.

| Field                           | Type   |
| ------------------------------- | ------ |
| `ts`                            | `i64`  |
| `record_id`                     | `u64`  |
| `peg_multiplier_before`         | `u128` |
| `base_asset_reserve_before`     | `u128` |
| `quote_asset_reserve_before`    | `u128` |
| `sqrt_k_before`                 | `u128` |
| `peg_multiplier_after`          | `u128` |
| `base_asset_reserve_after`      | `u128` |
| `quote_asset_reserve_after`     | `u128` |
| `sqrt_k_after`                  | `u128` |
| `base_asset_amount_long`        | `u128` |
| `base_asset_amount_short`       | `u128` |
| `base_asset_amount_with_amm`    | `i128` |
| `total_fee`                     | `i128` |
| `total_fee_minus_distributions` | `i128` |
| `adjustment_cost`               | `i128` |
| `oracle_price`                  | `i64`  |
| `fill_record`                   | `u128` |
| `number_of_users`               | `u32`  |
| `market_index`                  | `u16`  |

### `SignedMsgOrderRecord`

Discriminator `d3c519128e56711b` · `events::signed_msg_order_record::SignedMsgOrderRecordEvent`.

| Field                       | Type                          |
| --------------------------- | ----------------------------- |
| `user`                      | `Pubkey`                      |
| `hash`                      | `String`                      |
| `matching_order_params`     | [`OrderParams`](#orderparams) |
| `user_order_id`             | `u32`                         |
| `signed_msg_order_max_slot` | `u64`                         |
| `signed_msg_order_uuid`     | `[u8; 8]`                     |
| `ts`                        | `i64`                         |

### `OrderRecord`

Discriminator `681340385915025a` · `events::order_record::OrderRecordEvent`.

| Field   | Type              |
| ------- | ----------------- |
| `ts`    | `i64`             |
| `user`  | `Pubkey`          |
| `order` | [`Order`](#order) |

### `OrderActionRecord`

Discriminator `e0344347c2ed6d01` · `events::order_action_record::OrderActionRecordEvent`.

| Field                                              | Type                                                |
| -------------------------------------------------- | --------------------------------------------------- |
| `ts`                                               | `i64`                                               |
| `action`                                           | [`OrderAction`](#orderaction)                       |
| `action_explanation`                               | [`OrderActionExplanation`](#orderactionexplanation) |
| `market_index`                                     | `u16`                                               |
| `market_type`                                      | [`MarketType`](#markettype)                         |
| `filler`                                           | `Option<Pubkey>`                                    |
| `filler_reward`                                    | `Option<u64>`                                       |
| `fill_record_id`                                   | `Option<u64>`                                       |
| `base_asset_amount_filled`                         | `Option<u64>`                                       |
| `quote_asset_amount_filled`                        | `Option<u64>`                                       |
| `taker_fee`                                        | `Option<u64>`                                       |
| `maker_fee`                                        | `Option<i64>`                                       |
| `referrer_reward`                                  | `Option<u32>`                                       |
| `quote_asset_amount_surplus`                       | `Option<i64>`                                       |
| `spot_fulfillment_method_fee`                      | `Option<u64>`                                       |
| `taker`                                            | `Option<Pubkey>`                                    |
| `taker_order_id`                                   | `Option<u32>`                                       |
| `taker_order_direction`                            | [`Option<PositionDirection>`](#positiondirection)   |
| `taker_order_base_asset_amount`                    | `Option<u64>`                                       |
| `taker_order_cumulative_base_asset_amount_filled`  | `Option<u64>`                                       |
| `taker_order_cumulative_quote_asset_amount_filled` | `Option<u64>`                                       |
| `maker`                                            | `Option<Pubkey>`                                    |
| `maker_order_id`                                   | `Option<u32>`                                       |
| `maker_order_direction`                            | [`Option<PositionDirection>`](#positiondirection)   |
| `maker_order_base_asset_amount`                    | `Option<u64>`                                       |
| `maker_order_cumulative_base_asset_amount_filled`  | `Option<u64>`                                       |
| `maker_order_cumulative_quote_asset_amount_filled` | `Option<u64>`                                       |
| `oracle_price`                                     | `i64`                                               |
| `bit_flags`                                        | `u8`                                                |
| `taker_existing_quote_entry_amount`                | `Option<u64>`                                       |
| `taker_existing_base_asset_amount`                 | `Option<u64>`                                       |
| `maker_existing_quote_entry_amount`                | `Option<u64>`                                       |
| `maker_existing_base_asset_amount`                 | `Option<u64>`                                       |
| `trigger_price`                                    | `Option<u64>`                                       |
| `builder_idx`                                      | `Option<u8>`                                        |
| `builder_fee`                                      | `Option<u64>`                                       |

### `LPRecord`

Discriminator `65163626b20d8e6f` · `events::l_p_record::LPRecordEvent`.

| Field                      | Type                    |
| -------------------------- | ----------------------- |
| `ts`                       | `i64`                   |
| `user`                     | `Pubkey`                |
| `action`                   | [`LPAction`](#lpaction) |
| `n_shares`                 | `u64`                   |
| `market_index`             | `u16`                   |
| `delta_base_asset_amount`  | `i64`                   |
| `delta_quote_asset_amount` | `i64`                   |
| `pnl`                      | `i64`                   |

### `LiquidationRecord`

Discriminator `7f11006cb60de735` · `events::liquidation_record::LiquidationRecordEvent`.

| Field                            | Type                                                                    |
| -------------------------------- | ----------------------------------------------------------------------- |
| `ts`                             | `i64`                                                                   |
| `liquidation_type`               | [`LiquidationType`](#liquidationtype)                                   |
| `user`                           | `Pubkey`                                                                |
| `liquidator`                     | `Pubkey`                                                                |
| `margin_requirement`             | `u128`                                                                  |
| `total_collateral`               | `i128`                                                                  |
| `margin_freed`                   | `u64`                                                                   |
| `liquidation_id`                 | `u16`                                                                   |
| `bankrupt`                       | `bool`                                                                  |
| `canceled_order_ids`             | `Vec<u32>`                                                              |
| `liquidate_perp`                 | [`LiquidatePerpRecord`](#liquidateperprecord)                           |
| `liquidate_spot`                 | [`LiquidateSpotRecord`](#liquidatespotrecord)                           |
| `liquidate_borrow_for_perp_pnl`  | [`LiquidateBorrowForPerpPnlRecord`](#liquidateborrowforperppnlrecord)   |
| `liquidate_perp_pnl_for_deposit` | [`LiquidatePerpPnlForDepositRecord`](#liquidateperppnlfordepositrecord) |
| `perp_bankruptcy`                | [`PerpBankruptcyRecord`](#perpbankruptcyrecord)                         |
| `spot_bankruptcy`                | [`SpotBankruptcyRecord`](#spotbankruptcyrecord)                         |
| `bit_flags`                      | `u8`                                                                    |

### `SettlePnlRecord`

Discriminator `3944691a77c6d559` · `events::settle_pnl_record::SettlePnlRecordEvent`.

| Field                      | Type                                            |
| -------------------------- | ----------------------------------------------- |
| `ts`                       | `i64`                                           |
| `user`                     | `Pubkey`                                        |
| `market_index`             | `u16`                                           |
| `pnl`                      | `i128`                                          |
| `base_asset_amount`        | `i64`                                           |
| `quote_asset_amount_after` | `i64`                                           |
| `quote_entry_amount`       | `i64`                                           |
| `settle_price`             | `i64`                                           |
| `explanation`              | [`SettlePnlExplanation`](#settlepnlexplanation) |

### `InsuranceFundRecord`

Discriminator `38ded7eb4ec56392` · `events::insurance_fund_record::InsuranceFundRecordEvent`.

| Field                           | Type   |
| ------------------------------- | ------ |
| `ts`                            | `i64`  |
| `spot_market_index`             | `u16`  |
| `perp_market_index`             | `u16`  |
| `user_if_factor`                | `u32`  |
| `total_if_factor`               | `u32`  |
| `vault_amount_before`           | `u64`  |
| `insurance_vault_amount_before` | `u64`  |
| `total_if_shares_before`        | `u128` |
| `total_if_shares_after`         | `u128` |
| `amount`                        | `i64`  |

### `InsuranceFundStakeRecord`

Discriminator `44429c07d894fa72` · `events::insurance_fund_stake_record::InsuranceFundStakeRecordEvent`.

| Field                           | Type                          |
| ------------------------------- | ----------------------------- |
| `ts`                            | `i64`                         |
| `user_authority`                | `Pubkey`                      |
| `action`                        | [`StakeAction`](#stakeaction) |
| `amount`                        | `u64`                         |
| `market_index`                  | `u16`                         |
| `insurance_vault_amount_before` | `u64`                         |
| `if_shares_before`              | `u128`                        |
| `user_if_shares_before`         | `u128`                        |
| `total_if_shares_before`        | `u128`                        |
| `if_shares_after`               | `u128`                        |
| `user_if_shares_after`          | `u128`                        |
| `total_if_shares_after`         | `u128`                        |

### `InsuranceFundSwapRecord`

Discriminator `55be63cbed21e364` · `events::insurance_fund_swap_record::InsuranceFundSwapRecordEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `rebalance_config`            | `Pubkey` |
| `in_if_total_shares_before`   | `u128`   |
| `out_if_total_shares_before`  | `u128`   |
| `in_if_user_shares_before`    | `u128`   |
| `out_if_user_shares_before`   | `u128`   |
| `in_if_total_shares_after`    | `u128`   |
| `out_if_total_shares_after`   | `u128`   |
| `in_if_user_shares_after`     | `u128`   |
| `out_if_user_shares_after`    | `u128`   |
| `ts`                          | `i64`    |
| `in_amount`                   | `u64`    |
| `out_amount`                  | `u64`    |
| `out_oracle_price`            | `u64`    |
| `out_oracle_price_twap`       | `i64`    |
| `in_vault_amount_before`      | `u64`    |
| `out_vault_amount_before`     | `u64`    |
| `in_fund_vault_amount_after`  | `u64`    |
| `out_fund_vault_amount_after` | `u64`    |
| `in_market_index`             | `u16`    |
| `out_market_index`            | `u16`    |

### `TransferProtocolIfSharesToRevenuePoolRecord`

Discriminator `d1768ea7822ea497` · `events::transfer_protocol_if_shares_to_revenue_pool_record::TransferProtocolIfSharesToRevenuePoolRecordEvent`.

| Field                    | Type   |
| ------------------------ | ------ |
| `ts`                     | `i64`  |
| `market_index`           | `u16`  |
| `amount`                 | `u64`  |
| `shares`                 | `u128` |
| `if_vault_amount_before` | `u64`  |
| `protocol_shares_before` | `u128` |
| `transfer_amount`        | `u64`  |

### `SwapRecord`

Discriminator `a2bb7bc28a38faf1` · `events::swap_record::SwapRecordEvent`.

| Field              | Type     |
| ------------------ | -------- |
| `ts`               | `i64`    |
| `user`             | `Pubkey` |
| `amount_out`       | `u64`    |
| `amount_in`        | `u64`    |
| `out_market_index` | `u16`    |
| `in_market_index`  | `u16`    |
| `out_oracle_price` | `i64`    |
| `in_oracle_price`  | `i64`    |
| `fee`              | `u64`    |

### `SpotMarketVaultDepositRecord`

Discriminator `b2d917bc7fbe2049` · `events::spot_market_vault_deposit_record::SpotMarketVaultDepositRecordEvent`.

| Field                                | Type   |
| ------------------------------------ | ------ |
| `ts`                                 | `i64`  |
| `market_index`                       | `u16`  |
| `deposit_balance`                    | `u128` |
| `cumulative_deposit_interest_before` | `u128` |
| `cumulative_deposit_interest_after`  | `u128` |
| `deposit_token_amount_before`        | `u64`  |
| `amount`                             | `u64`  |

### `DeleteUserRecord`

Discriminator `476fbe76070384de` · `events::delete_user_record::DeleteUserRecordEvent`.

| Field            | Type             |
| ---------------- | ---------------- |
| `ts`             | `i64`            |
| `user_authority` | `Pubkey`         |
| `user`           | `Pubkey`         |
| `sub_account_id` | `u16`            |
| `keeper`         | `Option<Pubkey>` |

### `FuelSweepRecord`

Discriminator `295425f684f08308` · `events::fuel_sweep_record::FuelSweepRecordEvent`.

| Field                          | Type     |
| ------------------------------ | -------- |
| `ts`                           | `i64`    |
| `authority`                    | `Pubkey` |
| `user_stats_fuel_insurance`    | `u32`    |
| `user_stats_fuel_deposits`     | `u32`    |
| `user_stats_fuel_borrows`      | `u32`    |
| `user_stats_fuel_positions`    | `u32`    |
| `user_stats_fuel_taker`        | `u32`    |
| `user_stats_fuel_maker`        | `u32`    |
| `fuel_overflow_fuel_insurance` | `u128`   |
| `fuel_overflow_fuel_deposits`  | `u128`   |
| `fuel_overflow_fuel_borrows`   | `u128`   |
| `fuel_overflow_fuel_positions` | `u128`   |
| `fuel_overflow_fuel_taker`     | `u128`   |
| `fuel_overflow_fuel_maker`     | `u128`   |

### `FuelSeasonRecord`

Discriminator `13897721e0f90657` · `events::fuel_season_record::FuelSeasonRecordEvent`.

| Field            | Type     |
| ---------------- | -------- |
| `ts`             | `i64`    |
| `authority`      | `Pubkey` |
| `fuel_insurance` | `u128`   |
| `fuel_deposits`  | `u128`   |
| `fuel_borrows`   | `u128`   |
| `fuel_positions` | `u128`   |
| `fuel_taker`     | `u128`   |
| `fuel_maker`     | `u128`   |
| `fuel_total`     | `u128`   |

### `RevenueShareSettleRecord`

Discriminator `3da2590a18143b2d` · `events::revenue_share_settle_record::RevenueShareSettleRecordEvent`.

| Field                            | Type                        |
| -------------------------------- | --------------------------- |
| `ts`                             | `i64`                       |
| `builder`                        | `Option<Pubkey>`            |
| `referrer`                       | `Option<Pubkey>`            |
| `fee_settled`                    | `u64`                       |
| `market_index`                   | `u16`                       |
| `market_type`                    | [`MarketType`](#markettype) |
| `builder_sub_account_id`         | `u16`                       |
| `builder_total_referrer_rewards` | `u64`                       |
| `builder_total_builder_rewards`  | `u64`                       |

### `LPSettleRecord`

Discriminator `d0bf836ead300702` · `events::l_p_settle_record::LPSettleRecordEvent`.

| Field                   | Type     |
| ----------------------- | -------- |
| `record_id`             | `u64`    |
| `last_ts`               | `i64`    |
| `last_slot`             | `u64`    |
| `ts`                    | `i64`    |
| `slot`                  | `u64`    |
| `perp_market_index`     | `u16`    |
| `settle_to_lp_amount`   | `i64`    |
| `perp_amm_pnl_delta`    | `i64`    |
| `perp_amm_ex_fee_delta` | `i64`    |
| `lp_aum`                | `u128`   |
| `lp_price`              | `u128`   |
| `lp_pool`               | `Pubkey` |

### `LPSwapRecord`

Discriminator `9f3e82c4604fb0fe` · `events::l_p_swap_record::LPSwapRecordEvent`.

| Field                       | Type     |
| --------------------------- | -------- |
| `ts`                        | `i64`    |
| `slot`                      | `u64`    |
| `authority`                 | `Pubkey` |
| `out_amount`                | `u128`   |
| `in_amount`                 | `u128`   |
| `out_fee`                   | `i128`   |
| `in_fee`                    | `i128`   |
| `out_spot_market_index`     | `u16`    |
| `in_spot_market_index`      | `u16`    |
| `out_constituent_index`     | `u16`    |
| `in_constituent_index`      | `u16`    |
| `out_oracle_price`          | `i64`    |
| `in_oracle_price`           | `i64`    |
| `last_aum`                  | `u128`   |
| `last_aum_slot`             | `u64`    |
| `in_market_current_weight`  | `i64`    |
| `out_market_current_weight` | `i64`    |
| `in_market_target_weight`   | `i64`    |
| `out_market_target_weight`  | `i64`    |
| `in_swap_id`                | `u64`    |
| `out_swap_id`               | `u64`    |
| `lp_pool`                   | `Pubkey` |

### `LPMintRedeemRecord`

Discriminator `35b28e494e5b5b08` · `events::l_p_mint_redeem_record::LPMintRedeemRecordEvent`.

| Field                      | Type     |
| -------------------------- | -------- |
| `ts`                       | `i64`    |
| `slot`                     | `u64`    |
| `authority`                | `Pubkey` |
| `description`              | `u8`     |
| `amount`                   | `u128`   |
| `fee`                      | `i128`   |
| `spot_market_index`        | `u16`    |
| `constituent_index`        | `u16`    |
| `oracle_price`             | `i64`    |
| `mint`                     | `Pubkey` |
| `lp_amount`                | `u64`    |
| `lp_fee`                   | `i64`    |
| `lp_price`                 | `u128`   |
| `mint_redeem_id`           | `u64`    |
| `last_aum`                 | `u128`   |
| `last_aum_slot`            | `u64`    |
| `in_market_current_weight` | `i64`    |
| `in_market_target_weight`  | `i64`    |
| `lp_pool`                  | `Pubkey` |

### `LPBorrowLendDepositRecord`

Discriminator `f2b50b38f33d4fd2` · `events::l_p_borrow_lend_deposit_record::LPBorrowLendDepositRecordEvent`.

| Field                           | Type                                    |
| ------------------------------- | --------------------------------------- |
| `ts`                            | `i64`                                   |
| `slot`                          | `u64`                                   |
| `spot_market_index`             | `u16`                                   |
| `constituent_index`             | `u16`                                   |
| `direction`                     | [`DepositDirection`](#depositdirection) |
| `token_balance`                 | `i64`                                   |
| `last_token_balance`            | `i64`                                   |
| `interest_accrued_token_amount` | `i64`                                   |
| `amount_deposit_withdraw`       | `u64`                                   |
| `lp_pool`                       | `Pubkey`                                |

## Types

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

### `AddAmmConstituentMappingDatum`

Struct `types::AddAmmConstituentMappingDatum`.

| Field               | Type  |
| ------------------- | ----- |
| `constituent_index` | `u16` |
| `perp_market_index` | `u16` |
| `weight`            | `i64` |

### `AMM`

Struct `types::AMM`.

| Field                                  | Type                                            | Description                                                                                                                                                                                              |
| -------------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `oracle`                               | `Pubkey`                                        | oracle price data public key                                                                                                                                                                             |
| `historical_oracle_data`               | [`HistoricalOracleData`](#historicaloracledata) | stores historically witnessed oracle data                                                                                                                                                                |
| `base_asset_amount_per_lp`             | `i128`                                          | accumulated base asset amount since inception per lp share precision: QUOTE_PRECISION                                                                                                                    |
| `quote_asset_amount_per_lp`            | `i128`                                          | accumulated quote asset amount since inception per lp share precision: QUOTE_PRECISION                                                                                                                   |
| `fee_pool`                             | [`PoolBalance`](#poolbalance)                   | partition of fees from perp market trading moved from pnl settlements                                                                                                                                    |
| `base_asset_reserve`                   | `u128`                                          | `x` reserves for constant product mm formula (x \* y = k) precision: AMM_RESERVE_PRECISION                                                                                                               |
| `quote_asset_reserve`                  | `u128`                                          | `y` reserves for constant product mm formula (x \* y = k) precision: AMM_RESERVE_PRECISION                                                                                                               |
| `concentration_coef`                   | `u128`                                          | determines how close the min/max base asset reserve sit vs base reserves allow for decreasing slippage without increasing liquidity and v.v. precision: PERCENTAGE_PRECISION                             |
| `min_base_asset_reserve`               | `u128`                                          | minimum base_asset_reserve allowed before AMM is unavailable precision: AMM_RESERVE_PRECISION                                                                                                            |
| `max_base_asset_reserve`               | `u128`                                          | maximum base_asset_reserve allowed before AMM is unavailable precision: AMM_RESERVE_PRECISION                                                                                                            |
| `sqrt_k`                               | `u128`                                          | `sqrt(k)` in constant product mm formula (x \* y = k). stored to avoid drift caused by integer math issues precision: AMM_RESERVE_PRECISION                                                              |
| `peg_multiplier`                       | `u128`                                          | normalizing numerical factor for y, its use offers lowest slippage in cp-curve when market is balanced precision: PEG_PRECISION                                                                          |
| `terminal_quote_asset_reserve`         | `u128`                                          | y when market is balanced. stored to save computation precision: AMM_RESERVE_PRECISION                                                                                                                   |
| `base_asset_amount_long`               | `i128`                                          | always non-negative. tracks number of total longs in market (regardless of counterparty) precision: BASE_PRECISION                                                                                       |
| `base_asset_amount_short`              | `i128`                                          | always non-positive. tracks number of total shorts in market (regardless of counterparty) precision: BASE_PRECISION                                                                                      |
| `base_asset_amount_with_amm`           | `i128`                                          | tracks net position (longs-shorts) in market with AMM as counterparty precision: BASE_PRECISION                                                                                                          |
| `base_asset_amount_with_unsettled_lp`  | `i128`                                          | tracks net position (longs-shorts) in market with LPs as counterparty precision: BASE_PRECISION                                                                                                          |
| `max_open_interest`                    | `u128`                                          | max allowed open interest, blocks trades that breach this value precision: BASE_PRECISION                                                                                                                |
| `quote_asset_amount`                   | `i128`                                          | sum of all user's perp quote_asset_amount in market precision: QUOTE_PRECISION                                                                                                                           |
| `quote_entry_amount_long`              | `i128`                                          | sum of all long user's quote_entry_amount in market precision: QUOTE_PRECISION                                                                                                                           |
| `quote_entry_amount_short`             | `i128`                                          | sum of all short user's quote_entry_amount in market precision: QUOTE_PRECISION                                                                                                                          |
| `quote_break_even_amount_long`         | `i128`                                          | sum of all long user's quote_break_even_amount in market precision: QUOTE_PRECISION                                                                                                                      |
| `quote_break_even_amount_short`        | `i128`                                          | sum of all short user's quote_break_even_amount in market precision: QUOTE_PRECISION                                                                                                                     |
| `user_lp_shares`                       | `u128`                                          | total user lp shares of sqrt_k (protocol owned liquidity = sqrt_k - last_funding_rate) precision: AMM_RESERVE_PRECISION                                                                                  |
| `last_funding_rate`                    | `i64`                                           | last funding rate in this perp market (unit is quote per base) precision: FUNDING_RATE_PRECISION                                                                                                         |
| `last_funding_rate_long`               | `i64`                                           | last funding rate for longs in this perp market (unit is quote per base) precision: FUNDING_RATE_PRECISION                                                                                               |
| `last_funding_rate_short`              | `i64`                                           | last funding rate for shorts in this perp market (unit is quote per base) precision: QUOTE_PRECISION                                                                                                     |
| `last24h_avg_funding_rate`             | `i64`                                           | estimate of last 24h of funding rate perp market (unit is quote per base) precision: QUOTE_PRECISION                                                                                                     |
| `total_fee`                            | `i128`                                          | total fees collected by this perp market precision: QUOTE_PRECISION                                                                                                                                      |
| `total_mm_fee`                         | `i128`                                          | total fees collected by the vAMM's bid/ask spread precision: QUOTE_PRECISION                                                                                                                             |
| `total_exchange_fee`                   | `u128`                                          | total fees collected by exchange fee schedule precision: QUOTE_PRECISION                                                                                                                                 |
| `total_fee_minus_distributions`        | `i128`                                          | total fees minus any recognized upnl and pool withdraws precision: QUOTE_PRECISION                                                                                                                       |
| `total_fee_withdrawn`                  | `u128`                                          | sum of all fees from fee pool withdrawn to revenue pool precision: QUOTE_PRECISION                                                                                                                       |
| `total_liquidation_fee`                | `u128`                                          | all fees collected by market for liquidations precision: QUOTE_PRECISION                                                                                                                                 |
| `cumulative_funding_rate_long`         | `i128`                                          | accumulated funding rate for longs since inception in market                                                                                                                                             |
| `cumulative_funding_rate_short`        | `i128`                                          | accumulated funding rate for shorts since inception in market                                                                                                                                            |
| `total_social_loss`                    | `u128`                                          | accumulated social loss paid by users since inception in market                                                                                                                                          |
| `ask_base_asset_reserve`               | `u128`                                          | transformed base_asset_reserve for users going long precision: AMM_RESERVE_PRECISION                                                                                                                     |
| `ask_quote_asset_reserve`              | `u128`                                          | transformed quote_asset_reserve for users going long precision: AMM_RESERVE_PRECISION                                                                                                                    |
| `bid_base_asset_reserve`               | `u128`                                          | transformed base_asset_reserve for users going short precision: AMM_RESERVE_PRECISION                                                                                                                    |
| `bid_quote_asset_reserve`              | `u128`                                          | transformed quote_asset_reserve for users going short precision: AMM_RESERVE_PRECISION                                                                                                                   |
| `last_oracle_normalised_price`         | `i64`                                           | the last seen oracle price partially shrunk toward the amm reserve price precision: PRICE_PRECISION                                                                                                      |
| `last_oracle_reserve_price_spread_pct` | `i64`                                           | the gap between the oracle price and the reserve price = y \* peg_multiplier / x                                                                                                                         |
| `last_bid_price_twap`                  | `u64`                                           | average estimate of bid price over funding_period precision: PRICE_PRECISION                                                                                                                             |
| `last_ask_price_twap`                  | `u64`                                           | average estimate of ask price over funding_period precision: PRICE_PRECISION                                                                                                                             |
| `last_mark_price_twap`                 | `u64`                                           | average estimate of (bid+ask)/2 price over funding_period precision: PRICE_PRECISION                                                                                                                     |
| `last_mark_price_twap5min`             | `u64`                                           | average estimate of (bid+ask)/2 price over FIVE_MINUTES                                                                                                                                                  |
| `last_update_slot`                     | `u64`                                           | the last blockchain slot the amm was updated                                                                                                                                                             |
| `last_oracle_conf_pct`                 | `u64`                                           | the pct size of the oracle confidence interval precision: PERCENTAGE_PRECISION                                                                                                                           |
| `net_revenue_since_last_funding`       | `i64`                                           | the total_fee_minus_distribution change since the last funding update precision: QUOTE_PRECISION                                                                                                         |
| `last_funding_rate_ts`                 | `i64`                                           | the last funding rate update unix_timestamp                                                                                                                                                              |
| `funding_period`                       | `i64`                                           | the peridocity of the funding rate updates                                                                                                                                                               |
| `order_step_size`                      | `u64`                                           | the base step size (increment) of orders precision: BASE_PRECISION                                                                                                                                       |
| `order_tick_size`                      | `u64`                                           | the price tick size of orders precision: PRICE_PRECISION                                                                                                                                                 |
| `min_order_size`                       | `u64`                                           | the minimum base size of an order precision: BASE_PRECISION                                                                                                                                              |
| `mm_oracle_slot`                       | `u64`                                           | the max base size a single user can have precision: BASE_PRECISION                                                                                                                                       |
| `volume24h`                            | `u64`                                           | estimated total of volume in market QUOTE_PRECISION                                                                                                                                                      |
| `long_intensity_volume`                | `u64`                                           | the volume intensity of long fills against AMM                                                                                                                                                           |
| `short_intensity_volume`               | `u64`                                           | the volume intensity of short fills against AMM                                                                                                                                                          |
| `last_trade_ts`                        | `i64`                                           | the blockchain unix timestamp at the time of the last trade                                                                                                                                              |
| `mark_std`                             | `u64`                                           | estimate of standard deviation of the fill (mark) prices precision: PRICE_PRECISION                                                                                                                      |
| `oracle_std`                           | `u64`                                           | estimate of standard deviation of the oracle price at each update precision: PRICE_PRECISION                                                                                                             |
| `last_mark_price_twap_ts`              | `i64`                                           | the last unix_timestamp the mark twap was updated                                                                                                                                                        |
| `base_spread`                          | `u32`                                           | the minimum spread the AMM can quote. also used as step size for some spread logic increases.                                                                                                            |
| `max_spread`                           | `u32`                                           | the maximum spread the AMM can quote                                                                                                                                                                     |
| `long_spread`                          | `u32`                                           | the spread for asks vs the reserve price                                                                                                                                                                 |
| `short_spread`                         | `u32`                                           | the spread for bids vs the reserve price                                                                                                                                                                 |
| `mm_oracle_price`                      | `i64`                                           | MM oracle price                                                                                                                                                                                          |
| `max_fill_reserve_fraction`            | `u16`                                           | the fraction of total available liquidity a single fill on the AMM can consume                                                                                                                           |
| `max_slippage_ratio`                   | `u16`                                           | the maximum slippage a single fill on the AMM can push                                                                                                                                                   |
| `curve_update_intensity`               | `u8`                                            | the update intensity of AMM formulaic updates (adjusting k). 0-100                                                                                                                                       |
| `amm_jit_intensity`                    | `u8`                                            | the jit intensity of AMM. larger intensity means larger participation in jit. 0 means no jit participation. (0, 100] is intensity for protocol-owned AMM. (100, 200] is intensity for user LP-owned AMM. |
| `oracle_source`                        | [`OracleSource`](#oraclesource)                 | the oracle provider information. used to decode/scale the oracle public key                                                                                                                              |
| `last_oracle_valid`                    | `bool`                                          | tracks whether the oracle was considered valid at the last AMM update                                                                                                                                    |
| `target_base_asset_amount_per_lp`      | `i32`                                           | the target value for `base_asset_amount_per_lp`, used during AMM JIT with LP split precision: BASE_PRECISION                                                                                             |
| `per_lp_base`                          | `i8`                                            | expo for unit of per_lp, base 10 (if per_lp_base=X, then per_lp unit is 10^X)                                                                                                                            |
| `oracle_low_risk_slot_delay_override`  | `i8`                                            | the override for the state.min_perp_auction_duration 0 is no override, -1 is disable speed bump, 1-100 is literal speed bump                                                                             |
| `amm_spread_adjustment`                | `i8`                                            | signed scale amm_spread similar to fee_adjustment logic (-100 = 0, 100 = double)                                                                                                                         |
| `oracle_slot_delay_override`           | `i8`                                            |                                                                                                                                                                                                          |
| `mm_oracle_sequence_id`                | `u64`                                           |                                                                                                                                                                                                          |
| `net_unsettled_funding_pnl`            | `i64`                                           |                                                                                                                                                                                                          |
| `quote_asset_amount_with_unsettled_lp` | `i64`                                           |                                                                                                                                                                                                          |
| `reference_price_offset`               | `i32`                                           |                                                                                                                                                                                                          |
| `amm_inventory_spread_adjustment`      | `i8`                                            | signed scale amm_spread similar to fee_adjustment logic (-100 = 0, 100 = double)                                                                                                                         |
| `reference_price_offset_deadband_pct`  | `u8`                                            |                                                                                                                                                                                                          |
| `padding`                              | `[u8; 2]`                                       |                                                                                                                                                                                                          |
| `last_funding_oracle_twap`             | `i64`                                           |                                                                                                                                                                                                          |

### `AmmCacheFixed`

Struct `types::AmmCacheFixed`.

| Field  | Type      |
| ------ | --------- |
| `bump` | `u8`      |
| `pad`  | `[u8; 3]` |
| `len`  | `u32`     |

### `AmmConstituentDatum`

Struct `types::AmmConstituentDatum`.

| Field               | Type      | Description                                                              |
| ------------------- | --------- | ------------------------------------------------------------------------ |
| `perp_market_index` | `u16`     |                                                                          |
| `constituent_index` | `u16`     |                                                                          |
| `padding`           | `[u8; 4]` |                                                                          |
| `last_slot`         | `u64`     |                                                                          |
| `weight`            | `i64`     | PERCENTAGE_PRECISION. The weight this constituent has on the perp market |

### `AmmConstituentMappingFixed`

Struct `types::AmmConstituentMappingFixed`.

| Field     | Type      |
| --------- | --------- |
| `lp_pool` | `Pubkey`  |
| `bump`    | `u8`      |
| `pad`     | `[u8; 3]` |
| `len`     | `u32`     |

### `AssetTier`

Enum `types::AssetTier`.

| Variant      |
| ------------ |
| `Collateral` |
| `Protected`  |
| `Cross`      |
| `Isolated`   |
| `Unlisted`   |

### `AssetType`

Enum `types::AssetType`.

| Variant |
| ------- |
| `Base`  |
| `Quote` |

### `BuilderInfo`

Struct `types::BuilderInfo`.

| Field               | Type      |
| ------------------- | --------- |
| `authority`         | `Pubkey`  |
| `max_fee_tenth_bps` | `u16`     |
| `padding`           | `[u8; 6]` |

### `CacheInfo`

Struct `types::CacheInfo`.

| Field                            | Type       | Description    |
| -------------------------------- | ---------- | -------------- |
| `oracle`                         | `Pubkey`   |                |
| `last_fee_pool_token_amount`     | `u128`     |                |
| `last_net_pnl_pool_token_amount` | `i128`     |                |
| `last_exchange_fees`             | `u128`     |                |
| `last_settle_amm_ex_fees`        | `u128`     |                |
| `last_settle_amm_pnl`            | `i128`     |                |
| `position`                       | `i64`      | BASE PRECISION |
| `slot`                           | `u64`      |                |
| `last_settle_amount`             | `u64`      |                |
| `last_settle_slot`               | `u64`      |                |
| `last_settle_ts`                 | `i64`      |                |
| `quote_owed_from_lp_pool`        | `i64`      |                |
| `amm_inventory_limit`            | `i64`      |                |
| `oracle_price`                   | `i64`      |                |
| `oracle_slot`                    | `u64`      |                |
| `market_index`                   | `u16`      |                |
| `oracle_source`                  | `u8`       |                |
| `oracle_validity`                | `u8`       |                |
| `lp_status_for_perp_market`      | `u8`       |                |
| `amm_position_scalar`            | `u8`       |                |
| `padding`                        | `[u8; 34]` |                |

### `ConstituentCorrelationsFixed`

Struct `types::ConstituentCorrelationsFixed`.

| Field     | Type      | Description                                |
| --------- | --------- | ------------------------------------------ |
| `lp_pool` | `Pubkey`  |                                            |
| `bump`    | `u8`      |                                            |
| `pad`     | `[u8; 3]` |                                            |
| `len`     | `u32`     | total elements in the flattened `data` vec |

### `ConstituentLpOperation`

Enum `types::ConstituentLpOperation`.

| Variant    |
| ---------- |
| `Swap`     |
| `Deposit`  |
| `Withdraw` |

### `ConstituentParams`

Struct `types::ConstituentParams`.

| Field                          | Type          |
| ------------------------------ | ------------- |
| `max_weight_deviation`         | `Option<i64>` |
| `swap_fee_min`                 | `Option<i64>` |
| `swap_fee_max`                 | `Option<i64>` |
| `max_borrow_token_amount`      | `Option<u64>` |
| `oracle_staleness_threshold`   | `Option<u64>` |
| `cost_to_trade_bps`            | `Option<i32>` |
| `constituent_derivative_index` | `Option<i16>` |
| `derivative_weight`            | `Option<u64>` |
| `volatility`                   | `Option<u64>` |
| `gamma_execution`              | `Option<u8>`  |
| `gamma_inventory`              | `Option<u8>`  |
| `xi`                           | `Option<u8>`  |

### `ConstituentSpotBalance`

Struct `types::ConstituentSpotBalance`.

| Field                 | Type                                  | Description                                                                                                                                                         |
| --------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scaled_balance`      | `u128`                                | The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow interest of corresponding market. precision: token precision |
| `cumulative_deposits` | `i64`                                 | The cumulative deposits/borrows a user has made into a market precision: token mint precision                                                                       |
| `market_index`        | `u16`                                 | The market index of the corresponding spot market                                                                                                                   |
| `balance_type`        | [`SpotBalanceType`](#spotbalancetype) | Whether the position is deposit or borrow                                                                                                                           |
| `padding`             | `[u8; 5]`                             |                                                                                                                                                                     |

### `ConstituentStatus`

Enum `types::ConstituentStatus`.

| Variant          |
| ---------------- |
| `ReduceOnly`     |
| `Decommissioned` |

### `ConstituentTargetBaseFixed`

Struct `types::ConstituentTargetBaseFixed`.

| Field     | Type      | Description                                |
| --------- | --------- | ------------------------------------------ |
| `lp_pool` | `Pubkey`  |                                            |
| `bump`    | `u8`      |                                            |
| `pad`     | `[u8; 3]` |                                            |
| `len`     | `u32`     | total elements in the flattened `data` vec |

### `ContractTier`

Enum `types::ContractTier`.

| Variant             |
| ------------------- |
| `A`                 |
| `B`                 |
| `C`                 |
| `Speculative`       |
| `HighlySpeculative` |
| `Isolated`          |

### `ContractType`

Enum `types::ContractType`.

| Variant      |
| ------------ |
| `Perpetual`  |
| `Future`     |
| `Prediction` |

### `CurveRecord`

Struct `types::CurveRecord`. Same fields as the [`CurveRecord`](#curverecord) event.

### `DeleteUserRecord`

Struct `types::DeleteUserRecord`. Same fields as the [`DeleteUserRecord`](#deleteuserrecord) event.

### `DepositDirection`

Enum `types::DepositDirection`.

| Variant    |
| ---------- |
| `Deposit`  |
| `Withdraw` |

### `DepositExplanation`

Enum `types::DepositExplanation`.

| Variant       |
| ------------- |
| `None`        |
| `Transfer`    |
| `Borrow`      |
| `RepayBorrow` |
| `Reward`      |

### `DepositRecord`

Struct `types::DepositRecord`. Same fields as the [`DepositRecord`](#depositrecord) event.

### `DriftAction`

Enum `types::DriftAction`.

| Variant                 |
| ----------------------- |
| `UpdateFunding`         |
| `SettlePnl`             |
| `TriggerOrder`          |
| `FillOrderMatch`        |
| `FillOrderAmmLowRisk`   |
| `FillOrderAmmImmediate` |
| `Liquidate`             |
| `MarginCalc`            |
| `UpdateTwap`            |
| `UpdateAMMCurve`        |
| `OracleOrderPrice`      |
| `UseMMOraclePrice`      |
| `UpdateAmmCache`        |
| `UpdateLpPoolAum`       |
| `LpPoolSwap`            |

### `ExchangeStatus`

Enum `types::ExchangeStatus`.

| Variant                  |
| ------------------------ |
| `DepositPaused`          |
| `WithdrawPaused`         |
| `AmmPaused`              |
| `FillPaused`             |
| `LiqPaused`              |
| `FundingPaused`          |
| `SettlePnlPaused`        |
| `AmmImmediateFillPaused` |

### `FeatureBitFlags`

Enum `types::FeatureBitFlags`.

| Variant              |
| -------------------- |
| `MmOracleUpdate`     |
| `MedianTriggerPrice` |
| `BuilderCodes`       |
| `BuilderReferral`    |

### `FeeStructure`

Struct `types::FeeStructure`.

| Field                               | Type                                                        |
| ----------------------------------- | ----------------------------------------------------------- |
| `fee_tiers`                         | [`[FeeTier; 10]`](#feetier)                                 |
| `filler_reward_structure`           | [`OrderFillerRewardStructure`](#orderfillerrewardstructure) |
| `referrer_reward_epoch_upper_bound` | `u64`                                                       |
| `flat_filler_fee`                   | `u64`                                                       |

### `FeeTier`

Struct `types::FeeTier`.

| Field                         | Type  |
| ----------------------------- | ----- |
| `fee_numerator`               | `u32` |
| `fee_denominator`             | `u32` |
| `maker_rebate_numerator`      | `u32` |
| `maker_rebate_denominator`    | `u32` |
| `referrer_reward_numerator`   | `u32` |
| `referrer_reward_denominator` | `u32` |
| `referee_fee_numerator`       | `u32` |
| `referee_fee_denominator`     | `u32` |

### `FillMode`

Enum `types::FillMode`.

| Variant        | Fields       |
| -------------- | ------------ |
| `Fill`         |              |
| `PlaceAndMake` |              |
| `PlaceAndTake` | `bool`, `u8` |
| `Liquidation`  |              |

### `FuelOverflowStatus`

Enum `types::FuelOverflowStatus`.

| Variant  |
| -------- |
| `Exists` |

### `FuelSeasonRecord`

Struct `types::FuelSeasonRecord`. Same fields as the [`FuelSeasonRecord`](#fuelseasonrecord) event.

### `FuelSweepRecord`

Struct `types::FuelSweepRecord`. Same fields as the [`FuelSweepRecord`](#fuelsweeprecord) event.

### `FundingPaymentRecord`

Struct `types::FundingPaymentRecord`. Same fields as the [`FundingPaymentRecord`](#fundingpaymentrecord) event.

### `FundingRateRecord`

Struct `types::FundingRateRecord`. Same fields as the [`FundingRateRecord`](#fundingraterecord) event.

### `HistoricalIndexData`

Struct `types::HistoricalIndexData`.

| Field                       | Type  | Description                     |
| --------------------------- | ----- | ------------------------------- |
| `last_index_bid_price`      | `u64` | precision: PRICE_PRECISION      |
| `last_index_ask_price`      | `u64` | precision: PRICE_PRECISION      |
| `last_index_price_twap`     | `u64` | precision: PRICE_PRECISION      |
| `last_index_price_twap5min` | `u64` | precision: PRICE_PRECISION      |
| `last_index_price_twap_ts`  | `i64` | unix_timestamp of last snapshot |

### `HistoricalOracleData`

Struct `types::HistoricalOracleData`.

| Field                        | Type  | Description                       |
| ---------------------------- | ----- | --------------------------------- |
| `last_oracle_price`          | `i64` | precision: PRICE_PRECISION        |
| `last_oracle_conf`           | `u64` | precision: PRICE_PRECISION        |
| `last_oracle_delay`          | `i64` | number of slots since last update |
| `last_oracle_price_twap`     | `i64` | precision: PRICE_PRECISION        |
| `last_oracle_price_twap5min` | `i64` | precision: PRICE_PRECISION        |
| `last_oracle_price_twap_ts`  | `i64` | unix_timestamp of last snapshot   |

### `IfRebalanceConfigParams`

Struct `types::IfRebalanceConfigParams`.

| Field                 | Type  |
| --------------------- | ----- |
| `total_in_amount`     | `u64` |
| `epoch_max_in_amount` | `u64` |
| `epoch_duration`      | `i64` |
| `out_market_index`    | `u16` |
| `in_market_index`     | `u16` |
| `max_slippage_bps`    | `u16` |
| `swap_mode`           | `u8`  |
| `status`              | `u8`  |

### `InsuranceClaim`

Struct `types::InsuranceClaim`.

| Field                                | Type  | Description                                                                                                                                              |
| ------------------------------------ | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `revenue_withdraw_since_last_settle` | `i64` | The amount of revenue last settled Positive if funds left the perp market, negative if funds were pulled into the perp market precision: QUOTE_PRECISION |
| `max_revenue_withdraw_per_period`    | `u64` | The max amount of revenue that can be withdrawn per period precision: QUOTE_PRECISION                                                                    |
| `quote_max_insurance`                | `u64` | The max amount of insurance that perp market can use to resolve bankruptcy and pnl deficits precision: QUOTE_PRECISION                                   |
| `quote_settled_insurance`            | `u64` | The amount of insurance that has been used to resolve bankruptcy and pnl deficits precision: QUOTE_PRECISION                                             |
| `last_revenue_withdraw_ts`           | `i64` | The last time revenue was settled in/out of market                                                                                                       |

### `InsuranceFund`

Struct `types::InsuranceFund`.

| Field                    | Type     |
| ------------------------ | -------- |
| `vault`                  | `Pubkey` |
| `total_shares`           | `u128`   |
| `user_shares`            | `u128`   |
| `shares_base`            | `u128`   |
| `unstaking_period`       | `i64`    |
| `last_revenue_settle_ts` | `i64`    |
| `revenue_settle_period`  | `i64`    |
| `total_factor`           | `u32`    |
| `user_factor`            | `u32`    |

### `InsuranceFundOperation`

Enum `types::InsuranceFundOperation`.

| Variant         |
| --------------- |
| `Init`          |
| `Add`           |
| `RequestRemove` |
| `Remove`        |

### `InsuranceFundRecord`

Struct `types::InsuranceFundRecord`. Same fields as the [`InsuranceFundRecord`](#insurancefundrecord) event.

### `InsuranceFundStakeRecord`

Struct `types::InsuranceFundStakeRecord`. Same fields as the [`InsuranceFundStakeRecord`](#insurancefundstakerecord) event.

### `InsuranceFundSwapRecord`

Struct `types::InsuranceFundSwapRecord`. Same fields as the [`InsuranceFundSwapRecord`](#insurancefundswaprecord) event.

### `LiquidateBorrowForPerpPnlRecord`

Struct `types::LiquidateBorrowForPerpPnlRecord`.

| Field                    | Type   |
| ------------------------ | ------ |
| `perp_market_index`      | `u16`  |
| `market_oracle_price`    | `i64`  |
| `pnl_transfer`           | `u128` |
| `liability_market_index` | `u16`  |
| `liability_price`        | `i64`  |
| `liability_transfer`     | `u128` |

### `LiquidatePerpPnlForDepositRecord`

Struct `types::LiquidatePerpPnlForDepositRecord`.

| Field                 | Type   |
| --------------------- | ------ |
| `perp_market_index`   | `u16`  |
| `market_oracle_price` | `i64`  |
| `pnl_transfer`        | `u128` |
| `asset_market_index`  | `u16`  |
| `asset_price`         | `i64`  |
| `asset_transfer`      | `u128` |

### `LiquidatePerpRecord`

Struct `types::LiquidatePerpRecord`.

| Field                 | Type  | Description                      |
| --------------------- | ----- | -------------------------------- |
| `market_index`        | `u16` |                                  |
| `oracle_price`        | `i64` |                                  |
| `base_asset_amount`   | `i64` |                                  |
| `quote_asset_amount`  | `i64` |                                  |
| `lp_shares`           | `u64` | precision: AMM_RESERVE_PRECISION |
| `fill_record_id`      | `u64` |                                  |
| `user_order_id`       | `u32` |                                  |
| `liquidator_order_id` | `u32` |                                  |
| `liquidator_fee`      | `u64` | precision: QUOTE_PRECISION       |
| `if_fee`              | `u64` | precision: QUOTE_PRECISION       |

### `LiquidateSpotRecord`

Struct `types::LiquidateSpotRecord`.

| Field                    | Type   | Description                     |
| ------------------------ | ------ | ------------------------------- |
| `asset_market_index`     | `u16`  |                                 |
| `asset_price`            | `i64`  |                                 |
| `asset_transfer`         | `u128` |                                 |
| `liability_market_index` | `u16`  |                                 |
| `liability_price`        | `i64`  |                                 |
| `liability_transfer`     | `u128` | precision: token mint precision |
| `if_fee`                 | `u64`  | precision: token mint precision |

### `LiquidationBitFlag`

Enum `types::LiquidationBitFlag`.

| Variant            |
| ------------------ |
| `IsolatedPosition` |

### `LiquidationMultiplierType`

Enum `types::LiquidationMultiplierType`.

| Variant    |
| ---------- |
| `Discount` |
| `Premium`  |

### `LiquidationRecord`

Struct `types::LiquidationRecord`. Same fields as the [`LiquidationRecord`](#liquidationrecord) event.

### `LiquidationType`

Enum `types::LiquidationType`.

| Variant                      |
| ---------------------------- |
| `LiquidatePerp`              |
| `LiquidateSpot`              |
| `LiquidateBorrowForPerpPnl`  |
| `LiquidatePerpPnlForDeposit` |
| `PerpBankruptcy`             |
| `SpotBankruptcy`             |

### `LogMode`

Enum `types::LogMode`.

| Variant          |
| ---------------- |
| `None`           |
| `ExchangeOracle` |
| `MMOracle`       |
| `SafeMMOracle`   |
| `Margin`         |

### `LPAction`

Enum `types::LPAction`.

| Variant                 |
| ----------------------- |
| `AddLiquidity`          |
| `RemoveLiquidity`       |
| `SettleLiquidity`       |
| `RemoveLiquidityDerisk` |

### `LPBorrowLendDepositRecord`

Struct `types::LPBorrowLendDepositRecord`. Same fields as the [`LPBorrowLendDepositRecord`](#lpborrowlenddepositrecord) event.

### `LPMintRedeemRecord`

Struct `types::LPMintRedeemRecord`. Same fields as the [`LPMintRedeemRecord`](#lpmintredeemrecord) event.

### `LpPoolFeatureBitFlags`

Enum `types::LpPoolFeatureBitFlags`.

| Variant            |
| ------------------ |
| `SettleLpPool`     |
| `SwapLpPool`       |
| `MintRedeemLpPool` |

### `LpPoolParams`

Struct `types::LpPoolParams`.

| Field                     | Type             |
| ------------------------- | ---------------- |
| `max_settle_quote_amount` | `Option<u64>`    |
| `volatility`              | `Option<u64>`    |
| `gamma_execution`         | `Option<u8>`     |
| `xi`                      | `Option<u8>`     |
| `max_aum`                 | `Option<u128>`   |
| `whitelist_mint`          | `Option<Pubkey>` |

### `LPRecord`

Struct `types::LPRecord`. Same fields as the [`LPRecord`](#lprecord) event.

### `LPSettleRecord`

Struct `types::LPSettleRecord`. Same fields as the [`LPSettleRecord`](#lpsettlerecord) event.

### `LpStatus`

Enum `types::LpStatus`.

| Variant            |
| ------------------ |
| `Uncollateralized` |
| `Active`           |
| `Decommissioning`  |

### `LPSwapRecord`

Struct `types::LPSwapRecord`. Same fields as the [`LPSwapRecord`](#lpswaprecord) event.

### `MarginCalculationMode`

Enum `types::MarginCalculationMode`.

| Variant       | Fields                                                                                |
| ------------- | ------------------------------------------------------------------------------------- |
| `Standard`    |                                                                                       |
| `Liquidation` | `market_to_track_margin_requirement`: [`Option<MarketIdentifier>`](#marketidentifier) |

### `MarginMode`

Enum `types::MarginMode`.

| Variant                   |
| ------------------------- |
| `Default`                 |
| `HighLeverage`            |
| `HighLeverageMaintenance` |

### `MarginRequirementType`

Enum `types::MarginRequirementType`.

| Variant       |
| ------------- |
| `Initial`     |
| `Fill`        |
| `Maintenance` |

### `MarginTypeConfig`

Enum `types::MarginTypeConfig`.

| Variant                    | Fields                                                                                                                                                                                                                                                                                 |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Default`                  | [`MarginRequirementType`](#marginrequirementtype)                                                                                                                                                                                                                                      |
| `IsolatedPositionOverride` | `market_index`: `u16`, `margin_requirement_type`: [`MarginRequirementType`](#marginrequirementtype), `default_isolated_margin_requirement_type`: [`MarginRequirementType`](#marginrequirementtype), `cross_margin_requirement_type`: [`MarginRequirementType`](#marginrequirementtype) |
| `CrossMarginOverride`      | `margin_requirement_type`: [`MarginRequirementType`](#marginrequirementtype), `default_margin_requirement_type`: [`MarginRequirementType`](#marginrequirementtype)                                                                                                                     |

### `MarketConfigFlag`

Enum `types::MarketConfigFlag`.

| Variant                   |
| ------------------------- |
| `DisableFormulaicKUpdate` |

### `MarketIdentifier`

Struct `types::MarketIdentifier`.

| Field          | Type                        |
| -------------- | --------------------------- |
| `market_type`  | [`MarketType`](#markettype) |
| `market_index` | `u16`                       |

### `MarketStatus`

Enum `types::MarketStatus`.

| Variant          |
| ---------------- |
| `Initialized`    |
| `Active`         |
| `FundingPaused`  |
| `AmmPaused`      |
| `FillPaused`     |
| `WithdrawPaused` |
| `ReduceOnly`     |
| `Settlement`     |
| `Delisted`       |

### `MarketType`

Enum `types::MarketType`.

| Variant |
| ------- |
| `Spot`  |
| `Perp`  |

### `ModifyOrderId`

Enum `types::ModifyOrderId`.

| Variant       | Fields |
| ------------- | ------ |
| `UserOrderId` | `u8`   |
| `OrderId`     | `u32`  |

### `ModifyOrderParams`

Struct `types::ModifyOrderParams`.

| Field                 | Type                                                      |
| --------------------- | --------------------------------------------------------- |
| `direction`           | [`Option<PositionDirection>`](#positiondirection)         |
| `base_asset_amount`   | `Option<u64>`                                             |
| `price`               | `Option<u64>`                                             |
| `reduce_only`         | `Option<bool>`                                            |
| `post_only`           | [`Option<PostOnlyParam>`](#postonlyparam)                 |
| `bit_flags`           | `Option<u8>`                                              |
| `max_ts`              | `Option<i64>`                                             |
| `trigger_price`       | `Option<u64>`                                             |
| `trigger_condition`   | [`Option<OrderTriggerCondition>`](#ordertriggercondition) |
| `oracle_price_offset` | `Option<i32>`                                             |
| `auction_duration`    | `Option<u8>`                                              |
| `auction_start_price` | `Option<i64>`                                             |
| `auction_end_price`   | `Option<i64>`                                             |
| `policy`              | `Option<u8>`                                              |

### `ModifyOrderPolicy`

Enum `types::ModifyOrderPolicy`.

| Variant               |
| --------------------- |
| `MustModify`          |
| `ExcludePreviousFill` |

### `NewUserRecord`

Struct `types::NewUserRecord`. Same fields as the [`NewUserRecord`](#newuserrecord) event.

### `OracleGuardRails`

Struct `types::OracleGuardRails`.

| Field              | Type                                                      |
| ------------------ | --------------------------------------------------------- |
| `price_divergence` | [`PriceDivergenceGuardRails`](#pricedivergenceguardrails) |
| `validity`         | [`ValidityGuardRails`](#validityguardrails)               |

### `OracleSource`

Enum `types::OracleSource`.

| Variant               |
| --------------------- |
| `Pyth`                |
| `Switchboard`         |
| `QuoteAsset`          |
| `Pyth1K`              |
| `Pyth1M`              |
| `PythStableCoin`      |
| `Prelaunch`           |
| `PythPull`            |
| `Pyth1KPull`          |
| `Pyth1MPull`          |
| `PythStableCoinPull`  |
| `SwitchboardOnDemand` |
| `PythLazer`           |
| `PythLazer1K`         |
| `PythLazer1M`         |
| `PythLazerStableCoin` |

### `OracleValidity`

Enum `types::OracleValidity`.

| Variant                  | Fields                                  |
| ------------------------ | --------------------------------------- |
| `NonPositive`            |                                         |
| `TooVolatile`            |                                         |
| `TooUncertain`           |                                         |
| `StaleForMargin`         |                                         |
| `InsufficientDataPoints` |                                         |
| `StaleForAMM`            | `immediate`: `bool`, `low_risk`: `bool` |
| `Valid`                  |                                         |

### `Order`

Struct `types::Order`.

| Field                         | Type                                              | Description                                                                                                                                                           |
| ----------------------------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `slot`                        | `u64`                                             | The slot the order was placed                                                                                                                                         |
| `price`                       | `u64`                                             | The limit price for the order (can be 0 for market orders) For orders with an auction, this price isn't used until the auction is complete precision: PRICE_PRECISION |
| `base_asset_amount`           | `u64`                                             | The size of the order precision for perps: BASE_PRECISION precision for spot: token mint precision                                                                    |
| `base_asset_amount_filled`    | `u64`                                             | The amount of the order filled precision for perps: BASE_PRECISION precision for spot: token mint precision                                                           |
| `quote_asset_amount_filled`   | `u64`                                             | The amount of quote filled for the order precision: QUOTE_PRECISION                                                                                                   |
| `trigger_price`               | `u64`                                             | At what price the order will be triggered. Only relevant for trigger orders precision: PRICE_PRECISION                                                                |
| `auction_start_price`         | `i64`                                             | The start price for the auction. Only relevant for market/oracle orders precision: PRICE_PRECISION                                                                    |
| `auction_end_price`           | `i64`                                             | The end price for the auction. Only relevant for market/oracle orders precision: PRICE_PRECISION                                                                      |
| `max_ts`                      | `i64`                                             | The time when the order will expire                                                                                                                                   |
| `oracle_price_offset`         | `i32`                                             | If set, the order limit price is the oracle price + this offset precision: PRICE_PRECISION                                                                            |
| `order_id`                    | `u32`                                             | The id for the order. Each users has their own order id space                                                                                                         |
| `market_index`                | `u16`                                             | The perp/spot market index                                                                                                                                            |
| `status`                      | [`OrderStatus`](#orderstatus)                     | Whether the order is open or unused                                                                                                                                   |
| `order_type`                  | [`OrderType`](#ordertype)                         | The type of order                                                                                                                                                     |
| `market_type`                 | [`MarketType`](#markettype)                       | Whether market is spot or perp                                                                                                                                        |
| `user_order_id`               | `u8`                                              | User generated order id. Can make it easier to place/cancel orders                                                                                                    |
| `existing_position_direction` | [`PositionDirection`](#positiondirection)         | What the users position was when the order was placed                                                                                                                 |
| `direction`                   | [`PositionDirection`](#positiondirection)         | Whether the user is going long or short. LONG = bid, SHORT = ask                                                                                                      |
| `reduce_only`                 | `bool`                                            | Whether the order is allowed to only reduce position size                                                                                                             |
| `post_only`                   | `bool`                                            | Whether the order must be a maker                                                                                                                                     |
| `immediate_or_cancel`         | `bool`                                            | Whether the order must be canceled the same slot it is placed                                                                                                         |
| `trigger_condition`           | [`OrderTriggerCondition`](#ordertriggercondition) | Whether the order is triggered above or below the trigger price. Only relevant for trigger orders                                                                     |
| `auction_duration`            | `u8`                                              | How many slots the auction lasts                                                                                                                                      |
| `posted_slot_tail`            | `u8`                                              | Last 8 bits of the slot the order was posted on-chain (not order slot for signed msg orders)                                                                          |
| `bit_flags`                   | `u8`                                              | Bitflags for further classification 0: is_signed_message                                                                                                              |
| `padding`                     | `[u8; 1]`                                         |                                                                                                                                                                       |

### `OrderAction`

Enum `types::OrderAction`.

| Variant   |
| --------- |
| `Place`   |
| `Cancel`  |
| `Fill`    |
| `Trigger` |
| `Expire`  |

### `OrderActionExplanation`

Enum `types::OrderActionExplanation`.

| Variant                            |
| ---------------------------------- |
| `None`                             |
| `InsufficientFreeCollateral`       |
| `OraclePriceBreachedLimitPrice`    |
| `MarketOrderFilledToLimitPrice`    |
| `OrderExpired`                     |
| `Liquidation`                      |
| `OrderFilledWithAMM`               |
| `OrderFilledWithAMMJit`            |
| `OrderFilledWithMatch`             |
| `OrderFilledWithMatchJit`          |
| `MarketExpired`                    |
| `RiskingIncreasingOrder`           |
| `ReduceOnlyOrderIncreasedPosition` |
| `OrderFillWithSerum`               |
| `NoBorrowLiquidity`                |
| `OrderFillWithPhoenix`             |
| `OrderFilledWithAMMJitLPSplit`     |
| `OrderFilledWithLPJit`             |
| `DeriskLp`                         |
| `OrderFilledWithOpenbookV2`        |
| `TransferPerpPosition`             |

### `OrderActionRecord`

Struct `types::OrderActionRecord`. Same fields as the [`OrderActionRecord`](#orderactionrecord) event.

### `OrderBitFlag`

Enum `types::OrderBitFlag`.

| Variant                |
| ---------------------- |
| `SignedMessage`        |
| `OracleTriggerMarket`  |
| `SafeTriggerOrder`     |
| `NewTriggerReduceOnly` |
| `HasBuilder`           |
| `IsIsolatedPosition`   |

### `OrderFillerRewardStructure`

Struct `types::OrderFillerRewardStructure`.

| Field                           | Type   |
| ------------------------------- | ------ |
| `reward_numerator`              | `u32`  |
| `reward_denominator`            | `u32`  |
| `time_based_reward_lower_bound` | `u128` |

### `OrderParams`

Struct `types::OrderParams`.

| Field                 | Type                                              |
| --------------------- | ------------------------------------------------- |
| `order_type`          | [`OrderType`](#ordertype)                         |
| `market_type`         | [`MarketType`](#markettype)                       |
| `direction`           | [`PositionDirection`](#positiondirection)         |
| `user_order_id`       | `u8`                                              |
| `base_asset_amount`   | `u64`                                             |
| `price`               | `u64`                                             |
| `market_index`        | `u16`                                             |
| `reduce_only`         | `bool`                                            |
| `post_only`           | [`PostOnlyParam`](#postonlyparam)                 |
| `bit_flags`           | `u8`                                              |
| `max_ts`              | `Option<i64>`                                     |
| `trigger_price`       | `Option<u64>`                                     |
| `trigger_condition`   | [`OrderTriggerCondition`](#ordertriggercondition) |
| `oracle_price_offset` | `Option<i32>`                                     |
| `auction_duration`    | `Option<u8>`                                      |
| `auction_start_price` | `Option<i64>`                                     |
| `auction_end_price`   | `Option<i64>`                                     |

### `OrderParamsBitFlag`

Enum `types::OrderParamsBitFlag`.

| Variant                  |
| ------------------------ |
| `ImmediateOrCancel`      |
| `UpdateHighLeverageMode` |

### `OrderRecord`

Struct `types::OrderRecord`. Same fields as the [`OrderRecord`](#orderrecord) event.

### `OrderStatus`

Enum `types::OrderStatus`.

| Variant    |
| ---------- |
| `Init`     |
| `Open`     |
| `Filled`   |
| `Canceled` |

### `OrderTriggerCondition`

Enum `types::OrderTriggerCondition`.

| Variant          |
| ---------------- |
| `Above`          |
| `Below`          |
| `TriggeredAbove` |
| `TriggeredBelow` |

### `OrderType`

Enum `types::OrderType`.

| Variant         |
| --------------- |
| `Market`        |
| `Limit`         |
| `TriggerMarket` |
| `TriggerLimit`  |
| `Oracle`        |

### `OverrideAmmCacheParams`

Struct `types::OverrideAmmCacheParams`.

| Field                            | Type           |
| -------------------------------- | -------------- |
| `quote_owed_from_lp_pool`        | `Option<i64>`  |
| `last_settle_slot`               | `Option<u64>`  |
| `last_fee_pool_token_amount`     | `Option<u128>` |
| `last_net_pnl_pool_token_amount` | `Option<i128>` |
| `amm_position_scalar`            | `Option<u8>`   |
| `amm_inventory_limit`            | `Option<i64>`  |

### `PerpBankruptcyRecord`

Struct `types::PerpBankruptcyRecord`.

| Field                           | Type             |
| ------------------------------- | ---------------- |
| `market_index`                  | `u16`            |
| `pnl`                           | `i128`           |
| `if_payment`                    | `u128`           |
| `clawback_user`                 | `Option<Pubkey>` |
| `clawback_user_payment`         | `Option<u128>`   |
| `cumulative_funding_rate_delta` | `i128`           |

### `PerpFulfillmentMethod`

Enum `types::PerpFulfillmentMethod`.

| Variant | Fields                 |
| ------- | ---------------------- |
| `AMM`   | `Option<u64>`          |
| `Match` | `Pubkey`, `u16`, `u64` |

### `PerpLpOperation`

Enum `types::PerpLpOperation`.

| Variant           |
| ----------------- |
| `TrackAmmRevenue` |
| `SettleQuoteOwed` |

### `PerpOperation`

Enum `types::PerpOperation`.

| Variant                 |
| ----------------------- |
| `UpdateFunding`         |
| `AmmFill`               |
| `Fill`                  |
| `SettlePnl`             |
| `SettlePnlWithPosition` |
| `Liquidation`           |
| `AmmImmediateFill`      |
| `SettleRevPool`         |

### `PerpPosition`

Struct `types::PerpPosition`.

| Field                              | Type      | Description                                                                                                                                                                                                      |
| ---------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `last_cumulative_funding_rate`     | `i64`     | The perp market's last cumulative funding rate. Used to calculate the funding payment owed to user precision: FUNDING_RATE_PRECISION                                                                             |
| `base_asset_amount`                | `i64`     | the size of the users perp position precision: BASE_PRECISION                                                                                                                                                    |
| `quote_asset_amount`               | `i64`     | Used to calculate the users pnl. Upon entry, is equal to base_asset_amount \* avg entry price - fees Updated when the user open/closes position or settles pnl. Includes fees/funding precision: QUOTE_PRECISION |
| `quote_break_even_amount`          | `i64`     | The amount of quote the user would need to exit their position at to break even Updated when the user open/closes position or settles pnl. Includes fees/funding precision: QUOTE_PRECISION                      |
| `quote_entry_amount`               | `i64`     | The amount quote the user entered the position with. Equal to base asset amount \* avg entry price Updated when the user open/closes position. Excludes fees/funding precision: QUOTE_PRECISION                  |
| `open_bids`                        | `i64`     | The amount of non reduce only trigger orders the user has open precision: BASE_PRECISION                                                                                                                         |
| `open_asks`                        | `i64`     | The amount of non reduce only trigger orders the user has open precision: BASE_PRECISION                                                                                                                         |
| `settled_pnl`                      | `i64`     | The amount of pnl settled in this market since opening the position precision: QUOTE_PRECISION                                                                                                                   |
| `lp_shares`                        | `u64`     | The number of lp (liquidity provider) shares the user has in this perp market LP shares allow users to provide liquidity via the AMM precision: BASE_PRECISION                                                   |
| `isolated_position_scaled_balance` | `u64`     | The scaled balance of the isolated position precision: SPOT_BALANCE_PRECISION                                                                                                                                    |
| `last_quote_asset_amount_per_lp`   | `i64`     | The last quote asset amount per lp the amm had Used to settle the users lp position precision: QUOTE_PRECISION                                                                                                   |
| `padding`                          | `[u8; 2]` |                                                                                                                                                                                                                  |
| `max_margin_ratio`                 | `u16`     |                                                                                                                                                                                                                  |
| `market_index`                     | `u16`     | The market index for the perp market                                                                                                                                                                             |
| `open_orders`                      | `u8`      | The number of open orders                                                                                                                                                                                        |
| `position_flag`                    | `u8`      |                                                                                                                                                                                                                  |

### `PlaceAndTakeOrderSuccessCondition`

Enum `types::PlaceAndTakeOrderSuccessCondition`.

| Variant       |
| ------------- |
| `PartialFill` |
| `FullFill`    |

### `PoolBalance`

Struct `types::PoolBalance`.

| Field            | Type      | Description                                                                                                                                        |
| ---------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scaled_balance` | `u128`    | To get the pool's token amount, you must multiply the scaled balance by the market's cumulative deposit interest precision: SPOT_BALANCE_PRECISION |
| `market_index`   | `u16`     | The spot market the pool is for                                                                                                                    |
| `padding`        | `[u8; 6]` |                                                                                                                                                    |

### `PositionDirection`

Enum `types::PositionDirection`.

| Variant |
| ------- |
| `Long`  |
| `Short` |

### `PositionFlag`

Enum `types::PositionFlag`.

| Variant            |
| ------------------ |
| `IsolatedPosition` |
| `BeingLiquidated`  |
| `Bankrupt`         |

### `PositionUpdateType`

Enum `types::PositionUpdateType`.

| Variant    |
| ---------- |
| `Open`     |
| `Increase` |
| `Reduce`   |
| `Close`    |
| `Flip`     |

### `PostOnlyParam`

Enum `types::PostOnlyParam`.

| Variant        |
| -------------- |
| `None`         |
| `MustPostOnly` |
| `TryPostOnly`  |
| `Slide`        |

### `PrelaunchOracleParams`

Struct `types::PrelaunchOracleParams`.

| Field               | Type          |
| ------------------- | ------------- |
| `perp_market_index` | `u16`         |
| `price`             | `Option<i64>` |
| `max_price`         | `Option<i64>` |

### `PriceDivergenceGuardRails`

Struct `types::PriceDivergenceGuardRails`.

| Field                                | Type  |
| ------------------------------------ | ----- |
| `mark_oracle_percent_divergence`     | `u64` |
| `oracle_twap5min_percent_divergence` | `u64` |

### `ReferrerStatus`

Enum `types::ReferrerStatus`.

| Variant           |
| ----------------- |
| `IsReferrer`      |
| `IsReferred`      |
| `BuilderReferral` |

### `RevenueShareEscrowFixed`

Struct `types::RevenueShareEscrowFixed`.

| Field                          | Type       |
| ------------------------------ | ---------- |
| `authority`                    | `Pubkey`   |
| `referrer`                     | `Pubkey`   |
| `referrer_boost_expire_ts`     | `u32`      |
| `referrer_reward_offset`       | `i8`       |
| `referee_fee_numerator_offset` | `i8`       |
| `referrer_boost_numerator`     | `i8`       |
| `reserved_fixed`               | `[u8; 17]` |

### `RevenueShareOrder`

Struct `types::RevenueShareOrder`.

| Field              | Type                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------ | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fees_accrued`     | `u64`                       | fees accrued so far for this order slot. This is not exclusively fees from this order_id and may include fees from other orders in the same market. This may be swept to the builder's SpotPosition during settle_pnl.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `order_id`         | `u32`                       | the order_id of the current active order in this slot. It's only relevant while bit_flag = Open                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `fee_tenth_bps`    | `u16`                       | the builder fee on this order, in tenths of a bps, e.g. 100 = 0.01%                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `market_index`     | `u16`                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `sub_account_id`   | `u16`                       | the subaccount_id of the user who created this order. It's only relevant while bit_flag = Open                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `builder_idx`      | `u8`                        | the index of the RevenueShareEscrow\.approved_builders list, that this order's fee will settle to. Ignored if bit_flag = Referral.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `bit_flags`        | `u8`                        | bitflags that describe the state of the order. \[`RevenueShareOrderBitFlag::Init`]: this order slot is available for use. \[`RevenueShareOrderBitFlag::Open`]: this order slot is occupied, `order_id` is the `sub_account_id`'s active order. \[`RevenueShareOrderBitFlag::Completed`]: this order has been filled or canceled, and is waiting to be settled into. the builder's account order_id and sub_account_id are no longer relevant, it may be merged with other orders. \[`RevenueShareOrderBitFlag::Referral`]: this order stores referral rewards waiting to be settled for this market. If it is set, no other bitflag should be set. |
| `user_order_index` | `u8`                        | the index into the User's orders list when this RevenueShareOrder was created, make sure to verify that order_id matches.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `market_type`      | [`MarketType`](#markettype) |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `padding`          | `[u8; 10]`                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

### `RevenueShareOrderBitFlag`

Enum `types::RevenueShareOrderBitFlag`.

| Variant     |
| ----------- |
| `Init`      |
| `Open`      |
| `Completed` |
| `Referral`  |

### `RevenueShareSettleRecord`

Struct `types::RevenueShareSettleRecord`. Same fields as the [`RevenueShareSettleRecord`](#revenuesharesettlerecord) event.

### `ScaleOrderParams`

> _From the program's IDL:_
>
> Parameters for placing scale orders - multiple limit orders distributed across a price range

Struct `types::ScaleOrderParams`.

| Field                     | Type                                      | Description                                             |
| ------------------------- | ----------------------------------------- | ------------------------------------------------------- |
| `market_type`             | [`MarketType`](#markettype)               |                                                         |
| `direction`               | [`PositionDirection`](#positiondirection) |                                                         |
| `market_index`            | `u16`                                     |                                                         |
| `total_base_asset_amount` | `u64`                                     | Total base asset amount to distribute across all orders |
| `start_price`             | `u64`                                     | Starting price for the scale (in PRICE_PRECISION)       |
| `end_price`               | `u64`                                     | Ending price for the scale (in PRICE_PRECISION)         |
| `order_count`             | `u8`                                      | Number of orders to place (min 2, max 32)               |
| `size_distribution`       | [`SizeDistribution`](#sizedistribution)   | How to distribute sizes across orders                   |
| `reduce_only`             | `bool`                                    | Whether orders should be reduce-only                    |
| `post_only`               | [`PostOnlyParam`](#postonlyparam)         | Post-only setting for all orders                        |
| `bit_flags`               | `u8`                                      | Bit flags (e.g., for high leverage mode)                |
| `max_ts`                  | `Option<i64>`                             | Maximum timestamp for orders to be valid                |

### `SettlementDirection`

Enum `types::SettlementDirection`.

| Variant      |
| ------------ |
| `ToLpPool`   |
| `FromLpPool` |
| `None`       |

### `SettlePnlExplanation`

Enum `types::SettlePnlExplanation`.

| Variant           |
| ----------------- |
| `None`            |
| `ExpiredPosition` |

### `SettlePnlMode`

Enum `types::SettlePnlMode`.

| Variant      |
| ------------ |
| `MustSettle` |
| `TrySettle`  |

### `SettlePnlRecord`

Struct `types::SettlePnlRecord`. Same fields as the [`SettlePnlRecord`](#settlepnlrecord) event.

### `SignatureVerificationError`

Enum `types::SignatureVerificationError`.

| Variant                               |
| ------------------------------------- |
| `InvalidEd25519InstructionProgramId`  |
| `InvalidEd25519InstructionDataLength` |
| `InvalidSignatureIndex`               |
| `InvalidSignatureOffset`              |
| `InvalidPublicKeyOffset`              |
| `InvalidMessageOffset`                |
| `InvalidMessageDataSize`              |
| `InvalidInstructionIndex`             |
| `MessageOffsetOverflow`               |
| `InvalidMessageHex`                   |
| `InvalidMessageData`                  |
| `LoadInstructionAtFailed`             |

### `SignedMsgOrderId`

Struct `types::SignedMsgOrderId`.

| Field      | Type      |
| ---------- | --------- |
| `uuid`     | `[u8; 8]` |
| `max_slot` | `u64`     |
| `order_id` | `u32`     |
| `padding`  | `u32`     |

### `SignedMsgOrderParamsDelegateMessage`

Struct `types::SignedMsgOrderParamsDelegateMessage`.

| Field                       | Type                                                                  |
| --------------------------- | --------------------------------------------------------------------- |
| `signed_msg_order_params`   | [`OrderParams`](#orderparams)                                         |
| `taker_pubkey`              | `Pubkey`                                                              |
| `slot`                      | `u64`                                                                 |
| `uuid`                      | `[u8; 8]`                                                             |
| `take_profit_order_params`  | [`Option<SignedMsgTriggerOrderParams>`](#signedmsgtriggerorderparams) |
| `stop_loss_order_params`    | [`Option<SignedMsgTriggerOrderParams>`](#signedmsgtriggerorderparams) |
| `max_margin_ratio`          | `Option<u16>`                                                         |
| `builder_idx`               | `Option<u8>`                                                          |
| `builder_fee_tenth_bps`     | `Option<u16>`                                                         |
| `isolated_position_deposit` | `Option<u64>`                                                         |

### `SignedMsgOrderParamsMessage`

Struct `types::SignedMsgOrderParamsMessage`.

| Field                       | Type                                                                  |
| --------------------------- | --------------------------------------------------------------------- |
| `signed_msg_order_params`   | [`OrderParams`](#orderparams)                                         |
| `sub_account_id`            | `u16`                                                                 |
| `slot`                      | `u64`                                                                 |
| `uuid`                      | `[u8; 8]`                                                             |
| `take_profit_order_params`  | [`Option<SignedMsgTriggerOrderParams>`](#signedmsgtriggerorderparams) |
| `stop_loss_order_params`    | [`Option<SignedMsgTriggerOrderParams>`](#signedmsgtriggerorderparams) |
| `max_margin_ratio`          | `Option<u16>`                                                         |
| `builder_idx`               | `Option<u8>`                                                          |
| `builder_fee_tenth_bps`     | `Option<u16>`                                                         |
| `isolated_position_deposit` | `Option<u64>`                                                         |

### `SignedMsgOrderRecord`

Struct `types::SignedMsgOrderRecord`. Same fields as the [`SignedMsgOrderRecord`](#signedmsgorderrecord) event.

### `SignedMsgTriggerOrderParams`

Struct `types::SignedMsgTriggerOrderParams`.

| Field               | Type  |
| ------------------- | ----- |
| `trigger_price`     | `u64` |
| `base_asset_amount` | `u64` |

### `SignedMsgUserOrdersFixed`

Struct `types::SignedMsgUserOrdersFixed`.

| Field         | Type     |
| ------------- | -------- |
| `user_pubkey` | `Pubkey` |
| `padding`     | `u32`    |
| `len`         | `u32`    |

### `SizeDistribution`

> _From the program's IDL:_
>
> How to distribute order sizes across scale orders

Enum `types::SizeDistribution`.

| Variant      |
| ------------ |
| `Flat`       |
| `Ascending`  |
| `Descending` |

### `SpotBalanceType`

Enum `types::SpotBalanceType`.

| Variant   |
| --------- |
| `Deposit` |
| `Borrow`  |

### `SpotBankruptcyRecord`

Struct `types::SpotBankruptcyRecord`.

| Field                               | Type   |
| ----------------------------------- | ------ |
| `market_index`                      | `u16`  |
| `borrow_amount`                     | `u128` |
| `if_payment`                        | `u128` |
| `cumulative_deposit_interest_delta` | `u128` |

### `SpotFulfillmentConfigStatus`

Enum `types::SpotFulfillmentConfigStatus`.

| Variant    |
| ---------- |
| `Enabled`  |
| `Disabled` |

### `SpotFulfillmentMethod`

Enum `types::SpotFulfillmentMethod`.

| Variant          | Fields          |
| ---------------- | --------------- |
| `ExternalMarket` |                 |
| `Match`          | `Pubkey`, `u16` |

### `SpotFulfillmentType`

Enum `types::SpotFulfillmentType`.

| Variant      |
| ------------ |
| `SerumV3`    |
| `Match`      |
| `PhoenixV1`  |
| `OpenbookV2` |

### `SpotInterestRecord`

Struct `types::SpotInterestRecord`. Same fields as the [`SpotInterestRecord`](#spotinterestrecord) event.

### `SpotMarketVaultDepositRecord`

Struct `types::SpotMarketVaultDepositRecord`. Same fields as the [`SpotMarketVaultDepositRecord`](#spotmarketvaultdepositrecord) event.

### `SpotOperation`

Enum `types::SpotOperation`.

| Variant                    |
| -------------------------- |
| `UpdateCumulativeInterest` |
| `Fill`                     |
| `Deposit`                  |
| `Withdraw`                 |
| `Liquidation`              |

### `SpotPosition`

Struct `types::SpotPosition`.

| Field                 | Type                                  | Description                                                                                                                                                                |
| --------------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scaled_balance`      | `u64`                                 | The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow interest of corresponding market. precision: SPOT_BALANCE_PRECISION |
| `open_bids`           | `i64`                                 | How many spot non reduce only trigger orders the user has open precision: token mint precision                                                                             |
| `open_asks`           | `i64`                                 | How many spot non reduce only trigger orders the user has open precision: token mint precision                                                                             |
| `cumulative_deposits` | `i64`                                 | The cumulative deposits/borrows a user has made into a market precision: token mint precision                                                                              |
| `market_index`        | `u16`                                 | The market index of the corresponding spot market                                                                                                                          |
| `balance_type`        | [`SpotBalanceType`](#spotbalancetype) | Whether the position is deposit or borrow                                                                                                                                  |
| `open_orders`         | `u8`                                  | Number of open orders                                                                                                                                                      |
| `padding`             | `[u8; 4]`                             |                                                                                                                                                                            |

### `StakeAction`

Enum `types::StakeAction`.

| Variant                |
| ---------------------- |
| `Stake`                |
| `UnstakeRequest`       |
| `UnstakeCancelRequest` |
| `Unstake`              |
| `UnstakeTransfer`      |
| `StakeTransfer`        |
| `AdminDeposit`         |

### `SwapDirection`

Enum `types::SwapDirection`.

| Variant  |
| -------- |
| `Add`    |
| `Remove` |

### `SwapRecord`

Struct `types::SwapRecord`. Same fields as the [`SwapRecord`](#swaprecord) event.

### `SwapReduceOnly`

Enum `types::SwapReduceOnly`.

| Variant |
| ------- |
| `In`    |
| `Out`   |

### `TargetsDatum`

Struct `types::TargetsDatum`.

| Field                | Type      |
| -------------------- | --------- |
| `cost_to_trade_bps`  | `i32`     |
| `padding`            | `[u8; 4]` |
| `target_base`        | `i64`     |
| `last_oracle_slot`   | `u64`     |
| `last_position_slot` | `u64`     |

### `TokenProgramFlag`

Enum `types::TokenProgramFlag`.

| Variant        |
| -------------- |
| `Token2022`    |
| `TransferHook` |

### `TransferProtocolIfSharesToRevenuePoolRecord`

Struct `types::TransferProtocolIfSharesToRevenuePoolRecord`. Same fields as the [`TransferProtocolIfSharesToRevenuePoolRecord`](#transferprotocolifsharestorevenuepoolrecord) event.

### `TwapPeriod`

Enum `types::TwapPeriod`.

| Variant         |
| --------------- |
| `FundingPeriod` |
| `FiveMin`       |

### `UpdatePerpMarketSummaryStatsParams`

Struct `types::UpdatePerpMarketSummaryStatsParams`.

| Field                                  | Type           |
| -------------------------------------- | -------------- |
| `quote_asset_amount_with_unsettled_lp` | `Option<i64>`  |
| `net_unsettled_funding_pnl`            | `Option<i64>`  |
| `update_amm_summary_stats`             | `Option<bool>` |
| `exclude_total_liq_fee`                | `Option<bool>` |

### `UserFees`

Struct `types::UserFees`.

| Field                           | Type  | Description                                                    |
| ------------------------------- | ----- | -------------------------------------------------------------- |
| `total_fee_paid`                | `u64` | Total taker fee paid precision: QUOTE_PRECISION                |
| `total_fee_rebate`              | `u64` | Total maker fee rebate precision: QUOTE_PRECISION              |
| `total_token_discount`          | `u64` | Total discount from holding token precision: QUOTE_PRECISION   |
| `total_referee_discount`        | `u64` | Total discount from being referred precision: QUOTE_PRECISION  |
| `total_referrer_reward`         | `u64` | Total reward to referrer precision: QUOTE_PRECISION            |
| `current_epoch_referrer_reward` | `u64` | Total reward to referrer this epoch precision: QUOTE_PRECISION |

### `UserStatsPausedOperations`

Enum `types::UserStatsPausedOperations`.

| Variant                       |
| ----------------------------- |
| `UpdateBidAskTwap`            |
| `AmmAtomicFill`               |
| `AmmAtomicRiskIncreasingFill` |

### `UserStatus`

Enum `types::UserStatus`.

| Variant                |
| ---------------------- |
| `BeingLiquidated`      |
| `Bankrupt`             |
| `ReduceOnly`           |
| `AdvancedLp`           |
| `ProtectedMakerOrders` |

### `ValidityGuardRails`

Struct `types::ValidityGuardRails`.

| Field                           | Type  |
| ------------------------------- | ----- |
| `slots_before_stale_for_amm`    | `i64` |
| `slots_before_stale_for_margin` | `i64` |
| `confidence_interval_max_size`  | `u64` |
| `too_volatile_ratio`            | `i64` |

---

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