Skip to content

Commit

Permalink
switch destination and mint account pubkeys in confidential trans…
Browse files Browse the repository at this point in the history
…fer extension
  • Loading branch information
samkim-crypto committed Aug 25, 2023
1 parent f9fa519 commit dd29cf9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions token/client/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2198,8 +2198,8 @@ where
&confidential_transfer::instruction::transfer(
&self.program_id,
source_account,
destination_account,
&self.pubkey,
destination_account,
new_decryptable_available_balance,
source_authority,
&multisig_signers,
Expand Down Expand Up @@ -2244,8 +2244,8 @@ where
confidential_transfer::instruction::transfer_with_split_proofs(
&self.program_id,
source_account,
destination_account,
&self.pubkey,
destination_account,
new_decryptable_available_balance.into(),
source_authority,
context_state_accounts,
Expand Down Expand Up @@ -2311,8 +2311,8 @@ where
let transfer_instruction = confidential_transfer::instruction::transfer_with_split_proofs(
&self.program_id,
source_account,
destination_account,
&self.pubkey,
destination_account,
new_decryptable_available_balance.into(),
source_authority,
context_state_accounts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@ pub enum ConfidentialTransferInstruction {
///
/// * Single owner/delegate
/// 1. `[writable]` The source SPL Token account.
/// 2. `[writable]` The destination SPL Token account.
/// 3. `[]` The token mint.
/// 2. `[]` The token mint.
/// 3. `[writable]` The destination SPL Token account.
/// 4. `[]` Instructions sysvar if `VerifyTransfer` or `VerifyTransferWithFee` is included in
/// the same transaction or context state account if these proofs are pre-verified into a
/// context state account.
/// 5. `[signer]` The single source account owner.
///
/// * Multisignature owner/delegate
/// 1. `[writable]` The source SPL Token account.
/// 2. `[writable]` The destination SPL Token account.
/// 3. `[]` The token mint.
/// 2. `[]` The token mint.
/// 3. `[writable]` The destination SPL Token account.
/// 4. `[]` Instructions sysvar if `VerifyTransfer` or `VerifyTransferWithFee` is included in
/// the same transaction or context state account if these proofs are pre-verified into a
/// context state account.
Expand Down Expand Up @@ -369,8 +369,8 @@ pub enum ConfidentialTransferInstruction {
///
/// * Transfer without fee
/// 1. `[writable]` The source SPL Token account.
/// 2. `[writable]` The destination SPL Token account.
/// 3. `[]` The token mint.
/// 2. `[]` The token mint.
/// 3. `[writable]` The destination SPL Token account.
/// 4. `[]` Context state account for `VerifyCiphertextCommitmentEqualityProof`.
/// 5. `[]` Context state account for `VerifyBatchedGroupedCiphertext2HandlesValidityProof`.
/// 6. `[]` Context state account for `VerifyBatchedRangeProofU128`.
Expand All @@ -383,8 +383,8 @@ pub enum ConfidentialTransferInstruction {
///
/// * Transfer with fee
/// 1. `[writable]` The source SPL Token account.
/// 2. `[writable]` The destination SPL Token account.
/// 3. `[]` The token mint.
/// 2. `[]` The token mint.
/// 3. `[writable]` The destination SPL Token account.
/// 4. `[]` Context state account for `VerifyCiphertextCommitmentEqualityProof`.
/// 5. `[]` Context state account for `VerifyBatchedGroupedCiphertext2HandlesValidityProof`.
/// 6. `[]` Context state account for `VerifyFeeSigmaProof`.
Expand Down Expand Up @@ -960,8 +960,8 @@ pub fn withdraw(
pub fn inner_transfer(
token_program_id: &Pubkey,
source_token_account: &Pubkey,
destination_token_account: &Pubkey,
mint: &Pubkey,
destination_token_account: &Pubkey,
new_source_decryptable_available_balance: DecryptableBalance,
authority: &Pubkey,
multisig_signers: &[&Pubkey],
Expand All @@ -970,8 +970,8 @@ pub fn inner_transfer(
check_program_account(token_program_id)?;
let mut accounts = vec![
AccountMeta::new(*source_token_account, false),
AccountMeta::new(*destination_token_account, false),
AccountMeta::new_readonly(*mint, false),
AccountMeta::new(*destination_token_account, false),
];

let proof_instruction_offset = match proof_data_location {
Expand Down Expand Up @@ -1012,8 +1012,8 @@ pub fn inner_transfer(
pub fn transfer(
token_program_id: &Pubkey,
source_token_account: &Pubkey,
destination_token_account: &Pubkey,
mint: &Pubkey,
destination_token_account: &Pubkey,
new_source_decryptable_available_balance: AeCiphertext,
authority: &Pubkey,
multisig_signers: &[&Pubkey],
Expand All @@ -1022,8 +1022,8 @@ pub fn transfer(
let mut instructions = vec![inner_transfer(
token_program_id,
source_token_account,
destination_token_account,
mint,
destination_token_account,
new_source_decryptable_available_balance.into(),
authority,
multisig_signers,
Expand Down Expand Up @@ -1053,8 +1053,8 @@ pub fn transfer(
pub fn inner_transfer_with_fee(
token_program_id: &Pubkey,
source_token_account: &Pubkey,
destination_token_account: &Pubkey,
mint: &Pubkey,
destination_token_account: &Pubkey,
new_source_decryptable_available_balance: DecryptableBalance,
authority: &Pubkey,
multisig_signers: &[&Pubkey],
Expand All @@ -1063,8 +1063,8 @@ pub fn inner_transfer_with_fee(
check_program_account(token_program_id)?;
let mut accounts = vec![
AccountMeta::new(*source_token_account, false),
AccountMeta::new(*destination_token_account, false),
AccountMeta::new_readonly(*mint, false),
AccountMeta::new(*destination_token_account, false),
];

let proof_instruction_offset = match proof_data_location {
Expand Down Expand Up @@ -1105,8 +1105,8 @@ pub fn inner_transfer_with_fee(
pub fn transfer_with_fee(
token_program_id: &Pubkey,
source_token_account: &Pubkey,
destination_token_account: &Pubkey,
mint: &Pubkey,
destination_token_account: &Pubkey,
new_source_decryptable_available_balance: AeCiphertext,
authority: &Pubkey,
multisig_signers: &[&Pubkey],
Expand Down Expand Up @@ -1289,8 +1289,8 @@ pub fn disable_non_confidential_credits(
pub fn transfer_with_split_proofs(
token_program_id: &Pubkey,
source_token_account: &Pubkey,
destination_token_account: &Pubkey,
mint: &Pubkey,
destination_token_account: &Pubkey,
new_source_decryptable_available_balance: DecryptableBalance,
source_account_authority: &Pubkey,
context_accounts: TransferSplitContextStateAccounts,
Expand All @@ -1299,8 +1299,8 @@ pub fn transfer_with_split_proofs(
check_program_account(token_program_id)?;
let mut accounts = vec![
AccountMeta::new(*source_token_account, false),
AccountMeta::new(*destination_token_account, false),
AccountMeta::new_readonly(*mint, false),
AccountMeta::new(*destination_token_account, false),
];

let close_split_context_state_on_execution =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ fn process_transfer(
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let destination_token_account_info = next_account_info(account_info_iter)?;
let mint_info = next_account_info(account_info_iter)?;
let destination_token_account_info = next_account_info(account_info_iter)?;

check_program_account(mint_info.owner)?;
let mint_data = &mint_info.data.borrow_mut();
Expand Down

0 comments on commit dd29cf9

Please sign in to comment.