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

Commit c77a50b

Browse files
committed
use map_err(TokenError::from)
1 parent 99bd97b commit c77a50b

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ fn process_confidential_mint(
213213
let proof_context_auditor_ciphertext_lo = proof_context
214214
.mint_amount_ciphertext_lo
215215
.try_extract_ciphertext(2)
216-
.map_err(|e| -> TokenError { e.into() })?;
216+
.map_err(TokenError::from)?;
217217
let proof_context_auditor_ciphertext_hi = proof_context
218218
.mint_amount_ciphertext_hi
219219
.try_extract_ciphertext(2)
220-
.map_err(|e| -> TokenError { e.into() })?;
220+
.map_err(TokenError::from)?;
221221

222222
check_auditor_ciphertext(
223223
&data.mint_amount_auditor_ciphertext_lo,
@@ -231,15 +231,15 @@ fn process_confidential_mint(
231231
&proof_context
232232
.mint_amount_ciphertext_lo
233233
.try_extract_ciphertext(0)
234-
.map_err(|e| -> TokenError { e.into() })?,
234+
.map_err(TokenError::from)?,
235235
)
236236
.ok_or(TokenError::CiphertextArithmeticFailed)?;
237237
confidential_transfer_account.pending_balance_hi = ciphertext_arithmetic::add(
238238
&confidential_transfer_account.pending_balance_hi,
239239
&proof_context
240240
.mint_amount_ciphertext_hi
241241
.try_extract_ciphertext(0)
242-
.map_err(|e| -> TokenError { e.into() })?,
242+
.map_err(TokenError::from)?,
243243
)
244244
.ok_or(TokenError::CiphertextArithmeticFailed)?;
245245

@@ -330,11 +330,11 @@ fn process_confidential_burn(
330330
let proof_context_auditor_ciphertext_lo = proof_context
331331
.burn_amount_ciphertext_lo
332332
.try_extract_ciphertext(2)
333-
.map_err(|e| -> TokenError { e.into() })?;
333+
.map_err(TokenError::from)?;
334334
let proof_context_auditor_ciphertext_hi = proof_context
335335
.burn_amount_ciphertext_hi
336336
.try_extract_ciphertext(2)
337-
.map_err(|e| -> TokenError { e.into() })?;
337+
.map_err(TokenError::from)?;
338338

339339
check_auditor_ciphertext(
340340
&data.burn_amount_auditor_ciphertext_lo,
@@ -346,11 +346,11 @@ fn process_confidential_burn(
346346
let burn_amount_lo = &proof_context
347347
.burn_amount_ciphertext_lo
348348
.try_extract_ciphertext(0)
349-
.map_err(|e| -> TokenError { e.into() })?;
349+
.map_err(TokenError::from)?;
350350
let burn_amount_hi = &proof_context
351351
.burn_amount_ciphertext_hi
352352
.try_extract_ciphertext(0)
353-
.map_err(|e| -> TokenError { e.into() })?;
353+
.map_err(TokenError::from)?;
354354

355355
let new_source_available_balance = ciphertext_arithmetic::subtract_with_lo_hi(
356356
&confidential_transfer_account.available_balance,

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -729,11 +729,11 @@ fn process_transfer(
729729
let proof_context_auditor_ciphertext_lo = proof_context
730730
.ciphertext_lo
731731
.try_extract_ciphertext(2)
732-
.map_err(|e| -> TokenError { e.into() })?;
732+
.map_err(TokenError::from)?;
733733
let proof_context_auditor_ciphertext_hi = proof_context
734734
.ciphertext_hi
735735
.try_extract_ciphertext(2)
736-
.map_err(|e| -> TokenError { e.into() })?;
736+
.map_err(TokenError::from)?;
737737

738738
check_auditor_ciphertext(
739739
transfer_amount_auditor_ciphertext_lo,
@@ -852,11 +852,11 @@ fn process_source_for_transfer(
852852
let source_transfer_amount_lo = proof_context
853853
.ciphertext_lo
854854
.try_extract_ciphertext(0)
855-
.map_err(|e| -> TokenError { e.into() })?;
855+
.map_err(TokenError::from)?;
856856
let source_transfer_amount_hi = proof_context
857857
.ciphertext_hi
858858
.try_extract_ciphertext(0)
859-
.map_err(|e| -> TokenError { e.into() })?;
859+
.map_err(TokenError::from)?;
860860

861861
let new_source_available_balance = ciphertext_arithmetic::subtract_with_lo_hi(
862862
&confidential_transfer_account.available_balance,
@@ -914,11 +914,11 @@ fn process_destination_for_transfer(
914914
let destination_ciphertext_lo = proof_context
915915
.ciphertext_lo
916916
.try_extract_ciphertext(1)
917-
.map_err(|e| -> TokenError { e.into() })?;
917+
.map_err(TokenError::from)?;
918918
let destination_ciphertext_hi = proof_context
919919
.ciphertext_hi
920920
.try_extract_ciphertext(1)
921-
.map_err(|e| -> TokenError { e.into() })?;
921+
.map_err(TokenError::from)?;
922922

923923
destination_confidential_transfer_account.pending_balance_lo = ciphertext_arithmetic::add(
924924
&destination_confidential_transfer_account.pending_balance_lo,
@@ -990,11 +990,11 @@ fn process_source_for_transfer_with_fee(
990990
let source_transfer_amount_lo = proof_context
991991
.ciphertext_lo
992992
.try_extract_ciphertext(0)
993-
.map_err(|e| -> TokenError { e.into() })?;
993+
.map_err(TokenError::from)?;
994994
let source_transfer_amount_hi = proof_context
995995
.ciphertext_hi
996996
.try_extract_ciphertext(0)
997-
.map_err(|e| -> TokenError { e.into() })?;
997+
.map_err(TokenError::from)?;
998998

999999
let new_source_available_balance = ciphertext_arithmetic::subtract_with_lo_hi(
10001000
&confidential_transfer_account.available_balance,
@@ -1053,11 +1053,11 @@ fn process_destination_for_transfer_with_fee(
10531053
let destination_transfer_amount_lo = proof_context
10541054
.ciphertext_lo
10551055
.try_extract_ciphertext(1)
1056-
.map_err(|e| -> TokenError { e.into() })?;
1056+
.map_err(TokenError::from)?;
10571057
let destination_transfer_amount_hi = proof_context
10581058
.ciphertext_hi
10591059
.try_extract_ciphertext(1)
1060-
.map_err(|e| -> TokenError { e.into() })?;
1060+
.map_err(TokenError::from)?;
10611061

10621062
destination_confidential_transfer_account.pending_balance_lo = ciphertext_arithmetic::add(
10631063
&destination_confidential_transfer_account.pending_balance_lo,
@@ -1080,11 +1080,11 @@ fn process_destination_for_transfer_with_fee(
10801080
let destination_fee_lo = proof_context
10811081
.fee_ciphertext_lo
10821082
.try_extract_ciphertext(0)
1083-
.map_err(|e| -> TokenError { e.into() })?;
1083+
.map_err(TokenError::from)?;
10841084
let destination_fee_hi = proof_context
10851085
.fee_ciphertext_hi
10861086
.try_extract_ciphertext(0)
1087-
.map_err(|e| -> TokenError { e.into() })?;
1087+
.map_err(TokenError::from)?;
10881088

10891089
// Subtract the fee amount from the destination pending balance
10901090
destination_confidential_transfer_account.pending_balance_lo =
@@ -1105,11 +1105,11 @@ fn process_destination_for_transfer_with_fee(
11051105
let withdraw_withheld_authority_fee_lo = proof_context
11061106
.fee_ciphertext_lo
11071107
.try_extract_ciphertext(1)
1108-
.map_err(|e| -> TokenError { e.into() })?;
1108+
.map_err(TokenError::from)?;
11091109
let withdraw_withheld_authority_fee_hi = proof_context
11101110
.fee_ciphertext_hi
11111111
.try_extract_ciphertext(1)
1112-
.map_err(|e| -> TokenError { e.into() })?;
1112+
.map_err(TokenError::from)?;
11131113

11141114
let destination_confidential_transfer_fee_amount =
11151115
destination_token_account.get_extension_mut::<ConfidentialTransferFeeAmount>()?;

0 commit comments

Comments
 (0)