Program id: published here at deployment
The program is written with Anchor. Every account below is a PDA of the program, derived from the seeds shown. Integers in seeds are little-endian.
| Account | Seeds | Holds |
|---|---|---|
Config | ["config"] | admin, pending admin, keeper, treasury, signer set and threshold, token settings, fee and curve parameters, house state, counters |
Vault | ["vault"] | the USDC token account holding all collateral; its authority is the Config PDA |
Market | ["market", id u16] | feed id, Pyth account and feed id, leverage and caps, open interest, impact parameters, active, retired, frozen price |
PriceBook | ["book", id u16] | a ring of 64 verified grid prices |
UserAccount | ["user", owner] | available, locked, paper, reward debt, rewards owed, session key and expiry, claim index, open counts |
Request | ["request", id u64] | a pending open or close with its fill timestamp; closed at execution or cancel, rent to its payer |
Position | ["position", id u64] | side, margin, leverage, size, entry and bust price, open time; closed at settlement, rent to its payer |
Claim | ["claim", owner, index u32] | start, end, collected; closed when fully paid and collected, rent to its payer |
Instructions
| Instruction | Who can call it |
|---|---|
initialize | admin, once |
add_market, update_market, retire_market | admin |
set_opens_paused, set_signers, set_token, set_treasury, set_keeper | admin |
transfer_admin / accept_admin | admin / the proposed admin |
create_user | the owner, who pays its rent |
deposit, withdraw | the owner only, never a session key |
create_session, revoke_session | the owner |
request_open, request_close | the owner or its active session key |
cancel_request | anyone, after the TTL, never once executed |
post_price, execute, execute_with_proof, liquidate | anyone |
collect_claim, claim_rewards | the owner |
donate, push_excess, withdraw_treasury | anyone |
Events
The program emits Anchor events that the site reads for history, among them RequestCreated, PositionOpened, PositionClosed, PositionLiquidated, Queued, QueuePaid, PaperMinted and RewardsDistributed.
Units
| Quantity | Unit |
|---|---|
| Money | USDC base units, 6 decimals |
| Prices | 8 decimals, RedStone format: price × 1e8 |
| Paper | 6 decimals, stored as u128 |
| Rates | basis points, 10,000 = 100 % |