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

Method parse

program/src/processor/initialize_account.rs:57–84  ·  view source on GitHub ↗
(
        _program_id: &Pubkey,
        accounts: &'a [AccountInfo<'b>],
    )

Source from the content-addressed store, hash-verified

55
56impl<'a, 'b: 'a> Accounts<'a, AccountInfo<'b>> {
57 pub fn parse(
58 _program_id: &Pubkey,
59 accounts: &'a [AccountInfo<'b>],
60 ) -> Result<Self, ProgramError> {
61 let accounts_iter = &mut accounts.iter();
62 let a = Self {
63 system_program: next_account_info(accounts_iter)?,
64 user: next_account_info(accounts_iter)?,
65 user_owner: next_account_info(accounts_iter)?,
66 fee_payer: next_account_info(accounts_iter)?,
67 };
68 check_signer(a.user_owner).map_err(|e| {
69 msg!("The user account owner should be a signer for this transaction!");
70 e
71 })?;
72 check_account_key(
73 a.system_program,
74 &system_program::ID,
75 DexError::InvalidSystemProgramAccount,
76 )?;
77 check_account_owner(
78 a.user,
79 &system_program::ID,
80 DexError::InvalidStateAccountOwner,
81 )?;
82
83 Ok(a)
84 }
85}
86
87pub(crate) fn process(

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