carbon_boop_decoder/instructions/
mod.rs

1use crate::PROGRAM_ID;
2
3use super::BoopDecoder;
4pub mod add_operators;
5pub mod authority_transfer_cancelled_event;
6pub mod authority_transfer_completed_event;
7pub mod authority_transfer_initiated_event;
8pub mod bonding_curve_deployed_event;
9pub mod bonding_curve_deployed_fallback_event;
10pub mod bonding_curve_vault_closed_event;
11pub mod buy_token;
12pub mod cancel_authority_transfer;
13pub mod close_bonding_curve_vault;
14pub mod collect_meteora_trading_fees;
15pub mod collect_trading_fees;
16pub mod complete_authority_transfer;
17pub mod config_updated_event;
18pub mod create_meteora_pool;
19pub mod create_raydium_pool;
20pub mod create_raydium_random_pool;
21pub mod create_token;
22pub mod create_token_fallback;
23pub mod deploy_bonding_curve;
24pub mod deploy_bonding_curve_fallback;
25pub mod deposit_into_raydium;
26pub mod graduate;
27pub mod initialize;
28pub mod initiate_authority_transfer;
29pub mod liquidity_deposited_into_raydium_event;
30pub mod lock_raydium_liquidity;
31pub mod operators_added_event;
32pub mod operators_removed_event;
33pub mod paused_toggled_event;
34pub mod raydium_liquidity_locked_event;
35pub mod raydium_pool_created_event;
36pub mod raydium_random_pool_created_event;
37pub mod remove_operators;
38pub mod sell_token;
39pub mod split_trading_fees;
40pub mod swap_sol_for_tokens_on_raydium;
41pub mod swap_sol_for_tokens_on_raydium_event;
42pub mod swap_tokens_for_sol_on_raydium;
43pub mod swap_tokens_for_sol_on_raydium_event;
44pub mod toggle_paused;
45pub mod token_bought_event;
46pub mod token_created_event;
47pub mod token_created_fallback_event;
48pub mod token_graduated_event;
49pub mod token_sold_event;
50pub mod trading_fees_collected_event;
51pub mod trading_fees_split_event;
52pub mod update_config;
53
54#[derive(
55    carbon_core::InstructionType,
56    serde::Serialize,
57    serde::Deserialize,
58    PartialEq,
59    Eq,
60    Debug,
61    Clone,
62    Hash,
63)]
64pub enum BoopInstruction {
65    AddOperators(add_operators::AddOperators),
66    BuyToken(buy_token::BuyToken),
67    CancelAuthorityTransfer(cancel_authority_transfer::CancelAuthorityTransfer),
68    CloseBondingCurveVault(close_bonding_curve_vault::CloseBondingCurveVault),
69    CollectMeteoraTradingFees(collect_meteora_trading_fees::CollectMeteoraTradingFees),
70    CollectTradingFees(collect_trading_fees::CollectTradingFees),
71    CompleteAuthorityTransfer(complete_authority_transfer::CompleteAuthorityTransfer),
72    CreateMeteoraPool(create_meteora_pool::CreateMeteoraPool),
73    CreateRaydiumPool(create_raydium_pool::CreateRaydiumPool),
74    CreateRaydiumRandomPool(create_raydium_random_pool::CreateRaydiumRandomPool),
75    CreateToken(create_token::CreateToken),
76    CreateTokenFallback(create_token_fallback::CreateTokenFallback),
77    DeployBondingCurve(deploy_bonding_curve::DeployBondingCurve),
78    DeployBondingCurveFallback(deploy_bonding_curve_fallback::DeployBondingCurveFallback),
79    DepositIntoRaydium(deposit_into_raydium::DepositIntoRaydium),
80    Graduate(graduate::Graduate),
81    Initialize(initialize::Initialize),
82    InitiateAuthorityTransfer(initiate_authority_transfer::InitiateAuthorityTransfer),
83    LockRaydiumLiquidity(lock_raydium_liquidity::LockRaydiumLiquidity),
84    RemoveOperators(remove_operators::RemoveOperators),
85    SellToken(sell_token::SellToken),
86    SplitTradingFees(split_trading_fees::SplitTradingFees),
87    SwapSolForTokensOnRaydium(swap_sol_for_tokens_on_raydium::SwapSolForTokensOnRaydium),
88    SwapTokensForSolOnRaydium(swap_tokens_for_sol_on_raydium::SwapTokensForSolOnRaydium),
89    TogglePaused(toggle_paused::TogglePaused),
90    UpdateConfig(update_config::UpdateConfig),
91    AuthorityTransferCancelledEvent(
92        authority_transfer_cancelled_event::AuthorityTransferCancelledEvent,
93    ),
94    AuthorityTransferCompletedEvent(
95        authority_transfer_completed_event::AuthorityTransferCompletedEvent,
96    ),
97    AuthorityTransferInitiatedEvent(
98        authority_transfer_initiated_event::AuthorityTransferInitiatedEvent,
99    ),
100    BondingCurveDeployedEvent(bonding_curve_deployed_event::BondingCurveDeployedEvent),
101    BondingCurveDeployedFallbackEvent(
102        bonding_curve_deployed_fallback_event::BondingCurveDeployedFallbackEvent,
103    ),
104    BondingCurveVaultClosedEvent(bonding_curve_vault_closed_event::BondingCurveVaultClosedEvent),
105    ConfigUpdatedEvent(config_updated_event::ConfigUpdatedEvent),
106    LiquidityDepositedIntoRaydiumEvent(
107        liquidity_deposited_into_raydium_event::LiquidityDepositedIntoRaydiumEvent,
108    ),
109    OperatorsAddedEvent(operators_added_event::OperatorsAddedEvent),
110    OperatorsRemovedEvent(operators_removed_event::OperatorsRemovedEvent),
111    PausedToggledEvent(paused_toggled_event::PausedToggledEvent),
112    RaydiumLiquidityLockedEvent(raydium_liquidity_locked_event::RaydiumLiquidityLockedEvent),
113    RaydiumPoolCreatedEvent(raydium_pool_created_event::RaydiumPoolCreatedEvent),
114    RaydiumRandomPoolCreatedEvent(raydium_random_pool_created_event::RaydiumRandomPoolCreatedEvent),
115    SwapSolForTokensOnRaydiumEvent(
116        swap_sol_for_tokens_on_raydium_event::SwapSolForTokensOnRaydiumEvent,
117    ),
118    SwapTokensForSolOnRaydiumEvent(
119        swap_tokens_for_sol_on_raydium_event::SwapTokensForSolOnRaydiumEvent,
120    ),
121    TokenBoughtEvent(token_bought_event::TokenBoughtEvent),
122    TokenCreatedEvent(token_created_event::TokenCreatedEvent),
123    TokenCreatedFallbackEvent(token_created_fallback_event::TokenCreatedFallbackEvent),
124    TokenGraduatedEvent(token_graduated_event::TokenGraduatedEvent),
125    TokenSoldEvent(token_sold_event::TokenSoldEvent),
126    TradingFeesCollectedEvent(trading_fees_collected_event::TradingFeesCollectedEvent),
127    TradingFeesSplitEvent(trading_fees_split_event::TradingFeesSplitEvent),
128}
129
130impl carbon_core::instruction::InstructionDecoder<'_> for BoopDecoder {
131    type InstructionType = BoopInstruction;
132
133    fn decode_instruction(
134        &self,
135        instruction: &solana_instruction::Instruction,
136    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
137        if !instruction.program_id.eq(&PROGRAM_ID) {
138            return None;
139        }
140
141        carbon_core::try_decode_instructions!(instruction,
142            BoopInstruction::AddOperators => add_operators::AddOperators,
143            BoopInstruction::BuyToken => buy_token::BuyToken,
144            BoopInstruction::CancelAuthorityTransfer => cancel_authority_transfer::CancelAuthorityTransfer,
145            BoopInstruction::CloseBondingCurveVault => close_bonding_curve_vault::CloseBondingCurveVault,
146            BoopInstruction::CollectMeteoraTradingFees => collect_meteora_trading_fees::CollectMeteoraTradingFees,
147            BoopInstruction::CollectTradingFees => collect_trading_fees::CollectTradingFees,
148            BoopInstruction::CompleteAuthorityTransfer => complete_authority_transfer::CompleteAuthorityTransfer,
149            BoopInstruction::CreateMeteoraPool => create_meteora_pool::CreateMeteoraPool,
150            BoopInstruction::CreateRaydiumPool => create_raydium_pool::CreateRaydiumPool,
151            BoopInstruction::CreateRaydiumRandomPool => create_raydium_random_pool::CreateRaydiumRandomPool,
152            BoopInstruction::CreateToken => create_token::CreateToken,
153            BoopInstruction::CreateTokenFallback => create_token_fallback::CreateTokenFallback,
154            BoopInstruction::DeployBondingCurve => deploy_bonding_curve::DeployBondingCurve,
155            BoopInstruction::DeployBondingCurveFallback => deploy_bonding_curve_fallback::DeployBondingCurveFallback,
156            BoopInstruction::DepositIntoRaydium => deposit_into_raydium::DepositIntoRaydium,
157            BoopInstruction::Graduate => graduate::Graduate,
158            BoopInstruction::Initialize => initialize::Initialize,
159            BoopInstruction::InitiateAuthorityTransfer => initiate_authority_transfer::InitiateAuthorityTransfer,
160            BoopInstruction::LockRaydiumLiquidity => lock_raydium_liquidity::LockRaydiumLiquidity,
161            BoopInstruction::RemoveOperators => remove_operators::RemoveOperators,
162            BoopInstruction::SellToken => sell_token::SellToken,
163            BoopInstruction::SplitTradingFees => split_trading_fees::SplitTradingFees,
164            BoopInstruction::SwapSolForTokensOnRaydium => swap_sol_for_tokens_on_raydium::SwapSolForTokensOnRaydium,
165            BoopInstruction::SwapTokensForSolOnRaydium => swap_tokens_for_sol_on_raydium::SwapTokensForSolOnRaydium,
166            BoopInstruction::TogglePaused => toggle_paused::TogglePaused,
167            BoopInstruction::UpdateConfig => update_config::UpdateConfig,
168            BoopInstruction::AuthorityTransferCancelledEvent => authority_transfer_cancelled_event::AuthorityTransferCancelledEvent,
169            BoopInstruction::AuthorityTransferCompletedEvent => authority_transfer_completed_event::AuthorityTransferCompletedEvent,
170            BoopInstruction::AuthorityTransferInitiatedEvent => authority_transfer_initiated_event::AuthorityTransferInitiatedEvent,
171            BoopInstruction::BondingCurveDeployedEvent => bonding_curve_deployed_event::BondingCurveDeployedEvent,
172            BoopInstruction::BondingCurveDeployedFallbackEvent => bonding_curve_deployed_fallback_event::BondingCurveDeployedFallbackEvent,
173            BoopInstruction::BondingCurveVaultClosedEvent => bonding_curve_vault_closed_event::BondingCurveVaultClosedEvent,
174            BoopInstruction::ConfigUpdatedEvent => config_updated_event::ConfigUpdatedEvent,
175            BoopInstruction::LiquidityDepositedIntoRaydiumEvent => liquidity_deposited_into_raydium_event::LiquidityDepositedIntoRaydiumEvent,
176            BoopInstruction::OperatorsAddedEvent => operators_added_event::OperatorsAddedEvent,
177            BoopInstruction::OperatorsRemovedEvent => operators_removed_event::OperatorsRemovedEvent,
178            BoopInstruction::PausedToggledEvent => paused_toggled_event::PausedToggledEvent,
179            BoopInstruction::RaydiumLiquidityLockedEvent => raydium_liquidity_locked_event::RaydiumLiquidityLockedEvent,
180            BoopInstruction::RaydiumPoolCreatedEvent => raydium_pool_created_event::RaydiumPoolCreatedEvent,
181            BoopInstruction::RaydiumRandomPoolCreatedEvent => raydium_random_pool_created_event::RaydiumRandomPoolCreatedEvent,
182            BoopInstruction::SwapSolForTokensOnRaydiumEvent => swap_sol_for_tokens_on_raydium_event::SwapSolForTokensOnRaydiumEvent,
183            BoopInstruction::SwapTokensForSolOnRaydiumEvent => swap_tokens_for_sol_on_raydium_event::SwapTokensForSolOnRaydiumEvent,
184            BoopInstruction::TokenBoughtEvent => token_bought_event::TokenBoughtEvent,
185            BoopInstruction::TokenCreatedEvent => token_created_event::TokenCreatedEvent,
186            BoopInstruction::TokenCreatedFallbackEvent => token_created_fallback_event::TokenCreatedFallbackEvent,
187            BoopInstruction::TokenGraduatedEvent => token_graduated_event::TokenGraduatedEvent,
188            BoopInstruction::TokenSoldEvent => token_sold_event::TokenSoldEvent,
189            BoopInstruction::TradingFeesCollectedEvent => trading_fees_collected_event::TradingFeesCollectedEvent,
190            BoopInstruction::TradingFeesSplitEvent => trading_fees_split_event::TradingFeesSplitEvent,
191        )
192    }
193}