Module 3: The Private Order Book
ZendexOrderBookManager facilitates fully non-custodial, shielded limit orders through operator-assisted execution:
- Order Creation: The user submits a
CreateOrderVerifierproof that nullifies their active balance commitment and emits a private Spot Commitment containing the order details (side, asset pair, price, amount) into the state tree. - Batch Execution: The authorized
ORDER_BOOK_OPERATOR_ROLEaggregates matching spot commitments off-chain, constructs an execution batch, and submits anExecuteOrdersproof on-chain. - Settlement: The on-chain contract verifies the batch execution proof, updates
TreeOperatorwith output commitments for both counterparties, and records protocol execution fees. The operator cannot redirect user funds or execute non-matching orders. - Order Cancellation: The maker can cancel an active order at any time by submitting a
RequestCancelOrderVerifierproof, releasing a refund commitment back to their private control.
Placing Orders as a User
Place a buy or sell limit order at your price. It is filled when a matching order arrives. Like every private action, an order uses the full amount of the deposit you pick; to use only part of a deposit, Split it first (see Deposits Are Private Notes).