MCPcopy Create free account
hub / github.com/Bonfida/dex-v4 / process

Function process

program/src/processor/update_royalties.rs:73–106  ·  view source on GitHub ↗
(program_id: &Pubkey, accounts: &[AccountInfo])

Source from the content-addressed store, hash-verified

71}
72
73pub(crate) fn process(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
74 let accounts = Accounts::parse(accounts, program_id)?;
75
76 let mut market_state = DexState::get(accounts.market)?;
77 let mut orderbook_guard = accounts.orderbook.data.borrow_mut();
78 let aob_state = asset_agnostic_orderbook::state::market_state::MarketState::from_buffer(
79 &mut orderbook_guard,
80 AccountTag::Market,
81 )?;
82
83 check_metadata_account(accounts.token_metadata, &market_state.base_mint)?;
84 check_account_key(accounts.orderbook, &market_state.orderbook)?;
85
86 if &aob_state.event_queue != accounts.event_queue.key {
87 return Err(DexError::EventQueueMismatch.into());
88 }
89
90 let mut event_queue_guard = accounts.event_queue.data.borrow_mut();
91
92 let event_queue =
93 EventQueue::<CallBackInfo>::from_buffer(&mut event_queue_guard, AccountTag::EventQueue)?;
94
95 if !event_queue.is_empty() {
96 msg!("Header {}", event_queue.len());
97 return Err(DexError::EventQueueMustBeEmpty.into());
98 }
99
100 let metadata: Metadata = Metadata::from_account_info(accounts.token_metadata)?;
101 verify_metadata(&metadata.data.creators.unwrap())?;
102
103 market_state.royalties_bps = metadata.data.seller_fee_basis_points as u64;
104
105 Ok(())
106}

Callers

nothing calls this directly

Calls 3

check_metadata_accountFunction · 0.85
check_account_keyFunction · 0.85
verify_metadataFunction · 0.85

Tested by

no test coverage detected