$PREIMA has not launched and there is no token address. The stamp in the tabs contract, and the lock, Cube and Board contracts, are built and tested, not live. Round eight of the independent reviews answered yes to deploying these contracts with small amounts. Nothing here has been audited. The coin is only locked, burned or spent.
The coin ($PREIMA) is launched later on a launchpad, so its address is unknown today and appears nowhere in this repo. Every contract takes the real coin through a one-time owner call after it exists, and the product runs unchanged until then.
The coin's jobs
- Required to settle. Once the coin is set, a tab can only be settled by burning the coin, unless the seller has the coin locked. Every claim moves coin from whoever calls
claim(in practice the seller's settling key): a share goes to the Cube, the rest to the dead address. - Locked for free settlement. A seller who has at least the threshold locked in PreimaLock settles with no coin burned, for tabs that end within the lock's horizon.
- Burned for names and colours in the game (PreimaBoard).
Receiving the coin is never a utility. The contracts only lock, spend or burn it. The tabs contract never holds the coin: it only moves it from the caller of claim to the Cube and the dead address.
This is code with tests and independent reviews (review round 1 to review round 8; the stamp design was reviewed in rounds four to six). It has not been audited.
Honest consequences
- A seller needs the coin to get paid, once it launches. The caller of
claimpays the stamp, so in practice the seller's settling key must hold the coin and approve the tabs contract. If nobody with coin and approval claims,claimreverts, the seller is not paid, and the tab eventually refunds the payer. The seller's owed payments are lost if it does not fix this before the refund. This is the point of the design, and it is also a cost to every seller who has to acquire the coin first. - The rate is set by hand, not by a price feed. The owner sets how many coin units are burned per unit of USDG settled. The stamp's dollar value therefore drifts with the coin's price until the owner lowers the rate (immediately) or raises it (with 7 days' notice). If the coin rises, sellers pay more in dollars than intended until the owner lowers the rate. If it falls, the stamp is worth less until the owner raises the rate. There is no oracle and no automatic correction.
- The owner picks the coin address once and sets every rate. Nothing on chain checks that the address is the real coin, or that the coin behaves. In particular, a coin that refuses transfers to the dead address, or has an admin who can block it, would make every stamped claim revert for good, and open tabs keep their stamp. Payers still get their refunds, but sellers would lose every owed payment on stamped tabs. This cannot be fixed in these contracts. The coin's own admin, if it has one, is outside them. Choose a coin with no blocklist and test a transfer to the dead address and to the Cube before
tabs.setCoin. - There is no swap and no keeper. The burn is the stamp itself, paid in the coin by the seller. Nothing buys the coin on a market. Burn size depends on real settled volume and on the rate: it is zero when volume is zero, and the owner can set the rate to a very low number.
- A seller who locks the coin for free settlement still needs the coin, and a lock only covers tabs ending within 30 days.
PreimaTabs
Settlement fees and stamps. The pay-per-call rail is described in SPEC; this section covers only the coin.
Before the coin is set (today): every tab pins a fee in basis points of the token settled (default 50, cap 100), or a lower one from the fee source for a locked seller. The fee is swept to feeRecipient, which is the Cube. Nothing else differs.
Once the coin is set:
rate[token]is the number of coin base units burned per one base unit oftokensettled.rate == 0means the token is not accepted:openrevertsTokenNotAccepted.openpinsfeeBps = 0, the currentcubeBpsand astampin the tab: 0 if the fee source says this seller is free for the tab's whole life (the fee source returns 0), otherwiserate[token]. The stamp and the Cube share are pinned at open, so a later rate change orsetCubeBpscannot touch an open tab. A tab whose stamp times its total could overflow is refused at open (BadParams). A tab in the coin itself is refused (BadToken).claim(tabId, k, w)on a tab with a stamp: the CALLER ofclaimpayspaid * stampcoin units, not the seller. The tab's pinned Cube share (cubeBpsat open, default 2000, between 0 and 5000) goes tocube(the Cube address, set once by the owner) and the rest to0x000000000000000000000000000000000000dEaD. The caller must have approved the tabs contract for the coin. Nobody's allowance is ever spent by someone else: a stranger who settles a seller's tab burns its own coin. A seller is never forced to settle a tab whose stamp it dislikes, and a stranger cannot use up a seller's allowance. The contract checks the balance of each destination before and after, and if either transfer fails or delivers less than asked the whole claim reverts withStampUnpaid. The seller receives the full token amount with no token fee, whoever called.claimstays callable by anyone, and only ever pulls coin from its own caller.- Tabs opened before the coin was set keep their pinned basis-point fee and have stamp 0.
- Payer refund paths,
release,requestClose, parking and the owner having no power over an open tab's money are unchanged.
If cube has not been set when a stamped claim happens, the whole stamp is burned and the Cube gets nothing. feeRecipient only ever receives pre-coin token fees; it never receives coin.
Rounding: the Cube share is rounded down on each claim, so a tab settled in several claims can send the Cube a unit or two less than one claim for the same total would. The burned amount plus the Cube amount always equals the stamp due exactly.
Settling is a claim-time cost for the claimer. Seller advice: a tab can be opened to a seller without its consent and settled by whoever opened it, but that settlement is paid in the settler's own coin, so a seller's coin and allowance are never spent by someone else. Even so, approve the tabs contract for the coin only up to what you expect to owe, and keep the settling key separate from keys that hold other value. Watch Opened events for tabs to yourself and release any you did not agree to: an unwanted tab only costs the payer, but it sits on chain for up to 365 days.
Interface additions (exact signatures are listed in the build report): coin(), rate(token), cubeBps(), stampFor(seller, token, expiry), rateProposal(token), setCoin(coin, token, rate), setCube, cube(), setRate, proposeRate, executeRate, cancelRate, setCubeBps, events CoinSet, CubeSet, RateSet, RateProposed, RateCancelled, CubeBpsSet, Stamped, and Opened now carries the pinned stamp.
Owner powers and their limits (PreimaTabs)
| Power | Limit |
|---|---|
setCoin(coin, token, rate) | Once. The coin must have code and a decimals() of 36 or less. It also sets the first rate for token (more than 0, at most uint128 max) in the same call, so there is never a moment when the coin is set and no token is accepted. Until it is set, nothing about the stamp applies. |
setRate(token, rate) | The first setting for a token, and any lowering (including to 0), is immediate. A raise reverts NeedsNotice. A rate above uint128 max is refused. |
proposeRate(token, rate), executeRate(token, rate) | A raise needs a public proposal. It can be executed from 7 days after the proposal until 7 days after that; then it lapses and must be proposed again. cancelRate removes it. Lowering a rate drops a pending raise. |
setCube(cube) | Once. Must have code, must not be the tabs contract, and must answer pot() with two words (the PreimaCube interface); a random contract is refused. Until it is set the whole stamp is burned. After it is set the owner cannot change it. |
setCubeBps(bps) | 0 to 5000, immediate. It applies to tabs opened afterwards only: each tab pins the share at open. It changes only the split between the Cube and the dead address, never the total. |
setFeeRecipient(addr) | Immediate. It receives only pre-coin token fees (USDG), swept with sweepFees; today it is the Cube. It never receives coin. |
setFeeSource(addr) | Immediate. It decides which sellers are free on new tabs, in both directions. Pointing it away from the Lock removes lockers' free settlement on new tabs (their coins stay withdrawable after 30 days). Pointing it at a contract that answers 0 for chosen sellers makes them stamp-free at once, without locking anything. The source can only make a seller free; it can never raise a charge. |
setFee(bps) | 0 to 100, immediate. It affects only tabs opened before the coin is set. |
proposeOwner | Two-step handover. |
The owner has no power over an open tab's money: not the payer's refund, not the seller's payments, not the pinned stamp or fee.
Before the coin is set, setRate and proposeRate revert.
PreimaLock (the fee source)
A seller locks the coin and settles with no stamp. PreimaTabs asks this contract, through feeBpsFor(seller, expiry), whether a seller is free for a tab. The interface is unchanged: a return of 0 means free, anything else means "standard". After the coin is set PreimaTabs treats 0 as "stamp 0" and anything else as "pin the rate".
What a user can do:
lock(amount): lock more coin. Credited by the balance that actually arrived.requestUnlock(): starts a fixed 30 day notice.cancelUnlock()stops it.withdraw(): takes everything back once the notice has run. No partial withdrawal.
The discount: feeBpsFor returns 0 only if the coin is set, the threshold is set, the seller has at least the threshold locked, and the tab ends no later than the earliest moment the seller could withdraw: the unlock date if an unlock is requested, otherwise now plus 30 days. So a free tab always ends before the seller can get the coin out. A fuzz test goes through the real PreimaTabs with stamps (testFuzz_noStampFreeTabOutlivesTheLock) and another shows the lock, open a long tab, unlock trick pays the stamp (test_stampFree_forTabsEndingWithinTheHorizon_only). In practice tabs of up to 30 days are free for a locked seller and longer tabs pay the stamp.
tierOf(address) returns 0 to 3 from three owner-set amounts, and 0 while an unlock is pending. It is a live read, so a game snapshot should read it at a fixed block.
Things to know:
- Coins added while an unlock is pending leave at the old unlock date, possibly in under 30 days. The discount stays bounded by that date.
- The Lock's value depends on the owner of PreimaTabs, who can call
setFeeSourceelsewhere at any time.
| Power | Limit |
|---|---|
setToken(coin) | Once. The coin must have code and a decimals() of 36 or less. |
setThreshold(x) | 1 to 1,000,000,000 whole coins. Raising it only removes the discount from new tabs. It never traps coins: any locker can unlock after the 30 day notice. |
setTiers(a, b, c) | Each in the same bounds, ascending. |
sweepStray(token, to) | Sends tokens sent here by mistake. For the coin it can only send the amount above totalLocked, so lockers' coins cannot be taken. It also takes a positive rebase or an airdrop on locked coins, because it cannot tell them from a stray donation. |
proposeOwner | Two-step handover. |
The owner cannot pause, cannot change the 30 days (a constant), cannot move anyone's lock, and cannot block withdraw.
Before the coin is set: lock reverts, feeBpsFor returns "standard", tierOf returns 0, and setThreshold and setTiers revert. A threshold of 0 (not yet chosen) gives no discount even after the coin is set.
Reclaim path: none needed for lockers' coins. The team holds no money here.
PreimaCube (the bounty)
"Crack the cube, take the pot." The Cube holds two assets: USDG, from pre-coin fees and donations, and the coin, from stamps. It receives pre-coin fees because feeRecipient on PreimaTabs is the Cube, and the Cube's share of each stamp because cube on PreimaTabs is set to it. At construction it sets target = keccak256(abi.encode(blockhash(block.number - 1), address(this), block.prevrandao, "preima.v1.cube")). Winning needs w with keccak256(abi.encode(address(this), w)) == target, a 64 byte input. The target's own inputs are public (on this chain prevrandao is a constant), but its 192 byte preimage is a different message and does not help. Winning needs a second preimage of keccak256, so nobody should expect it to be won. The Cube is a standing public bounty on the hash function Preima's payments depend on.
- The coin is set once by the owner (
setCoin, must differ from USDG). Until then the pot is USDG only. A coin balance that arrived before it was set counts as pot from the moment the coin is set, and the coin is never a stray token afterwards. Set the Cube's coin beforetabs.setCoin. fund(asset, amount)adds USDG or the coin. A direct transfer counts too.commit(c)withc = keccak256(abi.encode(msg.sender, w)), then at least 1 block latercrack(w). Commits cost only gas and expire after one day. A transaction watcher who copies a revealedwcannot use it.- A successful
crackpays the whole pot, both assets, to the committer, and marks the cube cracked for ever (cracked,crackedBy,crackedAt,crackedPayoutUsdg,crackedPayoutCoin).Cracked(by, usdgPaid, coinPaid, w)is emitted. After that,commitandfundrevert. pot()returns(usdgPot, coinPot): each asset's balance less its parked amount.setCoinis allowed after a crack too: it only enablesflushfor the coin.- After a crack, anyone can call
flush(asset): late coin goes to the dead address and late USDG to the winner, so later arrivals do not sit here as money only the owner can move. - If an asset refuses a payout it is parked for that account, per asset.
collect(asset, account)pays it later, and money only goes to that account.
| Power | Limit |
|---|---|
setCoin(coin) | Once. |
proposeReclaim(to), then reclaim() | 30 day public notice (reclaimAt, reclaimTo). It can run only in the 7 days after the notice matures; then it lapses and must be proposed again. It sends both assets as they stand at that time. This includes the Cube's coin, which is mostly the Cube share of stamps, so with 30 days' notice the owner can withdraw it. That is disclosed, not removed, because team money always has a reclaim path. After a crack the pot reclaim is closed and flush is the only way late arrivals leave. A crack cancels a pending notice, and after a crack no new pot reclaim can be proposed: later arrivals leave only through flush. cancelReclaim removes it. |
proposeReclaimToken(token, to), then reclaimToken() | Same notice, window and lapse, for any other token that arrived. It cannot name USDG or the coin, even if the coin is set after the proposal. Sends the token's whole balance. cancelReclaimToken removes it. |
proposeOwner | Two-step handover. |
The owner has no way to set the target, mark the cube cracked, or touch parked money.
What this means for players: a player who sees a notice can crack until the owner executes it. Inside the 7 day window the owner picks the moment, so a player who commits during the window can be pre-empted in the same block. Outside the window the owner cannot. The pot is not locked and should never be described as if it were. In practice the Cube cannot be cracked.
PreimaBoard (spend the coin in the game)
Unchanged. claimName(name, maxPrice) burns namePrice from the caller to the dead address and records a unique name (3 to 20 characters of a-z, 0-9, -). setColour(colour, maxPrice) burns colourPrice. Both revert above maxPrice. Views: nameOf, ownerOfName, colourOf, isValidName, totalBurned. The contract holds no funds and cannot receive ether.
Things to know: a claim can be taken by whoever lands first, and names that differ only by hyphens are different names, so lookalikes are possible.
| Power | Limit |
|---|---|
setToken(coin) | Once. Sets default prices: 100 coins per name, 10 per colour. |
setNamePrice, setColourPrice | 1 to 1,000,000 whole coins. A change reaches calls already sent, but each call carries a maxPrice. |
proposeOwner | Two-step handover. |
Before the coin is set every spend reverts. There is no reclaim path because nothing is held.
Complete list of owner powers that are not obvious
- Tabs: the coin address is chosen once and not validated beyond having code and
decimals(). A coin whose own admin can block the dead address would freeze every stamped settlement (see "Honest consequences"). The coin's admin, if any, is outside these contracts. - Tabs: the first rate for a token is set with the coin, and every later lowering is immediate. Setting a rate to 0 stops that token being accepted for new tabs at once.
- Tabs:
setCubeBps(0 to 5000) is immediate and applies to tabs opened afterwards. Open tabs keep the share they pinned. - Tabs:
setFeeRecipientis immediate and controls where pre-coin USDG fees are swept. The Cube address for stamps is set once, must answerpot(), and cannot be changed. A stamped tab opened while the Cube is unset pins a Cube share of 0, so its whole stamp is burned whatever Cube is set later. - Tabs:
setFeeSourceis immediate and works both ways. It can take the free-settlement benefit away from lockers on new tabs, and it can grant free settlement to chosen sellers by pointing at a contract that answers 0 for them. - Cube: with 30 days' public notice (then a 7 day window) the owner can withdraw the whole pot, which includes the Cube share of stamps, so up to half of every stamp can end up reclaimable by the owner. Until the owner executes, anyone can crack the Cube, and after a crack anyone can
flushlater arrivals. The Cube's coin is also reclaimable only through this path, not as a stray token. - Lock:
sweepStrayalso takes a positive rebase or airdrop on locked coins. - Board: price changes apply to calls already sent, capped by each call's
maxPrice.
What happens before the coin exists
Nothing coin-related can happen. PreimaTabs behaves exactly as before (USDG fee pinned per tab, swept to the Cube). PreimaLock gives no discount and takes no locks, PreimaBoard refuses every spend, and PreimaCube works with USDG only. No stand-in address exists anywhere in the code, scripts or docs.
Deploy and wiring
contracts/script/DeployExtras.s.sol reads DEPLOYER_KEY, OWNER, TABS, USDG and optionally EXPECT_CHAIN_ID (default 4663), deploys the Cube, the Lock and the Board, reads everything back, and prints the calls below. It does not touch PreimaTabs and sets no coin.
The owner of PreimaTabs makes three calls after it:
tabs.setFeeRecipient(cube)tabs.setFeeSource(lock)tabs.setCube(cube)(once; can be made before the coin exists)
PreimaTabs calls the fee source with 60,000 gas and falls back to "standard" if it fails, so a broken Lock cannot stop a tab from opening or raise a charge.
One-time calls after the coin launches
All are made by the owner of each contract. COIN is the launched coin's address (18 decimals assumed in the examples). USDG is 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 (6 decimals, read from the chain on 2026-12-04; check it again before deploying). TABS, LOCK, CUBE, BOARD are the deployed addresses. None of this is made before the coin exists and none of it is made by the deploy script.
Order: do the Lock, Cube and Board first, then the tabs contract last. tabs.setCoin sets the coin and the first USDG rate in one call, so there is no moment when the coin is set and USDG tabs are refused.
lock.setToken(COIN). Once.lock.setThreshold(threshold). Raw coin units, between 1 and 1,000,000,000 whole coins (for an 18 decimal coin,1e18to1e27). Until it is set there is no free settlement.lock.setTiers(tier1, tier2, tier3). Raw units, ascending, same bounds.cube.setCoin(COIN). Once. Do this before step 6, so stamp shares count as pot from the first claim.board.setToken(COIN). Once. Optionallyboard.setNamePrice(x)andboard.setColourPrice(y), each 1 to 1,000,000 whole coins in raw units.tabs.setCoin(COIN, USDG, rate). Once.rateis a plain integer: coin base units per USDG base unit. The call sets the coin and the first USDG rate together. (tabs.setCube(CUBE)must also have been called, once, or the whole stamp is burned. It checks thatCUBEanswerspot().)- Optionally
tabs.setCubeBps(bps)(0 to 5000, default 2000). It affects tabs opened afterwards only. - Later rate changes: lower with
tabs.setRate(USDG, rate)immediately, raise withproposeRatethenexecuteRate7 to 14 days later. Other tokens:tabs.setRate(token, rate)(first setting immediate).
Before step 6, check that a transfer of the coin to the dead address 0x000000000000000000000000000000000000dEaD and to the Cube credits exactly the amount sent. Otherwise stamped claims would revert.
Example with cast: cast send $TABS "setCoin(address,address,uint256)" $COIN $USDG 2500000000000.
Choosing the rate
Settling X USDG base units costs X * rate coin base units. With USDG at 6 decimals and a coin at 18 decimals, and a coin price P in US dollars:
- value of the stamp in dollars =
X * rate / 1e18 * P - value settled in dollars =
X / 1e6 - for a stamp of 0.5% of settled value:
rate = 0.005 * 1e18 / (1e6 * P) = 5e9 / P
Worked example: coin price $0.002 gives rate = 5e9 / 0.002 = 2.5e12. Check: a seller settles 100 USDG, which is 1e8 base units. The stamp is 1e8 * 2.5e12 = 2.5e20 base units, which is 250 coins, worth $0.50 at $0.002, which is 0.5% of $100. At $0.0001 the rate is 5e13. For a coin with other decimals d, replace 1e18 with 10^d.
The rate does not follow the price. When the coin's price moves, recompute it and lower it at once, or raise it with notice.
Gas and size
Local runs use Foundry with evm_version = paris, optimizer 200 runs, no via_ir. PreimaTabs deployed size is 11,555 bytes (it was 7,285), well under the 24,576 byte limit.
| Call | Before the stamp | After |
|---|---|---|
PreimaTabs.open (first tab, no coin set) | 196,051 | 201,698 |
PreimaTabs.open (coin set, stamp and Cube share pinned) | not applicable | 204,614 |
PreimaTabs.claim, one payment (no coin set) | 104,920 | 107,461 |
PreimaTabs.claim, one payment (coin set, stamp paid by the caller) | not applicable | 165,919 |
PreimaLock.feeBpsFor (limit 60,000) | about 5,100 warm, 11,000 cold | unchanged |
PreimaCube.crack | about 110,000 | higher with a coin pot |
PreimaBoard.claimName | about 94,000 | unchanged |
Coin behaviour
These contracts are written for a plain ERC-20.
- A coin that takes a cut on transfer makes
claimrevert on a stamped tab (StampUnpaid), because the destination balances must rise by exactly the amount asked. It does not under-burn. - A coin that charges the sender more than it delivers also makes
claimrevert, and in the Lock it can leave the last locker'swithdrawfailing until someone tops the contract up. A positive rebase on locked coins is taken bysweepStray. Treat a rebasing or fee-charging coin as unsupported. - A coin whose
transferFromreturns no value is accepted. - A coin that calls back into PreimaTabs is refused: the guarded entry points revert and the claim fails as unpaid.
Chain addresses to re-check before deploy
These are public facts about Robinhood Chain (chain id 4663), read from the chain on a fork on 2026-12-04. They are not Preima contracts and not a token. Check them again before deploying.
| What | Address |
|---|---|
| USDG (6 decimals) | 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 |
| Burn address | 0x000000000000000000000000000000000000dEaD |