# Marinade Finance decoder (Carbon 2.0)

> Decode Marinade Finance instructions, accounts and events in Rust with the carbon-marinade-finance-decoder crate.

`carbon-marinade-finance-decoder` decodes the instructions, accounts and events of the Marinade Finance program (`MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD`): 28 instructions, 2 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-marinade-finance-decoder`](https://crates.io/crates/carbon-marinade-finance-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-marinade-finance-decoder@2.0.0`                                                                         |
| Program ID       | `MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD` (`carbon_marinade_finance_decoder::PROGRAM_ID`)                             |
| Category         | [Liquid staking & restaking](https://carbon.sevenlabs.org/decoders/liquid-staking.md)                                     |
| Decoder          | `carbon_marinade_finance_decoder::MarinadeFinanceDecoder`                                                                 |
| Instruction enum | `instructions::MarinadeFinanceInstruction`                                                                                |
| Account enum     | `accounts::MarinadeFinanceAccount`                                                                                        |
| Event enum       | `instructions::CpiEvent`                                                                                                  |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                                  |
| API docs         | [docs.rs/carbon-marinade-finance-decoder/2.0.0](https://docs.rs/carbon-marinade-finance-decoder/2.0.0)                    |
| Source           | [decoders/marinade-finance-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/marinade-finance-decoder) |

Other liquid staking and restaking decoders: [Solayer Restaking](https://carbon.sevenlabs.org/decoders/solayer-restaking-program.md). To decode several in one pipeline, see [liquid staking and restaking decoders](https://carbon.sevenlabs.org/decoders/liquid-staking.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 Marinade Finance transactions from the public RPC and prints every decoded `Deposit` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-marinade-finance-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_marinade_finance_decoder::{
        instructions::MarinadeFinanceInstruction, MarinadeFinanceDecoder, 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(MarinadeFinanceDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, MarinadeFinanceInstruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, MarinadeFinanceInstruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let MarinadeFinanceInstruction::Deposit { data, accounts, .. } = input.decoded_instruction {
            println!("deposit {signature}: {data:?} state={}", accounts.state);
        }
        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 `MarinadeFinanceInstruction::CpiEvent { data: CpiEvent::ChangeAuthorityEvent(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 `State` 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_marinade_finance_decoder::{
        accounts::MarinadeFinanceAccount, MarinadeFinanceDecoder, 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(MarinadeFinanceDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

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

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

### `AddLiquidity`

Discriminator `b59d59438fb63448` · data `AddLiquidity` · accounts `AddLiquidityInstructionAccounts`.

| Field      | Type  |
| ---------- | ----- |
| `lamports` | `u64` |

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

Fields of `AddLiquidityInstructionAccounts`, in account order:

| #  | Field                  | Type               |
| -- | ---------------------- | ------------------ |
| 0  | `state`                | `Pubkey`           |
| 1  | `lp_mint`              | `Pubkey`           |
| 2  | `lp_mint_authority`    | `Pubkey`           |
| 3  | `liq_pool_msol_leg`    | `Pubkey`           |
| 4  | `liq_pool_sol_leg_pda` | `Pubkey`           |
| 5  | `transfer_from`        | `Pubkey`           |
| 6  | `mint_to`              | `Pubkey`           |
| 7  | `system_program`       | `Pubkey`           |
| 8  | `token_program`        | `Pubkey`           |
| 9… | `remaining`            | `Vec<AccountMeta>` |

### `AddValidator`

Discriminator `fa7135368d75d7b9` · data `AddValidator` · accounts `AddValidatorInstructionAccounts`.

| Field   | Type  |
| ------- | ----- |
| `score` | `u32` |

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

Fields of `AddValidatorInstructionAccounts`, in account order:

| #  | Field               | Type               |
| -- | ------------------- | ------------------ |
| 0  | `state`             | `Pubkey`           |
| 1  | `manager_authority` | `Pubkey`           |
| 2  | `validator_list`    | `Pubkey`           |
| 3  | `validator_vote`    | `Pubkey`           |
| 4  | `duplication_flag`  | `Pubkey`           |
| 5  | `rent_payer`        | `Pubkey`           |
| 6  | `clock`             | `Pubkey`           |
| 7  | `rent`              | `Pubkey`           |
| 8  | `system_program`    | `Pubkey`           |
| 9… | `remaining`         | `Vec<AccountMeta>` |

### `ChangeAuthority`

Discriminator `326a426863769158` · data `ChangeAuthority` · accounts `ChangeAuthorityInstructionAccounts`.

| Field  | Type                                          |
| ------ | --------------------------------------------- |
| `data` | [`ChangeAuthorityData`](#changeauthoritydata) |

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

Fields of `ChangeAuthorityInstructionAccounts`, in account order:

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

### `Claim`

Discriminator `3ec6d6c1d59f6cd2` · data `Claim` · accounts `ClaimInstructionAccounts`.

No data fields.

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

Fields of `ClaimInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `state`           | `Pubkey`           |
| 1  | `reserve_pda`     | `Pubkey`           |
| 2  | `ticket_account`  | `Pubkey`           |
| 3  | `transfer_sol_to` | `Pubkey`           |
| 4  | `clock`           | `Pubkey`           |
| 5  | `system_program`  | `Pubkey`           |
| 6… | `remaining`       | `Vec<AccountMeta>` |

### `ConfigLp`

Discriminator `0a18a8775630e111` · data `ConfigLp` · accounts `ConfigLpInstructionAccounts`.

| Field    | Type                                |
| -------- | ----------------------------------- |
| `params` | [`ConfigLpParams`](#configlpparams) |

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

Fields of `ConfigLpInstructionAccounts`, in account order:

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

### `ConfigMarinade`

Discriminator `43032272beb9113e` · data `ConfigMarinade` · accounts `ConfigMarinadeInstructionAccounts`.

| Field    | Type                                            |
| -------- | ----------------------------------------------- |
| `params` | [`ConfigMarinadeParams`](#configmarinadeparams) |

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

Fields of `ConfigMarinadeInstructionAccounts`, in account order:

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

### `ConfigValidatorSystem`

Discriminator `1b5a61d111730728` · data `ConfigValidatorSystem` · accounts `ConfigValidatorSystemInstructionAccounts`.

| Field        | Type  |
| ------------ | ----- |
| `extra_runs` | `u32` |

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

Fields of `ConfigValidatorSystemInstructionAccounts`, in account order:

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

### `DeactivateStake`

Discriminator `a59ee561a8dcbbe1` · data `DeactivateStake` · accounts `DeactivateStakeInstructionAccounts`.

| Field             | Type  |
| ----------------- | ----- |
| `stake_index`     | `u32` |
| `validator_index` | `u32` |

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

Fields of `DeactivateStakeInstructionAccounts`, in account order:

| #   | Field                     | Type               |
| --- | ------------------------- | ------------------ |
| 0   | `state`                   | `Pubkey`           |
| 1   | `reserve_pda`             | `Pubkey`           |
| 2   | `validator_list`          | `Pubkey`           |
| 3   | `stake_list`              | `Pubkey`           |
| 4   | `stake_account`           | `Pubkey`           |
| 5   | `stake_deposit_authority` | `Pubkey`           |
| 6   | `split_stake_account`     | `Pubkey`           |
| 7   | `split_stake_rent_payer`  | `Pubkey`           |
| 8   | `clock`                   | `Pubkey`           |
| 9   | `rent`                    | `Pubkey`           |
| 10  | `epoch_schedule`          | `Pubkey`           |
| 11  | `stake_history`           | `Pubkey`           |
| 12  | `system_program`          | `Pubkey`           |
| 13  | `stake_program`           | `Pubkey`           |
| 14… | `remaining`               | `Vec<AccountMeta>` |

### `Deposit`

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

| Field      | Type  |
| ---------- | ----- |
| `lamports` | `u64` |

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

Fields of `DepositInstructionAccounts`, in account order:

| #   | Field                         | Type               |
| --- | ----------------------------- | ------------------ |
| 0   | `state`                       | `Pubkey`           |
| 1   | `msol_mint`                   | `Pubkey`           |
| 2   | `liq_pool_sol_leg_pda`        | `Pubkey`           |
| 3   | `liq_pool_msol_leg`           | `Pubkey`           |
| 4   | `liq_pool_msol_leg_authority` | `Pubkey`           |
| 5   | `reserve_pda`                 | `Pubkey`           |
| 6   | `transfer_from`               | `Pubkey`           |
| 7   | `mint_to`                     | `Pubkey`           |
| 8   | `msol_mint_authority`         | `Pubkey`           |
| 9   | `system_program`              | `Pubkey`           |
| 10  | `token_program`               | `Pubkey`           |
| 11… | `remaining`                   | `Vec<AccountMeta>` |

### `DepositStakeAccount`

Discriminator `6e827329a466023b` · data `DepositStakeAccount` · accounts `DepositStakeAccountInstructionAccounts`.

| Field             | Type  |
| ----------------- | ----- |
| `validator_index` | `u32` |

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

Fields of `DepositStakeAccountInstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `state`               | `Pubkey`           |
| 1   | `validator_list`      | `Pubkey`           |
| 2   | `stake_list`          | `Pubkey`           |
| 3   | `stake_account`       | `Pubkey`           |
| 4   | `stake_authority`     | `Pubkey`           |
| 5   | `duplication_flag`    | `Pubkey`           |
| 6   | `rent_payer`          | `Pubkey`           |
| 7   | `msol_mint`           | `Pubkey`           |
| 8   | `mint_to`             | `Pubkey`           |
| 9   | `msol_mint_authority` | `Pubkey`           |
| 10  | `clock`               | `Pubkey`           |
| 11  | `rent`                | `Pubkey`           |
| 12  | `system_program`      | `Pubkey`           |
| 13  | `token_program`       | `Pubkey`           |
| 14  | `stake_program`       | `Pubkey`           |
| 15… | `remaining`           | `Vec<AccountMeta>` |

### `EmergencyUnstake`

Discriminator `7b45a8c3b7d5c7d6` · data `EmergencyUnstake` · accounts `EmergencyUnstakeInstructionAccounts`.

| Field             | Type  |
| ----------------- | ----- |
| `stake_index`     | `u32` |
| `validator_index` | `u32` |

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

Fields of `EmergencyUnstakeInstructionAccounts`, in account order:

| #  | Field                         | Type               |
| -- | ----------------------------- | ------------------ |
| 0  | `state`                       | `Pubkey`           |
| 1  | `validator_manager_authority` | `Pubkey`           |
| 2  | `validator_list`              | `Pubkey`           |
| 3  | `stake_list`                  | `Pubkey`           |
| 4  | `stake_account`               | `Pubkey`           |
| 5  | `stake_deposit_authority`     | `Pubkey`           |
| 6  | `clock`                       | `Pubkey`           |
| 7  | `stake_program`               | `Pubkey`           |
| 8… | `remaining`                   | `Vec<AccountMeta>` |

### `Initialize`

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

| Field  | Type                                |
| ------ | ----------------------------------- |
| `data` | [`InitializeData`](#initializedata) |

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

Fields of `InitializeInstructionAccounts`, in account order:

| #   | Field                     | Type               |
| --- | ------------------------- | ------------------ |
| 0   | `state`                   | `Pubkey`           |
| 1   | `reserve_pda`             | `Pubkey`           |
| 2   | `stake_list`              | `Pubkey`           |
| 3   | `validator_list`          | `Pubkey`           |
| 4   | `msol_mint`               | `Pubkey`           |
| 5   | `operational_sol_account` | `Pubkey`           |
| 6   | `lp_mint`                 | `Pubkey`           |
| 7   | `sol_leg_pda`             | `Pubkey`           |
| 8   | `msol_leg`                | `Pubkey`           |
| 9   | `treasury_msol_account`   | `Pubkey`           |
| 10  | `clock`                   | `Pubkey`           |
| 11  | `rent`                    | `Pubkey`           |
| 12… | `remaining`               | `Vec<AccountMeta>` |

### `LiquidUnstake`

Discriminator `1e1e77f0bfe30c10` · data `LiquidUnstake` · accounts `LiquidUnstakeInstructionAccounts`.

| Field         | Type  |
| ------------- | ----- |
| `msol_amount` | `u64` |

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

Fields of `LiquidUnstakeInstructionAccounts`, in account order:

| #   | Field                     | Type               |
| --- | ------------------------- | ------------------ |
| 0   | `state`                   | `Pubkey`           |
| 1   | `msol_mint`               | `Pubkey`           |
| 2   | `liq_pool_sol_leg_pda`    | `Pubkey`           |
| 3   | `liq_pool_msol_leg`       | `Pubkey`           |
| 4   | `treasury_msol_account`   | `Pubkey`           |
| 5   | `get_msol_from`           | `Pubkey`           |
| 6   | `get_msol_from_authority` | `Pubkey`           |
| 7   | `transfer_sol_to`         | `Pubkey`           |
| 8   | `system_program`          | `Pubkey`           |
| 9   | `token_program`           | `Pubkey`           |
| 10… | `remaining`               | `Vec<AccountMeta>` |

### `MergeStakes`

Discriminator `d8248de1f34e7ded` · data `MergeStakes` · accounts `MergeStakesInstructionAccounts`.

| Field                     | Type  |
| ------------------------- | ----- |
| `destination_stake_index` | `u32` |
| `source_stake_index`      | `u32` |
| `validator_index`         | `u32` |

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

Fields of `MergeStakesInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `stake_list`               | `Pubkey`           |
| 2   | `validator_list`           | `Pubkey`           |
| 3   | `destination_stake`        | `Pubkey`           |
| 4   | `source_stake`             | `Pubkey`           |
| 5   | `stake_deposit_authority`  | `Pubkey`           |
| 6   | `stake_withdraw_authority` | `Pubkey`           |
| 7   | `operational_sol_account`  | `Pubkey`           |
| 8   | `clock`                    | `Pubkey`           |
| 9   | `stake_history`            | `Pubkey`           |
| 10  | `stake_program`            | `Pubkey`           |
| 11… | `remaining`                | `Vec<AccountMeta>` |

### `OrderUnstake`

Discriminator `61a7906b75be8024` · data `OrderUnstake` · accounts `OrderUnstakeInstructionAccounts`.

| Field         | Type  |
| ------------- | ----- |
| `msol_amount` | `u64` |

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

Fields of `OrderUnstakeInstructionAccounts`, in account order:

| #  | Field                 | Type               |
| -- | --------------------- | ------------------ |
| 0  | `state`               | `Pubkey`           |
| 1  | `msol_mint`           | `Pubkey`           |
| 2  | `burn_msol_from`      | `Pubkey`           |
| 3  | `burn_msol_authority` | `Pubkey`           |
| 4  | `new_ticket_account`  | `Pubkey`           |
| 5  | `clock`               | `Pubkey`           |
| 6  | `rent`                | `Pubkey`           |
| 7  | `token_program`       | `Pubkey`           |
| 8… | `remaining`           | `Vec<AccountMeta>` |

### `PartialUnstake`

Discriminator `37f1cddd2d72cda3` · data `PartialUnstake` · accounts `PartialUnstakeInstructionAccounts`.

| Field                    | Type  |
| ------------------------ | ----- |
| `stake_index`            | `u32` |
| `validator_index`        | `u32` |
| `desired_unstake_amount` | `u64` |

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

Fields of `PartialUnstakeInstructionAccounts`, in account order:

| #   | Field                         | Type               |
| --- | ----------------------------- | ------------------ |
| 0   | `state`                       | `Pubkey`           |
| 1   | `validator_manager_authority` | `Pubkey`           |
| 2   | `validator_list`              | `Pubkey`           |
| 3   | `stake_list`                  | `Pubkey`           |
| 4   | `stake_account`               | `Pubkey`           |
| 5   | `stake_deposit_authority`     | `Pubkey`           |
| 6   | `reserve_pda`                 | `Pubkey`           |
| 7   | `split_stake_account`         | `Pubkey`           |
| 8   | `split_stake_rent_payer`      | `Pubkey`           |
| 9   | `clock`                       | `Pubkey`           |
| 10  | `rent`                        | `Pubkey`           |
| 11  | `stake_history`               | `Pubkey`           |
| 12  | `system_program`              | `Pubkey`           |
| 13  | `stake_program`               | `Pubkey`           |
| 14… | `remaining`                   | `Vec<AccountMeta>` |

### `Pause`

Discriminator `d316ddfb4a79c12f` · data `Pause` · accounts `PauseInstructionAccounts`.

No data fields.

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

Fields of `PauseInstructionAccounts`, in account order:

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

### `ReallocStakeList`

Discriminator `0c247c1b806055c7` · data `ReallocStakeList` · accounts `ReallocStakeListInstructionAccounts`.

| Field      | Type  |
| ---------- | ----- |
| `capacity` | `u32` |

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

Fields of `ReallocStakeListInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `state`           | `Pubkey`           |
| 1  | `admin_authority` | `Pubkey`           |
| 2  | `stake_list`      | `Pubkey`           |
| 3  | `rent_funds`      | `Pubkey`           |
| 4  | `system_program`  | `Pubkey`           |
| 5… | `remaining`       | `Vec<AccountMeta>` |

### `ReallocValidatorList`

Discriminator `d73bda855d8a3c7b` · data `ReallocValidatorList` · accounts `ReallocValidatorListInstructionAccounts`.

| Field      | Type  |
| ---------- | ----- |
| `capacity` | `u32` |

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

Fields of `ReallocValidatorListInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `state`           | `Pubkey`           |
| 1  | `admin_authority` | `Pubkey`           |
| 2  | `validator_list`  | `Pubkey`           |
| 3  | `rent_funds`      | `Pubkey`           |
| 4  | `system_program`  | `Pubkey`           |
| 5… | `remaining`       | `Vec<AccountMeta>` |

### `Redelegate`

Discriminator `d45233a0e4507423` · data `Redelegate` · accounts `RedelegateInstructionAccounts`.

| Field                    | Type  |
| ------------------------ | ----- |
| `stake_index`            | `u32` |
| `source_validator_index` | `u32` |
| `dest_validator_index`   | `u32` |

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

Fields of `RedelegateInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `validator_list`           | `Pubkey`           |
| 2   | `stake_list`               | `Pubkey`           |
| 3   | `stake_account`            | `Pubkey`           |
| 4   | `stake_deposit_authority`  | `Pubkey`           |
| 5   | `reserve_pda`              | `Pubkey`           |
| 6   | `split_stake_account`      | `Pubkey`           |
| 7   | `split_stake_rent_payer`   | `Pubkey`           |
| 8   | `dest_validator_account`   | `Pubkey`           |
| 9   | `redelegate_stake_account` | `Pubkey`           |
| 10  | `clock`                    | `Pubkey`           |
| 11  | `stake_history`            | `Pubkey`           |
| 12  | `stake_config`             | `Pubkey`           |
| 13  | `system_program`           | `Pubkey`           |
| 14  | `stake_program`            | `Pubkey`           |
| 15… | `remaining`                | `Vec<AccountMeta>` |

### `RemoveLiquidity`

Discriminator `5055d14818ceb16c` · data `RemoveLiquidity` · accounts `RemoveLiquidityInstructionAccounts`.

| Field    | Type  |
| -------- | ----- |
| `tokens` | `u64` |

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

Fields of `RemoveLiquidityInstructionAccounts`, in account order:

| #   | Field                         | Type               |
| --- | ----------------------------- | ------------------ |
| 0   | `state`                       | `Pubkey`           |
| 1   | `lp_mint`                     | `Pubkey`           |
| 2   | `burn_from`                   | `Pubkey`           |
| 3   | `burn_from_authority`         | `Pubkey`           |
| 4   | `transfer_sol_to`             | `Pubkey`           |
| 5   | `transfer_msol_to`            | `Pubkey`           |
| 6   | `liq_pool_sol_leg_pda`        | `Pubkey`           |
| 7   | `liq_pool_msol_leg`           | `Pubkey`           |
| 8   | `liq_pool_msol_leg_authority` | `Pubkey`           |
| 9   | `system_program`              | `Pubkey`           |
| 10  | `token_program`               | `Pubkey`           |
| 11… | `remaining`                   | `Vec<AccountMeta>` |

### `RemoveValidator`

Discriminator `1960d39ba10ea8bc` · data `RemoveValidator` · accounts `RemoveValidatorInstructionAccounts`.

| Field            | Type     |
| ---------------- | -------- |
| `index`          | `u32`    |
| `validator_vote` | `Pubkey` |

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

Fields of `RemoveValidatorInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `state`                   | `Pubkey`           |
| 1  | `manager_authority`       | `Pubkey`           |
| 2  | `validator_list`          | `Pubkey`           |
| 3  | `duplication_flag`        | `Pubkey`           |
| 4  | `operational_sol_account` | `Pubkey`           |
| 5… | `remaining`               | `Vec<AccountMeta>` |

### `Resume`

Discriminator `01a633aa7f208dce` · data `Resume` · accounts `ResumeInstructionAccounts`.

No data fields.

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

Fields of `ResumeInstructionAccounts`, in account order:

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

### `SetValidatorScore`

Discriminator `6529ce21d86f194e` · data `SetValidatorScore` · accounts `SetValidatorScoreInstructionAccounts`.

| Field            | Type     |
| ---------------- | -------- |
| `index`          | `u32`    |
| `validator_vote` | `Pubkey` |
| `score`          | `u32`    |

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

Fields of `SetValidatorScoreInstructionAccounts`, in account order:

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

### `StakeReserve`

Discriminator `57d917b3cd197181` · data `StakeReserve` · accounts `StakeReserveInstructionAccounts`.

| Field             | Type  |
| ----------------- | ----- |
| `validator_index` | `u32` |

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

Fields of `StakeReserveInstructionAccounts`, in account order:

| #   | Field                     | Type               |
| --- | ------------------------- | ------------------ |
| 0   | `state`                   | `Pubkey`           |
| 1   | `validator_list`          | `Pubkey`           |
| 2   | `stake_list`              | `Pubkey`           |
| 3   | `validator_vote`          | `Pubkey`           |
| 4   | `reserve_pda`             | `Pubkey`           |
| 5   | `stake_account`           | `Pubkey`           |
| 6   | `stake_deposit_authority` | `Pubkey`           |
| 7   | `rent_payer`              | `Pubkey`           |
| 8   | `clock`                   | `Pubkey`           |
| 9   | `epoch_schedule`          | `Pubkey`           |
| 10  | `rent`                    | `Pubkey`           |
| 11  | `stake_history`           | `Pubkey`           |
| 12  | `stake_config`            | `Pubkey`           |
| 13  | `system_program`          | `Pubkey`           |
| 14  | `stake_program`           | `Pubkey`           |
| 15… | `remaining`               | `Vec<AccountMeta>` |

### `UpdateActive`

Discriminator `0443514088f55d98` · data `UpdateActive` · accounts `UpdateActiveInstructionAccounts`.

| Field             | Type  |
| ----------------- | ----- |
| `stake_index`     | `u32` |
| `validator_index` | `u32` |

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

Fields of `UpdateActiveInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `stake_list`               | `Pubkey`           |
| 2   | `stake_account`            | `Pubkey`           |
| 3   | `stake_withdraw_authority` | `Pubkey`           |
| 4   | `reserve_pda`              | `Pubkey`           |
| 5   | `msol_mint`                | `Pubkey`           |
| 6   | `msol_mint_authority`      | `Pubkey`           |
| 7   | `treasury_msol_account`    | `Pubkey`           |
| 8   | `clock`                    | `Pubkey`           |
| 9   | `stake_history`            | `Pubkey`           |
| 10  | `stake_program`            | `Pubkey`           |
| 11  | `token_program`            | `Pubkey`           |
| 12  | `validator_list`           | `Pubkey`           |
| 13… | `remaining`                | `Vec<AccountMeta>` |

### `UpdateDeactivated`

Discriminator `10e883739c64ef32` · data `UpdateDeactivated` · accounts `UpdateDeactivatedInstructionAccounts`.

| Field         | Type  |
| ------------- | ----- |
| `stake_index` | `u32` |

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

Fields of `UpdateDeactivatedInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `stake_list`               | `Pubkey`           |
| 2   | `stake_account`            | `Pubkey`           |
| 3   | `stake_withdraw_authority` | `Pubkey`           |
| 4   | `reserve_pda`              | `Pubkey`           |
| 5   | `msol_mint`                | `Pubkey`           |
| 6   | `msol_mint_authority`      | `Pubkey`           |
| 7   | `treasury_msol_account`    | `Pubkey`           |
| 8   | `clock`                    | `Pubkey`           |
| 9   | `stake_history`            | `Pubkey`           |
| 10  | `stake_program`            | `Pubkey`           |
| 11  | `token_program`            | `Pubkey`           |
| 12  | `operational_sol_account`  | `Pubkey`           |
| 13  | `system_program`           | `Pubkey`           |
| 14… | `remaining`                | `Vec<AccountMeta>` |

### `WithdrawStakeAccount`

Discriminator `d355b841b7b1e9d9` · data `WithdrawStakeAccount` · accounts `WithdrawStakeAccountInstructionAccounts`.

| Field             | Type     |
| ----------------- | -------- |
| `stake_index`     | `u32`    |
| `validator_index` | `u32`    |
| `msol_amount`     | `u64`    |
| `beneficiary`     | `Pubkey` |

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

Fields of `WithdrawStakeAccountInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `state`                    | `Pubkey`           |
| 1   | `msol_mint`                | `Pubkey`           |
| 2   | `burn_msol_from`           | `Pubkey`           |
| 3   | `burn_msol_authority`      | `Pubkey`           |
| 4   | `treasury_msol_account`    | `Pubkey`           |
| 5   | `validator_list`           | `Pubkey`           |
| 6   | `stake_list`               | `Pubkey`           |
| 7   | `stake_withdraw_authority` | `Pubkey`           |
| 8   | `stake_deposit_authority`  | `Pubkey`           |
| 9   | `stake_account`            | `Pubkey`           |
| 10  | `split_stake_account`      | `Pubkey`           |
| 11  | `split_stake_rent_payer`   | `Pubkey`           |
| 12  | `clock`                    | `Pubkey`           |
| 13  | `system_program`           | `Pubkey`           |
| 14  | `token_program`            | `Pubkey`           |
| 15  | `stake_program`            | `Pubkey`           |
| 16… | `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 `MarinadeFinanceAccount`. Each wraps a boxed struct from `carbon_marinade_finance_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `State`

Discriminator `d8926b5e684bb6b1` · `accounts::state::State`.

| Field                            | Type                                  | Description                                                    |
| -------------------------------- | ------------------------------------- | -------------------------------------------------------------- |
| `msol_mint`                      | `Pubkey`                              |                                                                |
| `admin_authority`                | `Pubkey`                              |                                                                |
| `operational_sol_account`        | `Pubkey`                              |                                                                |
| `treasury_msol_account`          | `Pubkey`                              |                                                                |
| `reserve_bump_seed`              | `u8`                                  |                                                                |
| `msol_mint_authority_bump_seed`  | `u8`                                  |                                                                |
| `rent_exempt_for_token_acc`      | `u64`                                 |                                                                |
| `reward_fee`                     | [`Fee`](#fee)                         |                                                                |
| `stake_system`                   | [`StakeSystem`](#stakesystem)         |                                                                |
| `validator_system`               | [`ValidatorSystem`](#validatorsystem) |                                                                |
| `liq_pool`                       | [`LiqPool`](#liqpool)                 |                                                                |
| `available_reserve_balance`      | `u64`                                 |                                                                |
| `msol_supply`                    | `u64`                                 |                                                                |
| `msol_price`                     | `u64`                                 |                                                                |
| `circulating_ticket_count`       | `u64`                                 | count tickets for delayed-unstake                              |
| `circulating_ticket_balance`     | `u64`                                 | total lamports amount of generated and not claimed yet tickets |
| `lent_from_reserve`              | `u64`                                 |                                                                |
| `min_deposit`                    | `u64`                                 |                                                                |
| `min_withdraw`                   | `u64`                                 |                                                                |
| `staking_sol_cap`                | `u64`                                 |                                                                |
| `emergency_cooling_down`         | `u64`                                 |                                                                |
| `pause_authority`                | `Pubkey`                              | emergency pause                                                |
| `paused`                         | `bool`                                |                                                                |
| `delayed_unstake_fee`            | [`FeeCents`](#feecents)               |                                                                |
| `withdraw_stake_account_fee`     | [`FeeCents`](#feecents)               |                                                                |
| `withdraw_stake_account_enabled` | `bool`                                |                                                                |
| `last_stake_move_epoch`          | `u64`                                 |                                                                |
| `stake_moved`                    | `u64`                                 |                                                                |
| `max_stake_moved_per_epoch`      | [`Fee`](#fee)                         |                                                                |

### `TicketAccountData`

Discriminator `854d1262d301e703` · `accounts::ticket_account_data::TicketAccountData`.

| Field             | Type     |
| ----------------- | -------- |
| `state_address`   | `Pubkey` |
| `beneficiary`     | `Pubkey` |
| `lamports_amount` | `u64`    |
| `created_epoch`   | `u64`    |

## Events

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

### `ChangeAuthorityEvent`

Discriminator `e46f2318bb4ee08a` · `events::change_authority_event::ChangeAuthorityEventEvent`.

| Field                            | Type                                              |
| -------------------------------- | ------------------------------------------------- |
| `state`                          | `Pubkey`                                          |
| `admin_change`                   | [`Option<PubkeyValueChange>`](#pubkeyvaluechange) |
| `validator_manager_change`       | [`Option<PubkeyValueChange>`](#pubkeyvaluechange) |
| `operational_sol_account_change` | [`Option<PubkeyValueChange>`](#pubkeyvaluechange) |
| `treasury_msol_account_change`   | [`Option<PubkeyValueChange>`](#pubkeyvaluechange) |
| `pause_authority_change`         | [`Option<PubkeyValueChange>`](#pubkeyvaluechange) |

### `ConfigLpEvent`

Discriminator `9fccc08a4491e094` · `events::config_lp_event::ConfigLpEventEvent`.

| Field                     | Type                                        |
| ------------------------- | ------------------------------------------- |
| `state`                   | `Pubkey`                                    |
| `min_fee_change`          | [`Option<FeeValueChange>`](#feevaluechange) |
| `max_fee_change`          | [`Option<FeeValueChange>`](#feevaluechange) |
| `liquidity_target_change` | [`Option<U64ValueChange>`](#u64valuechange) |
| `treasury_cut_change`     | [`Option<FeeValueChange>`](#feevaluechange) |

### `ConfigMarinadeEvent`

Discriminator `9fa4f5725efd0309` · `events::config_marinade_event::ConfigMarinadeEventEvent`.

| Field                                   | Type                                                  |
| --------------------------------------- | ----------------------------------------------------- |
| `state`                                 | `Pubkey`                                              |
| `rewards_fee_change`                    | [`Option<FeeValueChange>`](#feevaluechange)           |
| `slots_for_stake_delta_change`          | [`Option<U64ValueChange>`](#u64valuechange)           |
| `min_stake_change`                      | [`Option<U64ValueChange>`](#u64valuechange)           |
| `min_deposit_change`                    | [`Option<U64ValueChange>`](#u64valuechange)           |
| `min_withdraw_change`                   | [`Option<U64ValueChange>`](#u64valuechange)           |
| `staking_sol_cap_change`                | [`Option<U64ValueChange>`](#u64valuechange)           |
| `liquidity_sol_cap_change`              | [`Option<U64ValueChange>`](#u64valuechange)           |
| `withdraw_stake_account_enabled_change` | [`Option<BoolValueChange>`](#boolvaluechange)         |
| `delayed_unstake_fee_change`            | [`Option<FeeCentsValueChange>`](#feecentsvaluechange) |
| `withdraw_stake_account_fee_change`     | [`Option<FeeCentsValueChange>`](#feecentsvaluechange) |
| `max_stake_moved_per_epoch_change`      | [`Option<FeeValueChange>`](#feevaluechange)           |

### `InitializeEvent`

Discriminator `ceafa9d0f1d223dd` · `events::initialize_event::InitializeEventEvent`.

| Field                     | Type                                |
| ------------------------- | ----------------------------------- |
| `state`                   | `Pubkey`                            |
| `params`                  | [`InitializeData`](#initializedata) |
| `stake_list`              | `Pubkey`                            |
| `validator_list`          | `Pubkey`                            |
| `msol_mint`               | `Pubkey`                            |
| `operational_sol_account` | `Pubkey`                            |
| `lp_mint`                 | `Pubkey`                            |
| `lp_msol_leg`             | `Pubkey`                            |
| `treasury_msol_account`   | `Pubkey`                            |

### `EmergencyPauseEvent`

Discriminator `9ff1c0e81dd03315` · `events::emergency_pause_event::EmergencyPauseEventEvent`.

| Field   | Type     |
| ------- | -------- |
| `state` | `Pubkey` |

### `ResumeEvent`

Discriminator `6175b77375e008e5` · `events::resume_event::ResumeEventEvent`.

| Field   | Type     |
| ------- | -------- |
| `state` | `Pubkey` |

### `ReallocValidatorListEvent`

Discriminator `46bff2a4389c820d` · `events::realloc_validator_list_event::ReallocValidatorListEventEvent`.

| Field          | Type     |
| -------------- | -------- |
| `state`        | `Pubkey` |
| `count`        | `u32`    |
| `new_capacity` | `u32`    |

### `ReallocStakeListEvent`

Discriminator `c18110f3b183f817` · `events::realloc_stake_list_event::ReallocStakeListEventEvent`.

| Field          | Type     |
| -------------- | -------- |
| `state`        | `Pubkey` |
| `count`        | `u32`    |
| `new_capacity` | `u32`    |

### `DeactivateStakeEvent`

Discriminator `0236b8da4eb5a375` · `events::deactivate_stake_event::DeactivateStakeEventEvent`.

| Field                          | Type                                                      |
| ------------------------------ | --------------------------------------------------------- |
| `state`                        | `Pubkey`                                                  |
| `epoch`                        | `u64`                                                     |
| `stake_index`                  | `u32`                                                     |
| `stake_account`                | `Pubkey`                                                  |
| `last_update_stake_delegation` | `u64`                                                     |
| `split_stake_account`          | [`Option<SplitStakeAccountInfo>`](#splitstakeaccountinfo) |
| `validator_index`              | `u32`                                                     |
| `validator_vote`               | `Pubkey`                                                  |
| `total_stake_target`           | `u64`                                                     |
| `validator_stake_target`       | `u64`                                                     |
| `total_active_balance`         | `u64`                                                     |
| `delayed_unstake_cooling_down` | `u64`                                                     |
| `validator_active_balance`     | `u64`                                                     |
| `total_unstake_delta`          | `u64`                                                     |
| `unstaked_amount`              | `u64`                                                     |

### `MergeStakesEvent`

Discriminator `499c45e9200e9641` · `events::merge_stakes_event::MergeStakesEventEvent`.

| Field                                      | Type     |
| ------------------------------------------ | -------- |
| `state`                                    | `Pubkey` |
| `epoch`                                    | `u64`    |
| `destination_stake_index`                  | `u32`    |
| `destination_stake_account`                | `Pubkey` |
| `last_update_destination_stake_delegation` | `u64`    |
| `source_stake_index`                       | `u32`    |
| `source_stake_account`                     | `Pubkey` |
| `last_update_source_stake_delegation`      | `u64`    |
| `validator_index`                          | `u32`    |
| `validator_vote`                           | `Pubkey` |
| `extra_delegated`                          | `u64`    |
| `returned_stake_rent`                      | `u64`    |
| `validator_active_balance`                 | `u64`    |
| `total_active_balance`                     | `u64`    |
| `operational_sol_balance`                  | `u64`    |

### `RedelegateEvent`

Discriminator `f14b87adccd74843` · `events::redelegate_event::RedelegateEventEvent`.

| Field                           | Type                                                      |
| ------------------------------- | --------------------------------------------------------- |
| `state`                         | `Pubkey`                                                  |
| `epoch`                         | `u64`                                                     |
| `stake_index`                   | `u32`                                                     |
| `stake_account`                 | `Pubkey`                                                  |
| `last_update_delegation`        | `u64`                                                     |
| `source_validator_index`        | `u32`                                                     |
| `source_validator_vote`         | `Pubkey`                                                  |
| `source_validator_score`        | `u32`                                                     |
| `source_validator_balance`      | `u64`                                                     |
| `source_validator_stake_target` | `u64`                                                     |
| `dest_validator_index`          | `u32`                                                     |
| `dest_validator_vote`           | `Pubkey`                                                  |
| `dest_validator_score`          | `u32`                                                     |
| `dest_validator_balance`        | `u64`                                                     |
| `dest_validator_stake_target`   | `u64`                                                     |
| `redelegate_amount`             | `u64`                                                     |
| `split_stake_account`           | [`Option<SplitStakeAccountInfo>`](#splitstakeaccountinfo) |
| `redelegate_stake_index`        | `u32`                                                     |
| `redelegate_stake_account`      | `Pubkey`                                                  |

### `StakeReserveEvent`

Discriminator `707595b94d77be6a` · `events::stake_reserve_event::StakeReserveEventEvent`.

| Field                      | Type     |
| -------------------------- | -------- |
| `state`                    | `Pubkey` |
| `epoch`                    | `u64`    |
| `stake_index`              | `u32`    |
| `stake_account`            | `Pubkey` |
| `validator_index`          | `u32`    |
| `validator_vote`           | `Pubkey` |
| `total_stake_target`       | `u64`    |
| `validator_stake_target`   | `u64`    |
| `reserve_balance`          | `u64`    |
| `total_active_balance`     | `u64`    |
| `validator_active_balance` | `u64`    |
| `total_stake_delta`        | `u64`    |
| `amount`                   | `u64`    |

### `UpdateActiveEvent`

Discriminator `fb12804bd050ae8c` · `events::update_active_event::UpdateActiveEventEvent`.

| Field                           | Type                                |
| ------------------------------- | ----------------------------------- |
| `state`                         | `Pubkey`                            |
| `epoch`                         | `u64`                               |
| `stake_index`                   | `u32`                               |
| `stake_account`                 | `Pubkey`                            |
| `validator_index`               | `u32`                               |
| `validator_vote`                | `Pubkey`                            |
| `delegation_change`             | [`U64ValueChange`](#u64valuechange) |
| `delegation_growth_msol_fees`   | `Option<u64>`                       |
| `extra_lamports`                | `u64`                               |
| `extra_msol_fees`               | `Option<u64>`                       |
| `validator_active_balance`      | `u64`                               |
| `total_active_balance`          | `u64`                               |
| `msol_price_change`             | [`U64ValueChange`](#u64valuechange) |
| `reward_fee_used`               | [`Fee`](#fee)                       |
| `total_virtual_staked_lamports` | `u64`                               |
| `msol_supply`                   | `u64`                               |

### `UpdateDeactivatedEvent`

Discriminator `fc9fb193b671ba5e` · `events::update_deactivated_event::UpdateDeactivatedEventEvent`.

| Field                            | Type                                |
| -------------------------------- | ----------------------------------- |
| `state`                          | `Pubkey`                            |
| `epoch`                          | `u64`                               |
| `stake_index`                    | `u32`                               |
| `stake_account`                  | `Pubkey`                            |
| `balance_without_rent_exempt`    | `u64`                               |
| `last_update_delegated_lamports` | `u64`                               |
| `msol_fees`                      | `Option<u64>`                       |
| `msol_price_change`              | [`U64ValueChange`](#u64valuechange) |
| `reward_fee_used`                | [`Fee`](#fee)                       |
| `operational_sol_balance`        | `u64`                               |
| `total_virtual_staked_lamports`  | `u64`                               |
| `msol_supply`                    | `u64`                               |

### `ClaimEvent`

Discriminator `5d0f46aa308cd4db` · `events::claim_event::ClaimEventEvent`.

| Field                        | Type     |
| ---------------------------- | -------- |
| `state`                      | `Pubkey` |
| `epoch`                      | `u64`    |
| `ticket`                     | `Pubkey` |
| `beneficiary`                | `Pubkey` |
| `circulating_ticket_balance` | `u64`    |
| `circulating_ticket_count`   | `u64`    |
| `reserve_balance`            | `u64`    |
| `user_balance`               | `u64`    |
| `amount`                     | `u64`    |

### `OrderUnstakeEvent`

Discriminator `e43f9bf984a08771` · `events::order_unstake_event::OrderUnstakeEventEvent`.

| Field                           | Type     |
| ------------------------------- | -------- |
| `state`                         | `Pubkey` |
| `ticket_epoch`                  | `u64`    |
| `ticket`                        | `Pubkey` |
| `beneficiary`                   | `Pubkey` |
| `circulating_ticket_balance`    | `u64`    |
| `circulating_ticket_count`      | `u64`    |
| `user_msol_balance`             | `u64`    |
| `burned_msol_amount`            | `u64`    |
| `sol_amount`                    | `u64`    |
| `fee_bp_cents`                  | `u32`    |
| `total_virtual_staked_lamports` | `u64`    |
| `msol_supply`                   | `u64`    |

### `AddLiquidityEvent`

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

| Field                           | Type     |
| ------------------------------- | -------- |
| `state`                         | `Pubkey` |
| `sol_owner`                     | `Pubkey` |
| `user_sol_balance`              | `u64`    |
| `user_lp_balance`               | `u64`    |
| `sol_leg_balance`               | `u64`    |
| `lp_supply`                     | `u64`    |
| `sol_added_amount`              | `u64`    |
| `lp_minted`                     | `u64`    |
| `total_virtual_staked_lamports` | `u64`    |
| `msol_supply`                   | `u64`    |

### `LiquidUnstakeEvent`

Discriminator `ad05930f050ec274` · `events::liquid_unstake_event::LiquidUnstakeEventEvent`.

| Field                   | Type          |
| ----------------------- | ------------- |
| `state`                 | `Pubkey`      |
| `msol_owner`            | `Pubkey`      |
| `liq_pool_sol_balance`  | `u64`         |
| `liq_pool_msol_balance` | `u64`         |
| `treasury_msol_balance` | `Option<u64>` |
| `user_msol_balance`     | `u64`         |
| `user_sol_balance`      | `u64`         |
| `msol_amount`           | `u64`         |
| `msol_fee`              | `u64`         |
| `treasury_msol_cut`     | `u64`         |
| `sol_amount`            | `u64`         |
| `lp_liquidity_target`   | `u64`         |
| `lp_max_fee`            | [`Fee`](#fee) |
| `lp_min_fee`            | [`Fee`](#fee) |
| `treasury_cut`          | [`Fee`](#fee) |

### `RemoveLiquidityEvent`

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

| Field               | Type     |
| ------------------- | -------- |
| `state`             | `Pubkey` |
| `sol_leg_balance`   | `u64`    |
| `msol_leg_balance`  | `u64`    |
| `user_lp_balance`   | `u64`    |
| `user_sol_balance`  | `u64`    |
| `user_msol_balance` | `u64`    |
| `lp_mint_supply`    | `u64`    |
| `lp_burned`         | `u64`    |
| `sol_out_amount`    | `u64`    |
| `msol_out_amount`   | `u64`    |

### `AddValidatorEvent`

Discriminator `bee7aaf40ee38142` · `events::add_validator_event::AddValidatorEventEvent`.

| Field       | Type     |
| ----------- | -------- |
| `state`     | `Pubkey` |
| `validator` | `Pubkey` |
| `index`     | `u32`    |
| `score`     | `u32`    |

### `RemoveValidatorEvent`

Discriminator `43a4bec09c9ca8d2` · `events::remove_validator_event::RemoveValidatorEventEvent`.

| Field                     | Type     |
| ------------------------- | -------- |
| `state`                   | `Pubkey` |
| `validator`               | `Pubkey` |
| `index`                   | `u32`    |
| `operational_sol_balance` | `u64`    |

### `SetValidatorScoreEvent`

Discriminator `3a35edb2ee99559c` · `events::set_validator_score_event::SetValidatorScoreEventEvent`.

| Field          | Type                                |
| -------------- | ----------------------------------- |
| `state`        | `Pubkey`                            |
| `validator`    | `Pubkey`                            |
| `index`        | `u32`                               |
| `score_change` | [`U32ValueChange`](#u32valuechange) |

### `DepositStakeAccountEvent`

Discriminator `e7cb76604b7446e4` · `events::deposit_stake_account_event::DepositStakeAccountEventEvent`.

| Field                           | Type     |
| ------------------------------- | -------- |
| `state`                         | `Pubkey` |
| `stake`                         | `Pubkey` |
| `delegated`                     | `u64`    |
| `withdrawer`                    | `Pubkey` |
| `stake_index`                   | `u32`    |
| `validator`                     | `Pubkey` |
| `validator_index`               | `u32`    |
| `validator_active_balance`      | `u64`    |
| `total_active_balance`          | `u64`    |
| `user_msol_balance`             | `u64`    |
| `msol_minted`                   | `u64`    |
| `total_virtual_staked_lamports` | `u64`    |
| `msol_supply`                   | `u64`    |

### `DepositEvent`

Discriminator `78f83d531f8e6b90` · `events::deposit_event::DepositEventEvent`.

| Field                           | Type     |
| ------------------------------- | -------- |
| `state`                         | `Pubkey` |
| `sol_owner`                     | `Pubkey` |
| `user_sol_balance`              | `u64`    |
| `user_msol_balance`             | `u64`    |
| `sol_leg_balance`               | `u64`    |
| `msol_leg_balance`              | `u64`    |
| `reserve_balance`               | `u64`    |
| `sol_swapped`                   | `u64`    |
| `msol_swapped`                  | `u64`    |
| `sol_deposited`                 | `u64`    |
| `msol_minted`                   | `u64`    |
| `total_virtual_staked_lamports` | `u64`    |
| `msol_supply`                   | `u64`    |

### `WithdrawStakeAccountEvent`

Discriminator `83ee27301e1ba51c` · `events::withdraw_stake_account_event::WithdrawStakeAccountEventEvent`.

| Field                           | Type     |
| ------------------------------- | -------- |
| `state`                         | `Pubkey` |
| `epoch`                         | `u64`    |
| `stake`                         | `Pubkey` |
| `last_update_stake_delegation`  | `u64`    |
| `stake_index`                   | `u32`    |
| `validator`                     | `Pubkey` |
| `validator_index`               | `u32`    |
| `user_msol_balance`             | `u64`    |
| `user_msol_auth`                | `Pubkey` |
| `msol_burned`                   | `u64`    |
| `msol_fees`                     | `u64`    |
| `split_stake`                   | `Pubkey` |
| `beneficiary`                   | `Pubkey` |
| `split_lamports`                | `u64`    |
| `fee_bp_cents`                  | `u32`    |
| `total_virtual_staked_lamports` | `u64`    |
| `msol_supply`                   | `u64`    |

## Types

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

### `AddLiquidityEvent`

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

### `AddValidatorEvent`

Struct `types::AddValidatorEvent`. Same fields as the [`AddValidatorEvent`](#addvalidatorevent) event.

### `BoolValueChange`

Struct `types::BoolValueChange`.

| Field | Type   |
| ----- | ------ |
| `old` | `bool` |
| `new` | `bool` |

### `ChangeAuthorityData`

Struct `types::ChangeAuthorityData`.

| Field                     | Type             |
| ------------------------- | ---------------- |
| `admin`                   | `Option<Pubkey>` |
| `validator_manager`       | `Option<Pubkey>` |
| `operational_sol_account` | `Option<Pubkey>` |
| `treasury_msol_account`   | `Option<Pubkey>` |
| `pause_authority`         | `Option<Pubkey>` |

### `ChangeAuthorityEvent`

Struct `types::ChangeAuthorityEvent`. Same fields as the [`ChangeAuthorityEvent`](#changeauthorityevent) event.

### `ClaimEvent`

Struct `types::ClaimEvent`. Same fields as the [`ClaimEvent`](#claimevent) event.

### `ConfigLpEvent`

Struct `types::ConfigLpEvent`. Same fields as the [`ConfigLpEvent`](#configlpevent) event.

### `ConfigLpParams`

Struct `types::ConfigLpParams`.

| Field              | Type                  |
| ------------------ | --------------------- |
| `min_fee`          | [`Option<Fee>`](#fee) |
| `max_fee`          | [`Option<Fee>`](#fee) |
| `liquidity_target` | `Option<u64>`         |
| `treasury_cut`     | [`Option<Fee>`](#fee) |

### `ConfigMarinadeEvent`

Struct `types::ConfigMarinadeEvent`. Same fields as the [`ConfigMarinadeEvent`](#configmarinadeevent) event.

### `ConfigMarinadeParams`

Struct `types::ConfigMarinadeParams`.

| Field                            | Type                            |
| -------------------------------- | ------------------------------- |
| `rewards_fee`                    | [`Option<Fee>`](#fee)           |
| `slots_for_stake_delta`          | `Option<u64>`                   |
| `min_stake`                      | `Option<u64>`                   |
| `min_deposit`                    | `Option<u64>`                   |
| `min_withdraw`                   | `Option<u64>`                   |
| `staking_sol_cap`                | `Option<u64>`                   |
| `liquidity_sol_cap`              | `Option<u64>`                   |
| `withdraw_stake_account_enabled` | `Option<bool>`                  |
| `delayed_unstake_fee`            | [`Option<FeeCents>`](#feecents) |
| `withdraw_stake_account_fee`     | [`Option<FeeCents>`](#feecents) |
| `max_stake_moved_per_epoch`      | [`Option<Fee>`](#fee)           |

### `DeactivateStakeEvent`

Struct `types::DeactivateStakeEvent`. Same fields as the [`DeactivateStakeEvent`](#deactivatestakeevent) event.

### `DepositEvent`

Struct `types::DepositEvent`. Same fields as the [`DepositEvent`](#depositevent) event.

### `DepositStakeAccountEvent`

Struct `types::DepositStakeAccountEvent`. Same fields as the [`DepositStakeAccountEvent`](#depositstakeaccountevent) event.

### `EmergencyPauseEvent`

Struct `types::EmergencyPauseEvent`. Same fields as the [`EmergencyPauseEvent`](#emergencypauseevent) event.

### `Fee`

Struct `types::Fee`.

| Field          | Type  |
| -------------- | ----- |
| `basis_points` | `u32` |

### `FeeCents`

> _From the program's IDL:_
>
> FeeCents, same as Fee but / 1_000_000 instead of 10_000 1 FeeCent = 0.0001%, 10_000 FeeCent = 1%, 1_000_000 FeeCent = 100%

Struct `types::FeeCents`.

| Field      | Type  |
| ---------- | ----- |
| `bp_cents` | `u32` |

### `FeeCentsValueChange`

Struct `types::FeeCentsValueChange`.

| Field | Type                    |
| ----- | ----------------------- |
| `old` | [`FeeCents`](#feecents) |
| `new` | [`FeeCents`](#feecents) |

### `FeeValueChange`

Struct `types::FeeValueChange`.

| Field | Type          |
| ----- | ------------- |
| `old` | [`Fee`](#fee) |
| `new` | [`Fee`](#fee) |

### `InitializeData`

Struct `types::InitializeData`.

| Field                               | Type                                              |
| ----------------------------------- | ------------------------------------------------- |
| `admin_authority`                   | `Pubkey`                                          |
| `validator_manager_authority`       | `Pubkey`                                          |
| `min_stake`                         | `u64`                                             |
| `rewards_fee`                       | [`Fee`](#fee)                                     |
| `liq_pool`                          | [`LiqPoolInitializeData`](#liqpoolinitializedata) |
| `additional_stake_record_space`     | `u32`                                             |
| `additional_validator_record_space` | `u32`                                             |
| `slots_for_stake_delta`             | `u64`                                             |
| `pause_authority`                   | `Pubkey`                                          |

### `InitializeEvent`

Struct `types::InitializeEvent`. Same fields as the [`InitializeEvent`](#initializeevent) event.

### `LiqPool`

Struct `types::LiqPool`.

| Field                          | Type          | Description                                                                               |
| ------------------------------ | ------------- | ----------------------------------------------------------------------------------------- |
| `lp_mint`                      | `Pubkey`      |                                                                                           |
| `lp_mint_authority_bump_seed`  | `u8`          |                                                                                           |
| `sol_leg_bump_seed`            | `u8`          |                                                                                           |
| `msol_leg_authority_bump_seed` | `u8`          |                                                                                           |
| `msol_leg`                     | `Pubkey`      |                                                                                           |
| `lp_liquidity_target`          | `u64`         | Liquidity target. If the Liquidity reach this amount, the fee reaches lp_min_discount_fee |
| `lp_max_fee`                   | [`Fee`](#fee) | Liquidity pool max fee                                                                    |
| `lp_min_fee`                   | [`Fee`](#fee) | SOL/mSOL Liquidity pool min fee                                                           |
| `treasury_cut`                 | [`Fee`](#fee) | Treasury cut                                                                              |
| `lp_supply`                    | `u64`         |                                                                                           |
| `lent_from_sol_leg`            | `u64`         |                                                                                           |
| `liquidity_sol_cap`            | `u64`         |                                                                                           |

### `LiqPoolInitializeData`

Struct `types::LiqPoolInitializeData`.

| Field                 | Type          |
| --------------------- | ------------- |
| `lp_liquidity_target` | `u64`         |
| `lp_max_fee`          | [`Fee`](#fee) |
| `lp_min_fee`          | [`Fee`](#fee) |
| `lp_treasury_cut`     | [`Fee`](#fee) |

### `LiquidUnstakeEvent`

Struct `types::LiquidUnstakeEvent`. Same fields as the [`LiquidUnstakeEvent`](#liquidunstakeevent) event.

### `List`

Struct `types::List`.

| Field       | Type     |
| ----------- | -------- |
| `account`   | `Pubkey` |
| `item_size` | `u32`    |
| `count`     | `u32`    |
| `reserved1` | `Pubkey` |
| `reserved2` | `u32`    |

### `MergeStakesEvent`

Struct `types::MergeStakesEvent`. Same fields as the [`MergeStakesEvent`](#mergestakesevent) event.

### `OrderUnstakeEvent`

Struct `types::OrderUnstakeEvent`. Same fields as the [`OrderUnstakeEvent`](#orderunstakeevent) event.

### `PubkeyValueChange`

Struct `types::PubkeyValueChange`.

| Field | Type     |
| ----- | -------- |
| `old` | `Pubkey` |
| `new` | `Pubkey` |

### `ReallocStakeListEvent`

Struct `types::ReallocStakeListEvent`. Same fields as the [`ReallocStakeListEvent`](#reallocstakelistevent) event.

### `ReallocValidatorListEvent`

Struct `types::ReallocValidatorListEvent`. Same fields as the [`ReallocValidatorListEvent`](#reallocvalidatorlistevent) event.

### `RedelegateEvent`

Struct `types::RedelegateEvent`. Same fields as the [`RedelegateEvent`](#redelegateevent) event.

### `RemoveLiquidityEvent`

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

### `RemoveValidatorEvent`

Struct `types::RemoveValidatorEvent`. Same fields as the [`RemoveValidatorEvent`](#removevalidatorevent) event.

### `ResumeEvent`

Struct `types::ResumeEvent`. Same fields as the [`ResumeEvent`](#resumeevent) event.

### `SetValidatorScoreEvent`

Struct `types::SetValidatorScoreEvent`. Same fields as the [`SetValidatorScoreEvent`](#setvalidatorscoreevent) event.

### `SplitStakeAccountInfo`

Struct `types::SplitStakeAccountInfo`.

| Field     | Type     |
| --------- | -------- |
| `account` | `Pubkey` |
| `index`   | `u32`    |

### `StakeList`

Struct `types::StakeList`.

No fields.

### `StakeRecord`

Struct `types::StakeRecord`.

| Field                            | Type     |
| -------------------------------- | -------- |
| `stake_account`                  | `Pubkey` |
| `last_update_delegated_lamports` | `u64`    |
| `last_update_epoch`              | `u64`    |
| `is_emergency_unstaking`         | `u8`     |

### `StakeReserveEvent`

Struct `types::StakeReserveEvent`. Same fields as the [`StakeReserveEvent`](#stakereserveevent) event.

### `StakeSystem`

Struct `types::StakeSystem`.

| Field                          | Type            | Description                                                                                                                                                                                                                                                                                  |
| ------------------------------ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stake_list`                   | [`List`](#list) |                                                                                                                                                                                                                                                                                              |
| `delayed_unstake_cooling_down` | `u64`           |                                                                                                                                                                                                                                                                                              |
| `stake_deposit_bump_seed`      | `u8`            |                                                                                                                                                                                                                                                                                              |
| `stake_withdraw_bump_seed`     | `u8`            |                                                                                                                                                                                                                                                                                              |
| `slots_for_stake_delta`        | `u64`           | set by admin, how much slots before the end of the epoch, stake-delta can start                                                                                                                                                                                                              |
| `last_stake_delta_epoch`       | `u64`           | Marks the start of stake-delta operations, meaning that if somebody starts a delayed-unstake ticket after this var is set with epoch_num the ticket will have epoch_created = current_epoch+1 (the user must wait one more epoch, because their unstake-delta will be execute in this epoch) |
| `min_stake`                    | `u64`           |                                                                                                                                                                                                                                                                                              |
| `extra_stake_delta_runs`       | `u32`           | can be set by validator-manager-auth to allow a second run of stake-delta to stake late stakers in the last minute of the epoch so we maximize user's rewards                                                                                                                                |

### `U32ValueChange`

Struct `types::U32ValueChange`.

| Field | Type  |
| ----- | ----- |
| `old` | `u32` |
| `new` | `u32` |

### `U64ValueChange`

Struct `types::U64ValueChange`.

| Field | Type  |
| ----- | ----- |
| `old` | `u64` |
| `new` | `u64` |

### `UpdateActiveEvent`

Struct `types::UpdateActiveEvent`. Same fields as the [`UpdateActiveEvent`](#updateactiveevent) event.

### `UpdateDeactivatedEvent`

Struct `types::UpdateDeactivatedEvent`. Same fields as the [`UpdateDeactivatedEvent`](#updatedeactivatedevent) event.

### `ValidatorList`

Struct `types::ValidatorList`.

No fields.

### `ValidatorRecord`

Struct `types::ValidatorRecord`.

| Field                        | Type     | Description                         |
| ---------------------------- | -------- | ----------------------------------- |
| `validator_account`          | `Pubkey` | Validator vote pubkey               |
| `active_balance`             | `u64`    | Validator total balance in lamports |
| `score`                      | `u32`    |                                     |
| `last_stake_delta_epoch`     | `u64`    |                                     |
| `duplication_flag_bump_seed` | `u8`     |                                     |

### `ValidatorSystem`

Struct `types::ValidatorSystem`.

| Field                        | Type            | Description                       |
| ---------------------------- | --------------- | --------------------------------- |
| `validator_list`             | [`List`](#list) |                                   |
| `manager_authority`          | `Pubkey`        |                                   |
| `total_validator_score`      | `u32`           |                                   |
| `total_active_balance`       | `u64`           | sum of all active lamports staked |
| `auto_add_validator_enabled` | `u8`            | DEPRECATED, no longer used        |

### `WithdrawStakeAccountEvent`

Struct `types::WithdrawStakeAccountEvent`. Same fields as the [`WithdrawStakeAccountEvent`](#withdrawstakeaccountevent) event.

---

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