@@ -8,6 +8,7 @@ use mpl_token_metadata::types::TokenStandard;
8
8
use std:: slice:: Iter ;
9
9
use tensor_vipers:: prelude:: * ;
10
10
11
+ use crate :: token_2022:: transfer:: transfer_checked as token_2022_transfer_checked;
11
12
use crate :: TensorError ;
12
13
13
14
pub const HUNDRED_PCT_BPS : u64 = 10000 ;
@@ -364,17 +365,40 @@ pub fn transfer_creators_fee<'a, 'info>(
364
365
} ,
365
366
) ) ?;
366
367
367
- anchor_spl:: token:: transfer (
368
- CpiContext :: new (
369
- token_program. to_account_info ( ) ,
370
- anchor_spl:: token:: Transfer {
371
- from : from_ata. to_account_info ( ) ,
372
- to : current_creator_ata_info. to_account_info ( ) ,
373
- authority : from. to_account_info ( ) ,
374
- } ,
375
- ) ,
376
- creator_fee,
377
- ) ?;
368
+ match token_program. key ( ) {
369
+ anchor_spl:: token:: ID => {
370
+ anchor_spl:: token:: transfer (
371
+ CpiContext :: new (
372
+ token_program. to_account_info ( ) ,
373
+ anchor_spl:: token:: Transfer {
374
+ from : from_ata. to_account_info ( ) ,
375
+ to : current_creator_ata_info. to_account_info ( ) ,
376
+ authority : from. to_account_info ( ) ,
377
+ } ,
378
+ ) ,
379
+ creator_fee,
380
+ ) ?;
381
+ }
382
+ anchor_spl:: token_interface:: ID => {
383
+ let mint = anchor_spl:: token_interface:: Mint :: try_deserialize (
384
+ & mut & currency. data . borrow ( ) [ ..] ,
385
+ ) ?;
386
+ token_2022_transfer_checked (
387
+ CpiContext :: new (
388
+ token_program. to_account_info ( ) ,
389
+ anchor_spl:: token_interface:: TransferChecked {
390
+ from : from_ata. to_account_info ( ) ,
391
+ mint : currency. to_account_info ( ) ,
392
+ to : current_creator_ata_info. to_account_info ( ) ,
393
+ authority : from. to_account_info ( ) ,
394
+ } ,
395
+ ) ,
396
+ creator_fee,
397
+ mint. decimals ,
398
+ ) ?;
399
+ }
400
+ _ => return Err ( ErrorCode :: InvalidProgramId . into ( ) ) ,
401
+ }
378
402
}
379
403
}
380
404
}
0 commit comments