PC-Swap: Testing
Pre-Alpha Disclaimer: This is an early pre-alpha release for exploring the SDK and starting development only. There is no real encryption — all data is completely public and stored as plaintext on-chain. Do not submit any sensitive or real data. Encryption keys and the trust model are not final; do not rely on any encryption guarantees or key material until mainnet. All interfaces, APIs, and data formats are subject to change without notice. The Solana program and all on-chain data will be wiped periodically and everything will be deleted when we transition to Encrypt Alpha 1. This software is provided “as is” without warranty of any kind; use is entirely at your own risk and dWallet Labs assumes no liability for any damages arising from its use.
Unit Tests (9)
swap_basic— verify output, reserves, k-invariant, price updateswap_slippage— excessive min_amount_out → no-op, price unchangedswap_k_preserved— 5 alternating swaps, k never decreasesadd_liq_first— first deposit LP = a × badd_liq_second_deposit— proportional LP mintingremove_liq_sufficient— proportional withdrawal, LP decrementedremove_liq_insufficient— burn more than owned → no-opremove_liq_full— 100% withdrawal, pool emptygraph_shapes— verify input/output counts
LiteSVM Integration Tests (6)
test_create_pool— encrypted zero reserves + LP supplytest_add_and_remove— add liquidity, remove 50%, verify balancestest_remove_more_than_owned— burn 2x LP → no-op, everything unchangedtest_cannot_use_other_users_lp— cross-user LP access rejectedtest_swap_k_invariant— k-invariant verified after swaptest_swap_then_remove_earns_fees— LP earns fees from trading
E2E Devnet Test
Create pool → add 10,000/100 liquidity → swap 1,000 A→B →
swap 10 B→A → slippage rejection → remove 50% LP →
read public price via gRPC (0.008271 B per A)
All reserves, trade sizes, and LP positions encrypted. Only the price is public.
Run:
cargo build-sbf --manifest-path chains/solana/examples/pc-swap/pinocchio/Cargo.toml
solana program deploy target/deploy/pc_swap.so
bun chains/solana/examples/pc-swap/e2e/main.ts <ENCRYPT_ID> <PC_SWAP_ID>