Skip to content

Commit 001ca85

Browse files
author
Edward (OpenClaw)
committed
refactor(asset-leasing): alias SPL_TOKEN_PROGRAM_ID to TOKEN_PROGRAM_ID in tests
On Solana, 'token' is the default — the 'SPL' prefix is only meaningful when contrasting with the native token (SOL). The upstream quasar-svm crate exports the constant as SPL_TOKEN_PROGRAM_ID; since we can't rename that without touching the dependency, we alias it on import and use the clean TOKEN_PROGRAM_ID name throughout the test module. 12 tests still pass.
1 parent 33f5ef7 commit 001ca85

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

defi/asset-leasing/quasar/src/tests.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ extern crate std;
1313

1414
use {
1515
alloc::{vec, vec::Vec},
16+
// Alias the SPL-prefixed constant away: on Solana, "token" is the default;
17+
// the "SPL" qualifier is only useful when contrasting with the native token (SOL).
18+
quasar_svm::SPL_TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID,
1619
quasar_svm::{Account, Instruction, Pubkey, QuasarSvm},
1720
solana_instruction::AccountMeta,
1821
spl_token_interface::state::{Account as TokenAccount, AccountState, Mint},
@@ -272,7 +275,7 @@ fn create_lease_call(sc: &Scenario, lease_id: u64) -> (Instruction, Vec<Account>
272275
AccountMeta::new(sc.leased_vault, false),
273276
AccountMeta::new(sc.collateral_vault, false),
274277
AccountMeta::new_readonly(quasar_svm::solana_sdk_ids::sysvar::rent::ID, false),
275-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
278+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
276279
AccountMeta::new_readonly(quasar_svm::system_program::ID, false),
277280
],
278281
data: build_create_lease_data(
@@ -349,7 +352,7 @@ fn create_lease_call_with_mints(
349352
AccountMeta::new(sc.leased_vault, false),
350353
AccountMeta::new(sc.collateral_vault, false),
351354
AccountMeta::new_readonly(quasar_svm::solana_sdk_ids::sysvar::rent::ID, false),
352-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
355+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
353356
AccountMeta::new_readonly(quasar_svm::system_program::ID, false),
354357
],
355358
data: build_create_lease_data(
@@ -435,7 +438,7 @@ fn take_lease_call(sc: &Scenario) -> (Instruction, Vec<Account>) {
435438
AccountMeta::new(sc.collateral_vault, false),
436439
AccountMeta::new(sc.lessee_collateral_ta, false),
437440
AccountMeta::new(sc.lessee_leased_ta, false),
438-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
441+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
439442
],
440443
data: vec![1u8], // discriminator = take_lease
441444
};
@@ -467,7 +470,7 @@ fn pay_rent_call(sc: &Scenario) -> (Instruction, Vec<Account>) {
467470
AccountMeta::new_readonly(sc.collateral_mint, false),
468471
AccountMeta::new(sc.collateral_vault, false),
469472
AccountMeta::new(sc.lessor_collateral_ta, false),
470-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
473+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
471474
],
472475
data: vec![2u8],
473476
};
@@ -492,7 +495,7 @@ fn top_up_call(sc: &Scenario, amount: u64) -> (Instruction, Vec<Account>) {
492495
AccountMeta::new_readonly(sc.collateral_mint, false),
493496
AccountMeta::new(sc.collateral_vault, false),
494497
AccountMeta::new(sc.lessee_collateral_ta, false),
495-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
498+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
496499
],
497500
data,
498501
};
@@ -519,7 +522,7 @@ fn return_lease_call(sc: &Scenario) -> (Instruction, Vec<Account>) {
519522
AccountMeta::new(sc.lessee_collateral_ta, false),
520523
AccountMeta::new(sc.lessor_leased_ta, false),
521524
AccountMeta::new(sc.lessor_collateral_ta, false),
522-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
525+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
523526
],
524527
data: vec![4u8],
525528
};
@@ -547,7 +550,7 @@ fn liquidate_call(sc: &Scenario, price_update: Pubkey) -> (Instruction, Vec<Acco
547550
AccountMeta::new(sc.lessor_collateral_ta, false),
548551
AccountMeta::new(sc.keeper_collateral_ta, false),
549552
AccountMeta::new_readonly(price_update, false),
550-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
553+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
551554
],
552555
data: vec![5u8],
553556
};
@@ -574,7 +577,7 @@ fn close_expired_call(sc: &Scenario) -> (Instruction, Vec<Account>) {
574577
AccountMeta::new(sc.collateral_vault, false),
575578
AccountMeta::new(sc.lessor_leased_ta, false),
576579
AccountMeta::new(sc.lessor_collateral_ta, false),
577-
AccountMeta::new_readonly(quasar_svm::SPL_TOKEN_PROGRAM_ID, false),
580+
AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false),
578581
],
579582
data: vec![6u8],
580583
};

0 commit comments

Comments
 (0)