carbon-vertigo-decoder 1.0.0

Vertigo DEX Program Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use crate::{VertigoDecoder, PROGRAM_ID};

#[cfg(feature = "postgres")]
pub mod postgres;

#[cfg(feature = "graphql")]
pub mod graphql;

pub mod buy;
pub mod claim;
pub mod cpi_event;
pub mod create;
pub mod quote_buy;
pub mod quote_sell;
pub mod sell;

pub use self::{buy::*, claim::*, cpi_event::*, create::*, quote_buy::*, quote_sell::*, sell::*};

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum VertigoInstruction {
    Buy {
        program_id: solana_pubkey::Pubkey,
        data: Buy,
        accounts: BuyInstructionAccounts,
    },
    Claim {
        program_id: solana_pubkey::Pubkey,
        data: Claim,
        accounts: ClaimInstructionAccounts,
    },
    Create {
        program_id: solana_pubkey::Pubkey,
        data: Create,
        accounts: CreateInstructionAccounts,
    },
    QuoteBuy {
        program_id: solana_pubkey::Pubkey,
        data: QuoteBuy,
        accounts: QuoteBuyInstructionAccounts,
    },
    QuoteSell {
        program_id: solana_pubkey::Pubkey,
        data: QuoteSell,
        accounts: QuoteSellInstructionAccounts,
    },
    Sell {
        program_id: solana_pubkey::Pubkey,
        data: Sell,
        accounts: SellInstructionAccounts,
    },
    CpiEvent {
        program_id: solana_pubkey::Pubkey,
        data: CpiEvent,
        accounts: CpiEventInstructionAccounts,
    },
}

impl carbon_core::instruction::InstructionDecoder<'_> for VertigoDecoder {
    type InstructionType = VertigoInstruction;

    fn decode_instruction(
        &self,
        instruction: &solana_instruction::Instruction,
    ) -> Option<Self::InstructionType> {
        if instruction.program_id != PROGRAM_ID {
            return None;
        }

        carbon_core::try_decode_instructions!(
            instruction,
            PROGRAM_ID,
            VertigoInstruction::Buy => Buy,
            VertigoInstruction::Claim => Claim,
            VertigoInstruction::Create => Create,
            VertigoInstruction::QuoteBuy => QuoteBuy,
            VertigoInstruction::QuoteSell => QuoteSell,
            VertigoInstruction::Sell => Sell,
            VertigoInstruction::CpiEvent => CpiEvent,
        )
    }
}