Pokebet

Docs

How the contract, the price feed and the settlement service actually work.

The contract

One contract, SlabMarket, on Robinhood Chain. It is asset-agnostic: a market is identified by a number, and that number is either a small integer for a category index or the hash of a card’s name.

bet(marketId, durationIdx, up) payable
settle(marketId, durationIdx, roundIdx, openPrice, closePrice)
payout(roundKey, max)
refundStale(marketId, durationIdx, roundIdx)
withdraw()

Rounds are derived, not created

Round n of a duration runs from n x duration to (n + 1) x duration in unix time. Nothing has to be deployed or registered for a card to be tradable, and storage only appears when somebody bets. Betting closes a short window before expiry — fifteen seconds on a five-minute round, five minutes on a weekly one.

Payouts

total        = upPool + downPool
distributable = total - fee
payout(user)  = stake(user) / winningPool * distributable

The contract never pays out more than it took in, so a popular outcome cannot drain it: the most one side can win is the whole of the other side. The fee is recorded when the round settles, so changing the fee afterwards cannot alter what an already-settled round pays.

The price feed

An indexer polls completed Courtyard sales and prices each card against the last price paid for the same card at the same grade. Card identity cancels out, so what moves the number is price change rather than which cards happened to sell.

Comparables are matched on the card model rather than the token. Measured on live data, matching on token id finds a prior price for 0% of incoming sales — a slab that just sold does not sell again soon — while matching on model finds one for 58%.

Settlement

A keeper watches for rounds with money in them and settles each one after it expires, paying the winners in the same transaction. It settles against the last price published at or before the round’s end — never an interpolated one — so the number written to the chain was visible on screen while betting was open.

If the keeper disappears

Settlement needs the keeper, which would otherwise make an absent keeper a way to lock money in the contract forever. Twenty-four hours after expiry, refundStale lets anyone force an unsettled round to refund every bettor in full, with no fee. It cannot undo a round that already settled.

Chain

Robinhood Chain
chain id  4663
rpc       https://rpc.mainnet.chain.robinhood.com
explorer  https://robinhoodchain.blockscout.com
currency  ETH

Blocks land in about a tenth of a second, which is what makes a short round playable — a bet confirms almost immediately.