Cowswap

Cowswap Failed Swaps and Gas Costs

· last updated

Cowswap doesn’t charge user settlement gas when a standard off-chain ERC-20 order expires without a trade. An unsuccessful attempt can still leave a charge for a blockchain transaction that you submitted. On-chain token approvals, native-token deposits and on-chain cancellations have their own gas costs. A refund of unused native-token funds doesn’t reimburse the placement gas. The gas outcome follows the action that reached the blockchain and the account that submitted it.

From Token Permission to a Settled Swap

An ERC-20 swap with enough sell tokens and spending permission follows the signed-order path, with fills recording the amounts actually traded. Before signing, the minimum output and receiver need to match the intended exchange. A missing allowance adds an approval requirement before execution. The order record and the wallet’s transaction history provide different parts of the cost picture: trade execution and user-paid blockchain actions.

Order Signatures and Blockchain Receipts

A signed order specifies the assets, amounts, receiver and validity period that settlement must respect. Signing an EIP-712 order message doesn’t itself create a blockchain transaction. This typed-data format binds the signature to the selected network and settlement contract. Signing grants authority over those trading terms, including where the buy tokens should arrive. CoW Explorer combines order-book information with on-chain execution data, separating an open instruction from a recorded fill.

An order ID identifies a trading instruction. A transaction hash identifies a blockchain submission.


Approval Charges and Reusable Allowances

Token approval establishes spending permission before an ERC-20 trade can execute, and an on-chain approval can cost gas even when the subsequent order never fills.

On-Chain Token Approval

An allowance authorizes a specific spender to transfer a defined token amount from its owner. CoW Protocol’s GPv2VaultRelayer contract draws the sell tokens during settlement. Approving that spender doesn’t exchange the tokens or establish a completed swap. An existing, sufficient allowance can cover a later order, and the app supports approvals limited to the trading amount. An unlimited allowance isn’t a universal prerequisite. A mined approval that reverts consumes gas without establishing the requested permission.

Gasless Token Approval

Gasless approval applies only when the token and wallet support the app’s approval flow. Compatible tokens support this feature for market swaps and limit orders, excluding smart contract wallets. This avoids a separate user-paid approval transaction, although gasless token approval remains distinct from gasless order signing. A token can require an on-chain allowance even though its trading order uses an off-chain signature.


Who Pays When a Settlement Transaction Reverts?

The solver that submits a standard batch settlement pays that transaction’s gas. A revert rolls back the settlement’s token movements and trading-fee effects without returning the transaction sender’s consumed gas. The settlement contract enforces signed price limits and other validity conditions. A failure during execution can therefore prevent a trade without making the trader fund that failed transaction.

A completely unfilled order has no executed trade fee. Preparatory transactions remain outside that settlement’s rollback.

A filled order can include execution costs and protocol fees through its trading amounts. For a sell order, protocol fees reduce the buy amount compared with fee-free execution; for a buy order, they increase the sell amount. Those charges belong to completed execution; a displayed quote alone doesn’t debit them.


Cancellation Costs Before Settlement

Cancellation costs follow the method used to stop a pending order, with off-chain requests and on-chain invalidation creating different gas obligations and confirmation boundaries.

Off-Chain Cancellation

An off-chain cancellation request doesn’t require a blockchain transaction or transaction gas. It asks the order-book service to stop accepting the order for execution. The method relies on the service honoring the cancellation and doesn’t revoke the order’s on-chain authorization. Processing isn’t instantaneous. Settlement can happen before cancellation takes effect. A request to cancel therefore doesn’t establish that the order ended without a fill.

On-Chain Invalidation

On-chain invalidation records the cancellation in the settlement contract and requires transaction gas. Its protection begins once the invalidation transaction succeeds on-chain, so the order can still settle before that point. The amount that cancellation costs depends on gas consumed and the network’s fee conditions. A wallet’s displayed fee estimate describes that transaction, while the actual charge follows its execution receipt.

Native-Token Sales and Upfront Gas

Native-token sales can require user-paid blockchain transactions before settlement, so an unsuccessful swap can leave gas costs without a completed token exchange.

Wrapping Before Order Signing

Wrapping ETH produces WETH, the ERC-20 representation that the protocol can sell. The wrapping transaction costs gas, and WETH may need a vault-relayer allowance. Subsequent off-chain orders use that wrapped balance through the ordinary settlement mechanism. A failed or expired order doesn’t undo the earlier wrap or approval. Those completed operations retain their own gas costs, independently of whether the later trade succeeds.

Deposits Through Eth-flow

Eth-flow accepts native ETH in an on-chain deposit and creates an order that solvers settle later. A successful placement transaction establishes a funded order; the token exchange still requires settlement. The placement gas remains spent if the trade never fills. The app limits this flow to market swaps and doesn’t offer it to smart contract wallets. Safe’s app integration can instead bundle wrapping, approval and order placement in a wallet transaction.

Refunds of Unmatched ETH

An Eth-flow refund returns unused deposited funds after an unfilled order, and it doesn’t reimburse gas consumed by the placement transaction. Refundable trading funds and spent transaction gas are different balances, even when both use ETH.

The Eth-flow refunder implementation uses configurable eligibility settings for expired, unfilled orders. These settings govern the operated service, not the contract’s basic ability to return funds. The implementation’s default minimum price deviation from the quote is 190 basis points (1.9%). Operators can override this automatic-refund eligibility threshold through configuration. Manual recovery remains available if an automatic refund doesn’t arrive. The threshold isn’t a fixed trading fee.

Manual Eth-flow recovery remains available outside the automatic service’s eligibility rules. The creator can invalidate a still-valid order on-chain; after expiry, any account can trigger invalidation. A user who submits the recovery transaction pays its gas. Eth-flow cancellations use this on-chain path too.

Graphic: Refunds of Unmatched ETH (Cowswap)
Illustration: Refunds of Unmatched ETH

Open full-size image

Refunds go to the Eth-flow order’s creator, even if another account triggers recovery. That destination can differ from the designated buy-token receiver. The contract accounts for completed fills when calculating how much of the deposit it can return as unused ETH.

Cowswap FAQ

Does a Partially Filled Limit Order Still Incur Fees If the Remainder Expires?

Completed fills retain their execution fees even if the remaining limit order expires. An expired remainder doesn’t reverse the trades that already happened. CoW Explorer separates the recorded fills and their amounts, so an order that didn’t finish completely differs from one that never traded. Unspent sell tokens remain outside those completed fills.

Can a Token Approval From Another Exchange Cover a Cowswap Retry?

Another exchange’s approval only helps if it authorizes the same relevant spender. ERC-20 allowances belong to a token, an owner and a specific spender. CoW Protocol’s vault relayer needs sufficient permission on the network that holds the sell tokens. A retry can reuse that allowance if it remains adequate; updating it on-chain incurs gas.

Why Does a gas-estimation Error Appear Before a Token Approval?

A gas-estimation error means the wallet or node couldn’t produce a usable estimate for the proposed transaction. Estimation simulates execution without submitting the approval to the blockchain. That call doesn’t charge transaction gas. A warning before broadcast therefore differs from a mined, reverted approval, which consumes gas despite failing to establish permission.

Will Raising My wallet’s Gas Limit Make a Signed Order Fill Faster?

Raising a wallet transaction’s gas limit doesn’t accelerate an off-chain order. A gas limit caps the computation allowed for a blockchain transaction; it doesn’t change an order’s trading conditions. Solvers need an executable settlement that respects those conditions. Price, available funds, liquidity and execution costs govern whether the order can trade.

When Can Smart Contract Order Authorization Add an Upfront Gas Cost?

Order authorization adds upfront gas when the wallet uses CoW Protocol’s on-chain PreSign method. That method calls the settlement contract to authorize a specific order. Its transaction cost can remain even if the trade never executes. ERC-1271 also supports contract-validated orders, so PreSign isn’t a requirement for every smart contract order.

Are Failed Swaps Charged Differently When ETH Is the Buy Token?

Receiving ETH doesn’t require an Eth-flow sell deposit. A standard ERC-20 sell order can receive native ETH through settlement without first depositing ETH for sale. An entirely unfilled off-chain order creates no user settlement gas charge. Any on-chain approval that established permission for its sell token still has its own cost.

Why Can a Later Retry Quote Have a Different Network Fee?

A later quote can reflect changed execution costs and liquidity conditions. Network gas prices affect the cost of settling a trade, while the available execution path affects the work required. A limit order needs enough executable value to cover its price boundary and network costs. The earlier quote doesn’t permanently fix those conditions.

Can Cancelling a Settled Swap Return the Tokens That Were Sold?

Cancellation can’t reverse a completed settlement. Successful on-chain invalidation blocks future execution, while a settled trade has already transferred its tokens. For a partially filled order, cancellation can stop further fills without undoing earlier ones. An Eth-flow refund returns unused deposited funds, so it also doesn’t recover assets already exchanged in completed trades.