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

Method parse

program/src/processor/close_market.rs:75–112  ·  view source on GitHub ↗
(
        program_id: &Pubkey,
        accounts: &'a [AccountInfo<'b>],
    )

Source from the content-addressed store, hash-verified

73
74impl<'a, 'b: 'a> Accounts<'a, AccountInfo<'b>> {
75 pub fn parse(
76 program_id: &Pubkey,
77 accounts: &'a [AccountInfo<'b>],
78 ) -> Result<Self, ProgramError> {
79 let accounts_iter = &mut accounts.iter();
80
81 let a = Self {
82 market: next_account_info(accounts_iter)?,
83 base_vault: next_account_info(accounts_iter)?,
84 quote_vault: next_account_info(accounts_iter)?,
85 orderbook: next_account_info(accounts_iter)?,
86 event_queue: next_account_info(accounts_iter)?,
87 bids: next_account_info(accounts_iter)?,
88 asks: next_account_info(accounts_iter)?,
89 market_admin: next_account_info(accounts_iter)?,
90 target_lamports_account: next_account_info(accounts_iter)?,
91 market_signer: next_account_info(accounts_iter)?,
92 spl_token_program: next_account_info(accounts_iter)?,
93 };
94
95 // Check keys
96 check_account_key(
97 a.spl_token_program,
98 &spl_token::ID,
99 DexError::InvalidStateAccountOwner,
100 )?;
101
102 // Check owners
103 check_account_owner(a.market, program_id, DexError::InvalidStateAccountOwner)?;
104
105 // Check signers
106 check_signer(a.market_admin).map_err(|e| {
107 msg!("The market admin should be a signer for this transaction!");
108 e
109 })?;
110
111 Ok(a)
112 }
113}
114
115pub(crate) fn process(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {

Callers

nothing calls this directly

Calls 3

check_account_keyFunction · 0.85
check_account_ownerFunction · 0.85
check_signerFunction · 0.85

Tested by

no test coverage detected