carbon_pumpfun_decoder/instructions/
mod.rs

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