v3 (upcoming)
Market-making features. Pricing and fill math (fills, fees, rounding) are unchanged, and quote equals execution still holds. Order hashes are unchanged. Maker internal balance and batchdeposit: a transfer with msg{"deposit": true}credits the sender’s internal balance.auth_callbatch:bump_epoch→ up to 64 cancels → up to 32 maker-only placements, atomically, funded from and refunded to the internal balance. Crossing placements are skipped (place_skipped), not failed; so are placements into a full level (level_full), past the 200-orders cap (owner_cap) and a repeat of the same side and price in one batch (duplicate).auth_callwithdraw: pays one token (or all of it) out of the internal balance.auth_callset_payout_mode(intentsdefault,internal) and viewget_payout_mode: maker fills and refunds can be credited to the internal balance.- Gas measured in sandbox (book receipt):
deposit2.6 Tgas,withdraw3.2,cancel_all2.7,batchof 5 placements 8.4, of 8 placements 13.7 and of 32 placements 31–35 (maker with up to 200 orders).
- Per-book, per-maker epoch;
auth_callcancel_allbumps it in O(1). - Optional
expires_aton limit orders (transfermsgand batch placements). - Expired and stale-epoch orders are dead: hidden from views, closed with a refund when a trade meets them (counted
against
max_fills, gas and log budgets like a closing fill), and closable by anyone withprune. - Views
is_order_live,get_epochandget_order_meta({ epoch, expires_at, maker_epoch, live }).
- Per-book
tick_size, set byset_tick_size(OrderBookManager / DAO); new limit prices must be multiples of it. Shown inget_active_pairsand thebookevent. - View
get_book_config(fee_config,min_order_amount,tick_size);get_active_pairsalso returnsmin_order_amount.
get_quote_pubtakesext.expires_atand returnsbook_fill_result.fills[].dead,book_fill_result.internal_makersandinternal_credits(the part ofincrease_user_balancecredited to internal balances).
hex_orderbook 2.1.0
- New:
deposit,place_skipped(why:cross,level_full,owner_cap,duplicate),epoch,payout_mode. batchandprunelogorder_closed,order_createdandplace_skippedas one event each with an arraydata.tradegains optionalmi: makers in payout modeinternalmet by the trade (their proceeds and refunds are credited, not paid out).order_createdgains optionalx(expires_at) ande(epoch);order_closedgains optionalwhy;bookgainstick(omitted when 0). Existing shapes are otherwise unchanged.
- State version 2 → 3 through
approve_contract_code_hash+deploy_and_migrate. Existing books, orders and balances are preserved; existing orders are epoch 0 and never expire (socancel_allalso kills them).
close_orderstill claims the whole internal balance after closing;claim_balancestill pays everything.- Maker fee 0, taker fee 0.05% (USDC/USDT 0), referral fees up to 1%.
v2 (live, 2026-10)
The HEX fork of HOT’s order book (orderbook.fi.tg), deployed as hexbook.near.
- Quote equals execution:
get_quote_pubdecides fills, closes (closed_orders) and the taker remainder (new_order/refund); execution applies it and checks it. - Client
max_fills(default and cap 128); over the limit the remainder is refunded instead of failing. - Per-book minimum order amount (
set_min_order_amount). - Compact events (
hex_orderbook2.0.0): onetradeper taker order instead of the whole quote. - Protection limits: 500 orders per level, 200 per owner per book, protocol and referral fees at most 1% each.
- Safe
migrate()with a state version mark.