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.

FieldTypeMeaning
administratorPubkeyCreates markets.
oraclePubkeyAttests stake on every post.
reviewerPubkeySecond signer on every post.
dispute_authorityPubkeyRules on challenges.
challenge_slotsu64Length of the challenge window.
proposal_bond_lamportsu64Bond for posting a checkpoint.
challenge_bond_lamportsu64Bond for challenging one.
max_rate_ppbu64Highest cap a market may set.
liquidation_reserve_lamportsu64Reserve inside every deposit.
max_checkpoint_delay_epochsu64The delay limit, one to ten.
stake_mintPubkeyThe CREST mint every proposal stake is paid in.
proposal_stakeu64CREST, in base units, locked behind every post.
cohortVec 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].

FieldTypeMeaning
configPubkeyIts configuration.
market_idu64Chosen by the administrator.
start_epochu64First leg. Orders close when it begins.
end_epochu64Last leg. At most nine epochs after the start.
tick_ppbu64Step for fixed rates.
rate_cap_ppbu64Highest crest settled, highest fixed rate accepted.

Checkpoint#

One per epoch per configuration. Address: ["checkpoint", config, epoch as u64 little-endian].

FieldTypeMeaning
configPubkeyIts configuration.
epochu64The epoch it measures.
proposerPubkeyPaid the proposal bond.
challengerPubkeyPaid the challenge bond, or empty.
stake_lamportsVec of u64Attested stake of each cohort validator, in cohort order.
total_stake_lamportsu64Their sum: the denominator.
total_tip_lamportsu64Sum of the cohort's max_total_claim, read by the program.
rate_ppbu64floor(tips × 10^9 ÷ stake), uncapped.
observed_slotu64Slot at which the stake was observed, inside the epoch.
challenge_deadline_slotu64Last slot a challenge is accepted.
statusu81 pending, 2 disputed, 3 rejected, 4 final.
evidence_hash32 bytesCommitment to the off-chain evidence archive.
source_hash32 bytesCommitment to the tip accounts read. See Index method.
challenge_hash32 bytesThe challenger's evidence commitment.
resolution_hash32 bytesThe dispute authority's ruling commitment, or the timeout marker.
proposal_bond_lamportsu64Proposal bond still held.
challenge_bond_lamportsu64Challenge bond still held.
proposal_stakeu64CREST 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.

FieldTypeMeaning
marketPubkeyThe market.
makerPubkeyPlaced the order, paid the rent.
takerPubkeyTook it, or empty while open.
order_idu64Chosen by the maker; any number not already used by them in this market.
maker_longboolTrue if the maker is long crest.
notional_lamportsu64Notional.
fixed_rate_ppbu64Fixed rate.
maker_balance_lamportsu64The maker's balance.
taker_balance_lamportsu64The taker's balance.
next_epochu64The next leg to settle.
statusu80 open, 1 active, 2 closed.
close_reasonu80 none, 1 matured, 2 under margin, 4 oracle timeout.