docs(orderbook): fix order identifier & balance return types; document TP/SL triggers#222
Merged
Merged
Conversation
… TP/SL triggers Orders, cancels, updates, and the getOrders read are keyed by the computed order_id = keccak256(abi.encode(signer, nonce, sequence)), not the submitOrder tx hash. Correct the orderbook precompile reference and the API-reference index's 'transaction hashes as identifiers' note, which used the orderbook as its example. Fix balanceOf and getBalance return types (int256, not uint256) and document the withdrawableBalance read. Document the TP/SL trigger interface (submitTrigger, cancelTrigger, updateTrigger and the TriggerType/TriggerGrouping enums).
majesticwizardcat
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the orderbook precompile docs in line with the actual Clob contract interface.
Order identifier — the docs wrongly stated that orders are referenced by their
submitOrdertx hash. In the contract, anything that rests in the book is keyed by a computedorder_id = keccak256(abi.encode(signer, nonce, sequence)).cancel(canceledOrder),update(updatedOrder), and thegetOrders(orderIds)read all take thisorder_id(verified:node/src/clob/mod.rsstoresupdate.updatedOrder.into()asorder_id; the contract param is namedorderIds;trading::OrderId::newdefines the formula). Corrected the orderbook reference page (the identifier hint block,cancel,update, andgetOrdersparam/return), and the API-reference index's "transaction hashes as identifiers" note, which used the orderbook as its prime example — now reworded with correct examples (bridge withdrawal claim, recovery target) plus an explicit orderbook carve-out.Balance return types —
balanceOfandgetBalanceare documented asreturns (uint256)but the contract returnsint256(signed; native USD is funding-adjusted and can be negative). Fixed both, and documented the previously-missingwithdrawableBalance(token, account)read that pairs with them.TP/SL triggers — added the
TriggerType/TriggerGroupingenums and a triggers section documentingsubmitTrigger,cancelTrigger, andupdateTrigger, including the firing-direction table (side × type → mark-price condition) and the fact thattriggerOrderis the trigger'sorder_id(read back viaob_getTriggers), not thesubmitTriggertx hash. Signatures verified identical tonode/src/clob/contract.rs.Solver-only (
submitSolutions) and admin-only (createOrderBook) methods are intentionally left undocumented.