Skip to main content
All trading actions are batched via Controller.execute. For each item in actionList you provide an ABI‑encoded params struct in paramsDataList.

CANCEL (full or partial)

The CANCEL action allows you to cancel an open limit order, fully or partially. leftQuoteAmount is the remaining quote you want after cancellation (0 for full cancellation).

CancelOrderParams struct

CancelOrderParams(
  id: uint256,
  leftQuoteAmount: uint256
)

Example

const cancelTypes = [
  { name: 'id', type: 'uint256' },
  { name: 'leftQuoteAmount', type: 'uint256' },
] as const;

const cancelData = encodeAbiParameters(cancelTypes, [orderId, 0n]);
await writeExecute([Action.CANCEL], [cancelData]);

Parameters

  • id: The order ID
  • leftQuoteAmount: The amount of quote tokens you want to remain in the order after cancellation
    • Set to 0 for full cancellation
    • Set to a positive value for partial cancellation (the difference will be returned to your vault)

Partial cancellation example

// If you have an order with 1000 quote tokens and want to cancel 400 tokens:
const cancelData = encodeAbiParameters(cancelTypes, [orderId, 600n]); // Leave 600 tokens
await writeExecute([Action.CANCEL], [cancelData]);