Skip to content

v0.6.0 — SPL Tokens, Pyth Oracle, Security Hardening

Choose a tag to compare

@mizuki0x mizuki0x released this 06 Apr 14:43
· 12 commits to master since this release

What's New

Real Token Transfers

  • Deposit/withdraw now move actual SPL tokens (e.g. USDC) via transfer_checked CPI
  • PDA-controlled vault ([b"vault", market.key()]) holds all market collateral
  • Mint and token account validation enforced by Anchor constraints

On-Chain Pyth Oracle

  • Crank instruction reads price directly from a Pyth v2 price feed account
  • No more passing oracle price as a parameter — price is read and validated on-chain
  • Staleness check (60s max), Trading status required, exponent bounds [-18, 18]

Security Hardening

  • Program owner validation on all market account access (prevents fake account injection)
  • Pyth oracle account owner validation (must be owned by Pyth program)
  • Checked arithmetic for price exponent conversion (no silent overflow/truncation)
  • Future oracle timestamps rejected in staleness check
  • Self-trade prevention (account_a != account_b)
  • init_oracle_price > 0 and amount > 0 validation
  • Header deserialization returns error instead of panicking

Breaking Changes

  • deposit / withdraw amount type: u128 → u64 (matches SPL token amounts)
  • crank no longer accepts oracle_price parameter — pass a Pyth feed account instead
  • keeper now requires --pyth-feed <PUBKEY> (no longer optional)
  • Chain CLI commands require --mint and --token-account for deposit/withdraw

Upgrade from Anchor 0.32 → 1.0

  • Full Anchor 1.0 compatibility with Solana CLI 3.0
  • CpiContext::new takes Pubkey (not AccountInfo)

All 6 crates published on crates.io:
percolator-engine · percli-core · percli-program · percli-chain · percli-wasm · percli