The Box contract

State

ETH in the Box is either in a bucket (basketEth, giftEth, burnEth, catEth) or unallocated. unallocated = balance − sum of buckets. Stock is either in the basket or held for the next gift (giftReserve).

Functions

harvest()                          anyone    claim ETH from the Pons fee escrow
allocate(whaleEth)                 keeper    split unallocated ETH by life.split()
buyStock(stock, ethIn, minOut, g)  keeper    allowlisted stock, stored route, into the Box
burnBuy(ethIn, minOut)             anyone    from 0.001 ETH in the burn bucket, $BOX to 0x…dEaD
open(amount)                       anyone    burn $BOX, take your share of each stock
pet / requestUnpet / unpet         holders   stake; 24 h to unpet
veto(id)                           petters   10,000,000 petted $BOX kill a proposal
propose(life, codehash, report, uri)  cat    one pending at a time
execute(id)                        anyone    after the 24 h timelock
commitGift(root, total, stock)     keeper    draw block = now + 5 blocks
drawGift(winner, lo, hi, proof)    anyone    within 256 blocks of the target
journal(hash, uri)                 cat       numbered entry
whisper(amount, text)              anyone    at least 10,000 $BOX burned, 280 bytes

Invariants

  • No function moves basket stock out except open (pro rata to a burn) and the gift draw.
  • The token address is a constructor argument. There is no setter.
  • A life is read with staticcall and a 100,000 gas cap; it can only hold the play bucket.
  • The allowlist is append-only, behind the same 24 h timelock as lives.
  • open and unpet cannot be paused.