1use carbon_core::deserialize::CarbonDeserialize;
2use solana_instruction::Instruction;
3
4use crate::PROGRAM_ID;
5
6use super::PumpfunDecoder;
7
8pub mod admin_set_creator;
9pub mod admin_set_creator_event;
10pub mod admin_set_idl_authority;
11pub mod admin_set_idl_authority_event;
12pub mod admin_update_token_incentives;
13pub mod admin_update_token_incentives_event;
14pub mod buy;
15pub mod buy_exact_sol_in;
16pub mod claim_token_incentives;
17pub mod claim_token_incentives_event;
18pub mod close_user_volume_accumulator;
19pub mod close_user_volume_accumulator_event;
20pub mod collect_creator_fee;
21pub mod collect_creator_fee_event;
22pub mod complete_event;
23pub mod complete_pump_amm_migration_event;
24pub mod create;
25pub mod create_event;
26pub mod create_v2;
27pub mod extend_account;
28pub mod extend_account_event;
29pub mod init_user_volume_accumulator;
30pub mod init_user_volume_accumulator_event;
31pub mod initialize;
32pub mod migrate;
33pub mod sell;
34pub mod set_creator;
35pub mod set_creator_event;
36pub mod set_metaplex_creator;
37pub mod set_metaplex_creator_event;
38pub mod set_params;
39pub mod set_params_event;
40pub mod sync_user_volume_accumulator;
41pub mod sync_user_volume_accumulator_event;
42pub mod trade_event;
43pub mod update_global_authority;
44pub mod update_global_authority_event;
45
46#[derive(
47 carbon_core::InstructionType,
48 serde::Serialize,
49 serde::Deserialize,
50 PartialEq,
51 Eq,
52 Debug,
53 Clone,
54 Hash,
55)]
56pub enum PumpfunInstruction {
57 AdminSetCreator(admin_set_creator::AdminSetCreator),
58 AdminSetIdlAuthority(admin_set_idl_authority::AdminSetIdlAuthority),
59 AdminUpdateTokenIncentives(admin_update_token_incentives::AdminUpdateTokenIncentives),
60 Buy(buy::Buy),
61 ClaimTokenIncentives(claim_token_incentives::ClaimTokenIncentives),
62 CloseUserVolumeAccumulator(close_user_volume_accumulator::CloseUserVolumeAccumulator),
63 CollectCreatorFee(collect_creator_fee::CollectCreatorFee),
64 Create(create::Create),
65 CreateV2(create_v2::CreateV2),
66 ExtendAccount(extend_account::ExtendAccount),
67 InitUserVolumeAccumulator(init_user_volume_accumulator::InitUserVolumeAccumulator),
68 Initialize(initialize::Initialize),
69 Migrate(migrate::Migrate),
70 Sell(sell::Sell),
71 SetCreator(set_creator::SetCreator),
72 SetMetaplexCreator(set_metaplex_creator::SetMetaplexCreator),
73 SetParams(set_params::SetParams),
74 SyncUserVolumeAccumulator(sync_user_volume_accumulator::SyncUserVolumeAccumulator),
75 UpdateGlobalAuthority(update_global_authority::UpdateGlobalAuthority),
76 AdminSetCreatorEvent(admin_set_creator_event::AdminSetCreatorEvent),
77 AdminSetIdlAuthorityEvent(admin_set_idl_authority_event::AdminSetIdlAuthorityEvent),
78 AdminUpdateTokenIncentivesEvent(
79 admin_update_token_incentives_event::AdminUpdateTokenIncentivesEvent,
80 ),
81 ClaimTokenIncentivesEvent(claim_token_incentives_event::ClaimTokenIncentivesEvent),
82 CloseUserVolumeAccumulatorEvent(
83 close_user_volume_accumulator_event::CloseUserVolumeAccumulatorEvent,
84 ),
85 CollectCreatorFeeEvent(collect_creator_fee_event::CollectCreatorFeeEvent),
86 CompleteEvent(complete_event::CompleteEvent),
87 CompletePumpAmmMigrationEvent(complete_pump_amm_migration_event::CompletePumpAmmMigrationEvent),
88 CreateEvent(create_event::CreateEvent),
89 ExtendAccountEvent(extend_account_event::ExtendAccountEvent),
90 InitUserVolumeAccumulatorEvent(
91 init_user_volume_accumulator_event::InitUserVolumeAccumulatorEvent,
92 ),
93 SetCreatorEvent(set_creator_event::SetCreatorEvent),
94 SetMetaplexCreatorEvent(set_metaplex_creator_event::SetMetaplexCreatorEvent),
95 SetParamsEvent(set_params_event::SetParamsEvent),
96 SyncUserVolumeAccumulatorEvent(
97 sync_user_volume_accumulator_event::SyncUserVolumeAccumulatorEvent,
98 ),
99 TradeEvent(trade_event::TradeEvent),
100 UpdateGlobalAuthorityEvent(update_global_authority_event::UpdateGlobalAuthorityEvent),
101}
102
103impl carbon_core::instruction::InstructionDecoder<'_> for PumpfunDecoder {
104 type InstructionType = PumpfunInstruction;
105
106 fn decode_instruction(
107 &self,
108 instruction: &solana_instruction::Instruction,
109 ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
110 if !instruction.program_id.eq(&PROGRAM_ID) {
111 return None;
112 }
113 let instruction = if !instruction.data.is_empty()
114 && instruction.data[..8] == *buy::Buy::DISCRIMINATOR
115 && instruction.data.len() == 24
116 {
117 let mut data = instruction.data.clone();
118 data.push(0);
119 &Instruction {
120 program_id: instruction.program_id,
121 accounts: instruction.accounts.clone(),
122 data,
123 }
124 } else {
125 instruction
126 };
127 carbon_core::try_decode_instructions!(instruction,
128 PumpfunInstruction::AdminSetCreator => admin_set_creator::AdminSetCreator,
129 PumpfunInstruction::AdminSetIdlAuthority => admin_set_idl_authority::AdminSetIdlAuthority,
130 PumpfunInstruction::AdminUpdateTokenIncentives => admin_update_token_incentives::AdminUpdateTokenIncentives,
131 PumpfunInstruction::Buy => buy::Buy,
132 PumpfunInstruction::ClaimTokenIncentives => claim_token_incentives::ClaimTokenIncentives,
133 PumpfunInstruction::CloseUserVolumeAccumulator => close_user_volume_accumulator::CloseUserVolumeAccumulator,
134 PumpfunInstruction::CollectCreatorFee => collect_creator_fee::CollectCreatorFee,
135 PumpfunInstruction::Create => create::Create,
136 PumpfunInstruction::CreateV2 => create_v2::CreateV2,
137 PumpfunInstruction::ExtendAccount => extend_account::ExtendAccount,
138 PumpfunInstruction::InitUserVolumeAccumulator => init_user_volume_accumulator::InitUserVolumeAccumulator,
139 PumpfunInstruction::Initialize => initialize::Initialize,
140 PumpfunInstruction::Migrate => migrate::Migrate,
141 PumpfunInstruction::Sell => sell::Sell,
142 PumpfunInstruction::SetCreator => set_creator::SetCreator,
143 PumpfunInstruction::SetMetaplexCreator => set_metaplex_creator::SetMetaplexCreator,
144 PumpfunInstruction::SetParams => set_params::SetParams,
145 PumpfunInstruction::SyncUserVolumeAccumulator => sync_user_volume_accumulator::SyncUserVolumeAccumulator,
146 PumpfunInstruction::UpdateGlobalAuthority => update_global_authority::UpdateGlobalAuthority,
147 PumpfunInstruction::AdminSetCreatorEvent => admin_set_creator_event::AdminSetCreatorEvent,
148 PumpfunInstruction::AdminSetIdlAuthorityEvent => admin_set_idl_authority_event::AdminSetIdlAuthorityEvent,
149 PumpfunInstruction::AdminUpdateTokenIncentivesEvent => admin_update_token_incentives_event::AdminUpdateTokenIncentivesEvent,
150 PumpfunInstruction::ClaimTokenIncentivesEvent => claim_token_incentives_event::ClaimTokenIncentivesEvent,
151 PumpfunInstruction::CloseUserVolumeAccumulatorEvent => close_user_volume_accumulator_event::CloseUserVolumeAccumulatorEvent,
152 PumpfunInstruction::CollectCreatorFeeEvent => collect_creator_fee_event::CollectCreatorFeeEvent,
153 PumpfunInstruction::CompleteEvent => complete_event::CompleteEvent,
154 PumpfunInstruction::CompletePumpAmmMigrationEvent => complete_pump_amm_migration_event::CompletePumpAmmMigrationEvent,
155 PumpfunInstruction::CreateEvent => create_event::CreateEvent,
156 PumpfunInstruction::ExtendAccountEvent => extend_account_event::ExtendAccountEvent,
157 PumpfunInstruction::InitUserVolumeAccumulatorEvent => init_user_volume_accumulator_event::InitUserVolumeAccumulatorEvent,
158 PumpfunInstruction::SetCreatorEvent => set_creator_event::SetCreatorEvent,
159 PumpfunInstruction::SetMetaplexCreatorEvent => set_metaplex_creator_event::SetMetaplexCreatorEvent,
160 PumpfunInstruction::SetParamsEvent => set_params_event::SetParamsEvent,
161 PumpfunInstruction::SyncUserVolumeAccumulatorEvent => sync_user_volume_accumulator_event::SyncUserVolumeAccumulatorEvent,
162 PumpfunInstruction::TradeEvent => trade_event::TradeEvent,
163 PumpfunInstruction::UpdateGlobalAuthorityEvent => update_global_authority_event::UpdateGlobalAuthorityEvent,
164 )
165 }
166}
167#[cfg(test)]
168mod tests {
169 use alloc::{borrow::ToOwned, vec};
170 use carbon_core::{deserialize::ArrangeAccounts, instruction::InstructionDecoder};
171 use solana_instruction::AccountMeta;
172 use solana_pubkey::pubkey;
173
174 use crate::types::OptionBool;
175
176 use super::*;
177
178 #[test]
179 fn test_decode_buy() {
180 let expected_ix = PumpfunInstruction::Buy(buy::Buy {
181 amount: 1690358,
182 max_sol_cost: 195,
183 track_volume: OptionBool(false),
184 });
185
186 let expected_accounts = vec![
187 AccountMeta {
188 pubkey: pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
189 is_signer: false,
190 is_writable: false,
191 },
192 AccountMeta {
193 pubkey: pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV"),
194 is_signer: false,
195 is_writable: true,
196 },
197 AccountMeta {
198 pubkey: pubkey!("7uUTzNs4UFgarqY6TyRnW3ZnMFpcsw1iookL8R5KCGwA"),
199 is_signer: false,
200 is_writable: false,
201 },
202 AccountMeta {
203 pubkey: pubkey!("CxHfPAgH6PNLnfq5n5mq4tZK1aQCsMdeygwqaUSjsceN"),
204 is_signer: false,
205 is_writable: true,
206 },
207 AccountMeta {
208 pubkey: pubkey!("3AnftTe9GeUkp3HQJTm7tWLeVkojdFCyd33u4XEAMTpe"),
209 is_signer: false,
210 is_writable: true,
211 },
212 AccountMeta {
213 pubkey: pubkey!("A1C8VqECGc8CSjmiEpaaNTWeJVqVM3tQXnxcaSkfngxT"),
214 is_signer: false,
215 is_writable: true,
216 },
217 AccountMeta {
218 pubkey: pubkey!("9zR4L1w4cCvLndDYYiCBUvNfBPeZBAQWL57wQgW97Pau"),
219 is_signer: true,
220 is_writable: true,
221 },
222 AccountMeta {
223 pubkey: pubkey!("11111111111111111111111111111111"),
224 is_signer: false,
225 is_writable: false,
226 },
227 AccountMeta {
228 pubkey: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
229 is_signer: false,
230 is_writable: false,
231 },
232 AccountMeta {
233 pubkey: pubkey!("34D2HZjdrSfxhc4j6aduiwbN6uzXKaw73h2jjVBQfJ9p"),
234 is_signer: false,
235 is_writable: true,
236 },
237 AccountMeta {
238 pubkey: pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"),
239 is_signer: false,
240 is_writable: false,
241 },
242 AccountMeta {
243 pubkey: pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),
244 is_signer: false,
245 is_writable: false,
246 },
247 AccountMeta {
248 pubkey: pubkey!("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y"),
249 is_signer: false,
250 is_writable: true,
251 },
252 AccountMeta {
253 pubkey: pubkey!("3cm5x9jFRrZQzZxnYkm7jYkUy5srwamyMZZTsRPZqfgD"),
254 is_signer: false,
255 is_writable: true,
256 },
257 AccountMeta {
258 pubkey: pubkey!("8Wf5TiAheLUqBrKXeYg2JtAFFMWtKdG2BSFgqUcPVwTt"),
259 is_signer: false,
260 is_writable: false,
261 },
262 AccountMeta {
263 pubkey: pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"),
264 is_signer: false,
265 is_writable: false,
266 },
267 ];
268 let expected_arranged_accounts = buy::BuyInstructionAccounts {
269 global: pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
270 fee_recipient: pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV"),
271 mint: pubkey!("7uUTzNs4UFgarqY6TyRnW3ZnMFpcsw1iookL8R5KCGwA"),
272 bonding_curve: pubkey!("CxHfPAgH6PNLnfq5n5mq4tZK1aQCsMdeygwqaUSjsceN"),
273 associated_bonding_curve: pubkey!("3AnftTe9GeUkp3HQJTm7tWLeVkojdFCyd33u4XEAMTpe"),
274 associated_user: pubkey!("A1C8VqECGc8CSjmiEpaaNTWeJVqVM3tQXnxcaSkfngxT"),
275 user: pubkey!("9zR4L1w4cCvLndDYYiCBUvNfBPeZBAQWL57wQgW97Pau"),
276 system_program: pubkey!("11111111111111111111111111111111"),
277 token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
278 creator_vault: pubkey!("34D2HZjdrSfxhc4j6aduiwbN6uzXKaw73h2jjVBQfJ9p"),
279 event_authority: pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"),
280 program: pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),
281 global_volume_accumulator: pubkey!("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y"),
282 user_volume_accumulator: pubkey!("3cm5x9jFRrZQzZxnYkm7jYkUy5srwamyMZZTsRPZqfgD"),
283 fee_config: pubkey!("8Wf5TiAheLUqBrKXeYg2JtAFFMWtKdG2BSFgqUcPVwTt"),
284 fee_program: pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"),
285 };
286
287 let decoder = PumpfunDecoder;
289 let instruction = carbon_test_utils::read_instruction("tests/fixtures/buy_ix.json")
291 .expect("read fixture");
292 let decoded = decoder
293 .decode_instruction(&instruction)
294 .expect("decode instruction");
295 let decoded_arranged_accounts =
296 buy::Buy::arrange_accounts(&instruction.accounts).expect("aranage accounts");
297
298 assert_eq!(decoded.data, expected_ix);
300 assert_eq!(decoded.accounts, expected_accounts);
301 assert_eq!(decoded.program_id, PROGRAM_ID);
302 assert_eq!(decoded_arranged_accounts, expected_arranged_accounts);
303 }
304
305 #[test]
306 fn test_decode_sell() {
307 let expected_ix = PumpfunInstruction::Sell(sell::Sell {
309 amount: 376599365021,
310 min_sol_output: 14065038,
311 });
312 let expected_accounts = vec![
313 AccountMeta {
314 pubkey: pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
315 is_signer: false,
316 is_writable: false,
317 },
318 AccountMeta {
319 pubkey: pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV"),
320 is_signer: false,
321 is_writable: true,
322 },
323 AccountMeta {
324 pubkey: pubkey!("7gym364csXoyZHvN8tswevxxXcYRZ9hHdP1PaS99XWtf"),
325 is_signer: false,
326 is_writable: false,
327 },
328 AccountMeta {
329 pubkey: pubkey!("7kEiL6XFg24xdPbTWnae8URUud9NxnDZX95rQyxKGQvB"),
330 is_signer: false,
331 is_writable: true,
332 },
333 AccountMeta {
334 pubkey: pubkey!("ANq2idorZ1Ha9bjzWzUquKLho9H4ZpK5AHH7P3oTsRQA"),
335 is_signer: false,
336 is_writable: true,
337 },
338 AccountMeta {
339 pubkey: pubkey!("HVAi5g9JEMHTjBKFaBaNebtVNVVisRh8CAAPrddFVx5G"),
340 is_signer: false,
341 is_writable: true,
342 },
343 AccountMeta {
344 pubkey: pubkey!("GGrcscAqEq4qJ1apGnQMv3XkFL7Dp68C6Cm8wx4ytjuf"),
345 is_signer: true,
346 is_writable: true,
347 },
348 AccountMeta {
349 pubkey: pubkey!("11111111111111111111111111111111"),
350 is_signer: false,
351 is_writable: false,
352 },
353 AccountMeta {
354 pubkey: pubkey!("7stsnMwqhVnmUKdBdbKKHbLYm59V2W3NiihibhTwXq2b"),
355 is_signer: false,
356 is_writable: true,
357 },
358 AccountMeta {
359 pubkey: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
360 is_signer: false,
361 is_writable: false,
362 },
363 AccountMeta {
364 pubkey: pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"),
365 is_signer: false,
366 is_writable: false,
367 },
368 AccountMeta {
369 pubkey: pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),
370 is_signer: false,
371 is_writable: false,
372 },
373 AccountMeta {
374 pubkey: pubkey!("8Wf5TiAheLUqBrKXeYg2JtAFFMWtKdG2BSFgqUcPVwTt"),
375 is_signer: false,
376 is_writable: false,
377 },
378 AccountMeta {
379 pubkey: pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"),
380 is_signer: false,
381 is_writable: false,
382 },
383 ];
384
385 let expected_arranged_accounts = sell::SellInstructionAccounts {
386 global: pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
387 fee_recipient: pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV"),
388 mint: pubkey!("7gym364csXoyZHvN8tswevxxXcYRZ9hHdP1PaS99XWtf"),
389 bonding_curve: pubkey!("7kEiL6XFg24xdPbTWnae8URUud9NxnDZX95rQyxKGQvB"),
390 associated_bonding_curve: pubkey!("ANq2idorZ1Ha9bjzWzUquKLho9H4ZpK5AHH7P3oTsRQA"),
391 associated_user: pubkey!("HVAi5g9JEMHTjBKFaBaNebtVNVVisRh8CAAPrddFVx5G"),
392 user: pubkey!("GGrcscAqEq4qJ1apGnQMv3XkFL7Dp68C6Cm8wx4ytjuf"),
393 system_program: pubkey!("11111111111111111111111111111111"),
394 token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
395 creator_vault: pubkey!("7stsnMwqhVnmUKdBdbKKHbLYm59V2W3NiihibhTwXq2b"),
396 event_authority: pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"),
397 program: pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),
398 fee_config: pubkey!("8Wf5TiAheLUqBrKXeYg2JtAFFMWtKdG2BSFgqUcPVwTt"),
399 fee_program: pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"),
400 };
401
402 let decoder = PumpfunDecoder;
404 let instruction = carbon_test_utils::read_instruction("tests/fixtures/sell_ix.json")
405 .expect("read fixture");
406 let decoded = decoder
407 .decode_instruction(&instruction)
408 .expect("decode instruction");
409 let decoded_arranged_accounts =
410 sell::Sell::arrange_accounts(&instruction.accounts).expect("aranage accounts");
411
412 assert_eq!(decoded.data, expected_ix);
414 assert_eq!(decoded.accounts, expected_accounts);
415 assert_eq!(decoded.program_id, PROGRAM_ID);
416 assert_eq!(decoded_arranged_accounts, expected_arranged_accounts);
417 }
418
419 #[test]
420 fn test_decode_create() {
421 let expected_ix = PumpfunInstruction::Create(create::Create {
423 name: "Mystical Cat".to_owned(),
424 symbol: "MC".to_owned(),
425 uri: "https://ipfs.io/ipfs/QmeXR4TB9NZVK279DAVDKevSLzrWSi9papnaknVPJ8AvHe".to_owned(),
426 creator: pubkey!("CkdtUhQdH2sHXJYTJTNFbF1K5W33WVgVHG7zffaMkEmv"),
427 });
428 let expected_accounts = vec![
429 AccountMeta::new(
430 pubkey!("AC69oJv1m7843mdRfoQDneZuyRxYrMq86i2mARMtpump"),
431 true,
432 ),
433 AccountMeta::new_readonly(
434 pubkey!("TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM"),
435 false,
436 ),
437 AccountMeta::new(
438 pubkey!("623TpUDcZjKdmd9wybMveLKSSbgRs2hvwFjygzi4g15B"),
439 false,
440 ),
441 AccountMeta::new(
442 pubkey!("5rQKu3z4SXShvQkNKSJu9mtsVmgM8AvLoeNbJGvTyQv6"),
443 false,
444 ),
445 AccountMeta::new_readonly(
446 pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
447 false,
448 ),
449 AccountMeta::new_readonly(
450 pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
451 false,
452 ),
453 AccountMeta::new(
454 pubkey!("311RNHU1xDgJfYvQLszzgnBjQ1fDg5Ddr2yR3ymmUCed"),
455 false,
456 ),
457 AccountMeta::new(
458 pubkey!("CkdtUhQdH2sHXJYTJTNFbF1K5W33WVgVHG7zffaMkEmv"),
459 true,
460 ),
461 AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false),
462 AccountMeta::new_readonly(
463 pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
464 false,
465 ),
466 AccountMeta::new_readonly(
467 pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),
468 false,
469 ),
470 AccountMeta::new_readonly(
471 pubkey!("SysvarRent111111111111111111111111111111111"),
472 false,
473 ),
474 AccountMeta::new_readonly(
475 pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"),
476 false,
477 ),
478 AccountMeta::new_readonly(
479 pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),
480 false,
481 ),
482 ];
483 let expected_arranged_accounts = create::CreateInstructionAccounts {
484 mint: pubkey!("AC69oJv1m7843mdRfoQDneZuyRxYrMq86i2mARMtpump"),
485 mint_authority: pubkey!("TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM"),
486 bonding_curve: pubkey!("623TpUDcZjKdmd9wybMveLKSSbgRs2hvwFjygzi4g15B"),
487 associated_bonding_curve: pubkey!("5rQKu3z4SXShvQkNKSJu9mtsVmgM8AvLoeNbJGvTyQv6"),
488 global: pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
489 mpl_token_metadata: pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
490 metadata: pubkey!("311RNHU1xDgJfYvQLszzgnBjQ1fDg5Ddr2yR3ymmUCed"),
491 user: pubkey!("CkdtUhQdH2sHXJYTJTNFbF1K5W33WVgVHG7zffaMkEmv"),
492 system_program: pubkey!("11111111111111111111111111111111"),
493 token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
494 associated_token_program: pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),
495 rent: pubkey!("SysvarRent111111111111111111111111111111111"),
496 event_authority: pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"),
497 program: pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),
498 };
499
500 let decoder = PumpfunDecoder;
502 let instruction = carbon_test_utils::read_instruction("tests/fixtures/create_ix.json")
503 .expect("read fixture");
504 let decoded = decoder
505 .decode_instruction(&instruction)
506 .expect("decode instruction");
507 let decoded_arranged_accounts =
508 create::Create::arrange_accounts(&instruction.accounts).expect("aranage accounts");
509
510 assert_eq!(decoded.data, expected_ix);
512 assert_eq!(decoded.accounts, expected_accounts);
513 assert_eq!(decoded.program_id, PROGRAM_ID);
514 assert_eq!(decoded_arranged_accounts, expected_arranged_accounts);
515 }
516}