fn process_approve_account(accounts: &[AccountInfo]) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let account_to_approve_info = next_account_info(account_info_iter)?;
    let mint_info = next_account_info(account_info_iter)?;
    let authority_info = next_account_info(account_info_iter)?;

    check_program_account(account_to_approve_info.owner)?;
    let account_to_approve_data = &mut account_to_approve_info.data.borrow_mut();
    let mut account_to_approve = StateWithExtensionsMut::<Mint>::unpack(account_to_approve_data)?;

    check_program_account(mint_info.owner)?;
    let mint_data = &mint_info.data.borrow_mut();
    let mint = StateWithExtensions::<Mint>::unpack(mint_data)?;
    let auditor = mint.get_extension::<ConfidentialTransferAuditor>()?;

    if authority_info.is_signer && *authority_info.key == auditor.authority {
        let mut confidential_transfer_state =
            account_to_approve.get_extension_mut::<ConfidentialTransferState>()?;
        confidential_transfer_state.approved = true.into();
        Ok(())
    } else {
        Err(ProgramError::MissingRequiredSignature)
    }
}
/// Processes an [ApproveAccount] instruction.
Processes an [ApproveAccount] instruction.
Processes an [ ApproveAccount ] instruction .
fn process_approve_account(accounts: &[AccountInfo]) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let account_to_approve_info = next_account_info(account_info_iter)?;
    let mint_info = next_account_info(account_info_iter)?;
    let authority_info = next_account_info(account_info_iter)?;
    check_program_account(account_to_approve_info.owner)?;
    let account_to_approve_data = &mut account_to_approve_info.data.borrow_mut();
    let mut account_to_approve = StateWithExtensionsMut::<Mint>::unpack(account_to_approve_data)?;
    check_program_account(mint_info.owner)?;
    let mint_data = &mint_info.data.borrow_mut();
    let mint = StateWithExtensions::<Mint>::unpack(mint_data)?;
    let auditor = mint.get_extension::<ConfidentialTransferAuditor>()?;
    if authority_info.is_signer && *authority_info.key == auditor.authority {
        let mut confidential_transfer_state =
            account_to_approve.get_extension_mut::<ConfidentialTransferState>()?;
        confidential_transfer_state.approved = true.into();
        Ok(())
    } else {
        Err(ProgramError::MissingRequiredSignature)
    }
}
fn process_approve_account ( accounts : & [ AccountInfo ] ) -> ProgramResult { let account_info_iter = & mut accounts . iter ( ) ; let account_to_approve_info = next_account_info ( account_info_iter ) ? ; let mint_info = next_account_info ( account_info_iter ) ? ; let authority_info = next_account_info ( account_info_iter ) ? ; check_program_account ( account_to_approve_info . owner ) ? ; let account_to_approve_data = & mut account_to_approve_info . data . borrow_mut ( ) ; let mut account_to_approve = StateWithExtensionsMut :: < Mint > :: unpack ( account_to_approve_data ) ? ; check_program_account ( mint_info . owner ) ? ; let mint_data = & mint_info . data . borrow_mut ( ) ; let mint = StateWithExtensions :: < Mint > :: unpack ( mint_data ) ? ; let auditor = mint . get_extension :: < ConfidentialTransferAuditor > ( ) ? ; if authority_info . is_signer && * authority_info . key == auditor . authority { let mut confidential_transfer_state = account_to_approve . get_extension_mut :: < ConfidentialTransferState > ( ) ? ; confidential_transfer_state . approved = true . into ( ) ; Ok ( ( ) ) } else { Err ( ProgramError :: MissingRequiredSignature ) } }
Processes an [ApproveAccount] instruction.
Processes an [ ApproveAccount ] instruction .
accounts
&[AccountInfo]
accounts
&[AccountInfo]