BATCH(7)The Dark Room ManualBATCH(7)

batch(7)

The cadence, the price, the rule and the fees. The same code runs in the contract, the circuit, the room and this site.

Cadence

period
300 s. A batch closes when the chain clock is a multiple of 300 s.
cutoff
15 s before the close. The contract refuses later seals.
slots
64 orders per batch, one per address. The 65th seal waits for the next batch.
settlement
one room process settles every batch a few seconds after the close: the round, the opening, the proof (about 2 seconds on the GPU), then one transaction.
expiry
30 minutes after the close. An unsettled batch can never be settled after that.

Price

For a stock, the price P is the 60-second TWAP of its Uniswap v3 USDG pool ending exactly at the close, read by the contract itself from the pool oracle. The room supplies no price. It is the onchain pool price, not the Nasdaq price. For a Pons coin, P is the v4 spot price recorded onchain by mark between the cutoff and the close; that is weaker (a trade just before the mark moves it), and your limit is the protection.

The rule

  1. A buy is eligible when its limit is at or above P; a sell when its limit is at or below P. It must belong to the slot's owner and this batch, and not be void.
  2. Per market, B is the eligible buy quantity and S the eligible sell quantity. M = min(B, S).
  3. The smaller side fills in full. On the larger side each order gets floor(qty x M / larger).
  4. The leftover units (fewer than the number of orders) go one each to that side's orders in seal order, so base units balance exactly.
  5. A buyer pays the fill at P rounded up, a seller receives it rounded down; the dust joins the fees.

Example

one market, three orders, P = $241.32
slot  owner  side  qty     limit     eligible   fill
0     A      buy   0.0010  $246.17   yes        0.000471   = floor(1000*800/1700) + 1 leftover
1     B      sell  0.0008  $236.52   yes        0.000800   smaller side, in full
2     C      buy   0.0007  $243.73   yes        0.000329   = floor(700*800/1700)
                                                --------
                   B = 0.0017  S = 0.0008  M = 0.0008   buys 0.000800 = sells 0.000800

Fees

5 basis points a side on matched notional, taken in the quote asset (USDG for stocks, WETH for Pons coins). The owner can change it up to 10 bps, with a 24-hour delay that anyone can watch. Orders under 0.10 USDG of notional are refused by the order form. The room pays the gas of every settlement; at low volume fees do not cover it.

/ search · [ ] previous and next page