# Meteora Vault decoder (Carbon 2.0)

> Decode Meteora Vault instructions, accounts and events in Rust with carbon-meteora-vault-decoder 2.0.0. Program ID 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi.

`carbon-meteora-vault-decoder` decodes the instructions, accounts and events of the Meteora Vault program (`24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi`): 14 instructions, 2 account types, 8 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-meteora-vault-decoder`](https://crates.io/crates/carbon-meteora-vault-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-meteora-vault-decoder@2.0.0`                                                                      |
| Program ID       | `24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi` (`carbon_meteora_vault_decoder::PROGRAM_ID`)                         |
| Category         | [Lending](https://carbon.sevenlabs.org/decoders/lending.md)                                                         |
| Decoder          | `carbon_meteora_vault_decoder::MeteoraVaultDecoder`                                                                 |
| Instruction enum | `instructions::MeteoraVaultInstruction`                                                                             |
| Account enum     | `accounts::MeteoraVaultAccount`                                                                                     |
| Event enum       | `instructions::CpiEvent`                                                                                            |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                            |
| API docs         | [docs.rs/carbon-meteora-vault-decoder/2.0.0](https://docs.rs/carbon-meteora-vault-decoder/2.0.0)                    |
| Source           | [decoders/meteora-vault-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/meteora-vault-decoder) |

Other lending decoders: [Jupiter Lend](https://carbon.sevenlabs.org/decoders/jupiter-lend.md), [Kamino Lending](https://carbon.sevenlabs.org/decoders/kamino-lending.md), [Kamino Vault](https://carbon.sevenlabs.org/decoders/kamino-vault.md), [marginfi v2](https://carbon.sevenlabs.org/decoders/marginfi-v2.md), [Sharky](https://carbon.sevenlabs.org/decoders/sharky.md). To decode several in one pipeline, see [lending decoders](https://carbon.sevenlabs.org/decoders/lending.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 Meteora Vault transactions from the public RPC and prints every decoded `Deposit` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-meteora-vault-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_meteora_vault_decoder::{
        instructions::MeteoraVaultInstruction, MeteoraVaultDecoder, 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(MeteoraVaultDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

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

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

Each `Deposit` instruction prints one line with the transaction signature and the decoded `Deposit` 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 `MeteoraVaultInstruction::CpiEvent { data: CpiEvent::AddLiquidity(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 `Vault` 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_meteora_vault_decoder::{accounts::MeteoraVaultAccount, MeteoraVaultDecoder, 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(MeteoraVaultDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

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

Each update to a `Vault` 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 `MeteoraVaultInstruction`. Each is `MeteoraVaultInstruction::<Variant> { program_id, data, accounts }`, where `data` and `accounts` are the types listed under the variant, exported from `carbon_meteora_vault_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 `24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi`.
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.

### `AddStrategy`

> _From the program's IDL:_
>
> add a strategy

Discriminator `407b7fe3c0eac614` · data `AddStrategy` · accounts `AddStrategyInstructionAccounts`.

No data fields.

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

Fields of `AddStrategyInstructionAccounts`, in account order:

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

### `CollectDust`

> _From the program's IDL:_
>
> collect token, that someone send wrongly also help in case Mango reimbursement

Discriminator `f6951552a04afef0` · data `CollectDust` · accounts `CollectDustInstructionAccounts`.

No data fields.

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

Fields of `CollectDustInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `vault`         | `Pubkey`           |
| 1  | `token_vault`   | `Pubkey`           |
| 2  | `token_admin`   | `Pubkey`           |
| 3  | `admin`         | `Pubkey`           |
| 4  | `token_program` | `Pubkey`           |
| 5… | `remaining`     | `Vec<AccountMeta>` |

### `Deposit`

> _From the program's IDL:_
>
> user deposit liquidity to vault

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

| Field                     | Type  |
| ------------------------- | ----- |
| `token_amount`            | `u64` |
| `minimum_lp_token_amount` | `u64` |

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

Fields of `DepositInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `vault`         | `Pubkey`           |
| 1  | `token_vault`   | `Pubkey`           |
| 2  | `lp_mint`       | `Pubkey`           |
| 3  | `user_token`    | `Pubkey`           |
| 4  | `user_lp`       | `Pubkey`           |
| 5  | `user`          | `Pubkey`           |
| 6  | `token_program` | `Pubkey`           |
| 7… | `remaining`     | `Vec<AccountMeta>` |

### `DepositStrategy`

> _From the program's IDL:_
>
> deposit liquidity to a strategy

Discriminator `f65239e283defdf9` · data `DepositStrategy` · accounts `DepositStrategyInstructionAccounts`.

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

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

Fields of `DepositStrategyInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `vault`            | `Pubkey`           |
| 1   | `strategy`         | `Pubkey`           |
| 2   | `token_vault`      | `Pubkey`           |
| 3   | `fee_vault`        | `Pubkey`           |
| 4   | `lp_mint`          | `Pubkey`           |
| 5   | `strategy_program` | `Pubkey`           |
| 6   | `collateral_vault` | `Pubkey`           |
| 7   | `reserve`          | `Pubkey`           |
| 8   | `token_program`    | `Pubkey`           |
| 9   | `operator`         | `Pubkey`           |
| 10… | `remaining`        | `Vec<AccountMeta>` |

### `EnableVault`

> _From the program's IDL:_
>
> enable vault

Discriminator `9152f19c1a9ae9d3` · data `EnableVault` · accounts `EnableVaultInstructionAccounts`.

| Field     | Type |
| --------- | ---- |
| `enabled` | `u8` |

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

Fields of `EnableVaultInstructionAccounts`, in account order:

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

### `Initialize`

> _From the program's IDL:_
>
> initialize new vault

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

No data fields.

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

Fields of `InitializeInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `vault`          | `Pubkey`           |
| 1  | `payer`          | `Pubkey`           |
| 2  | `token_vault`    | `Pubkey`           |
| 3  | `token_mint`     | `Pubkey`           |
| 4  | `lp_mint`        | `Pubkey`           |
| 5  | `rent`           | `Pubkey`           |
| 6  | `token_program`  | `Pubkey`           |
| 7  | `system_program` | `Pubkey`           |
| 8… | `remaining`      | `Vec<AccountMeta>` |

### `InitializeStrategy`

> _From the program's IDL:_
>
> Initialize a strategy and add strategy to vault.strategies index

Discriminator `d0779091b23969fc` · data `InitializeStrategy` · accounts `InitializeStrategyInstructionAccounts`.

| Field           | Type                              |
| --------------- | --------------------------------- |
| `bumps`         | [`StrategyBumps`](#strategybumps) |
| `strategy_type` | [`StrategyType`](#strategytype)   |

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

Fields of `InitializeStrategyInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `vault`            | `Pubkey`           |
| 1   | `strategy_program` | `Pubkey`           |
| 2   | `strategy`         | `Pubkey`           |
| 3   | `reserve`          | `Pubkey`           |
| 4   | `collateral_vault` | `Pubkey`           |
| 5   | `collateral_mint`  | `Pubkey`           |
| 6   | `admin`            | `Pubkey`           |
| 7   | `system_program`   | `Pubkey`           |
| 8   | `rent`             | `Pubkey`           |
| 9   | `token_program`    | `Pubkey`           |
| 10… | `remaining`        | `Vec<AccountMeta>` |

### `RemoveStrategy`

> _From the program's IDL:_
>
> remove a strategy

Discriminator `b9ee215b86d2611a` · data `RemoveStrategy` · accounts `RemoveStrategyInstructionAccounts`.

No data fields.

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

Fields of `RemoveStrategyInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `vault`            | `Pubkey`           |
| 1   | `strategy`         | `Pubkey`           |
| 2   | `strategy_program` | `Pubkey`           |
| 3   | `collateral_vault` | `Pubkey`           |
| 4   | `reserve`          | `Pubkey`           |
| 5   | `token_vault`      | `Pubkey`           |
| 6   | `fee_vault`        | `Pubkey`           |
| 7   | `lp_mint`          | `Pubkey`           |
| 8   | `token_program`    | `Pubkey`           |
| 9   | `admin`            | `Pubkey`           |
| 10… | `remaining`        | `Vec<AccountMeta>` |

### `RemoveStrategy2`

> _From the program's IDL:_
>
> remove a strategy by advance payment

Discriminator `8a68d0947e23c30e` · data `RemoveStrategy2` · accounts `RemoveStrategy2InstructionAccounts`.

| Field                  | Type  |
| ---------------------- | ----- |
| `max_admin_pay_amount` | `u64` |

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

Fields of `RemoveStrategy2InstructionAccounts`, in account order:

| #   | Field                         | Type               |
| --- | ----------------------------- | ------------------ |
| 0   | `vault`                       | `Pubkey`           |
| 1   | `strategy`                    | `Pubkey`           |
| 2   | `strategy_program`            | `Pubkey`           |
| 3   | `collateral_vault`            | `Pubkey`           |
| 4   | `reserve`                     | `Pubkey`           |
| 5   | `token_vault`                 | `Pubkey`           |
| 6   | `token_admin_advance_payment` | `Pubkey`           |
| 7   | `token_vault_advance_payment` | `Pubkey`           |
| 8   | `fee_vault`                   | `Pubkey`           |
| 9   | `lp_mint`                     | `Pubkey`           |
| 10  | `token_program`               | `Pubkey`           |
| 11  | `admin`                       | `Pubkey`           |
| 12… | `remaining`                   | `Vec<AccountMeta>` |

### `SetOperator`

> _From the program's IDL:_
>
> set new operator

Discriminator `ee9965a9f3832401` · data `SetOperator` · accounts `SetOperatorInstructionAccounts`.

No data fields.

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

Fields of `SetOperatorInstructionAccounts`, in account order:

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

### `Withdraw`

> _From the program's IDL:_
>
> user withdraw liquidity from vault

Discriminator `b712469c946da122` · data `Withdraw` · accounts `WithdrawInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `unmint_amount`  | `u64` |
| `min_out_amount` | `u64` |

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

Fields of `WithdrawInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `vault`         | `Pubkey`           |
| 1  | `token_vault`   | `Pubkey`           |
| 2  | `lp_mint`       | `Pubkey`           |
| 3  | `user_token`    | `Pubkey`           |
| 4  | `user_lp`       | `Pubkey`           |
| 5  | `user`          | `Pubkey`           |
| 6  | `token_program` | `Pubkey`           |
| 7… | `remaining`     | `Vec<AccountMeta>` |

### `Withdraw2`

> _From the program's IDL:_
>
> Withdraw v2. Withdraw from token vault if no remaining accounts are available. Else, it will attempt to withdraw from strategy and token vault.\
> This method just proxy between 2 methods. Protocol integration should be using withdraw instead of this function.

Discriminator `50066f49aed34284` · data `Withdraw2` · accounts `Withdraw2InstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `unmint_amount`  | `u64` |
| `min_out_amount` | `u64` |

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

Fields of `Withdraw2InstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `vault`         | `Pubkey`           |
| 1  | `token_vault`   | `Pubkey`           |
| 2  | `lp_mint`       | `Pubkey`           |
| 3  | `user_token`    | `Pubkey`           |
| 4  | `user_lp`       | `Pubkey`           |
| 5  | `user`          | `Pubkey`           |
| 6  | `token_program` | `Pubkey`           |
| 7… | `remaining`     | `Vec<AccountMeta>` |

### `WithdrawDirectlyFromStrategy`

> _From the program's IDL:_
>
> user withdraw liquidity from vault, if vault reserve doesn't have enough liquidity, it will withdraw from the strategy firstly

Discriminator `c98d922ead74c616` · data `WithdrawDirectlyFromStrategy` · accounts `WithdrawDirectlyFromStrategyInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `unmint_amount`  | `u64` |
| `min_out_amount` | `u64` |

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

Fields of `WithdrawDirectlyFromStrategyInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `vault`            | `Pubkey`           |
| 1   | `strategy`         | `Pubkey`           |
| 2   | `reserve`          | `Pubkey`           |
| 3   | `strategy_program` | `Pubkey`           |
| 4   | `collateral_vault` | `Pubkey`           |
| 5   | `token_vault`      | `Pubkey`           |
| 6   | `lp_mint`          | `Pubkey`           |
| 7   | `fee_vault`        | `Pubkey`           |
| 8   | `user_token`       | `Pubkey`           |
| 9   | `user_lp`          | `Pubkey`           |
| 10  | `user`             | `Pubkey`           |
| 11  | `token_program`    | `Pubkey`           |
| 12… | `remaining`        | `Vec<AccountMeta>` |

### `WithdrawStrategy`

> _From the program's IDL:_
>
> withdraw liquidity from a strategy

Discriminator `1f2da205c1d986bc` · data `WithdrawStrategy` · accounts `WithdrawStrategyInstructionAccounts`.

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

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

Fields of `WithdrawStrategyInstructionAccounts`, in account order:

| #   | Field              | Type               |
| --- | ------------------ | ------------------ |
| 0   | `vault`            | `Pubkey`           |
| 1   | `strategy`         | `Pubkey`           |
| 2   | `token_vault`      | `Pubkey`           |
| 3   | `fee_vault`        | `Pubkey`           |
| 4   | `lp_mint`          | `Pubkey`           |
| 5   | `strategy_program` | `Pubkey`           |
| 6   | `collateral_vault` | `Pubkey`           |
| 7   | `reserve`          | `Pubkey`           |
| 8   | `token_program`    | `Pubkey`           |
| 9   | `operator`         | `Pubkey`           |
| 10… | `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 `MeteoraVaultAccount`. Each wraps a boxed struct from `carbon_meteora_vault_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `Strategy`

> _From the program's IDL:_
>
> Strategy struct

Discriminator `ae6e2777526aa966` · `accounts::strategy::Strategy`.

| Field               | Type                            | Description                                                                                |
| ------------------- | ------------------------------- | ------------------------------------------------------------------------------------------ |
| `reserve`           | `Pubkey`                        | Lending pool address, that the strategy will deposit/withdraw balance                      |
| `collateral_vault`  | `Pubkey`                        | The token account, that holds the collateral token                                         |
| `strategy_type`     | [`StrategyType`](#strategytype) | Specify type of strategy                                                                   |
| `current_liquidity` | `u64`                           | The liquidity in strategy at the time vault deposit/withdraw from a lending protocol       |
| `bumps`             | `[u8; 10]`                      | Hold some bumps, in case the strategy needs to use other seeds to sign a CPI call.         |
| `vault`             | `Pubkey`                        | Vault address, that the strategy belongs                                                   |
| `is_disable`        | `u8`                            | If we remove strategy by remove_strategy2 endpoint, this account will be never added again |

### `Vault`

> _From the program's IDL:_
>
> Vault struct

Discriminator `d308e82b02987577` · `accounts::vault::Vault`.

| Field                   | Type                                          | Description                                                                                                                                                                              |
| ----------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enabled`               | `u8`                                          | The flag, if admin set enable = false, then the user can only withdraw and cannot deposit in the vault.                                                                                  |
| `bumps`                 | [`VaultBumps`](#vaultbumps)                   | Vault nonce, to create vault seeds                                                                                                                                                       |
| `total_amount`          | `u64`                                         | The total liquidity of the vault, including remaining tokens in token_vault and the liquidity in all strategies.                                                                         |
| `token_vault`           | `Pubkey`                                      | Token account, hold liquidity in vault reserve                                                                                                                                           |
| `fee_vault`             | `Pubkey`                                      | Hold lp token of vault, each time rebalance crank is called, vault calculate performance fee and mint corresponding lp token amount to fee_vault. fee_vault is owned by treasury address |
| `token_mint`            | `Pubkey`                                      | Token mint that vault supports                                                                                                                                                           |
| `lp_mint`               | `Pubkey`                                      | Lp mint of vault                                                                                                                                                                         |
| `strategies`            | `[Pubkey; 30]`                                | The list of strategy addresses that vault supports, vault can support up to MAX_STRATEGY strategies at the same time.                                                                    |
| `base`                  | `Pubkey`                                      | The base address to create vault seeds                                                                                                                                                   |
| `admin`                 | `Pubkey`                                      | Admin of vault                                                                                                                                                                           |
| `operator`              | `Pubkey`                                      | Person who can send the crank. Operator can only send liquidity to strategies that admin defined, and claim reward to account of treasury address                                        |
| `locked_profit_tracker` | [`LockedProfitTracker`](#lockedprofittracker) | Stores information for locked profit.                                                                                                                                                    |

## Events

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

### `AddLiquidity`

Discriminator `1f5e7d5ae3343dba` · `events::add_liquidity::AddLiquidityEvent`.

| Field            | Type  |
| ---------------- | ----- |
| `lp_mint_amount` | `u64` |
| `token_amount`   | `u64` |

### `RemoveLiquidity`

Discriminator `74f461e8671f983a` · `events::remove_liquidity::RemoveLiquidityEvent`.

| Field              | Type  |
| ------------------ | ----- |
| `lp_unmint_amount` | `u64` |
| `token_amount`     | `u64` |

### `StrategyDeposit`

Discriminator `cd355bef2288492f` · `events::strategy_deposit::StrategyDepositEvent`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `strategy_type` | [`StrategyType`](#strategytype) |
| `token_amount`  | `u64`                           |

### `StrategyWithdraw`

Discriminator `784cd05fddd2e5bd` · `events::strategy_withdraw::StrategyWithdrawEvent`.

| Field                    | Type                            |
| ------------------------ | ------------------------------- |
| `strategy_type`          | [`StrategyType`](#strategytype) |
| `collateral_amount`      | `u64`                           |
| `estimated_token_amount` | `u64`                           |

### `ClaimReward`

Discriminator `947486cc16ab555f` · `events::claim_reward::ClaimRewardEvent`.

| Field           | Type                            |
| --------------- | ------------------------------- |
| `strategy_type` | [`StrategyType`](#strategytype) |
| `token_amount`  | `u64`                           |
| `mint_account`  | `Pubkey`                        |

### `PerformanceFee`

Discriminator `1c46e7df516defa7` · `events::performance_fee::PerformanceFeeEvent`.

| Field          | Type  |
| -------------- | ----- |
| `lp_mint_more` | `u64` |

### `ReportLoss`

Discriminator `9a249ec420a37b7e` · `events::report_loss::ReportLossEvent`.

| Field      | Type     |
| ---------- | -------- |
| `strategy` | `Pubkey` |
| `loss`     | `u64`    |

### `TotalAmount`

Discriminator `5cc87a91d3cb31cd` · `events::total_amount::TotalAmountEvent`.

| Field          | Type  |
| -------------- | ----- |
| `total_amount` | `u64` |

## Types

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

### `AddLiquidity`

Struct `types::AddLiquidity`. Same fields as the [`AddLiquidity`](#addliquidity) event.

### `ClaimReward`

Struct `types::ClaimReward`. Same fields as the [`ClaimReward`](#claimreward) event.

### `LockedProfitTracker`

> _From the program's IDL:_
>
> LockedProfitTracker struct

Struct `types::LockedProfitTracker`.

| Field                        | Type  | Description                                  |
| ---------------------------- | ----- | -------------------------------------------- |
| `last_updated_locked_profit` | `u64` | The total locked profit from the last report |
| `last_report`                | `u64` | The last timestamp (in seconds) rebalancing  |
| `locked_profit_degradation`  | `u64` | Rate per second of degradation               |

### `PerformanceFee`

Struct `types::PerformanceFee`. Same fields as the [`PerformanceFee`](#performancefee) event.

### `RemoveLiquidity`

Struct `types::RemoveLiquidity`. Same fields as the [`RemoveLiquidity`](#removeliquidity) event.

### `ReportLoss`

Struct `types::ReportLoss`. Same fields as the [`ReportLoss`](#reportloss) event.

### `StrategyBumps`

> _From the program's IDL:_
>
> Strategy bumps struct

Struct `types::StrategyBumps`.

| Field            | Type       | Description                                |
| ---------------- | ---------- | ------------------------------------------ |
| `strategy_index` | `u8`       | strategy_index                             |
| `other_bumps`    | `[u8; 10]` | Bumps of PDAs for the integrated protocol. |

### `StrategyDeposit`

Struct `types::StrategyDeposit`. Same fields as the [`StrategyDeposit`](#strategydeposit) event.

### `StrategyType`

> _From the program's IDL:_
>
> StrategyType struct

Enum `types::StrategyType`.

| Variant                |
| ---------------------- |
| `PortFinanceWithoutLM` |
| `PortFinanceWithLM`    |
| `SolendWithoutLM`      |
| `Mango`                |
| `SolendWithLM`         |
| `ApricotWithoutLM`     |
| `Francium`             |
| `Tulip`                |
| `Vault`                |
| `Drift`                |
| `Frakt`                |
| `Marginfi`             |

### `StrategyWithdraw`

Struct `types::StrategyWithdraw`. Same fields as the [`StrategyWithdraw`](#strategywithdraw) event.

### `TotalAmount`

Struct `types::TotalAmount`. Same fields as the [`TotalAmount`](#totalamount) event.

### `VaultBumps`

> _From the program's IDL:_
>
> Vault bumps struct

Struct `types::VaultBumps`.

| Field              | Type | Description      |
| ------------------ | ---- | ---------------- |
| `vault_bump`       | `u8` | vault_bump       |
| `token_vault_bump` | `u8` | token_vault_bump |

---

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