Cow swap cancellation can arrive after an order settles.
Cow swap lets you request cancellation of a pending order, but settlement can overtake that request. Off-chain cancellation asks the order book to stop processing the order. On-chain cancellation submits a transaction that invalidates it through the relevant contract. Neither method reverses a trade that has already settled. The distinction matters when you change your mind, discover incorrect trading terms or need to replace an order quickly. Before treating the exchange as stopped, distinguish the cancellation request from its confirmed effect. Check whether any part of the order traded and whether the remaining amount can still execute.
A pending order that fills before cancellation
In this hypothetical example, a regular token order remains open when its owner decides to stop the exchange. The order, wallet balances, network conditions and transaction ordering are illustrative.
The owner chooses on-chain cancellation because they want the contract to invalidate the order. Before submitting, they check the order identifier and network and confirm that the connected account owns the order. Their wallet must have enough native currency to cover the cancellation transaction’s estimated network fee.
The cancellation transaction eventually succeeds. However, an independent inspection of the order’s settlement transaction shows that the full trade executed earlier. The recipient’s token transfers confirm delivery of the buy token. The successful cancellation receipt therefore doesn’t establish that the exchange stopped before execution.
The concrete outcome is a completed trade followed by invalidation. The cancellation also incurred its own network cost. Different transaction ordering could have prevented the fill, but paying for cancellation never purchases a guaranteed place ahead of settlement.
Off-chain cancellation and the surviving signature
Off-chain cancellation sends an authenticated message to the order book, which marks the order cancelled and stops including it in future processing. The cancellation message itself doesn’t require a blockchain transaction, so it has no network gas charge.
Off-chain cancellation leaves the original order signature valid on-chain. This explains the term soft cancellation: the service changes its treatment of the order without changing the contract’s validation state. An accepted request therefore isn’t equivalent to a contract-enforced prohibition on execution.
The distinction is especially relevant when execution has already started. An order disappearing from an active list doesn’t prove that no settlement occurred.
Does an on-chain cancellation stop every pending trade?
On-chain cancellation prevents subsequent execution once invalidation takes effect, but a settlement can execute before the cancellation transaction confirms. Submitting the transaction starts that process; it doesn’t establish its outcome.
For regular orders, the settlement contract exposes
invalidateOrder. The order owner calls it with the order’s unique identifier.
The settlement contract rejects a regular order invalidation when the caller isn’t the order owner.
Successful invalidation changes the contract’s order state so that later settlement attempts cannot fill that order.
The transaction requires gas. Its cost depends on the contract operation and applicable network fees, rather than a fixed cancellation price. Review the wallet’s estimate before authorization and the actual fee after execution. A transaction hash alone confirms neither success nor invalidation.
The race between cancellation and settlement
Cancellation and settlement can progress concurrently, so the decisive event is their effective ordering rather than the moment you press a button. Off-chain requests need processing; on-chain requests need successful execution.
An order may already sit inside a settlement that a solver is preparing or submitting. The cancellation request doesn’t pull that transaction back out of execution. Even the on-chain option retains this timing risk until its transaction confirms.
Expiry provides a separate stopping condition. Regular orders contain a signed validity deadline, and the settlement contract checks it against the block timestamp. Waiting for expiry leaves an executable order exposed until that deadline passes. An expiring quote also doesn’t replace the validity conditions of an order that you already authorized.
There is no universal cancellation countdown. The order’s execution state, request processing and blockchain transaction ordering determine whether the request arrives in time.
Completed fills and funds still available
A partially filled order can contain completed trades alongside an unfilled remainder. Cancellation acts on future execution; it doesn’t exchange previously received tokens back into the original asset. This distinction changes both the amount that remains available and the records that you need to reconcile.
Amounts after a partial fill
Tokens already exchanged
Executed fills remain part of the trading history after cancellation. Use their recorded sell and buy amounts to establish what actually moved. The original requested amount describes the order’s terms, while individual trade records describe its execution.
Tokens that remain unspent
For ordinary orders funded from a wallet balance, the unspent portion remains in that wallet. Cancelling the order doesn’t require a refund of tokens that never left. Keep the distinction between the order amount and the amount already consumed by fills.
Native-token deposits
Eth-flow orders have a different funding arrangement because their creation deposits native tokens into a contract. Their invalidation operation returns funds that haven’t been used for trading. Before expiry, the intent creator can initiate invalidation; after expiry, another address can trigger the return to that creator. Confirm the returned funds as well as the order’s status. A cancellation request alone doesn’t establish a completed refund.
Records that establish the cancellation outcome
The order identifier connects cancellation status with trading history, while transaction receipts establish what the blockchain executed. Keep that identifier alongside any cancellation transaction hash and settlement transaction hashes.
For an on-chain cancellation, inspect the successful receipt and the invalidation associated with the intended order. Then check its trade history for earlier fills. A settlement record establishes execution; the corresponding token transfers establish what reached the recipient. These checks also distinguish an unsuccessful cancellation transaction from one that succeeded after a fill.
An off-chain acknowledgement has a narrower meaning: the order book accepted the cancellation. It doesn’t supply an on-chain invalidation receipt. The order API provides order details and trade queries for following the same identifier across these records.
When can I submit a replacement order?
Submit a replacement after accounting for the original order’s completed fills and establishing what prevents its remaining amount from executing. Otherwise, overlapping authorizations can leave both orders eligible to trade when sufficient balance and allowance exist.
The replacement needs its own reviewed quote and trading conditions. Reusing the original requested amount without subtracting completed fills can authorize more trading than you intended. Likewise, changing the recipient, amount or price in the form doesn’t edit an existing signed order.
The order book supports an atomic replacement operation that cancels the old order and creates the new one together. That atomicity concerns the order book operation; it doesn’t reverse earlier blockchain settlement or turn soft cancellation into contract invalidation. The API can also reject replacement while the old order is actively being bid on.
Everyday questions about Cow swap
-
Why does a cancellation request report that the order has expired?
- An expired order has passed its execution deadline, so the order book can reject a redundant cancellation request. Expiry doesn’t establish that the order never traded. Earlier fills remain valid, and an order that held deposited funds may still require a refund operation. The cancellation API distinguishes expiration from full execution and prior cancellation.
-
Can another wallet cancel my regular signed order?
- An unrelated wallet cannot invalidate your regular order through the settlement contract’s owner-only cancellation function. The contract checks the caller against the owner encoded in the order identifier. Connecting a different account therefore doesn’t transfer cancellation authority. A contract wallet must initiate the operation through its own authorization mechanism.
-
Does the protocol support cancelling several orders in one request?
- The order book API supports a signed cancellation request containing multiple order identifiers. This is an off-chain operation, so it retains the same limitation as an individual soft cancellation: it may not prevent settlement. Support in the API doesn’t establish that every interface exposes a bulk cancellation control.
-
How do required wallet signatures affect cancellation of a scheduled order?
- A scheduled order held through a Safe requires the wallet’s necessary approvals before its cancellation transaction can execute. Creating a cancellation proposal doesn’t complete cancellation. Required signers must authorize it, and the wallet must execute the transaction. Previously completed scheduled trades remain completed.
-
Is an empty historical filled-amount value proof that my cancelled order never traded?
- An empty historical filled-amount storage value doesn’t prove that an order never traded. The settlement contract allows storage for expired orders to be cleared. Historical trade events and transaction records preserve the execution evidence that this storage value cannot reliably supply after cleanup.
· updated