The batch
A batch is every order sealed in one window, named by the round it opens on.
1 Close
The batch stops taking seals at its close time on the Solana clock, set a margin ahead of the opening round's publication. Before close, a trader can cancel: the seal and its deposit come back.
A batch starts taking seals two batch lengths before its close, so the open batch and the one after it take seals at once. The app seals into the first batch that leaves time to sign in the wallet and still cancel before close; the trade room names it under joins batch.
2 Opening and reveal
When the round is published, anyone can decrypt every ciphertext in the batch. An opener — anyone running the open opener; the backend runs one — posts the plaintexts with reveal_orders, in chunks.
A transaction locks at most 64 accounts, so reveals and settlement run in chunks. The program checks each plaintext against its seal and against the account's balance. The seal deposit stays with the batch until the order settles.
3 Forfeit
An order still unrevealed when the reveal window ends loses its seal deposit to the fee PDA and is dropped.
4 Phases
- open — taking seals
- closed — waiting for its round
- opened — readable to everyone
- bidding — solvers price the net
- clearing — the winner clears
- cleared — one price per pair