Skip to main content

carbon_meteora_dbc_decoder/instructions/
create_virtual_pool_metadata.rs

1//! This code was AUTOGENERATED using the Codama library.
2use {
3    crate::types::CreateVirtualPoolMetadataParameters,
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 CreateVirtualPoolMetadata {
9    pub metadata: CreateVirtualPoolMetadataParameters,
10}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct CreateVirtualPoolMetadataInstructionAccounts {
15    pub virtual_pool: solana_pubkey::Pubkey,
16    pub virtual_pool_metadata: solana_pubkey::Pubkey,
17    pub creator: solana_pubkey::Pubkey,
18    pub payer: solana_pubkey::Pubkey,
19    pub system_program: solana_pubkey::Pubkey,
20    pub event_authority: solana_pubkey::Pubkey,
21    pub program: solana_pubkey::Pubkey,
22    pub remaining: Vec<solana_instruction::AccountMeta>,
23}
24
25impl CreateVirtualPoolMetadata {
26    pub fn decode(data: &[u8]) -> Option<Self> {
27        if data.len() < 8 {
28            return None;
29        }
30        let discriminator = &data[0..8];
31        if discriminator != [45, 97, 187, 103, 254, 109, 124, 134] {
32            return None;
33        }
34
35        let mut data_slice = data;
36
37        data_slice = &data_slice[8..];
38
39        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
40    }
41}
42
43impl ArrangeAccounts for CreateVirtualPoolMetadata {
44    type ArrangedAccounts = CreateVirtualPoolMetadataInstructionAccounts;
45
46    fn arrange_accounts(
47        accounts: &[solana_instruction::AccountMeta],
48    ) -> Option<Self::ArrangedAccounts> {
49        let mut iter = accounts.iter();
50
51        let virtual_pool = next_account(&mut iter)?;
52        let virtual_pool_metadata = next_account(&mut iter)?;
53        let creator = next_account(&mut iter)?;
54        let payer = next_account(&mut iter)?;
55        let system_program = next_account(&mut iter)?;
56        let event_authority = next_account(&mut iter)?;
57        let program = next_account(&mut iter)?;
58
59        let remaining = iter.as_slice();
60
61        Some(CreateVirtualPoolMetadataInstructionAccounts {
62            virtual_pool,
63            virtual_pool_metadata,
64            creator,
65            payer,
66            system_program,
67            event_authority,
68            program,
69            remaining: remaining.to_vec(),
70        })
71    }
72}