Skip to main content

carbon_pumpfun_decoder/instructions/
add_quote_mint.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#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
8pub struct AddQuoteMint {
9    pub quote_mint: Pubkey,
10}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct AddQuoteMintInstructionAccounts {
15    pub global: solana_pubkey::Pubkey,
16    pub authority: solana_pubkey::Pubkey,
17    pub event_authority: solana_pubkey::Pubkey,
18    pub program: solana_pubkey::Pubkey,
19    pub remaining: Vec<solana_instruction::AccountMeta>,
20}
21
22impl AddQuoteMint {
23    pub fn decode(data: &[u8]) -> Option<Self> {
24        if data.len() < 8 {
25            return None;
26        }
27        let discriminator = &data[0..8];
28        if discriminator != [111, 121, 21, 56, 40, 24, 94, 209] {
29            return None;
30        }
31
32        let mut data_slice = data;
33
34        data_slice = &data_slice[8..];
35
36        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
37    }
38}
39
40impl ArrangeAccounts for AddQuoteMint {
41    type ArrangedAccounts = AddQuoteMintInstructionAccounts;
42
43    fn arrange_accounts(
44        accounts: &[solana_instruction::AccountMeta],
45    ) -> Option<Self::ArrangedAccounts> {
46        let mut iter = accounts.iter();
47
48        let global = next_account(&mut iter)?;
49        let authority = next_account(&mut iter)?;
50        let event_authority = next_account(&mut iter)?;
51        let program = next_account(&mut iter)?;
52
53        let remaining = iter.as_slice();
54
55        Some(AddQuoteMintInstructionAccounts {
56            global,
57            authority,
58            event_authority,
59            program,
60            remaining: remaining.to_vec(),
61        })
62    }
63}