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

Method parse

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

Source from the content-addressed store, hash-verified

60
61impl<'a, 'b: 'a> Accounts<'a, AccountInfo<'b>> {
62 pub fn parse(
63 program_id: &Pubkey,
64 accounts: &'a [AccountInfo<'b>],
65 ) -> Result<Self, ProgramError> {
66 let accounts_iter = &mut accounts.iter();
67 let a = Self {
68 spl_token_program: next_account_info(accounts_iter)?,
69 market: next_account_info(accounts_iter)?,
70 base_vault: next_account_info(accounts_iter)?,
71 quote_vault: next_account_info(accounts_iter)?,
72 market_signer: next_account_info(accounts_iter)?,
73 user: next_account_info(accounts_iter)?,
74 user_owner: next_account_info(accounts_iter)?,
75 destination_base_account: next_account_info(accounts_iter)?,
76 destination_quote_account: next_account_info(accounts_iter)?,
77 };
78 check_signer(a.user_owner).map_err(|e| {
79 msg!("The user account owner should be a signer for this transaction!");
80 e
81 })?;
82 check_account_key(
83 a.spl_token_program,
84 &spl_token::ID,
85 DexError::InvalidSplTokenProgram,
86 )?;
87 check_account_owner(a.market, program_id, DexError::InvalidStateAccountOwner)?;
88 check_account_owner(a.user, program_id, DexError::InvalidStateAccountOwner)?;
89
90 Ok(a)
91 }
92
93 pub fn load_user_account(
94 &self,

Callers

nothing calls this directly

Calls 3

check_signerFunction · 0.85
check_account_keyFunction · 0.85
check_account_ownerFunction · 0.85

Tested by

no test coverage detected