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 batch
  • deposit: a transfer with msg {"deposit": true} credits the sender’s internal balance.
  • auth_call batch: 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_call withdraw: pays one token (or all of it) out of the internal balance.
  • auth_call set_payout_mode (intents default, internal) and view get_payout_mode: maker fills and refunds can be credited to the internal balance.
  • Gas measured in sandbox (book receipt): deposit 2.6 Tgas, withdraw 3.2, cancel_all 2.7, batch of 5 placements 8.4, of 8 placements 13.7 and of 32 placements 31–35 (maker with up to 200 orders).
Cancel-all, expiry, dead orders
  • Per-book, per-maker epoch; auth_call cancel_all bumps it in O(1).
  • Optional expires_at on limit orders (transfer msg and 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 with prune.
  • Views is_order_live, get_epoch and get_order_meta ({ epoch, expires_at, maker_epoch, live }).
Tick size
  • Per-book tick_size, set by set_tick_size (OrderBookManager / DAO); new limit prices must be multiples of it. Shown in get_active_pairs and the book event.
  • View get_book_config (fee_config, min_order_amount, tick_size); get_active_pairs also returns min_order_amount.
Quote
  • get_quote_pub takes ext.expires_at and returns book_fill_result.fills[].dead, book_fill_result.internal_makers and internal_credits (the part of increase_user_balance credited to internal balances).
Events: hex_orderbook 2.1.0
  • New: deposit, place_skipped (why: cross, level_full, owner_cap, duplicate), epoch, payout_mode.
  • batch and prune log order_closed, order_created and place_skipped as one event each with an array data.
  • trade gains optional mi: makers in payout mode internal met by the trade (their proceeds and refunds are credited, not paid out).
  • order_created gains optional x (expires_at) and e (epoch); order_closed gains optional why; book gains tick (omitted when 0). Existing shapes are otherwise unchanged.
Migration
  • 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 (so cancel_all also kills them).
Unchanged
  • close_order still claims the whole internal balance after closing; claim_balance still 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_pub decides 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_orderbook 2.0.0): one trade per 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.