carbon_vertigo_decoder/instructions/
mod.rs1use crate::{VertigoDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod buy;
11pub mod claim;
12pub mod cpi_event;
13pub mod create;
14pub mod quote_buy;
15pub mod quote_sell;
16pub mod sell;
17
18pub use self::{buy::*, claim::*, cpi_event::*, create::*, quote_buy::*, quote_sell::*, sell::*};
19
20#[derive(Debug, Clone, PartialEq)]
21#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
22#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
23pub enum VertigoInstruction {
24 Buy {
25 program_id: solana_pubkey::Pubkey,
26 data: Buy,
27 accounts: BuyInstructionAccounts,
28 },
29 Claim {
30 program_id: solana_pubkey::Pubkey,
31 data: Claim,
32 accounts: ClaimInstructionAccounts,
33 },
34 Create {
35 program_id: solana_pubkey::Pubkey,
36 data: Create,
37 accounts: CreateInstructionAccounts,
38 },
39 QuoteBuy {
40 program_id: solana_pubkey::Pubkey,
41 data: QuoteBuy,
42 accounts: QuoteBuyInstructionAccounts,
43 },
44 QuoteSell {
45 program_id: solana_pubkey::Pubkey,
46 data: QuoteSell,
47 accounts: QuoteSellInstructionAccounts,
48 },
49 Sell {
50 program_id: solana_pubkey::Pubkey,
51 data: Sell,
52 accounts: SellInstructionAccounts,
53 },
54 CpiEvent {
55 program_id: solana_pubkey::Pubkey,
56 data: CpiEvent,
57 accounts: CpiEventInstructionAccounts,
58 },
59}
60
61impl carbon_core::instruction::InstructionDecoder<'_> for VertigoDecoder {
62 type InstructionType = VertigoInstruction;
63
64 fn decode_instruction(
65 &self,
66 instruction: &solana_instruction::Instruction,
67 ) -> Option<Self::InstructionType> {
68 if instruction.program_id != PROGRAM_ID {
69 return None;
70 }
71
72 carbon_core::try_decode_instructions!(
73 instruction,
74 PROGRAM_ID,
75 VertigoInstruction::Buy => Buy,
76 VertigoInstruction::Claim => Claim,
77 VertigoInstruction::Create => Create,
78 VertigoInstruction::QuoteBuy => QuoteBuy,
79 VertigoInstruction::QuoteSell => QuoteSell,
80 VertigoInstruction::Sell => Sell,
81 VertigoInstruction::CpiEvent => CpiEvent,
82 )
83 }
84}