carbon_pumpfun_decoder/instructions/
mod.rs

1use super::PumpfunDecoder;
2pub mod buy;
3pub mod complete_event;
4pub mod create;
5pub mod create_event;
6pub mod initialize;
7pub mod sell;
8pub mod set_params;
9pub mod set_params_event;
10pub mod trade_event;
11pub mod withdraw;
12
13#[derive(
14    carbon_core::InstructionType,
15    serde::Serialize,
16    serde::Deserialize,
17    PartialEq,
18    Eq,
19    Debug,
20    Clone,
21    Hash,
22)]
23pub enum PumpfunInstruction {
24    Initialize(initialize::Initialize),
25    SetParams(set_params::SetParams),
26    Create(create::Create),
27    Buy(buy::Buy),
28    Sell(sell::Sell),
29    Withdraw(withdraw::Withdraw),
30    CreateEvent(create_event::CreateEvent),
31    TradeEvent(trade_event::TradeEvent),
32    CompleteEvent(complete_event::CompleteEvent),
33    SetParamsEvent(set_params_event::SetParamsEvent),
34}
35
36impl carbon_core::instruction::InstructionDecoder<'_> for PumpfunDecoder {
37    type InstructionType = PumpfunInstruction;
38
39    fn decode_instruction(
40        &self,
41        instruction: &solana_sdk::instruction::Instruction,
42    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
43        carbon_core::try_decode_instructions!(instruction,
44            PumpfunInstruction::Initialize => initialize::Initialize,
45            PumpfunInstruction::SetParams => set_params::SetParams,
46            PumpfunInstruction::Create => create::Create,
47            PumpfunInstruction::Buy => buy::Buy,
48            PumpfunInstruction::Sell => sell::Sell,
49            PumpfunInstruction::Withdraw => withdraw::Withdraw,
50            PumpfunInstruction::CreateEvent => create_event::CreateEvent,
51            PumpfunInstruction::TradeEvent => trade_event::TradeEvent,
52            PumpfunInstruction::CompleteEvent => complete_event::CompleteEvent,
53            PumpfunInstruction::SetParamsEvent => set_params_event::SetParamsEvent,
54        )
55    }
56}