@@ -39,15 +39,14 @@ const EXPIRE_OFFSET: i64 = 10 * 60;
3939const PREFIX : & str = "candy_machine" ;
4040// here just in case solana removes the var
4141const BLOCK_HASHES : & str = "SysvarRecentB1ockHashes11111111111111111111" ;
42- const BOT_FEE : u64 = 1000000 ;
42+ const BOT_FEE : u64 = 10000000 ;
4343
4444const GUMDROP_ID : Pubkey = solana_program:: pubkey!( "gdrpGjVffourzkdDRrQmySw4aTHr8a3xmQzzxSwFD1a" ) ;
4545const A_TOKEN : Pubkey = solana_program:: pubkey!( "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" ) ;
4646
4747#[ program]
4848pub mod candy_machine {
4949 use super :: * ;
50- use crate :: utils:: punish_bots_lamports;
5150
5251 #[ inline( never) ]
5352 pub fn mint_nft < ' info > (
@@ -525,8 +524,7 @@ pub mod candy_machine {
525524 let num_instructions = read_u16 ( & mut idx, & instruction_sysvar)
526525 . map_err ( |_| ProgramError :: InvalidAccountData ) ?;
527526
528- let associated_token =
529- Pubkey :: from_str ( "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" ) . unwrap ( ) ;
527+ let associated_token = A_TOKEN ;
530528
531529 for index in 0 ..num_instructions {
532530 let mut current = 2 + ( index * 2 ) as usize ;
@@ -565,24 +563,16 @@ pub mod candy_machine {
565563 "Transaction had ix with program id {}" ,
566564 & previous_instruction. program_id
567565 ) ;
568- punish_bots_lamports (
569- ErrorCode :: SuspiciousTransaction ,
570- & ctx. accounts . payer ,
571- & ctx. accounts . collection_pda . to_account_info ( ) ,
572- BOT_FEE ,
573- ) ?;
566+ return Ok ( ( ) ) ;
567+ }
568+ /// Check if the metadata acount has data if not bot fee
569+ if ctx. accounts . metadata . owner != & mpl_token_metadata:: id ( ) || ctx. accounts . token_metadata_program . data_len ( ) == 0 {
574570 return Ok ( ( ) ) ;
575571 }
576572
577573 let discriminator = & previous_instruction. data [ 0 ..8 ] ;
578574 if discriminator != [ 211 , 57 , 6 , 167 , 15 , 219 , 35 , 251 ] {
579575 msg ! ( "Transaction had ix with data {:?}" , discriminator) ;
580- punish_bots_lamports (
581- ErrorCode :: SuspiciousTransaction ,
582- & ctx. accounts . payer ,
583- & ctx. accounts . collection_pda . to_account_info ( ) ,
584- BOT_FEE ,
585- ) ?;
586576 return Ok ( ( ) ) ;
587577 }
588578
@@ -600,22 +590,10 @@ pub mod candy_machine {
600590 mint_ix_cm,
601591 candy_key
602592 ) ;
603- punish_bots_lamports (
604- ErrorCode :: SuspiciousTransaction ,
605- & ctx. accounts . payer ,
606- & ctx. accounts . collection_pda . to_account_info ( ) ,
607- BOT_FEE ,
608- ) ?;
609593 return Ok ( ( ) ) ;
610594 }
611595 if & mint_ix_cm != & candy_key {
612596 msg ! ( "Candy Machine with pubkey {} does not match the mint ix Candy Machine with pubkey {}" , mint_ix_cm, candy_key) ;
613- punish_bots_lamports (
614- ErrorCode :: SuspiciousTransaction ,
615- & ctx. accounts . payer ,
616- & ctx. accounts . collection_pda . to_account_info ( ) ,
617- BOT_FEE ,
618- ) ?;
619597 return Ok ( ( ) ) ;
620598 }
621599 if mint_ix_metadata != metadata {
@@ -624,24 +602,12 @@ pub mod candy_machine {
624602 mint_ix_metadata,
625603 metadata
626604 ) ;
627- punish_bots_lamports (
628- ErrorCode :: SuspiciousTransaction ,
629- & ctx. accounts . payer ,
630- & ctx. accounts . collection_pda . to_account_info ( ) ,
631- BOT_FEE ,
632- ) ?;
633605 return Ok ( ( ) ) ;
634606 }
635607
636608 let collection_pda = & ctx. accounts . collection_pda ;
637609 let collection_mint = ctx. accounts . collection_mint . to_account_info ( ) ;
638610 if & collection_pda. mint != & collection_mint. key ( ) {
639- punish_bots_lamports (
640- ErrorCode :: MismatchedCollectionMint ,
641- & ctx. accounts . payer ,
642- & ctx. accounts . collection_pda . to_account_info ( ) ,
643- BOT_FEE ,
644- ) ?;
645611 return Ok ( ( ) ) ;
646612 }
647613 let seeds = [ b"collection" . as_ref ( ) , candy_key. as_ref ( ) ] ;
@@ -661,7 +627,7 @@ pub mod candy_machine {
661627 ctx. accounts. collection_master_edition. to_account_info( ) ,
662628 ctx. accounts. collection_authority_record. to_account_info( ) ,
663629 ] ;
664- invoke_signed (
630+ let set = invoke_signed (
665631 & set_and_verify_collection (
666632 ctx. accounts . token_metadata_program . key ( ) ,
667633 ctx. accounts . metadata . key ( ) ,
@@ -675,7 +641,11 @@ pub mod candy_machine {
675641 ) ,
676642 set_collection_infos. as_slice ( ) ,
677643 & [ & signer_seeds] ,
678- ) ?;
644+ ) ;
645+ /// Set will only fail if the above IX fails
646+ if set. is_err ( ) {
647+ return Ok ( ( ) ) ;
648+ }
679649 Ok ( ( ) )
680650 }
681651
0 commit comments