# Pillowbook > An order book you sleep on. A weekly batch for Robinhood stock tokens on Robinhood Chain (chain id 4663). During the weekend, deposit USDG to buy or stock tokens to sell. Every order in a batch fills at ONE price: the first Chainlink round of that stock's feed published after the batch close (Sunday 23:45 UTC). Orders never touch a pool. Unmatched size is refunded. Site: https://pillowbook.pro · Docs: https://pillowbook.pro/docs/ · Token: https://pillowbook.pro/token/ Not audited. Stock tokens are not shares. All times UTC. ## Live state (JSON, refreshed every minute) - https://pillowbook.pro/api/book.json : contract address (null until live), current batch + close time, per stock: Friday close, pool price, pool depth for 1%, this batch's book. - https://pillowbook.pro/data/live.json : full board (feed age, pool change, previous batch settle data). - https://pillowbook.pro/data/results.json : settled and voided batches (price, round id, matched USD, tx). - https://pillowbook.pro/data/contract.json : address, chain id, fee, min/max order, holder threshold, stocks. - https://pillowbook.pro/rpc : read-only JSON-RPC proxy (eth_call, eth_getLogs, eth_blockNumber, eth_chainId, eth_estimateGas, eth_gasPrice, eth_getTransactionReceipt). Send transactions through your own RPC, e.g. https://robinhood-rpc.publicnode.com. Until `contract` in /api/book.json is non-null: "Book opens when the contract is live." ## Stocks (index = argument `stock`) 0 NVDA token 0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC 1 TSLA token 0x322F0929c4625eD5bAd873c95208D54E1c003b2d 2 SPY token 0x117cc2133c37B721F49dE2A7a74833232B3B4C0C 3 AAPL token 0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9 4 SPCX token 0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa 5 MSTR token 0xec262a75e413fAfD0dF80480274532C79D42da09 USDG 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 (6 decimals). Stock tokens: 18 decimals. Prices: feed units, 8 decimals. ## Rules - Per order: min $10, max $5,000 (sell valued at the latest feed price). Max 20 live orders per address per stock per batch (view liveOrders(stock, batch, owner)); max 1000 live orders per stock per batch. - Limit: buy maxPrice / sell minPrice in 8-decimal feed units, 0 = no limit. A non-zero limit must be within LIMIT_BAND_LO_PCT()..LIMIT_BAND_HI_PCT() percent of the latest feed price at placement (65%-135%, also in /data/contract.json limitBandPct; else BadLimit). Orders outside the limit at P are refunded. - Settle only until close + 3 days (after: TooLate, use void). Settle reverts PriceJump if the first round after the close moves more than 40% vs the round before; that batch voids after 3 days with full refunds. - Errors: TooSmall (< $10), TooLarge (> $5,000), BadLimit, TooManyOrders (20 per address), BatchFull (1000), Closed (after the close: no place/cancel), OraclePaused (token/feed paused or corporate action), PriceJump, TooLate, TooEarly (void before close + 3 days). - claimMany: send at most 300 ids per transaction (1000 ids is about 21.5M gas; block tx cap 32M). - closeOf(batch) = FIRST_CLOSE + batch * 7 days, FIRST_CLOSE = 1794786300 (Sun 15 Nov 2026 23:45 UTC). New orders go to currentBatch(). - Cancel only before the close. Settle is permissionless with the first round after the close. If not settled within 3 days: void(stock, batch), full refunds. - Fee 0.25% of what fills; free if the placing wallet holds >= 1,000,000 $PILLOW at placement (after the token is set). ## Short ABI function buy(uint8 stock, uint256 usdgAmount, uint256 maxPrice) returns (uint256 orderId) function sell(uint8 stock, uint256 qty, uint256 minPrice) returns (uint256 orderId) function cancel(uint256 id) function settle(uint8 stock, uint256 batch, uint80 roundId) function void(uint8 stock, uint256 batch) function claim(uint256 id) function claimMany(uint256[] ids) function liveOrders(uint256 stock, uint256 batch, address owner) view returns (uint256) function LIMIT_BAND_LO_PCT() view returns (uint256) function LIMIT_BAND_HI_PCT() view returns (uint256) function currentBatch() view returns (uint256) function closeOf(uint256 batch) view returns (uint256) function ordersOf(address owner) view returns (uint256[]) function order(uint256 id) view returns ((address owner, uint8 stock, bool isBuy, bool feeFree, uint8 status, uint48 batch, uint16 index, uint128 amount, uint128 limit)) function previewClaim(uint256 id) view returns (uint256 stockOut, uint256 usdgOut, uint256 fee) function batchInfo(uint8 stock, uint256 batch) view returns ((uint256 buyTotal, uint256 sellTotal, uint32 count, uint32 open, bool settled, bool voided, uint80 roundId, uint64 updatedAt, uint256 price, uint256 buyUsd, uint256 sellUsd, uint256 matchedUsd, uint256 usdgLeft, uint256 stockLeft)) event Placed(uint256 indexed id, address indexed owner, uint8 indexed stock, uint256 batch, bool isBuy, uint256 amount, uint256 limit, bool feeFree) event Settled(uint8 indexed stock, uint256 indexed batch, uint80 roundId, uint256 price, uint256 matchedUsd, uint256 buyUsd, uint256 sellUsd) Order status: 0 live, 1 cancelled (refunded), 2 claimed. ## Example: buy 100 USDG of NVDA, no limit (cast) PB=$(curl -s https://pillowbook.pro/api/book.json | jq -r .contract) RPC=https://robinhood-rpc.publicnode.com cast send 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 "approve(address,uint256)" $PB 100000000 --rpc-url $RPC --account cast send $PB "buy(uint8,uint256,uint256)" 0 100000000 0 --rpc-url $RPC --account ## Example: sell 0.5 TSLA, won't sell below $350 (viem) await wallet.writeContract({ address: TSLA, abi: erc20Abi, functionName: 'approve', args: [PB, parseUnits('0.5', 18)] }) await wallet.writeContract({ address: PB, abi, functionName: 'sell', args: [1, parseUnits('0.5', 18), parseUnits('350', 8)] }) ## After the close Read results.json or batchInfo(stock, batch). When settled or voided: previewClaim(id), then claim(id) or claimMany(ids). Funds always go to the order owner.