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.