# Jupiter Perpetuals decoder (Carbon 2.0)

> Decode Jupiter Perpetuals instructions, accounts and events in Rust with the carbon-jupiter-perpetuals-decoder crate.

`carbon-jupiter-perpetuals-decoder` decodes the instructions, accounts and events of the Jupiter Perpetuals program (`PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu`): 59 instructions, 8 account types, 25 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-jupiter-perpetuals-decoder`](https://crates.io/crates/carbon-jupiter-perpetuals-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-jupiter-perpetuals-decoder@2.0.0`                                                                           |
| Program ID       | `PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu` (`carbon_jupiter_perpetuals_decoder::PROGRAM_ID`)                               |
| Category         | [Perpetuals & derivatives](https://carbon.sevenlabs.org/decoders/perpetuals.md)                                               |
| Decoder          | `carbon_jupiter_perpetuals_decoder::JupiterPerpetualsDecoder`                                                                 |
| Instruction enum | `instructions::JupiterPerpetualsInstruction`                                                                                  |
| Account enum     | `accounts::JupiterPerpetualsAccount`                                                                                          |
| Event enum       | `instructions::CpiEvent`                                                                                                      |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                                      |
| API docs         | [docs.rs/carbon-jupiter-perpetuals-decoder/2.0.0](https://docs.rs/carbon-jupiter-perpetuals-decoder/2.0.0)                    |
| Source           | [decoders/jupiter-perpetuals-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/jupiter-perpetuals-decoder) |

Other perpetuals and derivatives decoders: [Drift v2](https://carbon.sevenlabs.org/decoders/drift-v2.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 Jupiter Perpetuals transactions from the public RPC and prints every decoded `AddCustody` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-jupiter-perpetuals-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_jupiter_perpetuals_decoder::{
        instructions::JupiterPerpetualsInstruction, JupiterPerpetualsDecoder, 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(JupiterPerpetualsDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

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

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

Each `AddCustody` instruction prints one line with the transaction signature and the decoded `AddCustody` 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 `JupiterPerpetualsInstruction::CpiEvent { data: CpiEvent::CreatePositionRequestEvent(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 `Pool` 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_jupiter_perpetuals_decoder::{
        accounts::JupiterPerpetualsAccount, JupiterPerpetualsDecoder, 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(JupiterPerpetualsDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

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

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

### `AddCustody`

Discriminator `f7fe7e111a06d775` · data `AddCustody` · accounts `AddCustodyInstructionAccounts`.

| Field    | Type                                    |
| -------- | --------------------------------------- |
| `params` | [`AddCustodyParams`](#addcustodyparams) |

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

Fields of `AddCustodyInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `admin`                 | `Pubkey`           |
| 1   | `transfer_authority`    | `Pubkey`           |
| 2   | `perpetuals`            | `Pubkey`           |
| 3   | `pool`                  | `Pubkey`           |
| 4   | `custody`               | `Pubkey`           |
| 5   | `custody_token_account` | `Pubkey`           |
| 6   | `custody_token_mint`    | `Pubkey`           |
| 7   | `system_program`        | `Pubkey`           |
| 8   | `token_program`         | `Pubkey`           |
| 9   | `rent`                  | `Pubkey`           |
| 10… | `remaining`             | `Vec<AccountMeta>` |

### `AddLiquidity2`

Discriminator `e4a24e1c46db7473` · data `AddLiquidity2` · accounts `AddLiquidity2InstructionAccounts`.

| Field    | Type                                          |
| -------- | --------------------------------------------- |
| `params` | [`AddLiquidity2Params`](#addliquidity2params) |

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

Fields of `AddLiquidity2InstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `owner`                         | `Pubkey`           |
| 1   | `funding_account`               | `Pubkey`           |
| 2   | `lp_token_account`              | `Pubkey`           |
| 3   | `transfer_authority`            | `Pubkey`           |
| 4   | `perpetuals`                    | `Pubkey`           |
| 5   | `pool`                          | `Pubkey`           |
| 6   | `custody`                       | `Pubkey`           |
| 7   | `custody_doves_price_account`   | `Pubkey`           |
| 8   | `custody_pythnet_price_account` | `Pubkey`           |
| 9   | `custody_token_account`         | `Pubkey`           |
| 10  | `lp_token_mint`                 | `Pubkey`           |
| 11  | `token_program`                 | `Pubkey`           |
| 12  | `event_authority`               | `Pubkey`           |
| 13  | `program`                       | `Pubkey`           |
| 14… | `remaining`                     | `Vec<AccountMeta>` |

### `AddPool`

Discriminator `73e6d4d3af3127a9` · data `AddPool` · accounts `AddPoolInstructionAccounts`.

| Field    | Type                              |
| -------- | --------------------------------- |
| `params` | [`AddPoolParams`](#addpoolparams) |

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

Fields of `AddPoolInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `admin`              | `Pubkey`           |
| 1  | `transfer_authority` | `Pubkey`           |
| 2  | `perpetuals`         | `Pubkey`           |
| 3  | `pool`               | `Pubkey`           |
| 4  | `lp_token_mint`      | `Pubkey`           |
| 5  | `system_program`     | `Pubkey`           |
| 6  | `token_program`      | `Pubkey`           |
| 7  | `rent`               | `Pubkey`           |
| 8… | `remaining`          | `Vec<AccountMeta>` |

### `BorrowFromCustody`

Discriminator `99b741417121f92d` · data `BorrowFromCustody` · accounts `BorrowFromCustodyInstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`BorrowFromCustodyParams`](#borrowfromcustodyparams) |

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

Fields of `BorrowFromCustodyInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `owner`                 | `Pubkey`           |
| 1   | `perpetuals`            | `Pubkey`           |
| 2   | `pool`                  | `Pubkey`           |
| 3   | `custody`               | `Pubkey`           |
| 4   | `transfer_authority`    | `Pubkey`           |
| 5   | `borrow_position`       | `Pubkey`           |
| 6   | `custody_token_account` | `Pubkey`           |
| 7   | `user_token_account`    | `Pubkey`           |
| 8   | `lp_token_mint`         | `Pubkey`           |
| 9   | `token_program`         | `Pubkey`           |
| 10  | `event_authority`       | `Pubkey`           |
| 11  | `program`               | `Pubkey`           |
| 12… | `remaining`             | `Vec<AccountMeta>` |

### `CloseBorrowPosition`

Discriminator `cce291cde825038c` · data `CloseBorrowPosition` · accounts `CloseBorrowPositionInstructionAccounts`.

| Field    | Type                                                      |
| -------- | --------------------------------------------------------- |
| `params` | [`CloseBorrowPositionParams`](#closeborrowpositionparams) |

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

Fields of `CloseBorrowPositionInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `owner`           | `Pubkey`           |
| 1  | `borrow_position` | `Pubkey`           |
| 2  | `system_program`  | `Pubkey`           |
| 3  | `event_authority` | `Pubkey`           |
| 4  | `program`         | `Pubkey`           |
| 5… | `remaining`       | `Vec<AccountMeta>` |

### `ClosePositionRequest2`

Discriminator `7944a21cd82fc842` · data `ClosePositionRequest2` · accounts `ClosePositionRequest2InstructionAccounts`.

No data fields.

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

Fields of `ClosePositionRequest2InstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `keeper`                   | `Option<Pubkey>`   |
| 1   | `owner`                    | `Pubkey`           |
| 2   | `owner_ata`                | `Pubkey`           |
| 3   | `pool`                     | `Pubkey`           |
| 4   | `position_request`         | `Pubkey`           |
| 5   | `position_request_ata`     | `Pubkey`           |
| 6   | `position`                 | `Pubkey`           |
| 7   | `mint`                     | `Pubkey`           |
| 8   | `token_program`            | `Pubkey`           |
| 9   | `system_program`           | `Pubkey`           |
| 10  | `associated_token_program` | `Pubkey`           |
| 11  | `event_authority`          | `Pubkey`           |
| 12  | `program`                  | `Pubkey`           |
| 13… | `remaining`                | `Vec<AccountMeta>` |

### `ClosePositionRequest3`

Discriminator `7a822112d32ca13a` · data `ClosePositionRequest3` · accounts `ClosePositionRequest3InstructionAccounts`.

No data fields.

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

Fields of `ClosePositionRequest3InstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `keeper`                   | `Option<Pubkey>`   |
| 1   | `owner`                    | `Pubkey`           |
| 2   | `owner_ata`                | `Pubkey`           |
| 3   | `pool`                     | `Pubkey`           |
| 4   | `position_request`         | `Pubkey`           |
| 5   | `position_request_ata`     | `Pubkey`           |
| 6   | `position`                 | `Pubkey`           |
| 7   | `custody`                  | `Pubkey`           |
| 8   | `mint`                     | `Pubkey`           |
| 9   | `token_program`            | `Pubkey`           |
| 10  | `system_program`           | `Pubkey`           |
| 11  | `associated_token_program` | `Pubkey`           |
| 12  | `event_authority`          | `Pubkey`           |
| 13  | `program`                  | `Pubkey`           |
| 14… | `remaining`                | `Vec<AccountMeta>` |

### `CreateAndDelegateStakeAccount`

Discriminator `62d17a1bde895e86` · data `CreateAndDelegateStakeAccount` · accounts `CreateAndDelegateStakeAccountInstructionAccounts`.

| Field    | Type                                                                          |
| -------- | ----------------------------------------------------------------------------- |
| `params` | [`CreateAndDelegateStakeAccountParams`](#createanddelegatestakeaccountparams) |

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

Fields of `CreateAndDelegateStakeAccountInstructionAccounts`, in account order:

| #   | Field                    | Type               |
| --- | ------------------------ | ------------------ |
| 0   | `keeper`                 | `Pubkey`           |
| 1   | `perpetuals`             | `Pubkey`           |
| 2   | `pool`                   | `Pubkey`           |
| 3   | `custody`                | `Pubkey`           |
| 4   | `custody_token_account`  | `Pubkey`           |
| 5   | `transfer_authority`     | `Pubkey`           |
| 6   | `stake_account`          | `Pubkey`           |
| 7   | `stake_info`             | `Pubkey`           |
| 8   | `validator_vote_account` | `Pubkey`           |
| 9   | `stake_config`           | `Pubkey`           |
| 10  | `wsol_mint`              | `Pubkey`           |
| 11  | `temp_wsol_account`      | `Pubkey`           |
| 12  | `rent`                   | `Pubkey`           |
| 13  | `clock`                  | `Pubkey`           |
| 14  | `stake_history`          | `Pubkey`           |
| 15  | `stake_program`          | `Pubkey`           |
| 16  | `system_program`         | `Pubkey`           |
| 17  | `token_program`          | `Pubkey`           |
| 18… | `remaining`              | `Vec<AccountMeta>` |

### `CreateDecreasePositionMarketRequest`

Discriminator `4ac6c356c163014f` · data `CreateDecreasePositionMarketRequest` · accounts `CreateDecreasePositionMarketRequestInstructionAccounts`.

| Field    | Type                                                                                      |
| -------- | ----------------------------------------------------------------------------------------- |
| `params` | [`CreateDecreasePositionMarketRequestParams`](#createdecreasepositionmarketrequestparams) |

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

Fields of `CreateDecreasePositionMarketRequestInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `owner`                    | `Pubkey`           |
| 1   | `receiving_account`        | `Pubkey`           |
| 2   | `perpetuals`               | `Pubkey`           |
| 3   | `pool`                     | `Pubkey`           |
| 4   | `position`                 | `Pubkey`           |
| 5   | `position_request`         | `Pubkey`           |
| 6   | `position_request_ata`     | `Pubkey`           |
| 7   | `custody`                  | `Pubkey`           |
| 8   | `collateral_custody`       | `Pubkey`           |
| 9   | `desired_mint`             | `Pubkey`           |
| 10  | `referral`                 | `Option<Pubkey>`   |
| 11  | `token_program`            | `Pubkey`           |
| 12  | `associated_token_program` | `Pubkey`           |
| 13  | `system_program`           | `Pubkey`           |
| 14  | `event_authority`          | `Pubkey`           |
| 15  | `program`                  | `Pubkey`           |
| 16… | `remaining`                | `Vec<AccountMeta>` |

### `CreateDecreasePositionRequest2`

Discriminator `6940c952fa0e6d4d` · data `CreateDecreasePositionRequest2` · accounts `CreateDecreasePositionRequest2InstructionAccounts`.

| Field    | Type                                                                            |
| -------- | ------------------------------------------------------------------------------- |
| `params` | [`CreateDecreasePositionRequest2Params`](#createdecreasepositionrequest2params) |

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

Fields of `CreateDecreasePositionRequest2InstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `owner`                         | `Pubkey`           |
| 1   | `receiving_account`             | `Pubkey`           |
| 2   | `perpetuals`                    | `Pubkey`           |
| 3   | `pool`                          | `Pubkey`           |
| 4   | `position`                      | `Pubkey`           |
| 5   | `position_request`              | `Pubkey`           |
| 6   | `position_request_ata`          | `Pubkey`           |
| 7   | `custody`                       | `Pubkey`           |
| 8   | `custody_doves_price_account`   | `Pubkey`           |
| 9   | `custody_pythnet_price_account` | `Pubkey`           |
| 10  | `collateral_custody`            | `Pubkey`           |
| 11  | `desired_mint`                  | `Pubkey`           |
| 12  | `referral`                      | `Option<Pubkey>`   |
| 13  | `token_program`                 | `Pubkey`           |
| 14  | `associated_token_program`      | `Pubkey`           |
| 15  | `system_program`                | `Pubkey`           |
| 16  | `event_authority`               | `Pubkey`           |
| 17  | `program`                       | `Pubkey`           |
| 18… | `remaining`                     | `Vec<AccountMeta>` |

### `CreateIncreasePositionMarketRequest`

Discriminator `b855c71869ab9c38` · data `CreateIncreasePositionMarketRequest` · accounts `CreateIncreasePositionMarketRequestInstructionAccounts`.

| Field    | Type                                                                                      |
| -------- | ----------------------------------------------------------------------------------------- |
| `params` | [`CreateIncreasePositionMarketRequestParams`](#createincreasepositionmarketrequestparams) |

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

Fields of `CreateIncreasePositionMarketRequestInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `owner`                    | `Pubkey`           |
| 1   | `funding_account`          | `Pubkey`           |
| 2   | `perpetuals`               | `Pubkey`           |
| 3   | `pool`                     | `Pubkey`           |
| 4   | `position`                 | `Pubkey`           |
| 5   | `position_request`         | `Pubkey`           |
| 6   | `position_request_ata`     | `Pubkey`           |
| 7   | `custody`                  | `Pubkey`           |
| 8   | `collateral_custody`       | `Pubkey`           |
| 9   | `input_mint`               | `Pubkey`           |
| 10  | `referral`                 | `Option<Pubkey>`   |
| 11  | `token_program`            | `Pubkey`           |
| 12  | `associated_token_program` | `Pubkey`           |
| 13  | `system_program`           | `Pubkey`           |
| 14  | `event_authority`          | `Pubkey`           |
| 15  | `program`                  | `Pubkey`           |
| 16… | `remaining`                | `Vec<AccountMeta>` |

### `CreateTokenLedger`

Discriminator `e8f2c5fdf08f8134` · data `CreateTokenLedger` · accounts `CreateTokenLedgerInstructionAccounts`.

No data fields.

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

Fields of `CreateTokenLedgerInstructionAccounts`, in account order:

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

### `CreateTokenMetadata`

Discriminator `dd50b02599bca044` · data `CreateTokenMetadata` · accounts `CreateTokenMetadataInstructionAccounts`.

| Field    | Type                                                      |
| -------- | --------------------------------------------------------- |
| `params` | [`CreateTokenMetadataParams`](#createtokenmetadataparams) |

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

Fields of `CreateTokenMetadataInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `admin`                  | `Pubkey`           |
| 1  | `perpetuals`             | `Pubkey`           |
| 2  | `pool`                   | `Pubkey`           |
| 3  | `transfer_authority`     | `Pubkey`           |
| 4  | `metadata`               | `Pubkey`           |
| 5  | `lp_token_mint`          | `Pubkey`           |
| 6  | `token_metadata_program` | `Pubkey`           |
| 7  | `system_program`         | `Pubkey`           |
| 8  | `rent`                   | `Pubkey`           |
| 9… | `remaining`              | `Vec<AccountMeta>` |

### `DecreasePosition4`

Discriminator `b9a172af609403aa` · data `DecreasePosition4` · accounts `DecreasePosition4InstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`DecreasePosition4Params`](#decreaseposition4params) |

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

Fields of `DecreasePosition4InstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `keeper`                                   | `Pubkey`           |
| 1   | `owner`                                    | `Pubkey`           |
| 2   | `transfer_authority`                       | `Pubkey`           |
| 3   | `perpetuals`                               | `Pubkey`           |
| 4   | `pool`                                     | `Pubkey`           |
| 5   | `position_request`                         | `Pubkey`           |
| 6   | `position_request_ata`                     | `Pubkey`           |
| 7   | `position`                                 | `Pubkey`           |
| 8   | `custody`                                  | `Pubkey`           |
| 9   | `custody_doves_price_account`              | `Pubkey`           |
| 10  | `custody_pythnet_price_account`            | `Pubkey`           |
| 11  | `collateral_custody`                       | `Pubkey`           |
| 12  | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 13  | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 14  | `collateral_custody_token_account`         | `Pubkey`           |
| 15  | `token_program`                            | `Pubkey`           |
| 16  | `event_authority`                          | `Pubkey`           |
| 17  | `program`                                  | `Pubkey`           |
| 18… | `remaining`                                | `Vec<AccountMeta>` |

### `DecreasePositionWithInternalSwap`

Discriminator `8311996e77646126` · data `DecreasePositionWithInternalSwap` · accounts `DecreasePositionWithInternalSwapInstructionAccounts`.

| Field    | Type                                                                                |
| -------- | ----------------------------------------------------------------------------------- |
| `params` | [`DecreasePositionWithInternalSwapParams`](#decreasepositionwithinternalswapparams) |

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

Fields of `DecreasePositionWithInternalSwapInstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `keeper`                                   | `Pubkey`           |
| 1   | `owner`                                    | `Pubkey`           |
| 2   | `transfer_authority`                       | `Pubkey`           |
| 3   | `perpetuals`                               | `Pubkey`           |
| 4   | `pool`                                     | `Pubkey`           |
| 5   | `position_request`                         | `Pubkey`           |
| 6   | `position_request_ata`                     | `Pubkey`           |
| 7   | `position`                                 | `Pubkey`           |
| 8   | `custody`                                  | `Pubkey`           |
| 9   | `custody_doves_price_account`              | `Pubkey`           |
| 10  | `custody_pythnet_price_account`            | `Pubkey`           |
| 11  | `collateral_custody`                       | `Pubkey`           |
| 12  | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 13  | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 14  | `collateral_custody_token_account`         | `Pubkey`           |
| 15  | `dispensing_custody`                       | `Pubkey`           |
| 16  | `dispensing_custody_doves_price_account`   | `Pubkey`           |
| 17  | `dispensing_custody_pythnet_price_account` | `Pubkey`           |
| 18  | `dispensing_custody_token_account`         | `Pubkey`           |
| 19  | `token_program`                            | `Pubkey`           |
| 20  | `event_authority`                          | `Pubkey`           |
| 21  | `program`                                  | `Pubkey`           |
| 22… | `remaining`                                | `Vec<AccountMeta>` |

### `DecreasePositionWithTpsl`

Discriminator `6c12cbd1e36741a5` · data `DecreasePositionWithTpsl` · accounts `DecreasePositionWithTpslInstructionAccounts`.

| Field    | Type                                                                |
| -------- | ------------------------------------------------------------------- |
| `params` | [`DecreasePositionWithTpslParams`](#decreasepositionwithtpslparams) |

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

Fields of `DecreasePositionWithTpslInstructionAccounts`, in account order:

| #   | Field                                    | Type               |
| --- | ---------------------------------------- | ------------------ |
| 0   | `keeper`                                 | `Pubkey`           |
| 1   | `owner`                                  | `Pubkey`           |
| 2   | `transfer_authority`                     | `Pubkey`           |
| 3   | `perpetuals`                             | `Pubkey`           |
| 4   | `pool`                                   | `Pubkey`           |
| 5   | `position_request`                       | `Pubkey`           |
| 6   | `position_request_ata`                   | `Pubkey`           |
| 7   | `position`                               | `Pubkey`           |
| 8   | `custody`                                | `Pubkey`           |
| 9   | `custody_doves_price_account`            | `Pubkey`           |
| 10  | `collateral_custody`                     | `Pubkey`           |
| 11  | `collateral_custody_doves_price_account` | `Pubkey`           |
| 12  | `collateral_custody_token_account`       | `Pubkey`           |
| 13  | `token_program`                          | `Pubkey`           |
| 14  | `event_authority`                        | `Pubkey`           |
| 15  | `program`                                | `Pubkey`           |
| 16… | `remaining`                              | `Vec<AccountMeta>` |

### `DecreasePositionWithTpslAndInternalSwap`

Discriminator `026fc8e723417beb` · data `DecreasePositionWithTpslAndInternalSwap` · accounts `DecreasePositionWithTpslAndInternalSwapInstructionAccounts`.

| Field    | Type                                                                                              |
| -------- | ------------------------------------------------------------------------------------------------- |
| `params` | [`DecreasePositionWithTpslAndInternalSwapParams`](#decreasepositionwithtpslandinternalswapparams) |

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

Fields of `DecreasePositionWithTpslAndInternalSwapInstructionAccounts`, in account order:

| #   | Field                                    | Type               |
| --- | ---------------------------------------- | ------------------ |
| 0   | `keeper`                                 | `Pubkey`           |
| 1   | `owner`                                  | `Pubkey`           |
| 2   | `transfer_authority`                     | `Pubkey`           |
| 3   | `perpetuals`                             | `Pubkey`           |
| 4   | `pool`                                   | `Pubkey`           |
| 5   | `position_request`                       | `Pubkey`           |
| 6   | `position_request_ata`                   | `Pubkey`           |
| 7   | `position`                               | `Pubkey`           |
| 8   | `custody`                                | `Pubkey`           |
| 9   | `custody_doves_price_account`            | `Pubkey`           |
| 10  | `collateral_custody`                     | `Pubkey`           |
| 11  | `collateral_custody_doves_price_account` | `Pubkey`           |
| 12  | `collateral_custody_token_account`       | `Pubkey`           |
| 13  | `dispensing_custody`                     | `Pubkey`           |
| 14  | `dispensing_custody_doves_price_account` | `Pubkey`           |
| 15  | `dispensing_custody_token_account`       | `Pubkey`           |
| 16  | `token_program`                          | `Pubkey`           |
| 17  | `event_authority`                        | `Pubkey`           |
| 18  | `program`                                | `Pubkey`           |
| 19… | `remaining`                              | `Vec<AccountMeta>` |

### `DepositCollateralForBorrows`

Discriminator `1102c3be4c10ee4a` · data `DepositCollateralForBorrows` · accounts `DepositCollateralForBorrowsInstructionAccounts`.

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

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

Fields of `DepositCollateralForBorrowsInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `owner`                    | `Pubkey`           |
| 1   | `perpetuals`               | `Pubkey`           |
| 2   | `pool`                     | `Pubkey`           |
| 3   | `custody`                  | `Pubkey`           |
| 4   | `transfer_authority`       | `Pubkey`           |
| 5   | `borrow_position`          | `Pubkey`           |
| 6   | `collateral_token_account` | `Pubkey`           |
| 7   | `user_token_account`       | `Pubkey`           |
| 8   | `lp_token_mint`            | `Pubkey`           |
| 9   | `token_program`            | `Pubkey`           |
| 10  | `system_program`           | `Pubkey`           |
| 11  | `event_authority`          | `Pubkey`           |
| 12  | `program`                  | `Pubkey`           |
| 13… | `remaining`                | `Vec<AccountMeta>` |

### `GetAddLiquidityAmountAndFee2`

Discriminator `6d9d37a908510476` · data `GetAddLiquidityAmountAndFee2` · accounts `GetAddLiquidityAmountAndFee2InstructionAccounts`.

| Field    | Type                                                                        |
| -------- | --------------------------------------------------------------------------- |
| `params` | [`GetAddLiquidityAmountAndFee2Params`](#getaddliquidityamountandfee2params) |

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

Fields of `GetAddLiquidityAmountAndFee2InstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `perpetuals`                    | `Pubkey`           |
| 1  | `pool`                          | `Pubkey`           |
| 2  | `custody`                       | `Pubkey`           |
| 3  | `custody_doves_price_account`   | `Pubkey`           |
| 4  | `custody_pythnet_price_account` | `Pubkey`           |
| 5  | `lp_token_mint`                 | `Pubkey`           |
| 6… | `remaining`                     | `Vec<AccountMeta>` |

### `GetAssetsUnderManagement2`

Discriminator `c1d20df971951d54` · data `GetAssetsUnderManagement2` · accounts `GetAssetsUnderManagement2InstructionAccounts`.

| Field    | Type                                                                  |
| -------- | --------------------------------------------------------------------- |
| `params` | [`GetAssetsUnderManagement2Params`](#getassetsundermanagement2params) |

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

Fields of `GetAssetsUnderManagement2InstructionAccounts`, in account order:

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

### `GetRemoveLiquidityAmountAndFee2`

Discriminator `b73b486edff3968e` · data `GetRemoveLiquidityAmountAndFee2` · accounts `GetRemoveLiquidityAmountAndFee2InstructionAccounts`.

| Field    | Type                                                                              |
| -------- | --------------------------------------------------------------------------------- |
| `params` | [`GetRemoveLiquidityAmountAndFee2Params`](#getremoveliquidityamountandfee2params) |

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

Fields of `GetRemoveLiquidityAmountAndFee2InstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `perpetuals`                    | `Pubkey`           |
| 1  | `pool`                          | `Pubkey`           |
| 2  | `custody`                       | `Pubkey`           |
| 3  | `custody_doves_price_account`   | `Pubkey`           |
| 4  | `custody_pythnet_price_account` | `Pubkey`           |
| 5  | `lp_token_mint`                 | `Pubkey`           |
| 6… | `remaining`                     | `Vec<AccountMeta>` |

### `IncreasePosition4`

Discriminator `439335172b391043` · data `IncreasePosition4` · accounts `IncreasePosition4InstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`IncreasePosition4Params`](#increaseposition4params) |

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

Fields of `IncreasePosition4InstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `keeper`                                   | `Pubkey`           |
| 1   | `perpetuals`                               | `Pubkey`           |
| 2   | `pool`                                     | `Pubkey`           |
| 3   | `position_request`                         | `Pubkey`           |
| 4   | `position_request_ata`                     | `Pubkey`           |
| 5   | `position`                                 | `Pubkey`           |
| 6   | `custody`                                  | `Pubkey`           |
| 7   | `custody_doves_price_account`              | `Pubkey`           |
| 8   | `custody_pythnet_price_account`            | `Pubkey`           |
| 9   | `collateral_custody`                       | `Pubkey`           |
| 10  | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 11  | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 12  | `collateral_custody_token_account`         | `Pubkey`           |
| 13  | `token_program`                            | `Pubkey`           |
| 14  | `event_authority`                          | `Pubkey`           |
| 15  | `program`                                  | `Pubkey`           |
| 16… | `remaining`                                | `Vec<AccountMeta>` |

### `IncreasePositionPreSwap`

Discriminator `1a88e1d916155314` · data `IncreasePositionPreSwap` · accounts `IncreasePositionPreSwapInstructionAccounts`.

| Field    | Type                                                              |
| -------- | ----------------------------------------------------------------- |
| `params` | [`IncreasePositionPreSwapParams`](#increasepositionpreswapparams) |

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

Fields of `IncreasePositionPreSwapInstructionAccounts`, in account order:

| #   | Field                              | Type               |
| --- | ---------------------------------- | ------------------ |
| 0   | `keeper`                           | `Pubkey`           |
| 1   | `keeper_ata`                       | `Pubkey`           |
| 2   | `position_request`                 | `Pubkey`           |
| 3   | `position_request_ata`             | `Pubkey`           |
| 4   | `position`                         | `Pubkey`           |
| 5   | `collateral_custody`               | `Pubkey`           |
| 6   | `collateral_custody_token_account` | `Pubkey`           |
| 7   | `instruction`                      | `Pubkey`           |
| 8   | `token_program`                    | `Pubkey`           |
| 9   | `event_authority`                  | `Pubkey`           |
| 10  | `program`                          | `Pubkey`           |
| 11… | `remaining`                        | `Vec<AccountMeta>` |

### `IncreasePositionWithInternalSwap`

Discriminator `72376a8cc7dd2070` · data `IncreasePositionWithInternalSwap` · accounts `IncreasePositionWithInternalSwapInstructionAccounts`.

| Field    | Type                                                                                |
| -------- | ----------------------------------------------------------------------------------- |
| `params` | [`IncreasePositionWithInternalSwapParams`](#increasepositionwithinternalswapparams) |

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

Fields of `IncreasePositionWithInternalSwapInstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `keeper`                                   | `Pubkey`           |
| 1   | `perpetuals`                               | `Pubkey`           |
| 2   | `pool`                                     | `Pubkey`           |
| 3   | `position_request`                         | `Pubkey`           |
| 4   | `position_request_ata`                     | `Pubkey`           |
| 5   | `position`                                 | `Pubkey`           |
| 6   | `custody`                                  | `Pubkey`           |
| 7   | `custody_doves_price_account`              | `Pubkey`           |
| 8   | `custody_pythnet_price_account`            | `Pubkey`           |
| 9   | `collateral_custody`                       | `Pubkey`           |
| 10  | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 11  | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 12  | `collateral_custody_token_account`         | `Pubkey`           |
| 13  | `receiving_custody`                        | `Pubkey`           |
| 14  | `receiving_custody_doves_price_account`    | `Pubkey`           |
| 15  | `receiving_custody_pythnet_price_account`  | `Pubkey`           |
| 16  | `receiving_custody_token_account`          | `Pubkey`           |
| 17  | `token_program`                            | `Pubkey`           |
| 18  | `event_authority`                          | `Pubkey`           |
| 19  | `program`                                  | `Pubkey`           |
| 20… | `remaining`                                | `Vec<AccountMeta>` |

### `Init`

Discriminator `dc3bcfec6cfa2f64` · data `Init` · accounts `InitInstructionAccounts`.

| Field    | Type                        |
| -------- | --------------------------- |
| `params` | [`InitParams`](#initparams) |

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

Fields of `InitInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `upgrade_authority`       | `Pubkey`           |
| 1  | `admin`                   | `Pubkey`           |
| 2  | `transfer_authority`      | `Pubkey`           |
| 3  | `perpetuals`              | `Pubkey`           |
| 4  | `perpetuals_program`      | `Pubkey`           |
| 5  | `perpetuals_program_data` | `Pubkey`           |
| 6  | `system_program`          | `Pubkey`           |
| 7  | `token_program`           | `Pubkey`           |
| 8… | `remaining`               | `Vec<AccountMeta>` |

### `InstantCreateLimitOrder`

Discriminator `c225c37b287f7e9c` · data `InstantCreateLimitOrder` · accounts `InstantCreateLimitOrderInstructionAccounts`.

| Field    | Type                                                              |
| -------- | ----------------------------------------------------------------- |
| `params` | [`InstantCreateLimitOrderParams`](#instantcreatelimitorderparams) |

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

Fields of `InstantCreateLimitOrderInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `keeper`                        | `Pubkey`           |
| 1   | `api_keeper`                    | `Pubkey`           |
| 2   | `owner`                         | `Pubkey`           |
| 3   | `funding_account`               | `Pubkey`           |
| 4   | `perpetuals`                    | `Pubkey`           |
| 5   | `pool`                          | `Pubkey`           |
| 6   | `position`                      | `Pubkey`           |
| 7   | `position_request`              | `Pubkey`           |
| 8   | `position_request_ata`          | `Pubkey`           |
| 9   | `custody`                       | `Pubkey`           |
| 10  | `custody_doves_price_account`   | `Pubkey`           |
| 11  | `custody_pythnet_price_account` | `Pubkey`           |
| 12  | `collateral_custody`            | `Pubkey`           |
| 13  | `input_mint`                    | `Pubkey`           |
| 14  | `referral`                      | `Option<Pubkey>`   |
| 15  | `token_program`                 | `Pubkey`           |
| 16  | `associated_token_program`      | `Pubkey`           |
| 17  | `system_program`                | `Pubkey`           |
| 18  | `event_authority`               | `Pubkey`           |
| 19  | `program`                       | `Pubkey`           |
| 20… | `remaining`                     | `Vec<AccountMeta>` |

### `InstantCreateTpsl`

Discriminator `7562427f1e3249b9` · data `InstantCreateTpsl` · accounts `InstantCreateTpslInstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`InstantCreateTpslParams`](#instantcreatetpslparams) |

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

Fields of `InstantCreateTpslInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `keeper`                        | `Pubkey`           |
| 1   | `api_keeper`                    | `Pubkey`           |
| 2   | `owner`                         | `Pubkey`           |
| 3   | `receiving_account`             | `Pubkey`           |
| 4   | `perpetuals`                    | `Pubkey`           |
| 5   | `pool`                          | `Pubkey`           |
| 6   | `position`                      | `Pubkey`           |
| 7   | `position_request`              | `Pubkey`           |
| 8   | `position_request_ata`          | `Pubkey`           |
| 9   | `custody`                       | `Pubkey`           |
| 10  | `custody_doves_price_account`   | `Pubkey`           |
| 11  | `custody_pythnet_price_account` | `Pubkey`           |
| 12  | `collateral_custody`            | `Pubkey`           |
| 13  | `desired_mint`                  | `Pubkey`           |
| 14  | `referral`                      | `Option<Pubkey>`   |
| 15  | `token_program`                 | `Pubkey`           |
| 16  | `associated_token_program`      | `Pubkey`           |
| 17  | `system_program`                | `Pubkey`           |
| 18  | `event_authority`               | `Pubkey`           |
| 19  | `program`                       | `Pubkey`           |
| 20… | `remaining`                     | `Vec<AccountMeta>` |

### `InstantDecreasePosition`

Discriminator `2e17f02c1e8a5e8c` · data `InstantDecreasePosition` · accounts `InstantDecreasePositionInstructionAccounts`.

| Field    | Type                                                              |
| -------- | ----------------------------------------------------------------- |
| `params` | [`InstantDecreasePositionParams`](#instantdecreasepositionparams) |

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

Fields of `InstantDecreasePositionInstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `keeper`                                   | `Pubkey`           |
| 1   | `api_keeper`                               | `Pubkey`           |
| 2   | `owner`                                    | `Pubkey`           |
| 3   | `receiving_account`                        | `Pubkey`           |
| 4   | `transfer_authority`                       | `Pubkey`           |
| 5   | `perpetuals`                               | `Pubkey`           |
| 6   | `pool`                                     | `Pubkey`           |
| 7   | `position`                                 | `Pubkey`           |
| 8   | `custody`                                  | `Pubkey`           |
| 9   | `custody_doves_price_account`              | `Pubkey`           |
| 10  | `custody_pythnet_price_account`            | `Pubkey`           |
| 11  | `collateral_custody`                       | `Pubkey`           |
| 12  | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 13  | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 14  | `collateral_custody_token_account`         | `Pubkey`           |
| 15  | `desired_mint`                             | `Pubkey`           |
| 16  | `referral`                                 | `Option<Pubkey>`   |
| 17  | `token_program`                            | `Pubkey`           |
| 18  | `associated_token_program`                 | `Pubkey`           |
| 19  | `system_program`                           | `Pubkey`           |
| 20  | `event_authority`                          | `Pubkey`           |
| 21  | `program`                                  | `Pubkey`           |
| 22… | `remaining`                                | `Vec<AccountMeta>` |

### `InstantDecreasePosition2`

Discriminator `a2bfc83e8b3eb011` · data `InstantDecreasePosition2` · accounts `InstantDecreasePosition2InstructionAccounts`.

| Field    | Type                                                                |
| -------- | ------------------------------------------------------------------- |
| `params` | [`InstantDecreasePosition2Params`](#instantdecreaseposition2params) |

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

Fields of `InstantDecreasePosition2InstructionAccounts`, in account order:

| #   | Field                                    | Type               |
| --- | ---------------------------------------- | ------------------ |
| 0   | `keeper`                                 | `Pubkey`           |
| 1   | `api_keeper`                             | `Pubkey`           |
| 2   | `owner`                                  | `Pubkey`           |
| 3   | `receiving_account`                      | `Pubkey`           |
| 4   | `transfer_authority`                     | `Pubkey`           |
| 5   | `perpetuals`                             | `Pubkey`           |
| 6   | `pool`                                   | `Pubkey`           |
| 7   | `position`                               | `Pubkey`           |
| 8   | `custody`                                | `Pubkey`           |
| 9   | `custody_doves_price_account`            | `Pubkey`           |
| 10  | `collateral_custody`                     | `Pubkey`           |
| 11  | `collateral_custody_doves_price_account` | `Pubkey`           |
| 12  | `collateral_custody_token_account`       | `Pubkey`           |
| 13  | `desired_mint`                           | `Pubkey`           |
| 14  | `referral`                               | `Option<Pubkey>`   |
| 15  | `position_request`                       | `Pubkey`           |
| 16  | `position_request_ata`                   | `Pubkey`           |
| 17  | `token_program`                          | `Pubkey`           |
| 18  | `associated_token_program`               | `Pubkey`           |
| 19  | `system_program`                         | `Pubkey`           |
| 20  | `event_authority`                        | `Pubkey`           |
| 21  | `program`                                | `Pubkey`           |
| 22… | `remaining`                              | `Vec<AccountMeta>` |

### `InstantIncreasePosition`

Discriminator `a47e44b6dfa640b7` · data `InstantIncreasePosition` · accounts `InstantIncreasePositionInstructionAccounts`.

| Field    | Type                                                              |
| -------- | ----------------------------------------------------------------- |
| `params` | [`InstantIncreasePositionParams`](#instantincreasepositionparams) |

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

Fields of `InstantIncreasePositionInstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `keeper`                                   | `Pubkey`           |
| 1   | `api_keeper`                               | `Pubkey`           |
| 2   | `owner`                                    | `Pubkey`           |
| 3   | `funding_account`                          | `Pubkey`           |
| 4   | `perpetuals`                               | `Pubkey`           |
| 5   | `pool`                                     | `Pubkey`           |
| 6   | `position`                                 | `Pubkey`           |
| 7   | `custody`                                  | `Pubkey`           |
| 8   | `custody_doves_price_account`              | `Pubkey`           |
| 9   | `custody_pythnet_price_account`            | `Pubkey`           |
| 10  | `collateral_custody`                       | `Pubkey`           |
| 11  | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 12  | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 13  | `collateral_custody_token_account`         | `Pubkey`           |
| 14  | `token_ledger`                             | `Option<Pubkey>`   |
| 15  | `referral`                                 | `Option<Pubkey>`   |
| 16  | `token_program`                            | `Pubkey`           |
| 17  | `system_program`                           | `Pubkey`           |
| 18  | `event_authority`                          | `Pubkey`           |
| 19  | `program`                                  | `Pubkey`           |
| 20… | `remaining`                                | `Vec<AccountMeta>` |

### `InstantIncreasePositionPreSwap`

Discriminator `c52656a5c71726ea` · data `InstantIncreasePositionPreSwap` · accounts `InstantIncreasePositionPreSwapInstructionAccounts`.

| Field    | Type                                                                            |
| -------- | ------------------------------------------------------------------------------- |
| `params` | [`InstantIncreasePositionPreSwapParams`](#instantincreasepositionpreswapparams) |

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

Fields of `InstantIncreasePositionPreSwapInstructionAccounts`, in account order:

| #   | Field                                    | Type               |
| --- | ---------------------------------------- | ------------------ |
| 0   | `owner`                                  | `Pubkey`           |
| 1   | `funding_account`                        | `Pubkey`           |
| 2   | `receiving_account`                      | `Pubkey`           |
| 3   | `transfer_authority`                     | `Pubkey`           |
| 4   | `perpetuals`                             | `Pubkey`           |
| 5   | `pool`                                   | `Pubkey`           |
| 6   | `receiving_custody`                      | `Pubkey`           |
| 7   | `receiving_custody_doves_price_account`  | `Pubkey`           |
| 8   | `receiving_custody_token_account`        | `Pubkey`           |
| 9   | `dispensing_custody`                     | `Pubkey`           |
| 10  | `dispensing_custody_doves_price_account` | `Pubkey`           |
| 11  | `dispensing_custody_token_account`       | `Pubkey`           |
| 12  | `token_program`                          | `Pubkey`           |
| 13  | `instruction`                            | `Pubkey`           |
| 14  | `event_authority`                        | `Pubkey`           |
| 15  | `program`                                | `Pubkey`           |
| 16… | `remaining`                              | `Vec<AccountMeta>` |

### `InstantUpdateLimitOrder`

Discriminator `88f5e53a798d0ccf` · data `InstantUpdateLimitOrder` · accounts `InstantUpdateLimitOrderInstructionAccounts`.

| Field    | Type                                                              |
| -------- | ----------------------------------------------------------------- |
| `params` | [`InstantUpdateLimitOrderParams`](#instantupdatelimitorderparams) |

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

Fields of `InstantUpdateLimitOrderInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `keeper`                        | `Pubkey`           |
| 1   | `api_keeper`                    | `Pubkey`           |
| 2   | `owner`                         | `Pubkey`           |
| 3   | `perpetuals`                    | `Pubkey`           |
| 4   | `pool`                          | `Pubkey`           |
| 5   | `position`                      | `Pubkey`           |
| 6   | `position_request`              | `Pubkey`           |
| 7   | `custody`                       | `Pubkey`           |
| 8   | `custody_doves_price_account`   | `Pubkey`           |
| 9   | `custody_pythnet_price_account` | `Pubkey`           |
| 10… | `remaining`                     | `Vec<AccountMeta>` |

### `InstantUpdateTpsl`

Discriminator `90e47225a5f26f65` · data `InstantUpdateTpsl` · accounts `InstantUpdateTpslInstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`InstantUpdateTpslParams`](#instantupdatetpslparams) |

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

Fields of `InstantUpdateTpslInstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `keeper`                        | `Pubkey`           |
| 1   | `api_keeper`                    | `Pubkey`           |
| 2   | `owner`                         | `Pubkey`           |
| 3   | `perpetuals`                    | `Pubkey`           |
| 4   | `pool`                          | `Pubkey`           |
| 5   | `position`                      | `Pubkey`           |
| 6   | `position_request`              | `Pubkey`           |
| 7   | `custody`                       | `Pubkey`           |
| 8   | `custody_doves_price_account`   | `Pubkey`           |
| 9   | `custody_pythnet_price_account` | `Pubkey`           |
| 10  | `event_authority`               | `Pubkey`           |
| 11  | `program`                       | `Pubkey`           |
| 12… | `remaining`                     | `Vec<AccountMeta>` |

### `LiquidateBorrowPosition`

Discriminator `ebc91185ea4854d2` · data `LiquidateBorrowPosition` · accounts `LiquidateBorrowPositionInstructionAccounts`.

| Field    | Type                                                              |
| -------- | ----------------------------------------------------------------- |
| `params` | [`LiquidateBorrowPositionParams`](#liquidateborrowpositionparams) |

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

Fields of `LiquidateBorrowPositionInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `signer`                   | `Pubkey`           |
| 1   | `perpetuals`               | `Pubkey`           |
| 2   | `pool`                     | `Pubkey`           |
| 3   | `custody`                  | `Pubkey`           |
| 4   | `transfer_authority`       | `Pubkey`           |
| 5   | `borrow_position`          | `Pubkey`           |
| 6   | `collateral_token_account` | `Pubkey`           |
| 7   | `lp_token_mint`            | `Pubkey`           |
| 8   | `token_program`            | `Pubkey`           |
| 9   | `event_authority`          | `Pubkey`           |
| 10  | `program`                  | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `LiquidateFullPosition4`

Discriminator `40b05833a8bc9caf` · data `LiquidateFullPosition4` · accounts `LiquidateFullPosition4InstructionAccounts`.

| Field    | Type                                                            |
| -------- | --------------------------------------------------------------- |
| `params` | [`LiquidateFullPosition4Params`](#liquidatefullposition4params) |

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

Fields of `LiquidateFullPosition4InstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `signer`                                   | `Pubkey`           |
| 1   | `perpetuals`                               | `Pubkey`           |
| 2   | `pool`                                     | `Pubkey`           |
| 3   | `position`                                 | `Pubkey`           |
| 4   | `custody`                                  | `Pubkey`           |
| 5   | `custody_doves_price_account`              | `Pubkey`           |
| 6   | `custody_pythnet_price_account`            | `Pubkey`           |
| 7   | `collateral_custody`                       | `Pubkey`           |
| 8   | `collateral_custody_doves_price_account`   | `Pubkey`           |
| 9   | `collateral_custody_pythnet_price_account` | `Pubkey`           |
| 10  | `collateral_custody_token_account`         | `Pubkey`           |
| 11  | `event_authority`                          | `Pubkey`           |
| 12  | `program`                                  | `Pubkey`           |
| 13… | `remaining`                                | `Vec<AccountMeta>` |

### `OperatorSetCustodyConfig`

Discriminator `a6895ccc91e018da` · data `OperatorSetCustodyConfig` · accounts `OperatorSetCustodyConfigInstructionAccounts`.

| Field    | Type                                                                |
| -------- | ------------------------------------------------------------------- |
| `params` | [`OperatorSetCustodyConfigParams`](#operatorsetcustodyconfigparams) |

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

Fields of `OperatorSetCustodyConfigInstructionAccounts`, in account order:

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

### `OperatorSetPoolConfig`

Discriminator `4cc95012c75cf669` · data `OperatorSetPoolConfig` · accounts `OperatorSetPoolConfigInstructionAccounts`.

| Field    | Type                                                          |
| -------- | ------------------------------------------------------------- |
| `params` | [`OperatorSetPoolConfigParams`](#operatorsetpoolconfigparams) |

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

Fields of `OperatorSetPoolConfigInstructionAccounts`, in account order:

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

### `PartialLiquidateBorrowPosition`

Discriminator `faa60d4a61cc82d1` · data `PartialLiquidateBorrowPosition` · accounts `PartialLiquidateBorrowPositionInstructionAccounts`.

| Field    | Type                                                                            |
| -------- | ------------------------------------------------------------------------------- |
| `params` | [`PartialLiquidateBorrowPositionParams`](#partialliquidateborrowpositionparams) |

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

Fields of `PartialLiquidateBorrowPositionInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `signer`                   | `Pubkey`           |
| 1   | `perpetuals`               | `Pubkey`           |
| 2   | `pool`                     | `Pubkey`           |
| 3   | `custody`                  | `Pubkey`           |
| 4   | `transfer_authority`       | `Pubkey`           |
| 5   | `borrow_position`          | `Pubkey`           |
| 6   | `collateral_token_account` | `Pubkey`           |
| 7   | `lp_token_mint`            | `Pubkey`           |
| 8   | `token_program`            | `Pubkey`           |
| 9   | `event_authority`          | `Pubkey`           |
| 10  | `program`                  | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `ReallocCustody`

Discriminator `7b3a6d8b8507e1c8` · data `ReallocCustody` · accounts `ReallocCustodyInstructionAccounts`.

No data fields.

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

Fields of `ReallocCustodyInstructionAccounts`, in account order:

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

### `ReallocPool`

Discriminator `728025a747e328b2` · data `ReallocPool` · accounts `ReallocPoolInstructionAccounts`.

No data fields.

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

Fields of `ReallocPoolInstructionAccounts`, in account order:

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

### `RedeemStake`

Discriminator `b2cbfa698576ff45` · data `RedeemStake` · accounts `RedeemStakeInstructionAccounts`.

No data fields.

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

Fields of `RedeemStakeInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `keeper`        | `Pubkey`           |
| 1  | `perpetuals`    | `Pubkey`           |
| 2  | `pool`          | `Pubkey`           |
| 3  | `custody`       | `Pubkey`           |
| 4  | `stake_account` | `Pubkey`           |
| 5  | `stake_info`    | `Pubkey`           |
| 6… | `remaining`     | `Vec<AccountMeta>` |

### `RefreshAssetsUnderManagement`

Discriminator `a200d737e10fb900` · data `RefreshAssetsUnderManagement` · accounts `RefreshAssetsUnderManagementInstructionAccounts`.

| Field    | Type                                                                        |
| -------- | --------------------------------------------------------------------------- |
| `params` | [`RefreshAssetsUnderManagementParams`](#refreshassetsundermanagementparams) |

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

Fields of `RefreshAssetsUnderManagementInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `keeper`        | `Pubkey`           |
| 1  | `perpetuals`    | `Pubkey`           |
| 2  | `pool`          | `Pubkey`           |
| 3  | `lp_token_mint` | `Pubkey`           |
| 4… | `remaining`     | `Vec<AccountMeta>` |

### `RemoveLiquidity2`

Discriminator `e6d7527ff165e392` · data `RemoveLiquidity2` · accounts `RemoveLiquidity2InstructionAccounts`.

| Field    | Type                                                |
| -------- | --------------------------------------------------- |
| `params` | [`RemoveLiquidity2Params`](#removeliquidity2params) |

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

Fields of `RemoveLiquidity2InstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `owner`                         | `Pubkey`           |
| 1   | `receiving_account`             | `Pubkey`           |
| 2   | `lp_token_account`              | `Pubkey`           |
| 3   | `transfer_authority`            | `Pubkey`           |
| 4   | `perpetuals`                    | `Pubkey`           |
| 5   | `pool`                          | `Pubkey`           |
| 6   | `custody`                       | `Pubkey`           |
| 7   | `custody_doves_price_account`   | `Pubkey`           |
| 8   | `custody_pythnet_price_account` | `Pubkey`           |
| 9   | `custody_token_account`         | `Pubkey`           |
| 10  | `lp_token_mint`                 | `Pubkey`           |
| 11  | `token_program`                 | `Pubkey`           |
| 12  | `event_authority`               | `Pubkey`           |
| 13  | `program`                       | `Pubkey`           |
| 14… | `remaining`                     | `Vec<AccountMeta>` |

### `RepayToCustody`

Discriminator `d3dbb7def84a051a` · data `RepayToCustody` · accounts `RepayToCustodyInstructionAccounts`.

| Field    | Type                                            |
| -------- | ----------------------------------------------- |
| `params` | [`RepayToCustodyParams`](#repaytocustodyparams) |

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

Fields of `RepayToCustodyInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `owner`                 | `Pubkey`           |
| 1   | `perpetuals`            | `Pubkey`           |
| 2   | `pool`                  | `Pubkey`           |
| 3   | `custody`               | `Pubkey`           |
| 4   | `borrow_position`       | `Pubkey`           |
| 5   | `custody_token_account` | `Pubkey`           |
| 6   | `user_token_account`    | `Pubkey`           |
| 7   | `token_program`         | `Pubkey`           |
| 8   | `event_authority`       | `Pubkey`           |
| 9   | `program`               | `Pubkey`           |
| 10… | `remaining`             | `Vec<AccountMeta>` |

### `SetCustodyConfig`

Discriminator `8561828fd7e524b0` · data `SetCustodyConfig` · accounts `SetCustodyConfigInstructionAccounts`.

| Field    | Type                                                |
| -------- | --------------------------------------------------- |
| `params` | [`SetCustodyConfigParams`](#setcustodyconfigparams) |

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

Fields of `SetCustodyConfigInstructionAccounts`, in account order:

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

### `SetMaxGlobalSizes`

Discriminator `5902d218a7e30dd6` · data `SetMaxGlobalSizes` · accounts `SetMaxGlobalSizesInstructionAccounts`.

| Field    | Type                                                  |
| -------- | ----------------------------------------------------- |
| `params` | [`SetMaxGlobalSizesParams`](#setmaxglobalsizesparams) |

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

Fields of `SetMaxGlobalSizesInstructionAccounts`, in account order:

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

### `SetPerpetualsConfig`

Discriminator `504815bf1d792d6f` · data `SetPerpetualsConfig` · accounts `SetPerpetualsConfigInstructionAccounts`.

| Field    | Type                                                      |
| -------- | --------------------------------------------------------- |
| `params` | [`SetPerpetualsConfigParams`](#setperpetualsconfigparams) |

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

Fields of `SetPerpetualsConfigInstructionAccounts`, in account order:

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

### `SetPoolConfig`

Discriminator `d857417d716eb978` · data `SetPoolConfig` · accounts `SetPoolConfigInstructionAccounts`.

| Field    | Type                                          |
| -------- | --------------------------------------------- |
| `params` | [`SetPoolConfigParams`](#setpoolconfigparams) |

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

Fields of `SetPoolConfigInstructionAccounts`, in account order:

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

### `SetTestTime`

Discriminator `f2e7b1fb7e919f68` · data `SetTestTime` · accounts `SetTestTimeInstructionAccounts`.

| Field    | Type                                      |
| -------- | ----------------------------------------- |
| `params` | [`SetTestTimeParams`](#settesttimeparams) |

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

Fields of `SetTestTimeInstructionAccounts`, in account order:

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

### `SetTokenLedger`

Discriminator `e455b9704e4f4d02` · data `SetTokenLedger` · accounts `SetTokenLedgerInstructionAccounts`.

No data fields.

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

Fields of `SetTokenLedgerInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `token_ledger`  | `Pubkey`           |
| 1  | `token_account` | `Pubkey`           |
| 2  | `token_program` | `Pubkey`           |
| 3… | `remaining`     | `Vec<AccountMeta>` |

### `Swap2`

Discriminator `414b3f4ceb5b5b88` · data `Swap2` · accounts `Swap2InstructionAccounts`.

| Field    | Type                          |
| -------- | ----------------------------- |
| `params` | [`Swap2Params`](#swap2params) |

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

Fields of `Swap2InstructionAccounts`, in account order:

| #   | Field                                      | Type               |
| --- | ------------------------------------------ | ------------------ |
| 0   | `owner`                                    | `Pubkey`           |
| 1   | `funding_account`                          | `Pubkey`           |
| 2   | `receiving_account`                        | `Pubkey`           |
| 3   | `transfer_authority`                       | `Pubkey`           |
| 4   | `perpetuals`                               | `Pubkey`           |
| 5   | `pool`                                     | `Pubkey`           |
| 6   | `receiving_custody`                        | `Pubkey`           |
| 7   | `receiving_custody_doves_price_account`    | `Pubkey`           |
| 8   | `receiving_custody_pythnet_price_account`  | `Pubkey`           |
| 9   | `receiving_custody_token_account`          | `Pubkey`           |
| 10  | `dispensing_custody`                       | `Pubkey`           |
| 11  | `dispensing_custody_doves_price_account`   | `Pubkey`           |
| 12  | `dispensing_custody_pythnet_price_account` | `Pubkey`           |
| 13  | `dispensing_custody_token_account`         | `Pubkey`           |
| 14  | `token_program`                            | `Pubkey`           |
| 15  | `event_authority`                          | `Pubkey`           |
| 16  | `program`                                  | `Pubkey`           |
| 17… | `remaining`                                | `Vec<AccountMeta>` |

### `SwapWithTokenLedger`

Discriminator `8b8deec529d3ac13` · data `SwapWithTokenLedger` · accounts `SwapWithTokenLedgerInstructionAccounts`.

| Field    | Type                                                      |
| -------- | --------------------------------------------------------- |
| `params` | [`SwapWithTokenLedgerParams`](#swapwithtokenledgerparams) |

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

Fields of `SwapWithTokenLedgerInstructionAccounts`, in account order:

| #   | Field                                    | Type               |
| --- | ---------------------------------------- | ------------------ |
| 0   | `owner`                                  | `Pubkey`           |
| 1   | `funding_account`                        | `Pubkey`           |
| 2   | `receiving_account`                      | `Pubkey`           |
| 3   | `transfer_authority`                     | `Pubkey`           |
| 4   | `perpetuals`                             | `Pubkey`           |
| 5   | `pool`                                   | `Pubkey`           |
| 6   | `receiving_custody`                      | `Pubkey`           |
| 7   | `receiving_custody_doves_price_account`  | `Pubkey`           |
| 8   | `receiving_custody_token_account`        | `Pubkey`           |
| 9   | `dispensing_custody`                     | `Pubkey`           |
| 10  | `dispensing_custody_doves_price_account` | `Pubkey`           |
| 11  | `dispensing_custody_token_account`       | `Pubkey`           |
| 12  | `token_ledger`                           | `Pubkey`           |
| 13  | `token_program`                          | `Pubkey`           |
| 14  | `instruction`                            | `Pubkey`           |
| 15  | `event_authority`                        | `Pubkey`           |
| 16  | `program`                                | `Pubkey`           |
| 17… | `remaining`                              | `Vec<AccountMeta>` |

### `TestInit`

Discriminator `30335c7a51137029` · data `TestInit` · accounts `TestInitInstructionAccounts`.

| Field    | Type                                |
| -------- | ----------------------------------- |
| `params` | [`TestInitParams`](#testinitparams) |

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

Fields of `TestInitInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `upgrade_authority`  | `Pubkey`           |
| 1  | `admin`              | `Pubkey`           |
| 2  | `transfer_authority` | `Pubkey`           |
| 3  | `perpetuals`         | `Pubkey`           |
| 4  | `system_program`     | `Pubkey`           |
| 5  | `token_program`      | `Pubkey`           |
| 6… | `remaining`          | `Vec<AccountMeta>` |

### `TransferAdmin`

Discriminator `2af2426ae40a6f9c` · data `TransferAdmin` · accounts `TransferAdminInstructionAccounts`.

| Field    | Type                                          |
| -------- | --------------------------------------------- |
| `params` | [`TransferAdminParams`](#transferadminparams) |

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

Fields of `TransferAdminInstructionAccounts`, in account order:

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

### `Unstake`

Discriminator `5a5f6b2acd7c32e1` · data `Unstake` · accounts `UnstakeInstructionAccounts`.

No data fields.

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

Fields of `UnstakeInstructionAccounts`, in account order:

| #  | Field                | Type               |
| -- | -------------------- | ------------------ |
| 0  | `operator`           | `Pubkey`           |
| 1  | `perpetuals`         | `Pubkey`           |
| 2  | `pool`               | `Pubkey`           |
| 3  | `custody`            | `Pubkey`           |
| 4  | `transfer_authority` | `Pubkey`           |
| 5  | `stake_account`      | `Pubkey`           |
| 6  | `stake_info`         | `Pubkey`           |
| 7  | `clock`              | `Pubkey`           |
| 8  | `stake_program`      | `Pubkey`           |
| 9… | `remaining`          | `Vec<AccountMeta>` |

### `UpdateDecreasePositionRequest2`

Discriminator `90c8f9ff6cd9f974` · data `UpdateDecreasePositionRequest2` · accounts `UpdateDecreasePositionRequest2InstructionAccounts`.

| Field    | Type                                                                            |
| -------- | ------------------------------------------------------------------------------- |
| `params` | [`UpdateDecreasePositionRequest2Params`](#updatedecreasepositionrequest2params) |

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

Fields of `UpdateDecreasePositionRequest2InstructionAccounts`, in account order:

| #  | Field                           | Type               |
| -- | ------------------------------- | ------------------ |
| 0  | `owner`                         | `Pubkey`           |
| 1  | `perpetuals`                    | `Pubkey`           |
| 2  | `pool`                          | `Pubkey`           |
| 3  | `position`                      | `Pubkey`           |
| 4  | `position_request`              | `Pubkey`           |
| 5  | `custody`                       | `Pubkey`           |
| 6  | `custody_doves_price_account`   | `Pubkey`           |
| 7  | `custody_pythnet_price_account` | `Pubkey`           |
| 8… | `remaining`                     | `Vec<AccountMeta>` |

### `WithdrawCollateralForBorrows`

Discriminator `75a03c52ede92eb6` · data `WithdrawCollateralForBorrows` · accounts `WithdrawCollateralForBorrowsInstructionAccounts`.

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

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

Fields of `WithdrawCollateralForBorrowsInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `owner`                    | `Pubkey`           |
| 1   | `perpetuals`               | `Pubkey`           |
| 2   | `pool`                     | `Pubkey`           |
| 3   | `custody`                  | `Pubkey`           |
| 4   | `transfer_authority`       | `Pubkey`           |
| 5   | `borrow_position`          | `Pubkey`           |
| 6   | `collateral_token_account` | `Pubkey`           |
| 7   | `user_token_account`       | `Pubkey`           |
| 8   | `lp_token_mint`            | `Pubkey`           |
| 9   | `token_program`            | `Pubkey`           |
| 10  | `event_authority`          | `Pubkey`           |
| 11  | `program`                  | `Pubkey`           |
| 12… | `remaining`                | `Vec<AccountMeta>` |

### `WithdrawFees2`

Discriminator `fc808f91e1dd9fcf` · data `WithdrawFees2` · accounts `WithdrawFees2InstructionAccounts`.

| Field    | Type                                          |
| -------- | --------------------------------------------- |
| `params` | [`WithdrawFees2Params`](#withdrawfees2params) |

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

Fields of `WithdrawFees2InstructionAccounts`, in account order:

| #   | Field                           | Type               |
| --- | ------------------------------- | ------------------ |
| 0   | `keeper`                        | `Pubkey`           |
| 1   | `transfer_authority`            | `Pubkey`           |
| 2   | `perpetuals`                    | `Pubkey`           |
| 3   | `pool`                          | `Pubkey`           |
| 4   | `custody`                       | `Pubkey`           |
| 5   | `custody_token_account`         | `Pubkey`           |
| 6   | `custody_doves_price_account`   | `Pubkey`           |
| 7   | `custody_pythnet_price_account` | `Pubkey`           |
| 8   | `receiving_token_account`       | `Pubkey`           |
| 9   | `token_program`                 | `Pubkey`           |
| 10… | `remaining`                     | `Vec<AccountMeta>` |

### `WithdrawStake`

Discriminator `9908168a69b05742` · data `WithdrawStake` · accounts `WithdrawStakeInstructionAccounts`.

No data fields.

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

Fields of `WithdrawStakeInstructionAccounts`, in account order:

| #   | Field                   | Type               |
| --- | ----------------------- | ------------------ |
| 0   | `keeper`                | `Pubkey`           |
| 1   | `perpetuals`            | `Pubkey`           |
| 2   | `pool`                  | `Pubkey`           |
| 3   | `custody`               | `Pubkey`           |
| 4   | `custody_token_account` | `Pubkey`           |
| 5   | `transfer_authority`    | `Pubkey`           |
| 6   | `stake_account`         | `Pubkey`           |
| 7   | `stake_info`            | `Pubkey`           |
| 8   | `clock`                 | `Pubkey`           |
| 9   | `stake_history`         | `Pubkey`           |
| 10  | `stake_program`         | `Pubkey`           |
| 11  | `system_program`        | `Pubkey`           |
| 12  | `token_program`         | `Pubkey`           |
| 13… | `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 `JupiterPerpetualsAccount`. Each wraps a boxed struct from `carbon_jupiter_perpetuals_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `BorrowPosition`

Discriminator `f38c148b20f37237` · `accounts::borrow_position::BorrowPosition`.

| Field                                     | Type     |
| ----------------------------------------- | -------- |
| `owner`                                   | `Pubkey` |
| `pool`                                    | `Pubkey` |
| `custody`                                 | `Pubkey` |
| `open_time`                               | `i64`    |
| `update_time`                             | `i64`    |
| `borrow_size`                             | `u128`   |
| `cumulative_compounded_interest_snapshot` | `u128`   |
| `locked_collateral`                       | `u64`    |
| `bump`                                    | `u8`     |
| `last_borrowed`                           | `i64`    |

### `Custody`

Discriminator `01b830515d833f91` · `accounts::custody::Custody`.

| Field                                   | Type                                      |
| --------------------------------------- | ----------------------------------------- |
| `pool`                                  | `Pubkey`                                  |
| `mint`                                  | `Pubkey`                                  |
| `token_account`                         | `Pubkey`                                  |
| `decimals`                              | `u8`                                      |
| `is_stable`                             | `bool`                                    |
| `oracle`                                | [`OracleParams`](#oracleparams)           |
| `pricing`                               | [`PricingParams`](#pricingparams)         |
| `permissions`                           | [`Permissions`](#permissions)             |
| `target_ratio_bps`                      | `u64`                                     |
| `assets`                                | [`Assets`](#assets)                       |
| `funding_rate_state`                    | [`FundingRateState`](#fundingratestate)   |
| `bump`                                  | `u8`                                      |
| `token_account_bump`                    | `u8`                                      |
| `increase_position_bps`                 | `u64`                                     |
| `decrease_position_bps`                 | `u64`                                     |
| `max_position_size_usd`                 | `u64`                                     |
| `doves_oracle`                          | `Pubkey`                                  |
| `jump_rate_state`                       | [`JumpRateState`](#jumpratestate)         |
| `doves_ag_oracle`                       | `Pubkey`                                  |
| `price_impact_buffer`                   | [`PriceImpactBuffer`](#priceimpactbuffer) |
| `borrow_lend_parameters`                | [`BorrowLendParams`](#borrowlendparams)   |
| `borrows_funding_rate_state`            | [`FundingRateState`](#fundingratestate)   |
| `debt`                                  | `u128`                                    |
| `borrow_lend_interests_accured`         | `u128`                                    |
| `borrow_limit_in_token_amount`          | `u64`                                     |
| `min_interest_fee_bps`                  | `u64`                                     |
| `min_interest_fee_grace_period_seconds` | `u64`                                     |
| `total_staked_amount_lamports`          | `u64`                                     |
| `max_total_staked_amount_lamports`      | `u64`                                     |
| `external_swap_fee_multiplier_bps`      | `u64`                                     |
| `disable_close_position_request`        | `bool`                                    |
| `withdrawal_limit_token_amount`         | `u64`                                     |
| `withdrawal_token_amount_accumulated`   | `u64`                                     |
| `withdrawal_limit_last_reset_at`        | `i64`                                     |
| `withdrawal_limit_interval_seconds`     | `u64`                                     |

### `Perpetuals`

Discriminator `1ca762bf68526cc4` · `accounts::perpetuals::Perpetuals`.

| Field                     | Type                          |
| ------------------------- | ----------------------------- |
| `permissions`             | [`Permissions`](#permissions) |
| `pools`                   | `Vec<Pubkey>`                 |
| `admin`                   | `Pubkey`                      |
| `transfer_authority_bump` | `u8`                          |
| `perpetuals_bump`         | `u8`                          |
| `inception_time`          | `i64`                         |

### `Pool`

Discriminator `f19a6d0411b16dbc` · `accounts::pool::Pool`.

| Field                            | Type                                  |
| -------------------------------- | ------------------------------------- |
| `name`                           | `String`                              |
| `custodies`                      | `Vec<Pubkey>`                         |
| `aum_usd`                        | `u128`                                |
| `limit`                          | [`Limit`](#limit)                     |
| `fees`                           | [`Fees`](#fees)                       |
| `pool_apr`                       | [`PoolApr`](#poolapr)                 |
| `max_request_execution_sec`      | `i64`                                 |
| `bump`                           | `u8`                                  |
| `lp_token_bump`                  | `u8`                                  |
| `inception_time`                 | `i64`                                 |
| `parameter_update_oracle`        | [`Secp256k1Pubkey`](#secp256k1pubkey) |
| `aum_usd_updated_at`             | `i64`                                 |
| `max_trigger_price_diff_bps`     | `u64`                                 |
| `disable_close_position_request` | `bool`                                |
| `max_lp_token_price_change_bps`  | `u64`                                 |
| `aum_usd_refreshed_at_slot`      | `u64`                                 |

### `Position`

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

| Field                          | Type            |
| ------------------------------ | --------------- |
| `owner`                        | `Pubkey`        |
| `pool`                         | `Pubkey`        |
| `custody`                      | `Pubkey`        |
| `collateral_custody`           | `Pubkey`        |
| `open_time`                    | `i64`           |
| `update_time`                  | `i64`           |
| `side`                         | [`Side`](#side) |
| `price`                        | `u64`           |
| `size_usd`                     | `u64`           |
| `collateral_usd`               | `u64`           |
| `realised_pnl_usd`             | `i64`           |
| `cumulative_interest_snapshot` | `u128`          |
| `locked_amount`                | `u64`           |
| `bump`                         | `u8`            |

### `PositionRequest`

Discriminator `0c26fac72e9a20d8` · `accounts::position_request::PositionRequest`.

| Field                     | Type                              |
| ------------------------- | --------------------------------- |
| `owner`                   | `Pubkey`                          |
| `pool`                    | `Pubkey`                          |
| `custody`                 | `Pubkey`                          |
| `position`                | `Pubkey`                          |
| `mint`                    | `Pubkey`                          |
| `open_time`               | `i64`                             |
| `update_time`             | `i64`                             |
| `size_usd_delta`          | `u64`                             |
| `collateral_delta`        | `u64`                             |
| `request_change`          | [`RequestChange`](#requestchange) |
| `request_type`            | [`RequestType`](#requesttype)     |
| `side`                    | [`Side`](#side)                   |
| `price_slippage`          | `Option<u64>`                     |
| `jupiter_minimum_out`     | `Option<u64>`                     |
| `pre_swap_amount`         | `Option<u64>`                     |
| `trigger_price`           | `Option<u64>`                     |
| `trigger_above_threshold` | `Option<bool>`                    |
| `entire_position`         | `Option<bool>`                    |
| `executed`                | `bool`                            |
| `counter`                 | `u64`                             |
| `bump`                    | `u8`                              |
| `referral`                | `Option<Pubkey>`                  |

### `StakeInfo`

Discriminator `423e44466cb3b7eb` · `accounts::stake_info::StakeInfo`.

| Field                            | Type     |
| -------------------------------- | -------- |
| `pool`                           | `Pubkey` |
| `stake_account`                  | `Pubkey` |
| `current_staked_amount_lamports` | `u64`    |
| `total_staking_rewards_lamports` | `u64`    |
| `last_updated_at`                | `i64`    |
| `deactivating`                   | `bool`   |
| `stake_account_index`            | `u64`    |
| `bump`                           | `u8`     |

### `TokenLedger`

Discriminator `9cf709bc366c554d` · `accounts::token_ledger::TokenLedger`.

| Field           | Type     |
| --------------- | -------- |
| `token_account` | `Pubkey` |
| `amount`        | `u64`    |

## Events

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

### `CreatePositionRequestEvent`

Discriminator `02ee5e3569d32eba` · `events::create_position_request_event::CreatePositionRequestEventEvent`.

| Field                         | Type             |
| ----------------------------- | ---------------- |
| `owner`                       | `Pubkey`         |
| `pool`                        | `Pubkey`         |
| `position_key`                | `Pubkey`         |
| `position_side`               | `u8`             |
| `position_mint`               | `Pubkey`         |
| `position_custody`            | `Pubkey`         |
| `position_collateral_mint`    | `Pubkey`         |
| `position_collateral_custody` | `Pubkey`         |
| `position_request_key`        | `Pubkey`         |
| `position_request_mint`       | `Pubkey`         |
| `size_usd_delta`              | `u64`            |
| `collateral_delta`            | `u64`            |
| `price_slippage`              | `Option<u64>`    |
| `jupiter_minimum_out`         | `Option<u64>`    |
| `pre_swap_amount`             | `Option<u64>`    |
| `request_change`              | `u8`             |
| `open_time`                   | `i64`            |
| `referral`                    | `Option<Pubkey>` |

### `InstantCreateTpslEvent`

Discriminator `f236065f188d67c6` · `events::instant_create_tpsl_event::InstantCreateTpslEventEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `owner`                       | `Pubkey` |
| `pool`                        | `Pubkey` |
| `position_key`                | `Pubkey` |
| `position_side`               | `u8`     |
| `position_mint`               | `Pubkey` |
| `position_custody`            | `Pubkey` |
| `position_collateral_custody` | `Pubkey` |
| `position_request_key`        | `Pubkey` |
| `position_request_mint`       | `Pubkey` |
| `size_usd_delta`              | `u64`    |
| `collateral_delta`            | `u64`    |
| `entire_position`             | `bool`   |
| `open_time`                   | `i64`    |

### `InstantUpdateTpslEvent`

Discriminator `b1162f2578f61165` · `events::instant_update_tpsl_event::InstantUpdateTpslEventEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `owner`                       | `Pubkey` |
| `pool`                        | `Pubkey` |
| `position_key`                | `Pubkey` |
| `position_side`               | `u8`     |
| `position_mint`               | `Pubkey` |
| `position_custody`            | `Pubkey` |
| `position_collateral_custody` | `Pubkey` |
| `position_request_key`        | `Pubkey` |
| `position_request_mint`       | `Pubkey` |
| `size_usd_delta`              | `u64`    |
| `collateral_delta`            | `u64`    |
| `entire_position`             | `bool`   |
| `update_time`                 | `i64`    |

### `ClosePositionRequestEvent`

Discriminator `15225c9ee01db4f3` · `events::close_position_request_event::ClosePositionRequestEventEvent`.

| Field                  | Type           |
| ---------------------- | -------------- |
| `entire_position`      | `Option<bool>` |
| `executed`             | `bool`         |
| `request_change`       | `u8`           |
| `request_type`         | `u8`           |
| `side`                 | `u8`           |
| `position_request_key` | `Pubkey`       |
| `owner`                | `Pubkey`       |
| `mint`                 | `Pubkey`       |
| `amount`               | `u64`          |
| `open_time`            | `i64`          |

### `IncreasePositionEvent`

Discriminator `f5715534d6bb9984` · `events::increase_position_event::IncreasePositionEventEvent`.

| Field                               | Type             |
| ----------------------------------- | ---------------- |
| `position_key`                      | `Pubkey`         |
| `position_side`                     | `u8`             |
| `position_custody`                  | `Pubkey`         |
| `position_collateral_custody`       | `Pubkey`         |
| `position_size_usd`                 | `u64`            |
| `position_mint`                     | `Pubkey`         |
| `position_request_key`              | `Pubkey`         |
| `position_request_mint`             | `Pubkey`         |
| `position_request_change`           | `u8`             |
| `position_request_type`             | `u8`             |
| `position_request_collateral_delta` | `u64`            |
| `owner`                             | `Pubkey`         |
| `pool`                              | `Pubkey`         |
| `size_usd_delta`                    | `u64`            |
| `collateral_usd_delta`              | `u64`            |
| `collateral_token_delta`            | `u64`            |
| `price`                             | `u64`            |
| `price_slippage`                    | `Option<u64>`    |
| `fee_token`                         | `u64`            |
| `fee_usd`                           | `u64`            |
| `open_time`                         | `i64`            |
| `referral`                          | `Option<Pubkey>` |
| `position_fee_usd`                  | `u64`            |
| `funding_fee_usd`                   | `u64`            |
| `price_impact_fee_usd`              | `u64`            |

### `IncreasePositionPreSwapEvent`

Discriminator `ed6b098b164b04d5` · `events::increase_position_pre_swap_event::IncreasePositionPreSwapEventEvent`.

| Field                                | Type     |
| ------------------------------------ | -------- |
| `position_request_key`               | `Pubkey` |
| `transfer_amount`                    | `u64`    |
| `collateral_custody_pre_swap_amount` | `u64`    |

### `DecreasePositionEvent`

Discriminator `409c2b4a6d83107f` · `events::decrease_position_event::DecreasePositionEventEvent`.

| Field                              | Type             |
| ---------------------------------- | ---------------- |
| `position_key`                     | `Pubkey`         |
| `position_side`                    | `u8`             |
| `position_custody`                 | `Pubkey`         |
| `position_collateral_custody`      | `Pubkey`         |
| `position_size_usd`                | `u64`            |
| `position_mint`                    | `Pubkey`         |
| `position_request_key`             | `Pubkey`         |
| `position_request_mint`            | `Pubkey`         |
| `position_request_change`          | `u8`             |
| `position_request_type`            | `u8`             |
| `has_profit`                       | `bool`           |
| `pnl_delta`                        | `u64`            |
| `owner`                            | `Pubkey`         |
| `pool`                             | `Pubkey`         |
| `size_usd_delta`                   | `u64`            |
| `transfer_amount_usd`              | `u64`            |
| `transfer_token`                   | `Option<u64>`    |
| `price`                            | `u64`            |
| `price_slippage`                   | `Option<u64>`    |
| `fee_usd`                          | `u64`            |
| `open_time`                        | `i64`            |
| `referral`                         | `Option<Pubkey>` |
| `position_fee_usd`                 | `u64`            |
| `funding_fee_usd`                  | `u64`            |
| `price_impact_fee_usd`             | `u64`            |
| `original_position_collateral_usd` | `u64`            |
| `position_collateral_usd`          | `u64`            |
| `position_open_time`               | `i64`            |
| `position_price`                   | `u64`            |

### `DecreasePositionPostSwapEvent`

Discriminator `17d210e962f55952` · `events::decrease_position_post_swap_event::DecreasePositionPostSwapEventEvent`.

| Field                  | Type          |
| ---------------------- | ------------- |
| `position_request_key` | `Pubkey`      |
| `swap_amount`          | `u64`         |
| `jupiter_minimum_out`  | `Option<u64>` |

### `LiquidateFullPositionEvent`

Discriminator `806547a880485654` · `events::liquidate_full_position_event::LiquidateFullPositionEventEvent`.

| Field                              | Type     |
| ---------------------------------- | -------- |
| `position_key`                     | `Pubkey` |
| `position_side`                    | `u8`     |
| `position_custody`                 | `Pubkey` |
| `position_collateral_custody`      | `Pubkey` |
| `position_collateral_mint`         | `Pubkey` |
| `position_mint`                    | `Pubkey` |
| `position_size_usd`                | `u64`    |
| `has_profit`                       | `bool`   |
| `pnl_delta`                        | `u64`    |
| `owner`                            | `Pubkey` |
| `pool`                             | `Pubkey` |
| `transfer_amount_usd`              | `u64`    |
| `transfer_token`                   | `u64`    |
| `price`                            | `u64`    |
| `fee_usd`                          | `u64`    |
| `liquidation_fee_usd`              | `u64`    |
| `open_time`                        | `i64`    |
| `position_fee_usd`                 | `u64`    |
| `funding_fee_usd`                  | `u64`    |
| `price_impact_fee_usd`             | `u64`    |
| `original_position_collateral_usd` | `u64`    |
| `position_collateral_usd`          | `u64`    |
| `position_open_time`               | `i64`    |
| `position_price`                   | `u64`    |

### `PoolSwapEvent`

Discriminator `286bd41adf8827dc` · `events::pool_swap_event::PoolSwapEventEvent`.

| Field                    | Type     |
| ------------------------ | -------- |
| `receiving_custody_key`  | `Pubkey` |
| `dispensing_custody_key` | `Pubkey` |
| `pool_key`               | `Pubkey` |
| `amount_in`              | `u64`    |
| `amount_out`             | `u64`    |
| `swap_usd_amount`        | `u64`    |
| `amount_out_after_fees`  | `u64`    |
| `fee_bps`                | `u64`    |
| `owner_key`              | `Pubkey` |
| `receiving_account_key`  | `Pubkey` |

### `PoolSwapExactOutEvent`

Discriminator `79760b0bc6428e73` · `events::pool_swap_exact_out_event::PoolSwapExactOutEventEvent`.

| Field                    | Type     |
| ------------------------ | -------- |
| `receiving_custody_key`  | `Pubkey` |
| `dispensing_custody_key` | `Pubkey` |
| `pool_key`               | `Pubkey` |
| `amount_in`              | `u64`    |
| `amount_in_after_fees`   | `u64`    |
| `amount_out`             | `u64`    |
| `swap_usd_amount`        | `u64`    |
| `fee_bps`                | `u64`    |
| `owner_key`              | `Pubkey` |
| `receiving_account_key`  | `Pubkey` |

### `AddLiquidityEvent`

Discriminator `1bb299ba2fc48c2d` · `events::add_liquidity_event::AddLiquidityEventEvent`.

| Field                    | Type     |
| ------------------------ | -------- |
| `custody_key`            | `Pubkey` |
| `pool_key`               | `Pubkey` |
| `token_amount_in`        | `u64`    |
| `pre_pool_amount_usd`    | `u128`   |
| `token_amount_usd`       | `u64`    |
| `fee_bps`                | `u64`    |
| `token_amount_after_fee` | `u64`    |
| `mint_amount_usd`        | `u64`    |
| `lp_amount`              | `u64`    |
| `post_pool_amount_usd`   | `u128`   |

### `RemoveLiquidityEvent`

Discriminator `8dc7b67b9f5ed766` · `events::remove_liquidity_event::RemoveLiquidityEventEvent`.

| Field                    | Type     |
| ------------------------ | -------- |
| `custody_key`            | `Pubkey` |
| `pool_key`               | `Pubkey` |
| `lp_amount_in`           | `u64`    |
| `remove_amount_usd`      | `u64`    |
| `fee_bps`                | `u64`    |
| `remove_token_amount`    | `u64`    |
| `token_amount_after_fee` | `u64`    |
| `post_pool_amount_usd`   | `u128`   |

### `InstantCreateLimitOrderEvent`

Discriminator `0aa3557381e050c0` · `events::instant_create_limit_order_event::InstantCreateLimitOrderEventEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `owner`                       | `Pubkey` |
| `pool`                        | `Pubkey` |
| `position_key`                | `Pubkey` |
| `position_side`               | `u8`     |
| `position_mint`               | `Pubkey` |
| `position_custody`            | `Pubkey` |
| `position_collateral_mint`    | `Pubkey` |
| `position_collateral_custody` | `Pubkey` |
| `position_request_key`        | `Pubkey` |
| `position_request_mint`       | `Pubkey` |
| `size_usd_delta`              | `u64`    |
| `collateral_delta`            | `u64`    |
| `open_time`                   | `i64`    |

### `InstantIncreasePositionEvent`

Discriminator `cdec3904d16a5745` · `events::instant_increase_position_event::InstantIncreasePositionEventEvent`.

| Field                         | Type             |
| ----------------------------- | ---------------- |
| `position_key`                | `Pubkey`         |
| `position_side`               | `u8`             |
| `position_custody`            | `Pubkey`         |
| `position_collateral_custody` | `Pubkey`         |
| `position_size_usd`           | `u64`            |
| `position_mint`               | `Pubkey`         |
| `owner`                       | `Pubkey`         |
| `pool`                        | `Pubkey`         |
| `size_usd_delta`              | `u64`            |
| `collateral_usd_delta`        | `u64`            |
| `collateral_token_delta`      | `u64`            |
| `price`                       | `u64`            |
| `price_slippage`              | `u64`            |
| `fee_token`                   | `u64`            |
| `fee_usd`                     | `u64`            |
| `open_time`                   | `i64`            |
| `referral`                    | `Option<Pubkey>` |
| `position_fee_usd`            | `u64`            |
| `funding_fee_usd`             | `u64`            |
| `price_impact_fee_usd`        | `u64`            |

### `InstantDecreasePositionEvent`

Discriminator `abad6a19efbe3a3b` · `events::instant_decrease_position_event::InstantDecreasePositionEventEvent`.

| Field                              | Type             |
| ---------------------------------- | ---------------- |
| `position_key`                     | `Pubkey`         |
| `position_side`                    | `u8`             |
| `position_custody`                 | `Pubkey`         |
| `position_collateral_custody`      | `Pubkey`         |
| `position_size_usd`                | `u64`            |
| `position_mint`                    | `Pubkey`         |
| `desired_mint`                     | `Pubkey`         |
| `has_profit`                       | `bool`           |
| `pnl_delta`                        | `u64`            |
| `owner`                            | `Pubkey`         |
| `pool`                             | `Pubkey`         |
| `size_usd_delta`                   | `u64`            |
| `transfer_amount_usd`              | `u64`            |
| `transfer_token`                   | `u64`            |
| `price`                            | `u64`            |
| `price_slippage`                   | `u64`            |
| `fee_usd`                          | `u64`            |
| `open_time`                        | `i64`            |
| `referral`                         | `Option<Pubkey>` |
| `position_fee_usd`                 | `u64`            |
| `funding_fee_usd`                  | `u64`            |
| `original_position_collateral_usd` | `u64`            |
| `position_collateral_usd`          | `u64`            |
| `price_impact_fee_usd`             | `u64`            |
| `position_open_time`               | `i64`            |
| `position_price`                   | `u64`            |
| `position_request`                 | `Option<Pubkey>` |

### `DepositCollateralEvent`

Discriminator `a90e66949b8912eb` · `events::deposit_collateral_event::DepositCollateralEventEvent`.

| Field                | Type     |
| -------------------- | -------- |
| `owner`              | `Pubkey` |
| `pool`               | `Pubkey` |
| `position_key`       | `Pubkey` |
| `position_mint`      | `Pubkey` |
| `position_custody`   | `Pubkey` |
| `deposit_amount`     | `u64`    |
| `user_token_account` | `Pubkey` |
| `time`               | `i64`    |

### `WithdrawCollateralEvent`

Discriminator `91262e57be95fdbf` · `events::withdraw_collateral_event::WithdrawCollateralEventEvent`.

| Field                        | Type     |
| ---------------------------- | -------- |
| `owner`                      | `Pubkey` |
| `pool`                       | `Pubkey` |
| `position_key`               | `Pubkey` |
| `position_mint`              | `Pubkey` |
| `position_custody`           | `Pubkey` |
| `withdraw_amount`            | `u64`    |
| `user_token_account`         | `Pubkey` |
| `custody`                    | `Pubkey` |
| `previous_collateral_amount` | `u64`    |
| `collateral_amount`          | `u64`    |
| `collateral_amount_usd`      | `u64`    |
| `margin_usd`                 | `u64`    |
| `time`                       | `i64`    |

### `BorrowFromCustodyEvent`

Discriminator `17798344a8460e4c` · `events::borrow_from_custody_event::BorrowFromCustodyEventEvent`.

| Field                   | Type     |
| ----------------------- | -------- |
| `owner`                 | `Pubkey` |
| `pool`                  | `Pubkey` |
| `position_key`          | `Pubkey` |
| `position_mint`         | `Pubkey` |
| `position_custody`      | `Pubkey` |
| `size_custody_token`    | `u64`    |
| `collateral_amount`     | `u64`    |
| `collateral_amount_usd` | `u64`    |
| `margin_usd`            | `u64`    |
| `update_time`           | `i64`    |

### `RepayToCustodyEvent`

Discriminator `e83674afba18f9dd` · `events::repay_to_custody_event::RepayToCustodyEventEvent`.

| Field                | Type     |
| -------------------- | -------- |
| `owner`              | `Pubkey` |
| `pool`               | `Pubkey` |
| `position_key`       | `Pubkey` |
| `position_mint`      | `Pubkey` |
| `position_custody`   | `Pubkey` |
| `size_custody_token` | `u64`    |
| `update_time`        | `i64`    |
| `interest`           | `u128`   |

### `LiquidateBorrowPositionEvent`

Discriminator `0b80fc3b31c038aa` · `events::liquidate_borrow_position_event::LiquidateBorrowPositionEventEvent`.

| Field                        | Type     |
| ---------------------------- | -------- |
| `position_key`               | `Pubkey` |
| `position_custody`           | `Pubkey` |
| `position_size_usd`          | `u64`    |
| `owner`                      | `Pubkey` |
| `pool`                       | `Pubkey` |
| `collateral_locked_in_usd`   | `u64`    |
| `collateral_locked_in_lp`    | `u64`    |
| `remaining_collateral_in_lp` | `u64`    |
| `custody_token_price`        | `u64`    |
| `total_borrows_in_usd`       | `u64`    |
| `liquidation_fee_usd`        | `u64`    |
| `liquidation_time`           | `i64`    |

### `RedeemStakeEvent`

Discriminator `00f1548d8baada6e` · `events::redeem_stake_event::RedeemStakeEventEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `custody`                     | `Pubkey` |
| `stake_account`               | `Pubkey` |
| `stake_info`                  | `Pubkey` |
| `stake_rewards`               | `u64`    |
| `custody_total_staked_amount` | `u64`    |
| `current_staked_amount`       | `u64`    |
| `total_staking_rewards`       | `u64`    |
| `redeem_time`                 | `i64`    |

### `WithdrawStakeEvent`

Discriminator `2f55efd6cf1d9758` · `events::withdraw_stake_event::WithdrawStakeEventEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `custody`                     | `Pubkey` |
| `stake_account`               | `Pubkey` |
| `stake_info`                  | `Pubkey` |
| `stake_rewards`               | `u64`    |
| `custody_total_staked_amount` | `u64`    |
| `total_staking_rewards`       | `u64`    |
| `withdraw_amount`             | `u64`    |
| `withdraw_time`               | `i64`    |

### `DelegateStakeEvent`

Discriminator `55874bdea8859fd4` · `events::delegate_stake_event::DelegateStakeEventEvent`.

| Field                         | Type     |
| ----------------------------- | -------- |
| `custody`                     | `Pubkey` |
| `stake_account`               | `Pubkey` |
| `stake_info`                  | `Pubkey` |
| `custody_total_staked_amount` | `u64`    |
| `stake_amount`                | `u64`    |
| `validator_vote_account`      | `Pubkey` |
| `delegate_time`               | `i64`    |

### `WithdrawFeesEvent`

Discriminator `ec768a5a8badb159` · `events::withdraw_fees_event::WithdrawFeesEventEvent`.

| Field                          | Type     |
| ------------------------------ | -------- |
| `pool`                         | `Pubkey` |
| `custody`                      | `Pubkey` |
| `custody_mint`                 | `Pubkey` |
| `receiving_token_account`      | `Pubkey` |
| `total_trade_swap_fees`        | `u64`    |
| `pool_trade_swap_fees`         | `u64`    |
| `protocol_trade_swap_fees`     | `u64`    |
| `total_borrow_lending_fees`    | `u64`    |
| `pool_borrow_lending_fees`     | `u64`    |
| `protocol_borrow_lending_fees` | `u64`    |
| `pool_total_fees_usd`          | `u64`    |
| `apr_bps_before`               | `u64`    |
| `apr_bps_after`                | `u64`    |
| `apr_bps_updated_at`           | `i64`    |
| `pool_realized_fee_usd_before` | `u64`    |
| `pool_realized_fee_usd_after`  | `u64`    |
| `curtime`                      | `i64`    |

## Types

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

### `AddCustodyParams`

Struct `types::AddCustodyParams`.

| Field                               | Type                              |
| ----------------------------------- | --------------------------------- |
| `is_stable`                         | `bool`                            |
| `oracle`                            | [`OracleParams`](#oracleparams)   |
| `pricing`                           | [`PricingParams`](#pricingparams) |
| `permissions`                       | [`Permissions`](#permissions)     |
| `hourly_funding_dbps`               | `u64`                             |
| `target_ratio_bps`                  | `u64`                             |
| `increase_position_bps`             | `u64`                             |
| `decrease_position_bps`             | `u64`                             |
| `doves_oracle`                      | `Pubkey`                          |
| `max_position_size_usd`             | `u64`                             |
| `jump_rate`                         | [`JumpRateState`](#jumpratestate) |
| `price_impact_fee_factor`           | `u64`                             |
| `price_impact_exponent`             | `f32`                             |
| `delta_imbalance_threshold_decimal` | `u64`                             |
| `max_fee_bps`                       | `u64`                             |
| `doves_ag_oracle`                   | `Pubkey`                          |

### `AddLiquidity2Params`

Struct `types::AddLiquidity2Params`.

| Field                   | Type          |
| ----------------------- | ------------- |
| `token_amount_in`       | `u64`         |
| `min_lp_amount_out`     | `u64`         |
| `token_amount_pre_swap` | `Option<u64>` |

### `AddLiquidityEvent`

Struct `types::AddLiquidityEvent`. Same fields as the [`AddLiquidityEvent`](#addliquidityevent) event.

### `AddPoolParams`

Struct `types::AddPoolParams`.

| Field                       | Type              |
| --------------------------- | ----------------- |
| `name`                      | `String`          |
| `limit`                     | [`Limit`](#limit) |
| `fees`                      | [`Fees`](#fees)   |
| `max_request_execution_sec` | `i64`             |

### `AmountAndFee`

Struct `types::AmountAndFee`.

| Field     | Type  |
| --------- | ----- |
| `amount`  | `u64` |
| `fee`     | `u64` |
| `fee_bps` | `u64` |

### `Assets`

Struct `types::Assets`.

| Field                         | Type  |
| ----------------------------- | ----- |
| `fees_reserves`               | `u64` |
| `owned`                       | `u64` |
| `locked`                      | `u64` |
| `guaranteed_usd`              | `u64` |
| `global_short_sizes`          | `u64` |
| `global_short_average_prices` | `u64` |

### `BorrowFromCustodyEvent`

Struct `types::BorrowFromCustodyEvent`. Same fields as the [`BorrowFromCustodyEvent`](#borrowfromcustodyevent) event.

### `BorrowFromCustodyParams`

Struct `types::BorrowFromCustodyParams`.

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

### `BorrowLendParams`

Struct `types::BorrowLendParams`.

| Field                     | Type  |
| ------------------------- | ----- |
| `borrows_limit_in_bps`    | `u64` |
| `maintainance_margin_bps` | `u64` |
| `protocol_fee_bps`        | `u64` |
| `liquidation_margin`      | `u64` |
| `liquidation_fee_bps`     | `u64` |

### `CloseBorrowPositionParams`

Struct `types::CloseBorrowPositionParams`.

No fields.

### `ClosePositionRequestEvent`

Struct `types::ClosePositionRequestEvent`. Same fields as the [`ClosePositionRequestEvent`](#closepositionrequestevent) event.

### `CreateAndDelegateStakeAccountParams`

Struct `types::CreateAndDelegateStakeAccountParams`.

| Field                   | Type  |
| ----------------------- | ----- |
| `stake_account_index`   | `u64` |
| `stake_amount_lamports` | `u64` |

### `CreateDecreasePositionMarketRequestParams`

Struct `types::CreateDecreasePositionMarketRequestParams`.

| Field                  | Type           |
| ---------------------- | -------------- |
| `collateral_usd_delta` | `u64`          |
| `size_usd_delta`       | `u64`          |
| `price_slippage`       | `u64`          |
| `jupiter_minimum_out`  | `Option<u64>`  |
| `entire_position`      | `Option<bool>` |
| `counter`              | `u64`          |

### `CreateDecreasePositionRequest2Params`

Struct `types::CreateDecreasePositionRequest2Params`.

| Field                     | Type                          |
| ------------------------- | ----------------------------- |
| `collateral_usd_delta`    | `u64`                         |
| `size_usd_delta`          | `u64`                         |
| `request_type`            | [`RequestType`](#requesttype) |
| `price_slippage`          | `Option<u64>`                 |
| `jupiter_minimum_out`     | `Option<u64>`                 |
| `trigger_price`           | `Option<u64>`                 |
| `trigger_above_threshold` | `Option<bool>`                |
| `entire_position`         | `Option<bool>`                |
| `counter`                 | `u64`                         |

### `CreateIncreasePositionMarketRequestParams`

Struct `types::CreateIncreasePositionMarketRequestParams`.

| Field                    | Type            |
| ------------------------ | --------------- |
| `size_usd_delta`         | `u64`           |
| `collateral_token_delta` | `u64`           |
| `side`                   | [`Side`](#side) |
| `price_slippage`         | `u64`           |
| `jupiter_minimum_out`    | `Option<u64>`   |
| `counter`                | `u64`           |

### `CreatePositionRequestEvent`

Struct `types::CreatePositionRequestEvent`. Same fields as the [`CreatePositionRequestEvent`](#createpositionrequestevent) event.

### `CreateTokenMetadataParams`

Struct `types::CreateTokenMetadataParams`.

| Field    | Type     |
| -------- | -------- |
| `name`   | `String` |
| `symbol` | `String` |
| `uri`    | `String` |

### `DecreasePosition4Params`

Struct `types::DecreasePosition4Params`.

No fields.

### `DecreasePositionEvent`

Struct `types::DecreasePositionEvent`. Same fields as the [`DecreasePositionEvent`](#decreasepositionevent) event.

### `DecreasePositionPostSwapEvent`

Struct `types::DecreasePositionPostSwapEvent`. Same fields as the [`DecreasePositionPostSwapEvent`](#decreasepositionpostswapevent) event.

### `DecreasePositionWithInternalSwapParams`

Struct `types::DecreasePositionWithInternalSwapParams`.

No fields.

### `DecreasePositionWithTpslAndInternalSwapParams`

Struct `types::DecreasePositionWithTpslAndInternalSwapParams`.

No fields.

### `DecreasePositionWithTpslParams`

Struct `types::DecreasePositionWithTpslParams`.

No fields.

### `DelegateStakeEvent`

Struct `types::DelegateStakeEvent`. Same fields as the [`DelegateStakeEvent`](#delegatestakeevent) event.

### `DepositCollateralEvent`

Struct `types::DepositCollateralEvent`. Same fields as the [`DepositCollateralEvent`](#depositcollateralevent) event.

### `DepositParams`

Struct `types::DepositParams`.

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

### `Fees`

Struct `types::Fees`.

| Field                      | Type  |
| -------------------------- | ----- |
| `swap_multiplier`          | `u64` |
| `stable_swap_multiplier`   | `u64` |
| `add_remove_liquidity_bps` | `u64` |
| `swap_bps`                 | `u64` |
| `tax_bps`                  | `u64` |
| `stable_swap_bps`          | `u64` |
| `stable_swap_tax_bps`      | `u64` |
| `liquidation_reward_bps`   | `u64` |
| `protocol_share_bps`       | `u64` |

### `FundingRateState`

Struct `types::FundingRateState`.

| Field                      | Type   |
| -------------------------- | ------ |
| `cumulative_interest_rate` | `u128` |
| `last_update`              | `i64`  |
| `hourly_funding_dbps`      | `u64`  |

### `GetAddLiquidityAmountAndFee2Params`

Struct `types::GetAddLiquidityAmountAndFee2Params`.

| Field             | Type  |
| ----------------- | ----- |
| `token_amount_in` | `u64` |

### `GetAssetsUnderManagement2Params`

Struct `types::GetAssetsUnderManagement2Params`.

| Field  | Type                                      |
| ------ | ----------------------------------------- |
| `mode` | [`Option<PriceCalcMode>`](#pricecalcmode) |

### `GetRemoveLiquidityAmountAndFee2Params`

Struct `types::GetRemoveLiquidityAmountAndFee2Params`.

| Field          | Type  |
| -------------- | ----- |
| `lp_amount_in` | `u64` |

### `IncreasePosition4Params`

Struct `types::IncreasePosition4Params`.

No fields.

### `IncreasePositionEvent`

Struct `types::IncreasePositionEvent`. Same fields as the [`IncreasePositionEvent`](#increasepositionevent) event.

### `IncreasePositionPreSwapEvent`

Struct `types::IncreasePositionPreSwapEvent`. Same fields as the [`IncreasePositionPreSwapEvent`](#increasepositionpreswapevent) event.

### `IncreasePositionPreSwapParams`

Struct `types::IncreasePositionPreSwapParams`.

No fields.

### `IncreasePositionWithInternalSwapParams`

Struct `types::IncreasePositionWithInternalSwapParams`.

No fields.

### `InitParams`

Struct `types::InitParams`.

| Field                         | Type   |
| ----------------------------- | ------ |
| `allow_swap`                  | `bool` |
| `allow_add_liquidity`         | `bool` |
| `allow_remove_liquidity`      | `bool` |
| `allow_increase_position`     | `bool` |
| `allow_decrease_position`     | `bool` |
| `allow_collateral_withdrawal` | `bool` |
| `allow_liquidate_position`    | `bool` |

### `InstantCreateLimitOrderEvent`

Struct `types::InstantCreateLimitOrderEvent`. Same fields as the [`InstantCreateLimitOrderEvent`](#instantcreatelimitorderevent) event.

### `InstantCreateLimitOrderParams`

Struct `types::InstantCreateLimitOrderParams`.

| Field                     | Type            |
| ------------------------- | --------------- |
| `size_usd_delta`          | `u64`           |
| `collateral_token_delta`  | `u64`           |
| `side`                    | [`Side`](#side) |
| `trigger_price`           | `u64`           |
| `trigger_above_threshold` | `bool`          |
| `counter`                 | `u64`           |
| `request_time`            | `i64`           |

### `InstantCreateTpslEvent`

Struct `types::InstantCreateTpslEvent`. Same fields as the [`InstantCreateTpslEvent`](#instantcreatetpslevent) event.

### `InstantCreateTpslParams`

Struct `types::InstantCreateTpslParams`.

| Field                     | Type   |
| ------------------------- | ------ |
| `collateral_usd_delta`    | `u64`  |
| `size_usd_delta`          | `u64`  |
| `trigger_price`           | `u64`  |
| `trigger_above_threshold` | `bool` |
| `entire_position`         | `bool` |
| `counter`                 | `u64`  |
| `request_time`            | `i64`  |

### `InstantDecreasePosition2Params`

Struct `types::InstantDecreasePosition2Params`.

| Field                  | Type           |
| ---------------------- | -------------- |
| `collateral_usd_delta` | `u64`          |
| `size_usd_delta`       | `u64`          |
| `price_slippage`       | `u64`          |
| `entire_position`      | `Option<bool>` |
| `request_time`         | `i64`          |
| `counter`              | `u64`          |

### `InstantDecreasePositionEvent`

Struct `types::InstantDecreasePositionEvent`. Same fields as the [`InstantDecreasePositionEvent`](#instantdecreasepositionevent) event.

### `InstantDecreasePositionParams`

Struct `types::InstantDecreasePositionParams`.

| Field                  | Type           |
| ---------------------- | -------------- |
| `collateral_usd_delta` | `u64`          |
| `size_usd_delta`       | `u64`          |
| `price_slippage`       | `u64`          |
| `entire_position`      | `Option<bool>` |
| `request_time`         | `i64`          |

### `InstantIncreasePositionEvent`

Struct `types::InstantIncreasePositionEvent`. Same fields as the [`InstantIncreasePositionEvent`](#instantincreasepositionevent) event.

### `InstantIncreasePositionParams`

Struct `types::InstantIncreasePositionParams`.

| Field                    | Type            |
| ------------------------ | --------------- |
| `size_usd_delta`         | `u64`           |
| `collateral_token_delta` | `Option<u64>`   |
| `side`                   | [`Side`](#side) |
| `price_slippage`         | `u64`           |
| `request_time`           | `i64`           |

### `InstantIncreasePositionPreSwapParams`

Struct `types::InstantIncreasePositionPreSwapParams`.

| Field            | Type  |
| ---------------- | ----- |
| `amount_in`      | `u64` |
| `min_amount_out` | `u64` |

### `InstantUpdateLimitOrderParams`

Struct `types::InstantUpdateLimitOrderParams`.

| Field            | Type  |
| ---------------- | ----- |
| `size_usd_delta` | `u64` |
| `trigger_price`  | `u64` |
| `request_time`   | `i64` |

### `InstantUpdateTpslEvent`

Struct `types::InstantUpdateTpslEvent`. Same fields as the [`InstantUpdateTpslEvent`](#instantupdatetpslevent) event.

### `InstantUpdateTpslParams`

Struct `types::InstantUpdateTpslParams`.

| Field            | Type  |
| ---------------- | ----- |
| `size_usd_delta` | `u64` |
| `trigger_price`  | `u64` |
| `request_time`   | `i64` |

### `JumpRateState`

Struct `types::JumpRateState`.

| Field                     | Type  |
| ------------------------- | ----- |
| `min_rate_bps`            | `u64` |
| `max_rate_bps`            | `u64` |
| `target_rate_bps`         | `u64` |
| `target_utilization_rate` | `u64` |

### `Limit`

Struct `types::Limit`.

| Field                        | Type   |
| ---------------------------- | ------ |
| `max_aum_usd`                | `u128` |
| `token_weightage_buffer_bps` | `u128` |
| `buffer`                     | `u64`  |

### `LiquidateBorrowPositionEvent`

Struct `types::LiquidateBorrowPositionEvent`. Same fields as the [`LiquidateBorrowPositionEvent`](#liquidateborrowpositionevent) event.

### `LiquidateBorrowPositionParams`

Struct `types::LiquidateBorrowPositionParams`.

No fields.

### `LiquidateFullPosition4Params`

Struct `types::LiquidateFullPosition4Params`.

No fields.

### `LiquidateFullPositionEvent`

Struct `types::LiquidateFullPositionEvent`. Same fields as the [`LiquidateFullPositionEvent`](#liquidatefullpositionevent) event.

### `OperatorSetCustodyConfigParams`

Struct `types::OperatorSetCustodyConfigParams`.

| Field                                   | Type                                    |
| --------------------------------------- | --------------------------------------- |
| `pricing`                               | [`PricingParams`](#pricingparams)       |
| `hourly_funding_dbps`                   | `u64`                                   |
| `target_ratio_bps`                      | `u64`                                   |
| `increase_position_bps`                 | `u64`                                   |
| `decrease_position_bps`                 | `u64`                                   |
| `max_position_size_usd`                 | `u64`                                   |
| `jump_rate`                             | [`JumpRateState`](#jumpratestate)       |
| `price_impact_fee_factor`               | `u64`                                   |
| `price_impact_exponent`                 | `f32`                                   |
| `delta_imbalance_threshold_decimal`     | `u64`                                   |
| `max_fee_bps`                           | `u64`                                   |
| `borrow_lend_parameters`                | [`BorrowLendParams`](#borrowlendparams) |
| `borrow_hourly_funding_dbps`            | `u64`                                   |
| `borrow_limit_in_token_amount`          | `u64`                                   |
| `min_interest_fee_bps`                  | `u64`                                   |
| `min_interest_fee_grace_period_seconds` | `u64`                                   |
| `max_total_staked_amount_lamports`      | `u64`                                   |
| `external_swap_fee_multiplier_bps`      | `u64`                                   |
| `disable_close_position_request`        | `bool`                                  |
| `withdrawal_limit_token_amount`         | `u64`                                   |
| `withdrawal_limit_interval_seconds`     | `u64`                                   |

### `OperatorSetPoolConfigParams`

Struct `types::OperatorSetPoolConfigParams`.

| Field                            | Type              |
| -------------------------------- | ----------------- |
| `fees`                           | [`Fees`](#fees)   |
| `limit`                          | [`Limit`](#limit) |
| `max_request_execution_sec`      | `i64`             |
| `max_trigger_price_diff_bps`     | `u64`             |
| `disable_close_position_request` | `bool`            |
| `max_lp_token_price_change_bps`  | `u64`             |

### `OracleParams`

Struct `types::OracleParams`.

| Field               | Type                        |
| ------------------- | --------------------------- |
| `oracle_account`    | `Pubkey`                    |
| `oracle_type`       | [`OracleType`](#oracletype) |
| `buffer`            | `u64`                       |
| `max_price_age_sec` | `u32`                       |

### `OraclePrice`

Struct `types::OraclePrice`.

| Field      | Type  |
| ---------- | ----- |
| `price`    | `u64` |
| `exponent` | `i32` |

### `OracleType`

Enum `types::OracleType`.

| Variant |
| ------- |
| `None`  |
| `Test`  |
| `Pyth`  |

### `PartialLiquidateBorrowPositionParams`

Struct `types::PartialLiquidateBorrowPositionParams`.

No fields.

### `Permissions`

Struct `types::Permissions`.

| Field                         | Type   |
| ----------------------------- | ------ |
| `allow_swap`                  | `bool` |
| `allow_add_liquidity`         | `bool` |
| `allow_remove_liquidity`      | `bool` |
| `allow_increase_position`     | `bool` |
| `allow_decrease_position`     | `bool` |
| `allow_collateral_withdrawal` | `bool` |
| `allow_liquidate_position`    | `bool` |

### `PoolApr`

Struct `types::PoolApr`.

| Field              | Type  |
| ------------------ | ----- |
| `last_updated`     | `i64` |
| `fee_apr_bps`      | `u64` |
| `realized_fee_usd` | `u64` |

### `PoolSwapEvent`

Struct `types::PoolSwapEvent`. Same fields as the [`PoolSwapEvent`](#poolswapevent) event.

### `PoolSwapExactOutEvent`

Struct `types::PoolSwapExactOutEvent`. Same fields as the [`PoolSwapExactOutEvent`](#poolswapexactoutevent) event.

### `Price`

Struct `types::Price`.

| Field          | Type  |
| -------------- | ----- |
| `price`        | `u64` |
| `expo`         | `i32` |
| `publish_time` | `i64` |

### `PriceCalcMode`

Enum `types::PriceCalcMode`.

| Variant  |
| -------- |
| `Min`    |
| `Max`    |
| `Ignore` |

### `PriceImpactBuffer`

Struct `types::PriceImpactBuffer`.

| Field                               | Type        |
| ----------------------------------- | ----------- |
| `open_interest`                     | `[i64; 60]` |
| `last_updated`                      | `i64`       |
| `fee_factor`                        | `u64`       |
| `exponent`                          | `f32`       |
| `delta_imbalance_threshold_decimal` | `u64`       |
| `max_fee_bps`                       | `u64`       |

### `PriceImpactMechanism`

Enum `types::PriceImpactMechanism`.

| Variant          |
| ---------------- |
| `TradeSize`      |
| `DeltaImbalance` |

### `PriceStaleTolerance`

Enum `types::PriceStaleTolerance`.

| Variant  |
| -------- |
| `Strict` |
| `Loose`  |

### `PricingParams`

Struct `types::PricingParams`.

| Field                     | Type  |
| ------------------------- | ----- |
| `trade_impact_fee_scalar` | `u64` |
| `buffer`                  | `u64` |
| `swap_spread`             | `u64` |
| `max_leverage`            | `u64` |
| `max_global_long_sizes`   | `u64` |
| `max_global_short_sizes`  | `u64` |

### `RedeemStakeEvent`

Struct `types::RedeemStakeEvent`. Same fields as the [`RedeemStakeEvent`](#redeemstakeevent) event.

### `RefreshAssetsUnderManagementParams`

Struct `types::RefreshAssetsUnderManagementParams`.

No fields.

### `RemoveLiquidity2Params`

Struct `types::RemoveLiquidity2Params`.

| Field            | Type  |
| ---------------- | ----- |
| `lp_amount_in`   | `u64` |
| `min_amount_out` | `u64` |

### `RemoveLiquidityEvent`

Struct `types::RemoveLiquidityEvent`. Same fields as the [`RemoveLiquidityEvent`](#removeliquidityevent) event.

### `RepayToCustodyEvent`

Struct `types::RepayToCustodyEvent`. Same fields as the [`RepayToCustodyEvent`](#repaytocustodyevent) event.

### `RepayToCustodyParams`

Struct `types::RepayToCustodyParams`.

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

### `RequestChange`

Enum `types::RequestChange`.

| Variant    |
| ---------- |
| `None`     |
| `Increase` |
| `Decrease` |

### `RequestType`

Enum `types::RequestType`.

| Variant   |
| --------- |
| `Market`  |
| `Trigger` |

### `Secp256k1Pubkey`

Struct `types::Secp256k1Pubkey`.

| Field    | Type       |
| -------- | ---------- |
| `prefix` | `u8`       |
| `key`    | `[u8; 32]` |

### `SetCustodyConfigParams`

Struct `types::SetCustodyConfigParams`.

| Field                                   | Type                                    |
| --------------------------------------- | --------------------------------------- |
| `oracle`                                | [`OracleParams`](#oracleparams)         |
| `pricing`                               | [`PricingParams`](#pricingparams)       |
| `permissions`                           | [`Permissions`](#permissions)           |
| `hourly_funding_dbps`                   | `u64`                                   |
| `target_ratio_bps`                      | `u64`                                   |
| `increase_position_bps`                 | `u64`                                   |
| `decrease_position_bps`                 | `u64`                                   |
| `doves_oracle`                          | `Pubkey`                                |
| `max_position_size_usd`                 | `u64`                                   |
| `jump_rate`                             | [`JumpRateState`](#jumpratestate)       |
| `price_impact_fee_factor`               | `u64`                                   |
| `price_impact_exponent`                 | `f32`                                   |
| `delta_imbalance_threshold_decimal`     | `u64`                                   |
| `max_fee_bps`                           | `u64`                                   |
| `doves_ag_oracle`                       | `Pubkey`                                |
| `borrow_lend_parameters`                | [`BorrowLendParams`](#borrowlendparams) |
| `borrow_hourly_funding_dbps`            | `u64`                                   |
| `borrow_limit_in_token_amount`          | `u64`                                   |
| `min_interest_fee_bps`                  | `u64`                                   |
| `min_interest_fee_grace_period_seconds` | `u64`                                   |
| `max_total_staked_amount_lamports`      | `u64`                                   |
| `external_swap_fee_multiplier_bps`      | `u64`                                   |
| `disable_close_position_request`        | `bool`                                  |
| `withdrawal_limit_interval_seconds`     | `u64`                                   |
| `withdrawal_limit_token_amount`         | `u64`                                   |

### `SetMaxGlobalSizesParams`

Struct `types::SetMaxGlobalSizesParams`.

| Field                   | Type       |
| ----------------------- | ---------- |
| `max_global_long_size`  | `u64`      |
| `max_global_short_size` | `u64`      |
| `recovery_id`           | `u8`       |
| `signature`             | `[u8; 64]` |
| `reference_id`          | `[u8; 16]` |
| `timestamp`             | `u64`      |

### `SetPerpetualsConfigParams`

Struct `types::SetPerpetualsConfigParams`.

| Field         | Type                          |
| ------------- | ----------------------------- |
| `permissions` | [`Permissions`](#permissions) |

### `SetPoolConfigParams`

Struct `types::SetPoolConfigParams`.

| Field                            | Type                                  |
| -------------------------------- | ------------------------------------- |
| `fees`                           | [`Fees`](#fees)                       |
| `limit`                          | [`Limit`](#limit)                     |
| `max_request_execution_sec`      | `i64`                                 |
| `parameter_update_oracle`        | [`Secp256k1Pubkey`](#secp256k1pubkey) |
| `max_trigger_price_diff_bps`     | `u64`                                 |
| `disable_close_position_request` | `bool`                                |
| `max_lp_token_price_change_bps`  | `u64`                                 |

### `SetTestTimeParams`

Struct `types::SetTestTimeParams`.

| Field  | Type  |
| ------ | ----- |
| `time` | `i64` |

### `Side`

Enum `types::Side`.

| Variant |
| ------- |
| `None`  |
| `Long`  |
| `Short` |

### `Swap2Params`

Struct `types::Swap2Params`.

| Field            | Type  |
| ---------------- | ----- |
| `amount_in`      | `u64` |
| `min_amount_out` | `u64` |

### `SwapWithTokenLedgerParams`

Struct `types::SwapWithTokenLedgerParams`.

| Field            | Type  |
| ---------------- | ----- |
| `min_amount_out` | `u64` |

### `TestInitParams`

Struct `types::TestInitParams`.

| Field                         | Type   |
| ----------------------------- | ------ |
| `allow_swap`                  | `bool` |
| `allow_add_liquidity`         | `bool` |
| `allow_remove_liquidity`      | `bool` |
| `allow_increase_position`     | `bool` |
| `allow_decrease_position`     | `bool` |
| `allow_collateral_withdrawal` | `bool` |
| `allow_liquidate_position`    | `bool` |

### `TradePoolType`

Enum `types::TradePoolType`.

| Variant    |
| ---------- |
| `Increase` |
| `Decrease` |

### `TransferAdminParams`

Struct `types::TransferAdminParams`.

No fields.

### `UpdateDecreasePositionRequest2Params`

Struct `types::UpdateDecreasePositionRequest2Params`.

| Field            | Type  |
| ---------------- | ----- |
| `size_usd_delta` | `u64` |
| `trigger_price`  | `u64` |

### `WithdrawCollateralEvent`

Struct `types::WithdrawCollateralEvent`. Same fields as the [`WithdrawCollateralEvent`](#withdrawcollateralevent) event.

### `WithdrawFees2Params`

Struct `types::WithdrawFees2Params`.

No fields.

### `WithdrawFeesEvent`

Struct `types::WithdrawFeesEvent`. Same fields as the [`WithdrawFeesEvent`](#withdrawfeesevent) event.

### `WithdrawParams`

Struct `types::WithdrawParams`.

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

### `WithdrawStakeEvent`

Struct `types::WithdrawStakeEvent`. Same fields as the [`WithdrawStakeEvent`](#withdrawstakeevent) event.

---

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