Reference
Program accounts
The four account types the Crest program owns, every field, and how each address is derived.
All four are Anchor accounts owned by the Crest program. Every integer is an unsigned 64-bit value unless noted, rates are ppb per epoch and amounts are lamports.
Config#
One per configuration of Crest. Address: ["config", administrator]. Under governance the administrator is the native treasury of an SPL Governance account, so each configuration has its own governance account in the CREST realm.
| Field | Type | Meaning |
|---|---|---|
administrator | Pubkey | Creates markets. |
oracle | Pubkey | Attests stake on every post. |
reviewer | Pubkey | Second signer on every post. |
dispute_authority | Pubkey | Rules on challenges. |
challenge_slots | u64 | Length of the challenge window. |
proposal_bond_lamports | u64 | Bond for posting a checkpoint. |
challenge_bond_lamports | u64 | Bond for challenging one. |
max_rate_ppb | u64 | Highest cap a market may set. |
liquidation_reserve_lamports | u64 | Reserve inside every deposit. |
max_checkpoint_delay_epochs | u64 | The delay limit, one to ten. |
stake_mint | Pubkey | The CREST mint every proposal stake is paid in. |
proposal_stake | u64 | CREST, in base units, locked behind every post. |
cohort | Vec of { vote, upload_authority } | One to eight validators, ordered by vote account bytes. |
Market#
One per maturity. Address: ["market", config, market_id as u64 little-endian].
| Field | Type | Meaning |
|---|---|---|
config | Pubkey | Its configuration. |
market_id | u64 | Chosen by the administrator. |
start_epoch | u64 | First leg. Orders close when it begins. |
end_epoch | u64 | Last leg. At most nine epochs after the start. |
tick_ppb | u64 | Step for fixed rates. |
rate_cap_ppb | u64 | Highest crest settled, highest fixed rate accepted. |
Checkpoint#
One per epoch per configuration. Address: ["checkpoint", config, epoch as u64 little-endian].
| Field | Type | Meaning |
|---|---|---|
config | Pubkey | Its configuration. |
epoch | u64 | The epoch it measures. |
proposer | Pubkey | Paid the proposal bond. |
challenger | Pubkey | Paid the challenge bond, or empty. |
stake_lamports | Vec of u64 | Attested stake of each cohort validator, in cohort order. |
total_stake_lamports | u64 | Their sum: the denominator. |
total_tip_lamports | u64 | Sum of the cohort's max_total_claim, read by the program. |
rate_ppb | u64 | floor(tips × 10^9 ÷ stake), uncapped. |
observed_slot | u64 | Slot at which the stake was observed, inside the epoch. |
challenge_deadline_slot | u64 | Last slot a challenge is accepted. |
status | u8 | 1 pending, 2 disputed, 3 rejected, 4 final. |
evidence_hash | 32 bytes | Commitment to the off-chain evidence archive. |
source_hash | 32 bytes | Commitment to the tip accounts read. See Index method. |
challenge_hash | 32 bytes | The challenger's evidence commitment. |
resolution_hash | 32 bytes | The dispute authority's ruling commitment, or the timeout marker. |
proposal_bond_lamports | u64 | Proposal bond still held. |
challenge_bond_lamports | u64 | Challenge bond still held. |
proposal_stake | u64 | CREST still locked behind this post: the configuration's stake while pending or disputed, zero once released. |
Stake vault#
One per configuration: a classic SPL Token account for CREST whose authority is the Config account itself. Address: ["stake_vault", config] under the Crest program. It holds the stake of every post that is pending or disputed, and only the program moves CREST out of it: back to the proposer, or to a successful challenger.
Position#
One per order. Address: ["position", market, maker, order_id as u64 little-endian]. It is 156 bytes and holds both deposits as its own lamports, above its rent.
| Field | Type | Meaning |
|---|---|---|
market | Pubkey | The market. |
maker | Pubkey | Placed the order, paid the rent. |
taker | Pubkey | Took it, or empty while open. |
order_id | u64 | Chosen by the maker; any number not already used by them in this market. |
maker_long | bool | True if the maker is long crest. |
notional_lamports | u64 | Notional. |
fixed_rate_ppb | u64 | Fixed rate. |
maker_balance_lamports | u64 | The maker's balance. |
taker_balance_lamports | u64 | The taker's balance. |
next_epoch | u64 | The next leg to settle. |
status | u8 | 0 open, 1 active, 2 closed. |
close_reason | u8 | 0 none, 1 matured, 2 under margin, 4 oracle timeout. |