hexbook.near is the HEX order book: a NEAR contract with a central limit order book per token pair. Every trade
settles on account balances in intents.near (the NEAR Intents multi-token contract); nothing is held outside it.
Makers lock tokens in resting orders or in their internal balance; takers send a token in and get the other side back in
the same transaction.
These docs are for market makers and integrators / indexers.
How a trade flows
- Orders and deposits are a token transfer with a JSON
msg: Placing orders. - A rejected
msgor a panic loses nothing:intents.nearrefunds the transfer. - Actions that move no tokens in (batch, cancel, cancel-all, withdraw, claim) are signed
auth_callintents: Maker actions. - The view
get_quote_pubreturns exactly what the trade will do, given enough gas: Quote equals execution.
Pairs
Every pair is quoted in USDT (nep141:usdt.tether-token.near, 6 decimals). The live list, with minimums and tick
sizes, is get_active_pairs.
Fees
1% = 10 000 pips. The contract caps the protocol fee of each side at 1%, and the referral fees of one order at 1% in
total and 5 referrers.
Limits
Where to go next
Concepts
Raw prices, sides, minimums, dead orders, payout modes.
Maker actions
Deposit, batch, cancel-all, withdraw, NEP-413 signing.
Build a market maker
The primitives a market maker is made of, to build your own.
Events
Every
hex_orderbook event and how to rebuild fills and balances.