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

Commit 7a27029

Browse files
remove transfer with fee instruction (#3766)
1 parent 0c8fb24 commit 7a27029

File tree

2 files changed

+4
-83
lines changed

2 files changed

+4
-83
lines changed

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

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -201,28 +201,6 @@ pub enum ConfidentialTransferInstruction {
201201
///
202202
Transfer,
203203

204-
/// Transfer tokens confidentially with fee.
205-
///
206-
/// * Single owner/delegate
207-
/// 1. `[writable]` The source SPL Token account.
208-
/// 2. `[writable]` The destination SPL Token account.
209-
/// 3. `[]` The token mint.
210-
/// 4. `[]` Instructions sysvar.
211-
/// 5. `[signer]` The single source account owner.
212-
///
213-
/// * Multisignature owner/delegate
214-
/// 1. `[writable]` The source SPL Token account.
215-
/// 2. `[writable]` The destination SPL Token account.
216-
/// 3. `[]` The token mint.
217-
/// 4. `[]` Instructions sysvar.
218-
/// 5. `[]` The multisig source account owner.
219-
/// 6.. `[signer]` Required M signer accounts for the SPL Token Multisig account.
220-
///
221-
/// Data expected by this instruction:
222-
/// `TransferInstructionData`
223-
///
224-
TransferWithFee,
225-
226204
/// Applies the pending balance to the available balance, based on the history of `Deposit`
227205
/// and/or `Transfer` instructions.
228206
///
@@ -418,8 +396,7 @@ pub struct WithdrawInstructionData {
418396
pub proof_instruction_offset: i8,
419397
}
420398

421-
/// Data expected by `ConfidentialTransferInstruction::Transfer` and
422-
/// `ConfidentialTransferInstruction::TransferWithFee`
399+
/// Data expected by `ConfidentialTransferInstruction::Transfer`
423400
#[derive(Clone, Copy, Pod, Zeroable)]
424401
#[repr(C)]
425402
pub struct TransferInstructionData {
@@ -758,7 +735,7 @@ pub fn inner_transfer(
758735
))
759736
}
760737

761-
/// Create a `Transfer` instruction
738+
/// Create a `Transfer` instruction with regular (no-fee) proof
762739
#[allow(clippy::too_many_arguments)]
763740
#[cfg(not(target_os = "solana"))]
764741
pub fn transfer(
@@ -786,46 +763,7 @@ pub fn transfer(
786763
])
787764
}
788765

789-
/// Create a inner `TransferWithFee` instruction
790-
///
791-
/// This instruction is suitable for use with a cross-program `invoke`
792-
#[allow(clippy::too_many_arguments)]
793-
pub fn inner_transfer_with_fee(
794-
token_program_id: &Pubkey,
795-
source_token_account: &Pubkey,
796-
destination_token_account: &Pubkey,
797-
mint: &Pubkey,
798-
new_source_decryptable_available_balance: DecryptableBalance,
799-
authority: &Pubkey,
800-
multisig_signers: &[&Pubkey],
801-
proof_instruction_offset: i8,
802-
) -> Result<Instruction, ProgramError> {
803-
check_program_account(token_program_id)?;
804-
let mut accounts = vec![
805-
AccountMeta::new(*source_token_account, false),
806-
AccountMeta::new(*destination_token_account, false),
807-
AccountMeta::new_readonly(*mint, false),
808-
AccountMeta::new_readonly(sysvar::instructions::id(), false),
809-
AccountMeta::new_readonly(*authority, multisig_signers.is_empty()),
810-
];
811-
812-
for multisig_signer in multisig_signers.iter() {
813-
accounts.push(AccountMeta::new_readonly(**multisig_signer, true));
814-
}
815-
816-
Ok(encode_instruction(
817-
token_program_id,
818-
accounts,
819-
TokenInstruction::ConfidentialTransferExtension,
820-
ConfidentialTransferInstruction::TransferWithFee,
821-
&TransferInstructionData {
822-
new_source_decryptable_available_balance,
823-
proof_instruction_offset,
824-
},
825-
))
826-
}
827-
828-
/// Create a `Transfer` instruction
766+
/// Create a `Transfer` instruction with fee proof
829767
#[allow(clippy::too_many_arguments)]
830768
#[cfg(not(target_os = "solana"))]
831769
pub fn transfer_with_fee(
@@ -839,7 +777,7 @@ pub fn transfer_with_fee(
839777
proof_data: &TransferWithFeeData,
840778
) -> Result<Vec<Instruction>, ProgramError> {
841779
Ok(vec![
842-
inner_transfer_with_fee(
780+
inner_transfer(
843781
token_program_id,
844782
source_token_account,
845783
destination_token_account,

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,23 +1208,6 @@ pub(crate) fn process_instruction(
12081208
#[cfg(not(feature = "zk-ops"))]
12091209
Err(ProgramError::InvalidInstructionData)
12101210
}
1211-
ConfidentialTransferInstruction::TransferWithFee => {
1212-
msg!("ConfidentialTransferInstruction::TransferWithFee");
1213-
#[cfg(feature = "zk-ops")]
1214-
{
1215-
let data = decode_instruction_data::<TransferInstructionData>(input)?;
1216-
process_transfer(
1217-
program_id,
1218-
accounts,
1219-
data.new_source_decryptable_available_balance,
1220-
data.proof_instruction_offset as i64,
1221-
)
1222-
}
1223-
#[cfg(not(feature = "zk-ops"))]
1224-
{
1225-
Err(ProgramError::InvalidInstructionData)
1226-
}
1227-
}
12281211
ConfidentialTransferInstruction::ApplyPendingBalance => {
12291212
msg!("ConfidentialTransferInstruction::ApplyPendingBalance");
12301213
#[cfg(feature = "zk-ops")]

0 commit comments

Comments
 (0)