Function: _cancelOrder(Order order, bool revertIfInvalidCancellation)
This function cancels an existing order. Only the owner of the order can cancel it before it expires. This function can be reached in two ways, either through the external function cancelOrdersIgnoreInvalidCancellation(), which takes an array of orders to cancel, or through cancelOrder(), which takes a single order to cancel. Both of these outer functions are non-reentrant.
The owner will be refunded for their order, and wrapped tokens will be unwrapped in order to accomplish this.
Inputs
orderControl: Almost full control —
order.tokenInis set toWRAPPED_NATIVE_TOKENinsidetoSettlementOrder(). However, the original struct is still used in some places.Constraints: There are no direct constraints, but the hash of the settlement order must map to an order with status "created"; otherwise, the function returns early. If the order's
validtofield is in the future, only the owner can cancel it.Impact: The order to cancel.
revertIfInvalidCancellationControl: Indirectly controllable by picking which external function to run.
Constraints: Boolean. Only true or false.
Impact: Decides if an error during cancellation should just return or revert. Do note that it can still revert if the refund to the owner is unsuccessful.
Branches and code coverage
Intended branches
Negative behavior