Liveness safety valve: if Drand round R is never produced (network stall) and the grace window after the reveal deadline has passed without the round opening, anyone can void it and all escrow is refunded.
fn void(env: soroban_sdk::Env, round_id: u64) -> Result<(), soroban_sdk::Error>
Deterministically compute the winner after the reveal deadline. If no valid bid was revealed, the round is voided and all escrow becomes refundable.
fn clear(
env: soroban_sdk::Env,
round_id: u64,
) -> Result
Submit (or overwrite, before the deadline) a sealed bid and lock escrow.
commitment H binds the bid; checked at reveal.ciphertext C is the timelock seal; guarantees forced reveal.escrow is a public USDC budget and an upper bound on the sealed bid;
locked now so the winner can always pay.auditor_blob is the bidder identity encrypted to the auditor key.fn commit(
env: soroban_sdk::Env,
round_id: u64,
bidder: soroban_sdk::Address,
commitment: soroban_sdk::BytesN<32>,
ciphertext: soroban_sdk::Bytes,
escrow: i128,
auditor_blob: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>
Reveal a bid. Permissionless: once R's signature is public, anyone can
decrypt any ciphertext and submit the reveal — so no bidder can abort.
The contract checks sha256(be16(value) ‖ nonce) == H.
fn reveal(
env: soroban_sdk::Env,
round_id: u64,
bidder: soroban_sdk::Address,
value: i128,
nonce: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
Settle a cleared round. The winner pays their bid from escrow to the operator; the winner's surplus and every loser's escrow are refunded. Cannot fail for lack of funds — everything was escrowed at commit.
fn settle(env: soroban_sdk::Env, round_id: u64) -> Result<(), soroban_sdk::Error>
Observer view: the sealed ciphertext + auditor blob, while still in Temporary storage. Visibly unreadable during the sealed phase.
fn get_seal(
env: soroban_sdk::Env,
round_id: u64,
bidder: soroban_sdk::Address,
) -> Option
fn get_round(env: soroban_sdk::Env, round_id: u64) -> Result
fn get_config(env: soroban_sdk::Env) -> Result
Keeper view: the deterministic, ordered bidder index for a round. The keeper reads this to learn exactly which seals must be opened and revealed — the reveal set is on-chain state, so no event scraping or indexer is required and nothing can be missed.
fn get_bidders(
env: soroban_sdk::Env,
round_id: u64,
) -> Result, soroban_sdk::Error>
Open the reveal window by proving Drand round R has been produced.
The supplied signature is verified on-chain via BLS12-381. This is the
only way to move a round into Revealing; there is no operator override.
fn open_reveal(
env: soroban_sdk::Env,
round_id: u64,
drand_signature: soroban_sdk::BytesN<96>,
) -> Result<(), soroban_sdk::Error>
Open a new sealed round. Permissionless: anyone can be an operator, and the operator gets no special read power — that is the point.
fn create_round(
env: soroban_sdk::Env,
operator: soroban_sdk::Address,
item_ref: soroban_sdk::BytesN<32>,
reveal_round: u64,
clearing_rule: ClearingRule,
commit_deadline: u64,
reveal_deadline: u64,
auditor_pubkey: soroban_sdk::Bytes,
) -> Result
fn get_bid_state(
env: soroban_sdk::Env,
round_id: u64,
bidder: soroban_sdk::Address,
) -> Result
One-time deploy configuration. All Drand parameters are supplied by the deployer from values validated against a live quicknet round.
fn __constructor(
env: soroban_sdk::Env,
drand_pubkey: soroban_sdk::BytesN<192>,
g2_neg_generator: soroban_sdk::BytesN<192>,
dst: soroban_sdk::Bytes,
drand_genesis: u64,
drand_period: u64,
usdc: soroban_sdk::Address,
)