carbon_vertigo_decoder/instructions/
mod.rs

1use super::VertigoDecoder;
2pub mod buy;
3pub mod buy_event;
4pub mod claim;
5pub mod create;
6pub mod pool_created_event;
7pub mod quote_buy;
8pub mod quote_sell;
9pub mod sell;
10pub mod sell_event;
11
12#[derive(
13    carbon_core::InstructionType, serde::Serialize, serde::Deserialize, PartialEq, Debug, Clone,
14)]
15pub enum VertigoInstruction {
16    Buy(buy::Buy),
17    Claim(claim::Claim),
18    Create(create::Create),
19    QuoteBuy(quote_buy::QuoteBuy),
20    QuoteSell(quote_sell::QuoteSell),
21    Sell(sell::Sell),
22    BuyEvent(buy_event::BuyEvent),
23    PoolCreatedEvent(pool_created_event::PoolCreatedEvent),
24    SellEvent(sell_event::SellEvent),
25}
26
27impl carbon_core::instruction::InstructionDecoder<'_> for VertigoDecoder {
28    type InstructionType = VertigoInstruction;
29
30    fn decode_instruction(
31        &self,
32        instruction: &solana_instruction::Instruction,
33    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
34        carbon_core::try_decode_instructions!(instruction,
35            VertigoInstruction::Buy => buy::Buy,
36            VertigoInstruction::Claim => claim::Claim,
37            VertigoInstruction::Create => create::Create,
38            VertigoInstruction::QuoteBuy => quote_buy::QuoteBuy,
39            VertigoInstruction::QuoteSell => quote_sell::QuoteSell,
40            VertigoInstruction::Sell => sell::Sell,
41            VertigoInstruction::BuyEvent => buy_event::BuyEvent,
42            VertigoInstruction::PoolCreatedEvent => pool_created_event::PoolCreatedEvent,
43            VertigoInstruction::SellEvent => sell_event::SellEvent,
44        )
45    }
46}