Reference

Instructions

The program's fourteen instructions, who signs each, and what each requires.

Trading#

InstructionSignerRequiresEffect
open_orderMakerMarket not started; notional above zero; fixed rate a whole number of ticks, at or below the capCreates the position, funds the maker's deposit and the rent.
match_orderTakerOrder open; market not started; taker isn't the maker; the side, notional and fixed rate the taker names are the order'sFunds the taker's deposit. The position becomes active.
cancel_orderMakerOrder openReturns the deposit and closes the account to the maker.
settle_epochAnyonePosition active; the next epoch's checkpoint finalPays one epoch, then closes the position if it matured or fell under margin.
liquidateAnyonePosition active, caught up, and under marginCloses it and pays the reserve to the signer.
expire_positionAnyonePosition active; the epoch it waits on is past the delay limit without a final checkpointCloses it by oracle timeout.
close_positionAnyonePosition closed and matchedPays both balances and closes the account to the maker.

Checkpoints#

InstructionSignerRequiresEffect
propose_checkpointProposer, oracle and reviewerEpoch ended and within the delay limit; every cohort tip account valid with a final root; stake above zero for each validator; the proposer's CREST account holds the proposal stake; the challenge window closes inside the delay limitRecords tips, stake and rate; takes the proposal bond and locks the CREST stake; opens the challenge window.
challenge_checkpointAnyone but the proposer, oracle, reviewer and dispute authorityPending; window open; within the delay limitTakes the challenge bond; status disputed.
resolve_checkpointDispute authorityDisputed; within the delay limit; for an upheld value, tip accounts unchangedUpheld: final at once, both bonds and the CREST stake to the proposer. Rejected: both bonds and the CREST stake to the challenger, status rejected.
finalize_checkpointAnyonePending; window closed; within the delay limit; tip accounts unchangedReturns the proposal bond and the CREST stake; status final.
expire_checkpointAnyonePending or disputed; past the delay limitReturns any bonds and the CREST stake to their payers; status rejected.

Administration#

InstructionSignerEffect
initialize_configAdministratorCreates a configuration with its cohort, authorities, bonds, limits and CREST stake, and its stake vault. Each bond is at least an empty account's rent-exempt minimum, the challenge window is shorter than the delay limit, and the stake mint has no freeze authority.
create_marketAdministratorCreates a market of one to ten epochs with its tick and cap.

Under governance the administrator is the native treasury of an SPL Governance account. It signs only when a proposal that passed the CREST vote runs; see The CREST token.