Skip to main content

carbon_pumpfun_decoder/instructions/
admin_set_creator.rs

1//! This code was AUTOGENERATED using the Codama library.
2use {
3    carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts},
4    solana_pubkey::Pubkey,
5};
6/// Allows Global::admin_set_creator_authority to override the bonding curve
7/// creator
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
10pub struct AdminSetCreator {
11    pub creator: Pubkey,
12}
13
14#[derive(Debug, Clone, PartialEq)]
15#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
16pub struct AdminSetCreatorInstructionAccounts {
17    pub admin_set_creator_authority: solana_pubkey::Pubkey,
18    pub global: solana_pubkey::Pubkey,
19    pub mint: solana_pubkey::Pubkey,
20    pub bonding_curve: solana_pubkey::Pubkey,
21    pub event_authority: solana_pubkey::Pubkey,
22    pub program: solana_pubkey::Pubkey,
23    pub remaining: Vec<solana_instruction::AccountMeta>,
24}
25
26impl AdminSetCreator {
27    pub fn decode(data: &[u8]) -> Option<Self> {
28        if data.len() < 8 {
29            return None;
30        }
31        let discriminator = &data[0..8];
32        if discriminator != [69, 25, 171, 142, 57, 239, 13, 4] {
33            return None;
34        }
35
36        let mut data_slice = data;
37
38        data_slice = &data_slice[8..];
39
40        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
41    }
42}
43
44impl ArrangeAccounts for AdminSetCreator {
45    type ArrangedAccounts = AdminSetCreatorInstructionAccounts;
46
47    fn arrange_accounts(
48        accounts: &[solana_instruction::AccountMeta],
49    ) -> Option<Self::ArrangedAccounts> {
50        let mut iter = accounts.iter();
51
52        let admin_set_creator_authority = next_account(&mut iter)?;
53        let global = next_account(&mut iter)?;
54        let mint = next_account(&mut iter)?;
55        let bonding_curve = 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(AdminSetCreatorInstructionAccounts {
62            admin_set_creator_authority,
63            global,
64            mint,
65            bonding_curve,
66            event_authority,
67            program,
68            remaining: remaining.to_vec(),
69        })
70    }
71}