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

Commit 253c2d7

Browse files
committed
make instruction constructor function parameters consistent
1 parent 77821a3 commit 253c2d7

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use {
2626
#[cfg(not(target_os = "solana"))]
2727
use {
2828
solana_zk_sdk::{
29-
encryption::{auth_encryption::AeCiphertext, elgamal::ElGamalPubkey},
29+
encryption::elgamal::ElGamalPubkey,
3030
zk_elgamal_proof_program::{
3131
instruction::ProofInstruction,
3232
proof_data::{
@@ -291,8 +291,8 @@ pub struct BurnInstructionData {
291291
pub fn initialize_mint(
292292
token_program_id: &Pubkey,
293293
mint: &Pubkey,
294-
supply_elgamal_pubkey: PodElGamalPubkey,
295-
decryptable_supply: PodAeCiphertext,
294+
supply_elgamal_pubkey: &PodElGamalPubkey,
295+
decryptable_supply: &DecryptableBalance,
296296
) -> Result<Instruction, ProgramError> {
297297
check_program_account(token_program_id)?;
298298
let accounts = vec![AccountMeta::new(*mint, false)];
@@ -303,8 +303,8 @@ pub fn initialize_mint(
303303
TokenInstruction::ConfidentialMintBurnExtension,
304304
ConfidentialMintBurnInstruction::InitializeMint,
305305
&InitializeMintData {
306-
supply_elgamal_pubkey,
307-
decryptable_supply,
306+
supply_elgamal_pubkey: *supply_elgamal_pubkey,
307+
decryptable_supply: *decryptable_supply,
308308
},
309309
))
310310
}
@@ -317,7 +317,7 @@ pub fn rotate_supply_elgamal_pubkey(
317317
mint: &Pubkey,
318318
authority: &Pubkey,
319319
multisig_signers: &[&Pubkey],
320-
new_supply_elgamal_pubkey: ElGamalPubkey,
320+
new_supply_elgamal_pubkey: &PodElGamalPubkey,
321321
ciphertext_equality_proof: ProofLocation<CiphertextCiphertextEqualityProofData>,
322322
) -> Result<Vec<Instruction>, ProgramError> {
323323
check_program_account(token_program_id)?;
@@ -349,7 +349,7 @@ pub fn rotate_supply_elgamal_pubkey(
349349
TokenInstruction::ConfidentialMintBurnExtension,
350350
ConfidentialMintBurnInstruction::RotateSupplyElGamalPubkey,
351351
&RotateSupplyElGamalPubkeyData {
352-
new_supply_elgamal_pubkey: PodElGamalPubkey::from(new_supply_elgamal_pubkey),
352+
new_supply_elgamal_pubkey: *new_supply_elgamal_pubkey,
353353
proof_instruction_offset,
354354
},
355355
)];
@@ -366,7 +366,7 @@ pub fn update_decryptable_supply(
366366
mint: &Pubkey,
367367
authority: &Pubkey,
368368
multisig_signers: &[&Pubkey],
369-
new_decryptable_supply: AeCiphertext,
369+
new_decryptable_supply: &DecryptableBalance,
370370
) -> Result<Instruction, ProgramError> {
371371
check_program_account(token_program_id)?;
372372
let mut accounts = vec![
@@ -382,7 +382,7 @@ pub fn update_decryptable_supply(
382382
TokenInstruction::ConfidentialMintBurnExtension,
383383
ConfidentialMintBurnInstruction::UpdateDecryptableSupply,
384384
&UpdateDecryptableSupplyData {
385-
new_decryptable_supply: new_decryptable_supply.into(),
385+
new_decryptable_supply: *new_decryptable_supply,
386386
},
387387
))
388388
}
@@ -417,7 +417,7 @@ pub fn confidential_mint_with_split_proofs(
417417
BatchedGroupedCiphertext3HandlesValidityProofData,
418418
>,
419419
range_proof_location: ProofLocation<BatchedRangeProofU128Data>,
420-
new_decryptable_supply: AeCiphertext,
420+
new_decryptable_supply: &DecryptableBalance,
421421
) -> Result<Vec<Instruction>, ProgramError> {
422422
check_program_account(token_program_id)?;
423423
let mut accounts = vec![AccountMeta::new(*token_account, false)];
@@ -473,7 +473,7 @@ pub fn confidential_mint_with_split_proofs(
473473
TokenInstruction::ConfidentialMintBurnExtension,
474474
ConfidentialMintBurnInstruction::Mint,
475475
&MintInstructionData {
476-
new_decryptable_supply: new_decryptable_supply.into(),
476+
new_decryptable_supply: *new_decryptable_supply,
477477
mint_amount_auditor_ciphertext_lo: *mint_amount_auditor_ciphertext_lo,
478478
mint_amount_auditor_ciphertext_hi: *mint_amount_auditor_ciphertext_hi,
479479
equality_proof_instruction_offset,
@@ -495,7 +495,7 @@ pub fn confidential_burn_with_split_proofs(
495495
token_account: &Pubkey,
496496
mint: &Pubkey,
497497
supply_elgamal_pubkey: Option<ElGamalPubkey>,
498-
new_decryptable_available_balance: DecryptableBalance,
498+
new_decryptable_available_balance: &DecryptableBalance,
499499
burn_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
500500
burn_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
501501
authority: &Pubkey,
@@ -559,7 +559,7 @@ pub fn confidential_burn_with_split_proofs(
559559
TokenInstruction::ConfidentialMintBurnExtension,
560560
ConfidentialMintBurnInstruction::Burn,
561561
&BurnInstructionData {
562-
new_decryptable_available_balance,
562+
new_decryptable_available_balance: *new_decryptable_available_balance,
563563
burn_amount_auditor_ciphertext_lo: *burn_amount_auditor_ciphertext_lo,
564564
burn_amount_auditor_ciphertext_hi: *burn_amount_auditor_ciphertext_hi,
565565
equality_proof_instruction_offset,

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ pub fn inner_configure_account(
760760
token_program_id: &Pubkey,
761761
token_account: &Pubkey,
762762
mint: &Pubkey,
763-
decryptable_zero_balance: PodAeCiphertext,
763+
decryptable_zero_balance: &DecryptableBalance,
764764
maximum_pending_balance_credit_counter: u64,
765765
authority: &Pubkey,
766766
multisig_signers: &[&Pubkey],
@@ -802,7 +802,7 @@ pub fn inner_configure_account(
802802
TokenInstruction::ConfidentialTransferExtension,
803803
ConfidentialTransferInstruction::ConfigureAccount,
804804
&ConfigureAccountInstructionData {
805-
decryptable_zero_balance,
805+
decryptable_zero_balance: *decryptable_zero_balance,
806806
maximum_pending_balance_credit_counter: maximum_pending_balance_credit_counter.into(),
807807
proof_instruction_offset,
808808
},
@@ -815,7 +815,7 @@ pub fn configure_account(
815815
token_program_id: &Pubkey,
816816
token_account: &Pubkey,
817817
mint: &Pubkey,
818-
decryptable_zero_balance: PodAeCiphertext,
818+
decryptable_zero_balance: &DecryptableBalance,
819819
maximum_pending_balance_credit_counter: u64,
820820
authority: &Pubkey,
821821
multisig_signers: &[&Pubkey],
@@ -1013,7 +1013,7 @@ pub fn inner_withdraw(
10131013
mint: &Pubkey,
10141014
amount: u64,
10151015
decimals: u8,
1016-
new_decryptable_available_balance: DecryptableBalance,
1016+
new_decryptable_available_balance: &DecryptableBalance,
10171017
authority: &Pubkey,
10181018
multisig_signers: &[&Pubkey],
10191019
equality_proof_data_location: ProofLocation<CiphertextCommitmentEqualityProofData>,
@@ -1076,7 +1076,7 @@ pub fn inner_withdraw(
10761076
&WithdrawInstructionData {
10771077
amount: amount.into(),
10781078
decimals,
1079-
new_decryptable_available_balance,
1079+
new_decryptable_available_balance: *new_decryptable_available_balance,
10801080
equality_proof_instruction_offset,
10811081
range_proof_instruction_offset,
10821082
},
@@ -1091,7 +1091,7 @@ pub fn withdraw(
10911091
mint: &Pubkey,
10921092
amount: u64,
10931093
decimals: u8,
1094-
new_decryptable_available_balance: PodAeCiphertext,
1094+
new_decryptable_available_balance: &DecryptableBalance,
10951095
authority: &Pubkey,
10961096
multisig_signers: &[&Pubkey],
10971097
equality_proof_data_location: ProofLocation<CiphertextCommitmentEqualityProofData>,
@@ -1162,7 +1162,7 @@ pub fn inner_transfer(
11621162
source_token_account: &Pubkey,
11631163
mint: &Pubkey,
11641164
destination_token_account: &Pubkey,
1165-
new_source_decryptable_available_balance: DecryptableBalance,
1165+
new_source_decryptable_available_balance: &DecryptableBalance,
11661166
transfer_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
11671167
transfer_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
11681168
authority: &Pubkey,
@@ -1244,7 +1244,7 @@ pub fn inner_transfer(
12441244
TokenInstruction::ConfidentialTransferExtension,
12451245
ConfidentialTransferInstruction::Transfer,
12461246
&TransferInstructionData {
1247-
new_source_decryptable_available_balance,
1247+
new_source_decryptable_available_balance: *new_source_decryptable_available_balance,
12481248
transfer_amount_auditor_ciphertext_lo: *transfer_amount_auditor_ciphertext_lo,
12491249
transfer_amount_auditor_ciphertext_hi: *transfer_amount_auditor_ciphertext_hi,
12501250
equality_proof_instruction_offset,
@@ -1261,7 +1261,7 @@ pub fn transfer(
12611261
source_token_account: &Pubkey,
12621262
mint: &Pubkey,
12631263
destination_token_account: &Pubkey,
1264-
new_source_decryptable_available_balance: DecryptableBalance,
1264+
new_source_decryptable_available_balance: &DecryptableBalance,
12651265
transfer_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
12661266
transfer_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
12671267
authority: &Pubkey,
@@ -1359,7 +1359,7 @@ pub fn inner_apply_pending_balance(
13591359
token_program_id: &Pubkey,
13601360
token_account: &Pubkey,
13611361
expected_pending_balance_credit_counter: u64,
1362-
new_decryptable_available_balance: DecryptableBalance,
1362+
new_decryptable_available_balance: &DecryptableBalance,
13631363
authority: &Pubkey,
13641364
multisig_signers: &[&Pubkey],
13651365
) -> Result<Instruction, ProgramError> {
@@ -1380,7 +1380,7 @@ pub fn inner_apply_pending_balance(
13801380
ConfidentialTransferInstruction::ApplyPendingBalance,
13811381
&ApplyPendingBalanceData {
13821382
expected_pending_balance_credit_counter: expected_pending_balance_credit_counter.into(),
1383-
new_decryptable_available_balance,
1383+
new_decryptable_available_balance: *new_decryptable_available_balance,
13841384
},
13851385
))
13861386
}
@@ -1390,7 +1390,7 @@ pub fn apply_pending_balance(
13901390
token_program_id: &Pubkey,
13911391
token_account: &Pubkey,
13921392
pending_balance_instructions: u64,
1393-
new_decryptable_available_balance: PodAeCiphertext,
1393+
new_decryptable_available_balance: &DecryptableBalance,
13941394
authority: &Pubkey,
13951395
multisig_signers: &[&Pubkey],
13961396
) -> Result<Instruction, ProgramError> {
@@ -1503,7 +1503,7 @@ pub fn inner_transfer_with_fee(
15031503
source_token_account: &Pubkey,
15041504
mint: &Pubkey,
15051505
destination_token_account: &Pubkey,
1506-
new_source_decryptable_available_balance: DecryptableBalance,
1506+
new_source_decryptable_available_balance: &DecryptableBalance,
15071507
transfer_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
15081508
transfer_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
15091509
authority: &Pubkey,
@@ -1618,7 +1618,7 @@ pub fn inner_transfer_with_fee(
16181618
TokenInstruction::ConfidentialTransferExtension,
16191619
ConfidentialTransferInstruction::TransferWithFee,
16201620
&TransferWithFeeInstructionData {
1621-
new_source_decryptable_available_balance,
1621+
new_source_decryptable_available_balance: *new_source_decryptable_available_balance,
16221622
transfer_amount_auditor_ciphertext_lo: *transfer_amount_auditor_ciphertext_lo,
16231623
transfer_amount_auditor_ciphertext_hi: *transfer_amount_auditor_ciphertext_hi,
16241624
equality_proof_instruction_offset,
@@ -1637,7 +1637,7 @@ pub fn transfer_with_fee(
16371637
source_token_account: &Pubkey,
16381638
mint: &Pubkey,
16391639
destination_token_account: &Pubkey,
1640-
new_source_decryptable_available_balance: DecryptableBalance,
1640+
new_source_decryptable_available_balance: &DecryptableBalance,
16411641
transfer_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
16421642
transfer_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
16431643
authority: &Pubkey,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub fn initialize_confidential_transfer_fee_config(
275275
token_program_id: &Pubkey,
276276
mint: &Pubkey,
277277
authority: Option<Pubkey>,
278-
withdraw_withheld_authority_elgamal_pubkey: PodElGamalPubkey,
278+
withdraw_withheld_authority_elgamal_pubkey: &PodElGamalPubkey,
279279
) -> Result<Instruction, ProgramError> {
280280
check_program_account(token_program_id)?;
281281
let accounts = vec![AccountMeta::new(*mint, false)];
@@ -287,7 +287,7 @@ pub fn initialize_confidential_transfer_fee_config(
287287
ConfidentialTransferFeeInstruction::InitializeConfidentialTransferFeeConfig,
288288
&InitializeConfidentialTransferFeeConfigData {
289289
authority: authority.try_into()?,
290-
withdraw_withheld_authority_elgamal_pubkey,
290+
withdraw_withheld_authority_elgamal_pubkey: *withdraw_withheld_authority_elgamal_pubkey,
291291
},
292292
))
293293
}

0 commit comments

Comments
 (0)