fn process_update_auditor(
    accounts: &[AccountInfo],
    new_auditor: &ConfidentialTransferAuditor,
) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let mint_info = next_account_info(account_info_iter)?;
    let authority_info = next_account_info(account_info_iter)?;
    let new_authority_info = next_account_info(account_info_iter)?;

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

    if authority_info.is_signer
        && (new_authority_info.is_signer || *new_authority_info.key == Pubkey::default())
    {
        if new_auditor.authority == *new_authority_info.key {
            *auditor = *new_auditor;
            Ok(())
        } else {
            Err(ProgramError::InvalidInstructionData)
        }
    } else {
        Err(ProgramError::MissingRequiredSignature)
    }
}
/// Processes an [UpdateAuditor] instruction.
Processes an [UpdateAuditor] instruction.
Processes an [ UpdateAuditor ] instruction .
fn process_update_auditor(
    accounts: &[AccountInfo],
    new_auditor: &ConfidentialTransferAuditor,
) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let mint_info = next_account_info(account_info_iter)?;
    let authority_info = next_account_info(account_info_iter)?;
    let new_authority_info = next_account_info(account_info_iter)?;
    check_program_account(mint_info.owner)?;
    let mint_data = &mut mint_info.data.borrow_mut();
    let mut mint = StateWithExtensionsMut::<Mint>::unpack(mint_data)?;
    let auditor = mint.get_extension_mut::<ConfidentialTransferAuditor>()?;
    if authority_info.is_signer
        && (new_authority_info.is_signer || *new_authority_info.key == Pubkey::default())
    {
        if new_auditor.authority == *new_authority_info.key {
            *auditor = *new_auditor;
            Ok(())
        } else {
            Err(ProgramError::InvalidInstructionData)
        }
    } else {
        Err(ProgramError::MissingRequiredSignature)
    }
}
fn process_update_auditor ( accounts : & [ AccountInfo ] , new_auditor : & ConfidentialTransferAuditor , ) -> ProgramResult { let account_info_iter = & mut accounts . iter ( ) ; let mint_info = next_account_info ( account_info_iter ) ? ; let authority_info = next_account_info ( account_info_iter ) ? ; let new_authority_info = next_account_info ( account_info_iter ) ? ; check_program_account ( mint_info . owner ) ? ; let mint_data = & mut mint_info . data . borrow_mut ( ) ; let mut mint = StateWithExtensionsMut :: < Mint > :: unpack ( mint_data ) ? ; let auditor = mint . get_extension_mut :: < ConfidentialTransferAuditor > ( ) ? ; if authority_info . is_signer && ( new_authority_info . is_signer || * new_authority_info . key == Pubkey :: default ( ) ) { if new_auditor . authority == * new_authority_info . key { * auditor = * new_auditor ; Ok ( ( ) ) } else { Err ( ProgramError :: InvalidInstructionData ) } } else { Err ( ProgramError :: MissingRequiredSignature ) } }
Processes an [UpdateAuditor] instruction.
Processes an [ UpdateAuditor ] instruction .
accounts
&[AccountInfo]
new_auditor
&ConfidentialTransferAuditor
accounts
&[AccountInfo]
new_auditor
&ConfidentialTransferAuditor