@@ -512,7 +512,7 @@ async fn process_exchange_deposit<T: Signers>(
512
512
. into ( ) ) ;
513
513
}
514
514
515
- let ( mut instructions, amount) = match token. token ( ) {
515
+ let ( mut instructions, amount, compute_units ) = match token. token ( ) {
516
516
/*SOL*/
517
517
None => {
518
518
assert_eq ! ( from_account. lamports, from_account_balance) ;
@@ -533,6 +533,7 @@ async fn process_exchange_deposit<T: Signers>(
533
533
amount,
534
534
) ] ,
535
535
amount,
536
+ 1_000 ,
536
537
)
537
538
} else if from_account. owner == solana_vote_program:: id ( ) {
538
539
let minimum_balance = rpc_client. get_minimum_balance_for_rent_exemption (
@@ -550,6 +551,7 @@ async fn process_exchange_deposit<T: Signers>(
550
551
& deposit_address,
551
552
) ] ,
552
553
amount,
554
+ 1_000 ,
553
555
)
554
556
} else if from_account. owner == solana_sdk:: stake:: program:: id ( ) {
555
557
let amount = amount. unwrap_or ( from_account_balance) ;
@@ -563,6 +565,7 @@ async fn process_exchange_deposit<T: Signers>(
563
565
None ,
564
566
) ] ,
565
567
amount,
568
+ 1_000 ,
566
569
)
567
570
} else {
568
571
return Err (
@@ -575,6 +578,8 @@ async fn process_exchange_deposit<T: Signers>(
575
578
576
579
let mut instructions = vec ! [ ] ;
577
580
581
+ let mut compute_units = 5_000 ;
582
+
578
583
if rpc_client
579
584
. get_account_with_commitment ( & token. ata ( & deposit_address) , rpc_client. commitment ( ) ) ?
580
585
. value
@@ -588,6 +593,7 @@ async fn process_exchange_deposit<T: Signers>(
588
593
& spl_token:: id ( ) ,
589
594
) ,
590
595
) ;
596
+ compute_units += 20_000
591
597
}
592
598
593
599
instructions. push (
@@ -604,10 +610,10 @@ async fn process_exchange_deposit<T: Signers>(
604
610
. unwrap ( ) ,
605
611
) ;
606
612
607
- ( instructions, amount)
613
+ ( instructions, amount, compute_units )
608
614
}
609
615
} ;
610
- apply_priority_fee ( rpc_client, & mut instructions, 20_000 , priority_fee) ?;
616
+ apply_priority_fee ( rpc_client, & mut instructions, compute_units , priority_fee) ?;
611
617
612
618
if amount == 0 {
613
619
return Err ( "Nothing to deposit" . into ( ) ) ;
0 commit comments