Reference
Instructions
The program's fourteen instructions, who signs each, and what each requires.
Trading#
| Instruction | Signer | Requires | Effect |
|---|---|---|---|
open_order | Maker | Market not started; notional above zero; fixed rate a whole number of ticks, at or below the cap | Creates the position, funds the maker's deposit and the rent. |
match_order | Taker | Order open; market not started; taker isn't the maker; the side, notional and fixed rate the taker names are the order's | Funds the taker's deposit. The position becomes active. |
cancel_order | Maker | Order open | Returns the deposit and closes the account to the maker. |
settle_epoch | Anyone | Position active; the next epoch's checkpoint final | Pays one epoch, then closes the position if it matured or fell under margin. |
liquidate | Anyone | Position active, caught up, and under margin | Closes it and pays the reserve to the signer. |
expire_position | Anyone | Position active; the epoch it waits on is past the delay limit without a final checkpoint | Closes it by oracle timeout. |
close_position | Anyone | Position closed and matched | Pays both balances and closes the account to the maker. |
Checkpoints#
| Instruction | Signer | Requires | Effect |
|---|---|---|---|
propose_checkpoint | Proposer, oracle and reviewer | Epoch 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 limit | Records tips, stake and rate; takes the proposal bond and locks the CREST stake; opens the challenge window. |
challenge_checkpoint | Anyone but the proposer, oracle, reviewer and dispute authority | Pending; window open; within the delay limit | Takes the challenge bond; status disputed. |
resolve_checkpoint | Dispute authority | Disputed; within the delay limit; for an upheld value, tip accounts unchanged | Upheld: 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_checkpoint | Anyone | Pending; window closed; within the delay limit; tip accounts unchanged | Returns the proposal bond and the CREST stake; status final. |
expire_checkpoint | Anyone | Pending or disputed; past the delay limit | Returns any bonds and the CREST stake to their payers; status rejected. |
Administration#
| Instruction | Signer | Effect |
|---|---|---|
initialize_config | Administrator | Creates 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_market | Administrator | Creates 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.