carbon_stake_program_decoder/instructions/
initialize_checked.rs

1use carbon_core::{borsh, CarbonDeserialize};
2
3#[derive(
4    CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5)]
6#[carbon(discriminator = "0xdb5a3aa18b58f61c")]
7pub struct InitializeChecked {}
8
9pub struct InitializeCheckedInstructionAccounts {
10    pub stake: solana_pubkey::Pubkey,
11    pub rent: solana_pubkey::Pubkey,
12    pub stake_authority: solana_pubkey::Pubkey,
13    pub withdraw_authority: solana_pubkey::Pubkey,
14}
15
16impl carbon_core::deserialize::ArrangeAccounts for InitializeChecked {
17    type ArrangedAccounts = InitializeCheckedInstructionAccounts;
18
19    fn arrange_accounts(
20        accounts: &[solana_instruction::AccountMeta],
21    ) -> Option<Self::ArrangedAccounts> {
22        let [stake, rent, stake_authority, withdraw_authority, _remaining @ ..] = accounts else {
23            return None;
24        };
25
26        Some(InitializeCheckedInstructionAccounts {
27            stake: stake.pubkey,
28            rent: rent.pubkey,
29            stake_authority: stake_authority.pubkey,
30            withdraw_authority: withdraw_authority.pubkey,
31        })
32    }
33}