Function: cancel(byte[32] asset, address account, uint256[] orderIds)
This function cancels previously placed limit orders. The account should be an owner of all orders from orderIds. Provided orders are removed from the order book (if they exist), and the totalCollateralRefunded is returned from this function.
This function ensures the order belongs to the account and the order exists.
Branches and code coverage
Intended branches
One
reduceOnlyorder —totalCollateralRefundedis zero.Successfully cancels all provided active limit orders.
Emits
OrderCanceledevents with correct data.Orders are removed from the order book.
orderbookCollateralin the GTL contract is updated correctly.quoteTokenOpenInterestis updated properly whenside == Side.BUY.baseTokenOpenInterestis updated properly whenside == Side.SELL.
Negative behavior
order.owner != account.if order is null, this order will be skipped, and execution is not revert.
orderIdscontains duplicate IDs. All duplicate IDs are skipped, and execution is not revert.