Commit f107365
committed
test(token-swap): add comprehensive quasar integration tests
Adds 11 new integration tests using QuasarSvm covering all 6 instruction
handlers: create_pool, deposit_liquidity (initial, subsequent, insufficient),
withdraw_liquidity, swap_tokens (A→B, B→A, slippage guard), and
claim_admin_fees (happy path + unauthorised rejection).
Key correctness points:
- Non-PDA init(idempotent) accounts (pool_a/b, lp_token, recv_a/b, token_out)
need is_signer=true in AccountMeta so the inner create_account/allocate
CPIs can satisfy the writable_signer requirement without a PDA signer list.
- depositor/trader must be separate from payer in each instruction; using the
same pubkey in a readonly and mutable slot triggers AccountBorrowFailed.
All instructions use env.payer (funded in setup_pool) as the fee payer.
https://claude.ai/code/session_01DFHVK3tVoPfz6MJMwEAGBf1 parent 17a6209 commit f107365
1 file changed
Lines changed: 724 additions & 43 deletions
0 commit comments