Function: cancel(byte[32] asset, address account, CancelArgs args)
The cancel function allows an account or approved operator of an account to manually cancel previously submitted limit orders that are still active (not yet filled or expired).
Inputs
assetControl: Full control.
Constraints: Market should exist.
Impact: Determines from which
assetmarket the orders are canceled.
accountControl: Full control.
Constraints: Only the order owner (or authorized operator) can cancel the order.
Impact: Owner of the orders.
args.orderIdsControl: Full control.
Constraints: Active orders.
Impact: Orders to be canceled.
args.settlementControl: Full control.
Constraints:
ACCOUNTandINSTANT.Impact: Settlement mode for the collateral refund.
Branches and code coverage
Intended branches
reduceOnlyorder — no refund.Successfully cancels all active limit orders.
INSTANTsettlement.ACCOUNTsettlement.Refunds correct margin.
No orders exist. No margin is refunded.
orderIdscontains multiple valid orders and one invalid, and it is skipped.orderIdscontains duplicated orders, and they are all skipped, except the first one.Cancels the last order in the book.
Negative behavior
The caller is not an owner or approved operator.