SOL–HYPE–

Program reference

Note For developers. Program id: 4wA3M1Wdwq8E1Aavr4KVnGJM79yYRagGndnhLX1B4FRY (not deployed yet). Reproducible build; source available to auditors on request. See Security.

Written in Rust on Anchor. All money math is integer, with overflow checks on. Every number below comes from the program's launch settings.

Accounts

Account Seeds Holds
Config config team and operator keys, active and pending settings, app pause
Vault vault, collateral mint house balance, set-aside total, margins, open interest, daily-loss history, vault share totals
Vault share mint lpmint, vault the vault's share token (not transferable in this version)
LpAccount lp, vault, owner one depositor's shares, last deposit time, queued withdrawal
Market market, mint pool addresses, recent prices, open interest, set-aside total, close-only flag
Position pos, owner, market, position number side, margin, size, entry, expiry, max profit, TP and SL, terms locked at open
Order order, owner, market, order number a resting limit order and its escrowed deposit
FirstTrade first, owner marks a wallet's free first trade as used

Instructions

Instruction Who Does
open, open_free owner open a position; open_free is the free first trade
close, close_partial owner close all or part; never blocked
set_tp_sl, trigger_close owner, then anyone set TP and SL; execute one that is hit
place_limit, fill_limit, cancel_limit, expire_limit owner / anyone limit orders
liquidate anyone past the line at both prices
close_expired, close_stale anyone, owner expired position; dead pool
deposit_lp, request_withdraw, fulfil_withdraw depositor / anyone vault deposits and the withdrawal queue
poke, poke_many anyone record a price; alone in their transaction
list_market, list_buyback_market, refresh_pool_fee operator / anyone list a pool after the on-chain checks
settle, burn_buyback operator daily settle; buyback with a same-transaction burn
propose_params, apply_params team, then anyone risk-reducing changes at once; every other change after a public 6 h delay
set_paused, set_vault_paused, set_market_reduce_only, set_lp_deposits_open team switches: stop opens, open vault deposits, rotate the operator key

There is no admin access to traders' margins or depositors' shares. The operator fee and the buyback treasury are withdrawable by the treasury.

How prices are recorded

  • A price is recorded only by a transaction that does nothing else, so no swap can sit next to it.
  • Each record is at least 4 seconds after the last and can move at most 5% from it.
  • The average price used for fills and liquidation is taken over the last 60 seconds, from at least 5 records, using the middle value so one bad record cannot move it.
  • Trades need a record no older than 10 seconds. They read the pool live but do not record.
  • Price settings that add risk change only after a public 6 h delay, and the program refuses any setting that could stop closes from working.

Events for every action (opens, closes, liquidations, deposits, withdrawals, settles, buybacks, setting changes) are emitted on-chain and listed on the Vault page.