30
30
transfer_fee:: TransferFeeConfig ,
31
31
} ,
32
32
solana_program:: { clock:: Clock , sysvar:: Sysvar } ,
33
- solana_zk_token_sdk:: zk_token_elgamal:: ops,
33
+ solana_zk_token_sdk:: zk_token_elgamal:: ops as syscall ,
34
34
} ;
35
35
36
36
/// Decodes the zero-knowledge proof instruction associated with the token instruction.
@@ -346,12 +346,12 @@ fn process_deposit(
346
346
// Prevent unnecessary ciphertext arithmetic syscalls if `amount_lo` or `amount_hi` is zero
347
347
if amount_lo > 0 {
348
348
confidential_transfer_account. pending_balance_lo =
349
- ops :: add_to ( & confidential_transfer_account. pending_balance_lo , amount_lo)
349
+ syscall :: add_to ( & confidential_transfer_account. pending_balance_lo , amount_lo)
350
350
. ok_or ( ProgramError :: InvalidInstructionData ) ?;
351
351
}
352
352
if amount_hi > 0 {
353
353
confidential_transfer_account. pending_balance_hi =
354
- ops :: add_to ( & confidential_transfer_account. pending_balance_hi , amount_hi)
354
+ syscall :: add_to ( & confidential_transfer_account. pending_balance_hi , amount_hi)
355
355
. ok_or ( ProgramError :: InvalidInstructionData ) ?;
356
356
}
357
357
@@ -447,7 +447,7 @@ fn process_withdraw(
447
447
// Prevent unnecessary ciphertext arithmetic syscalls if the withdraw amount is zero
448
448
if amount > 0 {
449
449
confidential_transfer_account. available_balance =
450
- ops :: subtract_from ( & confidential_transfer_account. available_balance , amount)
450
+ syscall :: subtract_from ( & confidential_transfer_account. available_balance , amount)
451
451
. ok_or ( ProgramError :: InvalidInstructionData ) ?;
452
452
}
453
453
// Check that the final available balance ciphertext is consistent with the actual ciphertext
@@ -695,7 +695,7 @@ fn process_source_for_transfer(
695
695
return Err ( TokenError :: ConfidentialTransferElGamalPubkeyMismatch . into ( ) ) ;
696
696
}
697
697
698
- let new_source_available_balance = ops :: subtract_with_lo_hi (
698
+ let new_source_available_balance = syscall :: subtract_with_lo_hi (
699
699
& confidential_transfer_account. available_balance ,
700
700
source_transfer_amount_lo,
701
701
source_transfer_amount_hi,
@@ -750,13 +750,13 @@ fn process_destination_for_transfer(
750
750
return Err ( TokenError :: ConfidentialTransferElGamalPubkeyMismatch . into ( ) ) ;
751
751
}
752
752
753
- destination_confidential_transfer_account. pending_balance_lo = ops :: add (
753
+ destination_confidential_transfer_account. pending_balance_lo = syscall :: add (
754
754
& destination_confidential_transfer_account. pending_balance_lo ,
755
755
destination_transfer_amount_lo,
756
756
)
757
757
. ok_or ( ProgramError :: InvalidInstructionData ) ?;
758
758
759
- destination_confidential_transfer_account. pending_balance_hi = ops :: add (
759
+ destination_confidential_transfer_account. pending_balance_hi = syscall :: add (
760
760
& destination_confidential_transfer_account. pending_balance_hi ,
761
761
destination_transfer_amount_hi,
762
762
)
@@ -779,12 +779,12 @@ fn process_destination_for_transfer(
779
779
. into ( ) ;
780
780
781
781
// Subtract the fee amount from the destination pending balance
782
- destination_confidential_transfer_account. pending_balance_lo = ops :: subtract (
782
+ destination_confidential_transfer_account. pending_balance_lo = syscall :: subtract (
783
783
& destination_confidential_transfer_account. pending_balance_lo ,
784
784
& destination_fee_lo,
785
785
)
786
786
. ok_or ( ProgramError :: InvalidInstructionData ) ?;
787
- destination_confidential_transfer_account. pending_balance_hi = ops :: subtract (
787
+ destination_confidential_transfer_account. pending_balance_hi = syscall :: subtract (
788
788
& destination_confidential_transfer_account. pending_balance_hi ,
789
789
& destination_fee_hi,
790
790
)
@@ -804,7 +804,7 @@ fn process_destination_for_transfer(
804
804
. into ( ) ;
805
805
806
806
// Add the fee amount to the destination withheld fee
807
- destination_confidential_transfer_account. withheld_amount = ops :: add_with_lo_hi (
807
+ destination_confidential_transfer_account. withheld_amount = syscall :: add_with_lo_hi (
808
808
& destination_confidential_transfer_account. withheld_amount ,
809
809
& withdraw_withheld_authority_fee_lo,
810
810
& withdraw_withheld_authority_fee_hi,
@@ -845,7 +845,7 @@ fn process_apply_pending_balance(
845
845
let mut confidential_transfer_account =
846
846
token_account. get_extension_mut :: < ConfidentialTransferAccount > ( ) ?;
847
847
848
- confidential_transfer_account. available_balance = ops :: add_with_lo_hi (
848
+ confidential_transfer_account. available_balance = syscall :: add_with_lo_hi (
849
849
& confidential_transfer_account. available_balance ,
850
850
& confidential_transfer_account. pending_balance_lo ,
851
851
& confidential_transfer_account. pending_balance_hi ,
@@ -1009,7 +1009,7 @@ fn process_withdraw_withheld_tokens_from_mint(
1009
1009
1010
1010
// The proof data contains the mint withheld amount encrypted under the destination ElGamal pubkey.
1011
1011
// This amount is added to the destination pending balance.
1012
- destination_confidential_transfer_account. pending_balance_lo = ops :: add (
1012
+ destination_confidential_transfer_account. pending_balance_lo = syscall :: add (
1013
1013
& destination_confidential_transfer_account. pending_balance_lo ,
1014
1014
& proof_data. destination_ciphertext ,
1015
1015
)
@@ -1078,7 +1078,7 @@ fn process_withdraw_withheld_tokens_from_accounts(
1078
1078
. get_extension_mut :: < ConfidentialTransferAccount > ( )
1079
1079
. map_err ( |_| TokenError :: InvalidState ) ?;
1080
1080
1081
- aggregate_withheld_amount = ops :: add (
1081
+ aggregate_withheld_amount = syscall :: add (
1082
1082
& aggregate_withheld_amount,
1083
1083
& confidential_transfer_destination_account. withheld_amount ,
1084
1084
)
@@ -1090,7 +1090,7 @@ fn process_withdraw_withheld_tokens_from_accounts(
1090
1090
match harvest_from_account ( mint_account_info. key , account_info) {
1091
1091
Ok ( encrypted_withheld_amount) => {
1092
1092
aggregate_withheld_amount =
1093
- ops :: add ( & aggregate_withheld_amount, & encrypted_withheld_amount)
1093
+ syscall :: add ( & aggregate_withheld_amount, & encrypted_withheld_amount)
1094
1094
. ok_or ( ProgramError :: InvalidInstructionData ) ?;
1095
1095
}
1096
1096
Err ( e) => {
@@ -1135,7 +1135,7 @@ fn process_withdraw_withheld_tokens_from_accounts(
1135
1135
1136
1136
// The proof data contains the mint withheld amount encrypted under the destination ElGamal pubkey.
1137
1137
// This amount is added to the destination pending balance.
1138
- destination_confidential_transfer_account. pending_balance_lo = ops :: add (
1138
+ destination_confidential_transfer_account. pending_balance_lo = syscall :: add (
1139
1139
& destination_confidential_transfer_account. pending_balance_lo ,
1140
1140
& proof_data. destination_ciphertext ,
1141
1141
)
@@ -1184,7 +1184,7 @@ fn process_harvest_withheld_tokens_to_mint(accounts: &[AccountInfo]) -> ProgramR
1184
1184
for token_account_info in token_account_infos {
1185
1185
match harvest_from_account ( mint_account_info. key , token_account_info) {
1186
1186
Ok ( withheld_amount) => {
1187
- let new_mint_withheld_amount = ops :: add (
1187
+ let new_mint_withheld_amount = syscall :: add (
1188
1188
& confidential_transfer_mint. withheld_amount ,
1189
1189
& withheld_amount,
1190
1190
)
0 commit comments