carbon_pumpfun_decoder/instructions/
create.rs

1use carbon_core::{account_utils::next_account, borsh, CarbonDeserialize};
2
3#[derive(
4    CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5)]
6#[carbon(discriminator = "0x181ec828051c0777")]
7pub struct Create {
8    pub name: String,
9    pub symbol: String,
10    pub uri: String,
11    pub creator: solana_pubkey::Pubkey,
12}
13
14#[derive(Debug, PartialEq, Eq, Clone, Hash, serde::Serialize, serde::Deserialize)]
15pub struct CreateInstructionAccounts {
16    pub mint: solana_pubkey::Pubkey,
17    pub mint_authority: solana_pubkey::Pubkey,
18    pub bonding_curve: solana_pubkey::Pubkey,
19    pub associated_bonding_curve: solana_pubkey::Pubkey,
20    pub global: solana_pubkey::Pubkey,
21    pub mpl_token_metadata: solana_pubkey::Pubkey,
22    pub metadata: solana_pubkey::Pubkey,
23    pub user: solana_pubkey::Pubkey,
24    pub system_program: solana_pubkey::Pubkey,
25    pub token_program: solana_pubkey::Pubkey,
26    pub associated_token_program: solana_pubkey::Pubkey,
27    pub rent: solana_pubkey::Pubkey,
28    pub event_authority: solana_pubkey::Pubkey,
29    pub program: solana_pubkey::Pubkey,
30}
31
32impl carbon_core::deserialize::ArrangeAccounts for Create {
33    type ArrangedAccounts = CreateInstructionAccounts;
34
35    fn arrange_accounts(
36        accounts: &[solana_instruction::AccountMeta],
37    ) -> Option<Self::ArrangedAccounts> {
38        let mut iter = accounts.iter();
39        let mint = next_account(&mut iter)?;
40        let mint_authority = next_account(&mut iter)?;
41        let bonding_curve = next_account(&mut iter)?;
42        let associated_bonding_curve = next_account(&mut iter)?;
43        let global = next_account(&mut iter)?;
44        let mpl_token_metadata = next_account(&mut iter)?;
45        let metadata = next_account(&mut iter)?;
46        let user = next_account(&mut iter)?;
47        let system_program = next_account(&mut iter)?;
48        let token_program = next_account(&mut iter)?;
49        let associated_token_program = next_account(&mut iter)?;
50        let rent = next_account(&mut iter)?;
51        let event_authority = next_account(&mut iter)?;
52        let program = next_account(&mut iter)?;
53
54        Some(CreateInstructionAccounts {
55            mint,
56            mint_authority,
57            bonding_curve,
58            associated_bonding_curve,
59            global,
60            mpl_token_metadata,
61            metadata,
62            user,
63            system_program,
64            token_program,
65            associated_token_program,
66            rent,
67            event_authority,
68            program,
69        })
70    }
71}