Skip to main content

carbon_moonshot_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{MoonshotDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod buy;
11pub mod config_init;
12pub mod config_update;
13pub mod cpi_event;
14pub mod migrate_funds;
15pub mod sell;
16pub mod token_mint;
17
18pub use self::{
19    buy::*, config_init::*, config_update::*, cpi_event::*, migrate_funds::*, sell::*,
20    token_mint::*,
21};
22
23#[derive(Debug, Clone, PartialEq)]
24#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
25#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
26pub enum MoonshotInstruction {
27    Buy {
28        program_id: solana_pubkey::Pubkey,
29        data: Buy,
30        accounts: BuyInstructionAccounts,
31    },
32    ConfigInit {
33        program_id: solana_pubkey::Pubkey,
34        data: ConfigInit,
35        accounts: ConfigInitInstructionAccounts,
36    },
37    ConfigUpdate {
38        program_id: solana_pubkey::Pubkey,
39        data: ConfigUpdate,
40        accounts: ConfigUpdateInstructionAccounts,
41    },
42    MigrateFunds {
43        program_id: solana_pubkey::Pubkey,
44        data: MigrateFunds,
45        accounts: MigrateFundsInstructionAccounts,
46    },
47    Sell {
48        program_id: solana_pubkey::Pubkey,
49        data: Sell,
50        accounts: SellInstructionAccounts,
51    },
52    TokenMint {
53        program_id: solana_pubkey::Pubkey,
54        data: TokenMint,
55        accounts: TokenMintInstructionAccounts,
56    },
57    CpiEvent {
58        program_id: solana_pubkey::Pubkey,
59        data: CpiEvent,
60        accounts: CpiEventInstructionAccounts,
61    },
62}
63
64impl carbon_core::instruction::InstructionDecoder<'_> for MoonshotDecoder {
65    type InstructionType = MoonshotInstruction;
66
67    fn decode_instruction(
68        &self,
69        instruction: &solana_instruction::Instruction,
70    ) -> Option<Self::InstructionType> {
71        if instruction.program_id != PROGRAM_ID {
72            return None;
73        }
74
75        carbon_core::try_decode_instructions!(
76            instruction,
77            PROGRAM_ID,
78            MoonshotInstruction::Buy => Buy,
79            MoonshotInstruction::ConfigInit => ConfigInit,
80            MoonshotInstruction::ConfigUpdate => ConfigUpdate,
81            MoonshotInstruction::MigrateFunds => MigrateFunds,
82            MoonshotInstruction::Sell => Sell,
83            MoonshotInstruction::TokenMint => TokenMint,
84            MoonshotInstruction::CpiEvent => CpiEvent,
85        )
86    }
87}