carbon_score_decoder/instructions/
process_partial_deposit.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::CarbonDeserialize;
3use carbon_core::account_utils::next_account;
4use carbon_core::borsh;
5use carbon_core::deserialize::ArrangeAccounts;
6use carbon_core::deserialize::CarbonDeserialize;
7
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[derive(Debug, Clone, borsh::BorshSerialize, CarbonDeserialize, PartialEq, Eq, Hash)]
10pub struct ProcessPartialDeposit {
11    pub staking_bump: u8,
12    pub scorevars_ship_bump: u8,
13    pub escrow_auth_bump: u8,
14    pub escrow_bump: u8,
15    pub ship_quantity: u64,
16}
17
18#[derive(Debug, Clone, PartialEq)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20pub struct ProcessPartialDepositInstructionAccounts {
21    pub player_account: solana_pubkey::Pubkey,
22    pub ship_staking_account: solana_pubkey::Pubkey,
23    pub score_vars_ship_account: solana_pubkey::Pubkey,
24    pub escrow_authority: solana_pubkey::Pubkey,
25    pub system_program: solana_pubkey::Pubkey,
26    pub token_program: solana_pubkey::Pubkey,
27    pub clock: solana_pubkey::Pubkey,
28    pub ship_mint: solana_pubkey::Pubkey,
29    pub ship_token_account_source: solana_pubkey::Pubkey,
30    pub ship_token_account_escrow: solana_pubkey::Pubkey,
31    pub remaining: Vec<solana_instruction::AccountMeta>,
32}
33
34impl ProcessPartialDeposit {
35    pub fn decode(data: &[u8]) -> Option<Self> {
36        if data.len() < 8 {
37            return None;
38        }
39        let discriminator = &data[0..8];
40        if discriminator != &[52, 195, 156, 20, 83, 73, 30, 21] {
41            return None;
42        }
43
44        let data_slice = data;
45
46        let data_slice = &data_slice[8..];
47
48        Self::deserialize(data_slice)
49    }
50}
51
52impl ArrangeAccounts for ProcessPartialDeposit {
53    type ArrangedAccounts = ProcessPartialDepositInstructionAccounts;
54
55    fn arrange_accounts(
56        accounts: &[solana_instruction::AccountMeta],
57    ) -> Option<Self::ArrangedAccounts> {
58        let mut iter = accounts.iter();
59
60        let player_account = next_account(&mut iter)?;
61        let ship_staking_account = next_account(&mut iter)?;
62        let score_vars_ship_account = next_account(&mut iter)?;
63        let escrow_authority = next_account(&mut iter)?;
64        let system_program = next_account(&mut iter)?;
65        let token_program = next_account(&mut iter)?;
66        let clock = next_account(&mut iter)?;
67        let ship_mint = next_account(&mut iter)?;
68        let ship_token_account_source = next_account(&mut iter)?;
69        let ship_token_account_escrow = next_account(&mut iter)?;
70
71        let remaining = iter.as_slice();
72
73        Some(ProcessPartialDepositInstructionAccounts {
74            player_account,
75            ship_staking_account,
76            score_vars_ship_account,
77            escrow_authority,
78            system_program,
79            token_program,
80            clock,
81            ship_mint,
82            ship_token_account_source,
83            ship_token_account_escrow,
84            remaining: remaining.to_vec(),
85        })
86    }
87}