Skip to main content

carbon_zeta_decoder/instructions/
initialize_market_node.rs

1//! This code was AUTOGENERATED using the Codama library.
2use {
3    crate::types::InitializeMarketNodeArgs,
4    carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts},
5};
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
8pub struct InitializeMarketNode {
9    pub args: InitializeMarketNodeArgs,
10}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct InitializeMarketNodeInstructionAccounts {
15    pub zeta_group: solana_pubkey::Pubkey,
16    pub market_node: solana_pubkey::Pubkey,
17    pub greeks: solana_pubkey::Pubkey,
18    pub payer: solana_pubkey::Pubkey,
19    pub system_program: solana_pubkey::Pubkey,
20    pub remaining: Vec<solana_instruction::AccountMeta>,
21}
22
23impl InitializeMarketNode {
24    pub fn decode(data: &[u8]) -> Option<Self> {
25        if data.len() < 8 {
26            return None;
27        }
28        let discriminator = &data[0..8];
29        if discriminator != [50, 118, 21, 21, 179, 248, 23, 128] {
30            return None;
31        }
32
33        let mut data_slice = data;
34
35        data_slice = &data_slice[8..];
36
37        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
38    }
39}
40
41impl ArrangeAccounts for InitializeMarketNode {
42    type ArrangedAccounts = InitializeMarketNodeInstructionAccounts;
43
44    fn arrange_accounts(
45        accounts: &[solana_instruction::AccountMeta],
46    ) -> Option<Self::ArrangedAccounts> {
47        let mut iter = accounts.iter();
48
49        let zeta_group = next_account(&mut iter)?;
50        let market_node = next_account(&mut iter)?;
51        let greeks = next_account(&mut iter)?;
52        let payer = next_account(&mut iter)?;
53        let system_program = next_account(&mut iter)?;
54
55        let remaining = iter.as_slice();
56
57        Some(InitializeMarketNodeInstructionAccounts {
58            zeta_group,
59            market_node,
60            greeks,
61            payer,
62            system_program,
63            remaining: remaining.to_vec(),
64        })
65    }
66}