diff --git a/rust/metaplex/program/src/instruction.rs b/rust/metaplex/program/src/instruction.rs index bd04952..961d512 100644 --- a/rust/metaplex/program/src/instruction.rs +++ b/rust/metaplex/program/src/instruction.rs @@ -154,7 +154,7 @@ pub enum MetaplexInstruction { /// 20. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit] /// This account will only get used AND BE REQUIRED in the event this is an AuctionManagerV2 /// 21. `[]` Auction extended (pda relative to auction of ['auction', program id, vault key, 'extended']) - DeprecatedRedeemBid, + RedeemBid, /// Note: This requires that auction manager be in a Running state. /// diff --git a/rust/metaplex/program/src/processor/end_auction.rs b/rust/metaplex/program/src/processor/end_auction.rs index 9da4c0a..0fa7edd 100644 --- a/rust/metaplex/program/src/processor/end_auction.rs +++ b/rust/metaplex/program/src/processor/end_auction.rs @@ -2,10 +2,9 @@ use { crate::{ error::MetaplexError, instruction::EndAuctionArgs as MetaplexEndAuctionArgs, - state::{AuctionManager, AuctionManagerStatus, Store, PREFIX}, + state::{get_auction_manager, AuctionManagerStatus, Store, PREFIX}, utils::{assert_authority_correct, assert_owned_by}, }, - borsh::BorshSerialize, solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint::ProgramResult, @@ -49,7 +48,7 @@ pub fn process_end_auction( args: MetaplexEndAuctionArgs, ) -> ProgramResult { let account_info_iter = &mut accounts.iter(); - let auction_manager_info = next_account_info(account_info_iter)?; + let mut auction_manager_info = next_account_info(account_info_iter)?; let auction_info = next_account_info(account_info_iter)?; let auction_data_extended_info = next_account_info(account_info_iter)?; let authority_info = next_account_info(account_info_iter)?; @@ -57,7 +56,7 @@ pub fn process_end_auction( let auction_program_info = next_account_info(account_info_iter)?; let clock_info = next_account_info(account_info_iter)?; - let mut auction_manager = AuctionManager::from_account_info(auction_manager_info)?; + let mut auction_manager = get_auction_manager(auction_manager_info)?; let auction = AuctionData::from_account_info(auction_info)?; let auction_data_extended = AuctionDataExtended::from_account_info(auction_data_extended_info)?; let store = Store::from_account_info(store_info)?; @@ -66,16 +65,16 @@ pub fn process_end_auction( return Err(MetaplexError::AuctionAuthorityMismatch.into()); } - assert_authority_correct(&auction_manager, authority_info)?; + assert_authority_correct(&auction_manager.authority(), authority_info)?; assert_owned_by(auction_info, &store.auction_program)?; assert_owned_by(auction_manager_info, program_id)?; assert_owned_by(store_info, program_id)?; - if auction_manager.store != *store_info.key { + if auction_manager.store() != *store_info.key { return Err(MetaplexError::AuctionManagerStoreMismatch.into()); } - if auction_manager.auction != *auction_info.key { + if auction_manager.auction() != *auction_info.key { return Err(MetaplexError::AuctionManagerAuctionMismatch.into()); } @@ -83,15 +82,16 @@ pub fn process_end_auction( return Err(MetaplexError::AuctionManagerAuctionProgramMismatch.into()); } - if auction_manager.state.status != AuctionManagerStatus::Validated { + if auction_manager.status() != AuctionManagerStatus::Validated { return Err(MetaplexError::AuctionManagerMustBeValidated.into()); } - let seeds = &[PREFIX.as_bytes(), &auction_manager.auction.as_ref()]; + let auction_key = auction_manager.auction(); + let seeds = &[PREFIX.as_bytes(), &auction_key.as_ref()]; let (_, bump_seed) = Pubkey::find_program_address(seeds, &program_id); let authority_seeds = &[ PREFIX.as_bytes(), - &auction_manager.auction.as_ref(), + &auction_key.as_ref(), &[bump_seed], ]; @@ -100,7 +100,7 @@ pub fn process_end_auction( auction_manager_info.clone(), auction_info.clone(), clock_info.clone(), - auction_manager.vault, + auction_manager.vault(), args.reveal, authority_seeds, )?; @@ -108,17 +108,17 @@ pub fn process_end_auction( if auction_data_extended.instant_sale_price.is_some() { match auction.bid_state { BidState::EnglishAuction { .. } => { - auction_manager.state.status = AuctionManagerStatus::Disbursing; + auction_manager.set_status(AuctionManagerStatus::Disbursing); } BidState::OpenEdition { .. } => { - auction_manager.state.status = AuctionManagerStatus::Finished; + auction_manager.set_status(AuctionManagerStatus::Finished); } } } else { - auction_manager.state.status = AuctionManagerStatus::Disbursing; + auction_manager.set_status(AuctionManagerStatus::Disbursing); } - auction_manager.serialize(&mut *auction_manager_info.data.borrow_mut())?; + auction_manager.save(&mut auction_manager_info)?; Ok(()) } diff --git a/rust/metaplex/program/src/processor/redeem_participation_bid.rs b/rust/metaplex/program/src/processor/redeem_participation_bid.rs index 60a4233..de69011 100644 --- a/rust/metaplex/program/src/processor/redeem_participation_bid.rs +++ b/rust/metaplex/program/src/processor/redeem_participation_bid.rs @@ -271,7 +271,7 @@ pub fn process_redeem_participation_bid<'a>( }); auction_extended_info = None; } else { - v2_accounts = Some(V2Accounts { + let v2_accounts_base = V2Accounts { prize_tracking_ticket_info: next_account_info(account_info_iter)?, new_metadata_account_info: next_account_info(account_info_iter)?, new_edition_account_info: next_account_info(account_info_iter)?, @@ -281,8 +281,9 @@ pub fn process_redeem_participation_bid<'a>( mint_authority_info: next_account_info(account_info_iter)?, metadata_account_info: next_account_info(account_info_iter)?, auction_extended_info: next_account_info(account_info_iter)?, - }); - auction_extended_info = Some(v2_accounts.unwrap().auction_extended_info) + }; + auction_extended_info = Some(v2_accounts_base.auction_extended_info); + v2_accounts = Some(v2_accounts_base); } let CommonRedeemReturn {