Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit c986098

Browse files
token-2022: merge instruction data for confidential Transfer and TransferWithFee (#3410)
1 parent 8f75f59 commit c986098

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

token/program-2022/src/extension/confidential_transfer/instruction.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub enum ConfidentialTransferInstruction {
219219
/// 6.. `[signer]` Required M signer accounts for the SPL Token Multisig account.
220220
///
221221
/// Data expected by this instruction:
222-
/// `TransferWithFeeInstructionData`
222+
/// `TransferInstructionData`
223223
///
224224
TransferWithFee,
225225

@@ -418,7 +418,8 @@ pub struct WithdrawInstructionData {
418418
pub proof_instruction_offset: i8,
419419
}
420420

421-
/// Data expected by `ConfidentialTransferInstruction::Transfer`
421+
/// Data expected by `ConfidentialTransferInstruction::Transfer` and
422+
/// `ConfidentialTransferInstruction::TransferWithFee`
422423
#[derive(Clone, Copy, Pod, Zeroable)]
423424
#[repr(C)]
424425
pub struct TransferInstructionData {
@@ -429,17 +430,6 @@ pub struct TransferInstructionData {
429430
pub proof_instruction_offset: i8,
430431
}
431432

432-
/// Data expected by `ConfidentialTransferInstruction::TransferWithFee`
433-
#[derive(Clone, Copy, Pod, Zeroable)]
434-
#[repr(C)]
435-
pub struct TransferWithFeeInstructionData {
436-
/// The new source decryptable balance if the transfer succeeds
437-
pub new_source_decryptable_available_balance: DecryptableBalance,
438-
/// Relative location of the `ProofInstruction::VerifyTransfer` instruction to the
439-
/// `Transfer` instruction in the transaction
440-
pub proof_instruction_offset: i8,
441-
}
442-
443433
/// Data expected by `ConfidentialTransferInstruction::ApplyPendingBalance`
444434
#[derive(Clone, Copy, Pod, Zeroable)]
445435
#[repr(C)]
@@ -834,7 +824,7 @@ pub fn inner_transfer_with_fee(
834824
accounts,
835825
TokenInstruction::ConfidentialTransferExtension,
836826
ConfidentialTransferInstruction::TransferWithFee,
837-
&TransferWithFeeInstructionData {
827+
&TransferInstructionData {
838828
new_source_decryptable_available_balance,
839829
proof_instruction_offset,
840830
},

token/program-2022/src/extension/confidential_transfer/processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ pub(crate) fn process_instruction(
12361236
msg!("ConfidentialTransferInstruction::TransferWithFee");
12371237
#[cfg(feature = "zk-ops")]
12381238
{
1239-
let data = decode_instruction_data::<TransferWithFeeInstructionData>(input)?;
1239+
let data = decode_instruction_data::<TransferInstructionData>(input)?;
12401240
process_transfer(
12411241
program_id,
12421242
accounts,

0 commit comments

Comments
 (0)