|
3 | 3 | use crate::extension::transfer_hook;
|
4 | 4 | #[cfg(feature = "zk-ops")]
|
5 | 5 | use {
|
6 |
| - crate::extension::non_transferable::NonTransferable, |
| 6 | + crate::extension::non_transferable::NonTransferableAccount, |
7 | 7 | solana_zk_token_sdk::zk_token_elgamal::ops as syscall,
|
8 | 8 | };
|
9 | 9 | use {
|
@@ -269,13 +269,15 @@ fn process_deposit(
|
269 | 269 | return Err(TokenError::MintDecimalsMismatch.into());
|
270 | 270 | }
|
271 | 271 |
|
272 |
| - if mint.get_extension::<NonTransferable>().is_ok() { |
273 |
| - return Err(TokenError::NonTransferable.into()); |
274 |
| - } |
275 |
| - |
276 | 272 | check_program_account(token_account_info.owner)?;
|
277 | 273 | let token_account_data = &mut token_account_info.data.borrow_mut();
|
278 | 274 | let mut token_account = PodStateWithExtensionsMut::<PodAccount>::unpack(token_account_data)?;
|
| 275 | + if token_account |
| 276 | + .get_extension::<NonTransferableAccount>() |
| 277 | + .is_ok() |
| 278 | + { |
| 279 | + return Err(TokenError::NonTransferable.into()); |
| 280 | + } |
279 | 281 |
|
280 | 282 | Processor::validate_owner(
|
281 | 283 | program_id,
|
@@ -367,13 +369,15 @@ fn process_withdraw(
|
367 | 369 | return Err(TokenError::MintDecimalsMismatch.into());
|
368 | 370 | }
|
369 | 371 |
|
370 |
| - if mint.get_extension::<NonTransferable>().is_ok() { |
371 |
| - return Err(TokenError::NonTransferable.into()); |
372 |
| - } |
373 |
| - |
374 | 372 | check_program_account(token_account_info.owner)?;
|
375 | 373 | let token_account_data = &mut token_account_info.data.borrow_mut();
|
376 | 374 | let mut token_account = PodStateWithExtensionsMut::<PodAccount>::unpack(token_account_data)?;
|
| 375 | + if token_account |
| 376 | + .get_extension::<NonTransferableAccount>() |
| 377 | + .is_ok() |
| 378 | + { |
| 379 | + return Err(TokenError::NonTransferable.into()); |
| 380 | + } |
377 | 381 |
|
378 | 382 | Processor::validate_owner(
|
379 | 383 | program_id,
|
@@ -450,9 +454,6 @@ fn process_transfer(
|
450 | 454 | let mint_data = mint_info.data.borrow_mut();
|
451 | 455 | let mint = PodStateWithExtensions::<PodMint>::unpack(&mint_data)?;
|
452 | 456 |
|
453 |
| - if mint.get_extension::<NonTransferable>().is_ok() { |
454 |
| - return Err(TokenError::NonTransferable.into()); |
455 |
| - } |
456 | 457 | let confidential_transfer_mint = mint.get_extension::<ConfidentialTransferMint>()?;
|
457 | 458 |
|
458 | 459 | // A `Transfer` instruction must be accompanied by a zero-knowledge proof
|
@@ -677,6 +678,12 @@ fn process_source_for_transfer(
|
677 | 678 | let authority_info_data_len = authority_info.data_len();
|
678 | 679 | let token_account_data = &mut source_account_info.data.borrow_mut();
|
679 | 680 | let mut token_account = PodStateWithExtensionsMut::<PodAccount>::unpack(token_account_data)?;
|
| 681 | + if token_account |
| 682 | + .get_extension::<NonTransferableAccount>() |
| 683 | + .is_ok() |
| 684 | + { |
| 685 | + return Err(TokenError::NonTransferable.into()); |
| 686 | + } |
680 | 687 |
|
681 | 688 | Processor::validate_owner(
|
682 | 689 | program_id,
|
@@ -803,6 +810,12 @@ fn process_source_for_transfer_with_fee(
|
803 | 810 | let authority_info_data_len = authority_info.data_len();
|
804 | 811 | let token_account_data = &mut source_account_info.data.borrow_mut();
|
805 | 812 | let mut token_account = PodStateWithExtensionsMut::<PodAccount>::unpack(token_account_data)?;
|
| 813 | + if token_account |
| 814 | + .get_extension::<NonTransferableAccount>() |
| 815 | + .is_ok() |
| 816 | + { |
| 817 | + return Err(TokenError::NonTransferable.into()); |
| 818 | + } |
806 | 819 |
|
807 | 820 | Processor::validate_owner(
|
808 | 821 | program_id,
|
|
0 commit comments