cricket
On chain

Contracts

Two files, no owner, no admin, no keys, nothing to pay. Not deployed yet. Solidity 0.8.26, EVM version prague for the tests.

CricketBeacon

A library plus a callable wrapper (CricketBeaconVerifier).

FunctionWhat it does
verify(uint64 round, bytes sig) → bytes32Checks the 48-byte compressed signature for round, returns sha256(sig). Reverts otherwise.
roundAt(uint256 timestamp) → uint64The round that is current at a unix time. 0 before genesis.
timeOfRound(uint64 round) → uint256The unix time when a round is published.

Errors: BadSignatureLength, NotACompressedPoint, NotOnCurve, PrecompileFailed(which), InvalidSignature.

The contract decompresses the signature itself (square root with the modexp precompile), so you pass exactly what the relays publish. It calls precompiles 0x05, 0x0b (G1 add), 0x10 (map to G1, twice) and 0x0f (pairing), each with a gas cap: a point outside the subgroup makes the pairing precompile burn all the gas it is given.

CricketDraw

FunctionWhat it does
commit(bytes32 listHash, uint64 round, uint32 winners, uint64 totalWeight) → idRegisters a draw. round must be at least 2 rounds after the current one. totalWeight is the number of tickets.
reveal(uint256 id, bytes sig)Anyone, once. Only when the round's time has come. Verifies the signature and stores the seed.
winnerIndex(id, k)The k-th winner (from 0), an index between 0 and totalWeight - 1.
allWinners(id)All winners in order.
getDraw(id)The stored draw.

Events: Committed(id, committer, listHash, round, winners, totalWeight), Revealed(id, round, randomness, seed). Errors: RoundTooSoon, BadTerms, UnknownDraw, AlreadyRevealed, RoundNotPublished, NotRevealed, NoSuchWinner.

Using the pick function on its own

CricketPick.pickAll(seed, count, total) is the same algorithm as the JavaScript engine, byte for byte. A differential test checks 200 random cases between the two.

Deployment. Deploy CricketBeaconVerifier then CricketDraw, no constructor arguments. The addresses will appear here and on the token page once they exist.
ROUND --
next --
$CRICKET 0xb11e...bb13 X