OddMaki
Operations

Batch Operations

Place up to 20 orders, cancel up to 100 orders, or atomically cancel-and-replace in a single transaction. Built for market makers.

The BatchOrdersFacet lets you place or cancel many orders in a single transaction. This is designed for market makers and quoting bots that need to update a book quickly and atomically.

Limits

OperationMax per call
Place orders (same market)20
Cancel orders (any markets)100
Cancel-and-replace (same market)100 cancels + 20 places

Batch Place

Place up to 20 limit orders on the same market in one transaction:

await client.trade.batchPlaceOrdersSimple({
  marketId: 1n,
  orders: [
    { outcomeId: 0n, side: 'BUY',  price: '0.60', quantity: '100', expiry: '24h' },
    { outcomeId: 0n, side: 'BUY',  price: '0.58', quantity: '100', expiry: '24h' },
    { outcomeId: 0n, side: 'SELL', price: '0.62', quantity: '100', expiry: '24h' },
    { outcomeId: 0n, side: 'SELL', price: '0.64', quantity: '100', expiry: '24h' },
  ],
});

All orders share the same marketId. Collateral for all BUYs is pulled in a single transferFrom; outcome tokens for all SELLs are pulled in one safeBatchTransferFrom. If any order fails validation, the whole batch reverts.

A raw batchPlaceOrders variant is also available for callers that already work in ticks and BigInt quantities.

Batch Cancel

Cancel up to 100 orders in a single transaction. Orders may belong to different markets:

await client.trade.batchCancelOrders([orderId1, orderId2, orderId3, /* … */]);

Only the order owner can cancel their orders. Any non-cancellable order in the batch reverts the whole transaction.

Cancel and Replace (Atomic)

For market makers adjusting quotes, cancelAndReplace atomically cancels existing orders on a specific market and places new ones — all in one transaction:

await client.trade.cancelAndReplaceSimple({
  marketId: 1n,
  cancelOrderIds: [existingBuyId, existingSellId],
  newOrders: [
    { outcomeId: 0n, side: 'BUY',  price: '0.61', quantity: '100', expiry: '24h' },
    { outcomeId: 0n, side: 'SELL', price: '0.63', quantity: '100', expiry: '24h' },
  ],
});

Cancelled collateral is released and immediately re-locked for the new orders, which can reduce approval friction and ensures you never have a moment with a partially-updated quote.

Gas Notes

  • Batch place and cancel each walk their respective lists — gas scales linearly
  • Cancel-and-replace refunds collateral before re-locking it, so it's cheaper than a separate cancel + place pair
  • The protocol's inline expiry cleanup still runs during normal matching; you don't need to batch-cancel expired orders just to clean them up

What's Next