1use crate::{RaydiumLaunchpadDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod buy_exact_in;
11pub mod buy_exact_out;
12pub mod claim_creator_fee;
13pub mod claim_platform_fee;
14pub mod claim_platform_fee_from_vault;
15pub mod claim_vested_token;
16pub mod close_platform_global_access;
17pub mod collect_fee;
18pub mod collect_migrate_fee;
19pub mod cpi_event;
20pub mod create_config;
21pub mod create_platform_config;
22pub mod create_platform_global_access;
23pub mod create_platform_vesting_account;
24pub mod create_vesting_account;
25pub mod initialize;
26pub mod initialize_v2;
27pub mod initialize_with_token2022;
28pub mod migrate_to_amm;
29pub mod migrate_to_cpswap;
30pub mod remove_platform_curve_param;
31pub mod sell_exact_in;
32pub mod sell_exact_out;
33pub mod update_config;
34pub mod update_platform_config;
35pub mod update_platform_curve_param;
36
37pub use self::{
38 buy_exact_in::*, buy_exact_out::*, claim_creator_fee::*, claim_platform_fee::*,
39 claim_platform_fee_from_vault::*, claim_vested_token::*, close_platform_global_access::*,
40 collect_fee::*, collect_migrate_fee::*, cpi_event::*, create_config::*,
41 create_platform_config::*, create_platform_global_access::*,
42 create_platform_vesting_account::*, create_vesting_account::*, initialize::*, initialize_v2::*,
43 initialize_with_token2022::*, migrate_to_amm::*, migrate_to_cpswap::*,
44 remove_platform_curve_param::*, sell_exact_in::*, sell_exact_out::*, update_config::*,
45 update_platform_config::*, update_platform_curve_param::*,
46};
47
48#[derive(Debug, Clone, PartialEq)]
49#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
50#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
51pub enum RaydiumLaunchpadInstruction {
52 BuyExactIn {
53 program_id: solana_pubkey::Pubkey,
54 data: BuyExactIn,
55 accounts: BuyExactInInstructionAccounts,
56 },
57 BuyExactOut {
58 program_id: solana_pubkey::Pubkey,
59 data: BuyExactOut,
60 accounts: BuyExactOutInstructionAccounts,
61 },
62 ClaimCreatorFee {
63 program_id: solana_pubkey::Pubkey,
64 data: ClaimCreatorFee,
65 accounts: ClaimCreatorFeeInstructionAccounts,
66 },
67 ClaimPlatformFee {
68 program_id: solana_pubkey::Pubkey,
69 data: ClaimPlatformFee,
70 accounts: ClaimPlatformFeeInstructionAccounts,
71 },
72 ClaimPlatformFeeFromVault {
73 program_id: solana_pubkey::Pubkey,
74 data: ClaimPlatformFeeFromVault,
75 accounts: ClaimPlatformFeeFromVaultInstructionAccounts,
76 },
77 ClaimVestedToken {
78 program_id: solana_pubkey::Pubkey,
79 data: ClaimVestedToken,
80 accounts: ClaimVestedTokenInstructionAccounts,
81 },
82 ClosePlatformGlobalAccess {
83 program_id: solana_pubkey::Pubkey,
84 data: ClosePlatformGlobalAccess,
85 accounts: ClosePlatformGlobalAccessInstructionAccounts,
86 },
87 CollectFee {
88 program_id: solana_pubkey::Pubkey,
89 data: CollectFee,
90 accounts: CollectFeeInstructionAccounts,
91 },
92 CollectMigrateFee {
93 program_id: solana_pubkey::Pubkey,
94 data: CollectMigrateFee,
95 accounts: CollectMigrateFeeInstructionAccounts,
96 },
97 CreateConfig {
98 program_id: solana_pubkey::Pubkey,
99 data: CreateConfig,
100 accounts: CreateConfigInstructionAccounts,
101 },
102 CreatePlatformConfig {
103 program_id: solana_pubkey::Pubkey,
104 data: CreatePlatformConfig,
105 accounts: CreatePlatformConfigInstructionAccounts,
106 },
107 CreatePlatformGlobalAccess {
108 program_id: solana_pubkey::Pubkey,
109 data: CreatePlatformGlobalAccess,
110 accounts: CreatePlatformGlobalAccessInstructionAccounts,
111 },
112 CreatePlatformVestingAccount {
113 program_id: solana_pubkey::Pubkey,
114 data: CreatePlatformVestingAccount,
115 accounts: CreatePlatformVestingAccountInstructionAccounts,
116 },
117 CreateVestingAccount {
118 program_id: solana_pubkey::Pubkey,
119 data: CreateVestingAccount,
120 accounts: CreateVestingAccountInstructionAccounts,
121 },
122 Initialize {
123 program_id: solana_pubkey::Pubkey,
124 data: Initialize,
125 accounts: InitializeInstructionAccounts,
126 },
127 InitializeV2 {
128 program_id: solana_pubkey::Pubkey,
129 data: InitializeV2,
130 accounts: InitializeV2InstructionAccounts,
131 },
132 InitializeWithToken2022 {
133 program_id: solana_pubkey::Pubkey,
134 data: InitializeWithToken2022,
135 accounts: InitializeWithToken2022InstructionAccounts,
136 },
137 MigrateToAmm {
138 program_id: solana_pubkey::Pubkey,
139 data: MigrateToAmm,
140 accounts: MigrateToAmmInstructionAccounts,
141 },
142 MigrateToCpswap {
143 program_id: solana_pubkey::Pubkey,
144 data: MigrateToCpswap,
145 accounts: MigrateToCpswapInstructionAccounts,
146 },
147 RemovePlatformCurveParam {
148 program_id: solana_pubkey::Pubkey,
149 data: RemovePlatformCurveParam,
150 accounts: RemovePlatformCurveParamInstructionAccounts,
151 },
152 SellExactIn {
153 program_id: solana_pubkey::Pubkey,
154 data: SellExactIn,
155 accounts: SellExactInInstructionAccounts,
156 },
157 SellExactOut {
158 program_id: solana_pubkey::Pubkey,
159 data: SellExactOut,
160 accounts: SellExactOutInstructionAccounts,
161 },
162 UpdateConfig {
163 program_id: solana_pubkey::Pubkey,
164 data: UpdateConfig,
165 accounts: UpdateConfigInstructionAccounts,
166 },
167 UpdatePlatformConfig {
168 program_id: solana_pubkey::Pubkey,
169 data: UpdatePlatformConfig,
170 accounts: UpdatePlatformConfigInstructionAccounts,
171 },
172 UpdatePlatformCurveParam {
173 program_id: solana_pubkey::Pubkey,
174 data: UpdatePlatformCurveParam,
175 accounts: UpdatePlatformCurveParamInstructionAccounts,
176 },
177 CpiEvent {
178 program_id: solana_pubkey::Pubkey,
179 data: CpiEvent,
180 accounts: CpiEventInstructionAccounts,
181 },
182}
183
184impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumLaunchpadDecoder {
185 type InstructionType = RaydiumLaunchpadInstruction;
186
187 fn decode_instruction(
188 &self,
189 instruction: &solana_instruction::Instruction,
190 ) -> Option<Self::InstructionType> {
191 if instruction.program_id != PROGRAM_ID {
192 return None;
193 }
194
195 carbon_core::try_decode_instructions!(
196 instruction,
197 PROGRAM_ID,
198 RaydiumLaunchpadInstruction::BuyExactIn => BuyExactIn,
199 RaydiumLaunchpadInstruction::BuyExactOut => BuyExactOut,
200 RaydiumLaunchpadInstruction::ClaimCreatorFee => ClaimCreatorFee,
201 RaydiumLaunchpadInstruction::ClaimPlatformFee => ClaimPlatformFee,
202 RaydiumLaunchpadInstruction::ClaimPlatformFeeFromVault => ClaimPlatformFeeFromVault,
203 RaydiumLaunchpadInstruction::ClaimVestedToken => ClaimVestedToken,
204 RaydiumLaunchpadInstruction::ClosePlatformGlobalAccess => ClosePlatformGlobalAccess,
205 RaydiumLaunchpadInstruction::CollectFee => CollectFee,
206 RaydiumLaunchpadInstruction::CollectMigrateFee => CollectMigrateFee,
207 RaydiumLaunchpadInstruction::CreateConfig => CreateConfig,
208 RaydiumLaunchpadInstruction::CreatePlatformConfig => CreatePlatformConfig,
209 RaydiumLaunchpadInstruction::CreatePlatformGlobalAccess => CreatePlatformGlobalAccess,
210 RaydiumLaunchpadInstruction::CreatePlatformVestingAccount => CreatePlatformVestingAccount,
211 RaydiumLaunchpadInstruction::CreateVestingAccount => CreateVestingAccount,
212 RaydiumLaunchpadInstruction::Initialize => Initialize,
213 RaydiumLaunchpadInstruction::InitializeV2 => InitializeV2,
214 RaydiumLaunchpadInstruction::InitializeWithToken2022 => InitializeWithToken2022,
215 RaydiumLaunchpadInstruction::MigrateToAmm => MigrateToAmm,
216 RaydiumLaunchpadInstruction::MigrateToCpswap => MigrateToCpswap,
217 RaydiumLaunchpadInstruction::RemovePlatformCurveParam => RemovePlatformCurveParam,
218 RaydiumLaunchpadInstruction::SellExactIn => SellExactIn,
219 RaydiumLaunchpadInstruction::SellExactOut => SellExactOut,
220 RaydiumLaunchpadInstruction::UpdateConfig => UpdateConfig,
221 RaydiumLaunchpadInstruction::UpdatePlatformConfig => UpdatePlatformConfig,
222 RaydiumLaunchpadInstruction::UpdatePlatformCurveParam => UpdatePlatformCurveParam,
223 RaydiumLaunchpadInstruction::CpiEvent => CpiEvent,
224 )
225 }
226}