fn process_apply_pending_balance(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    ApplyPendingBalanceData {
        expected_pending_balance_credit_counter,
        new_decryptable_available_balance,
    }: &ApplyPendingBalanceData,
) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let token_account_info = next_account_info(account_info_iter)?;
    let authority_info = next_account_info(account_info_iter)?;
    let authority_info_data_len = authority_info.data_len();

    check_program_account(token_account_info.owner)?;
    let token_account_data = &mut token_account_info.data.borrow_mut();
    let mut token_account = StateWithExtensionsMut::<Account>::unpack(token_account_data)?;

    Processor::validate_owner(
        program_id,
        token_account_info.owner,
        authority_info,
        authority_info_data_len,
        account_info_iter.as_slice(),
    )?;

    let mut ct_token_account = token_account.get_extension_mut::<ConfidentialTransferAccount>()?;
    ct_token_account.approved()?;

    ct_token_account.available_balance = ops::add(
        &ct_token_account.available_balance,
        &ct_token_account.pending_balance,
    )
    .ok_or(ProgramError::InvalidInstructionData)?;

    ct_token_account.actual_pending_balance_credit_counter =
        ct_token_account.pending_balance_credit_counter;
    ct_token_account.expected_pending_balance_credit_counter =
        *expected_pending_balance_credit_counter;
    ct_token_account.decryptable_available_balance = *new_decryptable_available_balance;
    ct_token_account.pending_balance = pod::ElGamalCiphertext::zeroed();

    Ok(())
}
/// Processes an [ApplyPendingBalance] instruction.
Processes an [ApplyPendingBalance] instruction.
Processes an [ ApplyPendingBalance ] instruction .
fn process_apply_pending_balance(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    ApplyPendingBalanceData {
        expected_pending_balance_credit_counter,
        new_decryptable_available_balance,
    }: &ApplyPendingBalanceData,
) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let token_account_info = next_account_info(account_info_iter)?;
    let authority_info = next_account_info(account_info_iter)?;
    let authority_info_data_len = authority_info.data_len();
    check_program_account(token_account_info.owner)?;
    let token_account_data = &mut token_account_info.data.borrow_mut();
    let mut token_account = StateWithExtensionsMut::<Account>::unpack(token_account_data)?;
    Processor::validate_owner(
        program_id,
        token_account_info.owner,
        authority_info,
        authority_info_data_len,
        account_info_iter.as_slice(),
    )?;
    let mut ct_token_account = token_account.get_extension_mut::<ConfidentialTransferAccount>()?;
    ct_token_account.approved()?;
    ct_token_account.available_balance = ops::add(
        &ct_token_account.available_balance,
        &ct_token_account.pending_balance,
    )
    .ok_or(ProgramError::InvalidInstructionData)?;
    ct_token_account.actual_pending_balance_credit_counter =
        ct_token_account.pending_balance_credit_counter;
    ct_token_account.expected_pending_balance_credit_counter =
        *expected_pending_balance_credit_counter;
    ct_token_account.decryptable_available_balance = *new_decryptable_available_balance;
    ct_token_account.pending_balance = pod::ElGamalCiphertext::zeroed();
    Ok(())
}
fn process_apply_pending_balance ( program_id : & Pubkey , accounts : & [ AccountInfo ] , ApplyPendingBalanceData { expected_pending_balance_credit_counter , new_decryptable_available_balance , } : & ApplyPendingBalanceData , ) -> ProgramResult { let account_info_iter = & mut accounts . iter ( ) ; let token_account_info = next_account_info ( account_info_iter ) ? ; let authority_info = next_account_info ( account_info_iter ) ? ; let authority_info_data_len = authority_info . data_len ( ) ; check_program_account ( token_account_info . owner ) ? ; let token_account_data = & mut token_account_info . data . borrow_mut ( ) ; let mut token_account = StateWithExtensionsMut :: < Account > :: unpack ( token_account_data ) ? ; Processor :: validate_owner ( program_id , token_account_info . owner , authority_info , authority_info_data_len , account_info_iter . as_slice ( ) , ) ? ; let mut ct_token_account = token_account . get_extension_mut :: < ConfidentialTransferAccount > ( ) ? ; ct_token_account . approved ( ) ? ; ct_token_account . available_balance = ops :: add ( & ct_token_account . available_balance , & ct_token_account . pending_balance , ) . ok_or ( ProgramError :: InvalidInstructionData ) ? ; ct_token_account . actual_pending_balance_credit_counter = ct_token_account . pending_balance_credit_counter ; ct_token_account . expected_pending_balance_credit_counter = * expected_pending_balance_credit_counter ; ct_token_account . decryptable_available_balance = * new_decryptable_available_balance ; ct_token_account . pending_balance = pod :: ElGamalCiphertext :: zeroed ( ) ; Ok ( ( ) ) }
Processes an [ApplyPendingBalance] instruction.
Processes an [ ApplyPendingBalance ] instruction .
program_id
&Pubkey
accounts
&ApplyPendingBalanceData
program_id
&Pubkey
accounts
&ApplyPendingBalanceData