Skip to main content

carbon_raydium_launchpad_decoder/instructions/
create_platform_config.rs

1//! This code was AUTOGENERATED using the Codama library.
2use {
3    crate::types::PlatformParams,
4    carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts},
5};
6/// Create platform config account
7/// # Arguments
8/// * `ctx` - The context of accounts
9///
10/// # Fields
11/// * `fee_rate` - Fee rate of the platform
12/// * `name` - Name of the platform
13/// * `web` - Website of the platform
14/// * `img` - Image link of the platform
15#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
16#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
17pub struct CreatePlatformConfig {
18    pub platform_params: PlatformParams,
19}
20
21#[derive(Debug, Clone, PartialEq)]
22#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
23pub struct CreatePlatformConfigInstructionAccounts {
24    pub platform_admin: solana_pubkey::Pubkey,
25    pub platform_fee_wallet: solana_pubkey::Pubkey,
26    pub platform_nft_wallet: solana_pubkey::Pubkey,
27    pub platform_config: solana_pubkey::Pubkey,
28    pub cpswap_config: solana_pubkey::Pubkey,
29    pub system_program: solana_pubkey::Pubkey,
30    pub transfer_fee_extension_authority: solana_pubkey::Pubkey,
31    pub platform_vesting_wallet: solana_pubkey::Pubkey,
32    pub remaining: Vec<solana_instruction::AccountMeta>,
33}
34
35impl CreatePlatformConfig {
36    pub fn decode(data: &[u8]) -> Option<Self> {
37        if data.len() < 8 {
38            return None;
39        }
40        let discriminator = &data[0..8];
41        if discriminator != [176, 90, 196, 175, 253, 113, 220, 20] {
42            return None;
43        }
44
45        let mut data_slice = data;
46
47        data_slice = &data_slice[8..];
48
49        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
50    }
51}
52
53impl ArrangeAccounts for CreatePlatformConfig {
54    type ArrangedAccounts = CreatePlatformConfigInstructionAccounts;
55
56    fn arrange_accounts(
57        accounts: &[solana_instruction::AccountMeta],
58    ) -> Option<Self::ArrangedAccounts> {
59        let mut iter = accounts.iter();
60
61        let platform_admin = next_account(&mut iter)?;
62        let platform_fee_wallet = next_account(&mut iter)?;
63        let platform_nft_wallet = next_account(&mut iter)?;
64        let platform_config = next_account(&mut iter)?;
65        let cpswap_config = next_account(&mut iter)?;
66        let system_program = next_account(&mut iter)?;
67        let transfer_fee_extension_authority = next_account(&mut iter)?;
68        let platform_vesting_wallet = next_account(&mut iter)?;
69
70        let remaining = iter.as_slice();
71
72        Some(CreatePlatformConfigInstructionAccounts {
73            platform_admin,
74            platform_fee_wallet,
75            platform_nft_wallet,
76            platform_config,
77            cpswap_config,
78            system_program,
79            transfer_fee_extension_authority,
80            platform_vesting_wallet,
81            remaining: remaining.to_vec(),
82        })
83    }
84}