Debridge swap

Debridge swap allows cancellation before a cross-chain order reaches fulfillment

· last updated

Debridge swap cancellation starts on the destination chain and releases locked funds on the source chain. Cancelling an unfilled cross-chain order requires action from its designated cancellation authority. Fulfillment closes that exit, even if source settlement remains pending. Before committing funds, establish who can cancel, which address receives the refund and which asset the order actually locks.

Timing affects both the exchange and its exit. Leaving an order open preserves the opportunity for fulfillment. Cancelling stops that opportunity once the destination transaction succeeds, while a separate cross-chain message enables the refund.

Fulfillment closes the cancellation window

An unfilled order permits cancellation only while its destination state remains eligible, so elapsed waiting time does not reserve a later opportunity to exit. Solvers decide whether an order merits execution. Changing market conditions can make an outstanding order attractive before a cancellation transaction executes.

Submitting a cancellation request does not establish that the contract accepted it. If fulfillment happens first, the order has already crossed the cancellation boundary. Conversely, successful cancellation prevents subsequent fulfillment. The destination contract resolves this competition through the order state, rather than the time someone opened a cancellation screen.


Cancellation confirmation and source release

Successful destination cancellation stops the exchange, while the source-chain refund requires the cancellation message to complete its separate execution. These events answer different questions: whether the order can still fill and whether its locked funds have returned.

The order record distinguishes cancellation initiation from the completed claim. A cancellation transaction therefore provides evidence of the exit request without necessarily proving that the beneficiary already holds the refund. The order identifier connects those records across chains.

Source settlement also occurs after successful fulfillment, but that settlement releases the locked input to the solver. Pending source settlement does not reopen a fulfilled order for cancellation.

For refund reconciliation, match the source-chain transfer to the cancellation beneficiary and the asset that the order locked. A destination cancellation confirmation alone cannot establish that source-chain receipt.


Who controls the cancellation transaction?

The destination order authority controls cancellation, and the order fixes that authority when it is created. Holding the source wallet or being the intended output recipient does not independently confer that permission.

Only the designated destination order authority can initiate the order cancellation transaction. The API identifies this address through dstChainOrderAuthorityAddress. Its generated cancellation transaction includes a from field and the destination chainId, allowing the integration to identify the required signer and submission network.

This authority matters before funds enter the order. An integration that assigns cancellation authority elsewhere changes who can initiate recovery.

Where will the refund arrive?

The refund arrives at the permitted cancellation beneficiary on the source chain, which need not be the destination recipient selected for a successful exchange.

Where will the refund arrive?: The standard cancellation API returns a cancelBeneficiary alongside the transaction fields. Its documented flow returns funds to the source order authority.; Inspecting that field identifies the actual refund destination for the generated transaction; assuming it matches the destination recipient can lead to checking the wrong account.

Open full-size image

At the contract level, an order can restrict refunds to a specified beneficiary. When that restriction exists, the cancellation authority must use the permitted address. Without that restriction, the authority can select a beneficiary during cancellation. This difference affects control over the refund as well as control over the cancellation itself.

The standard cancellation API returns a cancelBeneficiary alongside the transaction fields. Its documented flow returns funds to the source order authority. Inspecting that field identifies the actual refund destination for the generated transaction; assuming it matches the destination recipient can lead to checking the wrong account.

Refund assets after source conversion

A refund returns the asset locked for the cross-chain order, so a completed source conversion can change what comes back after cancellation.

Refund assets after source conversion: Some routes first exchange the selected input into a reserve asset before creating the order. The contract then locks that reserve asset for settlement.; Cancellation after a pre-order swap returns the locked reserve asset rather than the original non-reserve input. The cancellation does not reverse the earlier conversion.
Visual summary: Refund assets after source conversion

Open full-size image

Some routes first exchange the selected input into a reserve asset before creating the order. The contract then locks that reserve asset for settlement. Cancellation after a pre-order swap returns the locked reserve asset rather than the original non-reserve input. The cancellation does not reverse the earlier conversion.

The creation response exposes the refund asset and amount through srcChainTokenOut when a pre-order swap occurs. If that field is absent, srcChainTokenIn identifies the refund asset. This distinction makes refund denomination part of the decision before submission, especially when regaining the original token matters more than recovering the order's locked balance.

Cancellation costs outside the locked balance

Returning an order's locked balance does not make its cancellation transaction free, because initiating and delivering the cancellation requires additional blockchain execution.

The locked funds return with the affiliate and protocol fees held for that order. Network gas already spent on transactions is separate. The cancellation transaction generated through the API also carries a native-currency value. That value covers cross-chain messaging and a prepayment toward execution of the source-chain claim. The sender needs enough native currency for the transaction value and destination transaction gas.

A fixed cancellation-cost estimate would conceal those separate inputs. The transaction being prepared supplies the applicable value, while the wallet estimates its network gas requirement.

Cancellation costs outside the locked balance: Returning an order's locked balance does not make its cancellation transaction free, because initiating and delivering the cancellation requires additional blockchain execution.
Cancellation costs outside the locked balance

Open full-size image


When does automatic cancellation apply?

Automatic cancellation applies to eligible market orders through approved integrations with the feature enabled for their referral code; a referral code alone does not activate it.

The arrangement assigns destination cancellation authority to a deBridge-controlled address and subsidizes cancellation costs. Limit orders fall outside this automatic mechanism. Integrations must configure the source refund beneficiary correctly, because automation changes who submits cancellation without removing the need for a valid refund destination. Its configured timeout is an integration condition, not a universal deadline for every order.

Waiting and cancelling serve different timing needs

Leaving an order open retains its existing exchange terms and the possibility of later fulfillment. Cancellation seeks recovery of the locked input instead.

Waiting depends on a solver accepting the order under prevailing conditions. An order can remain unfilled when its terms do not cover the solver's costs or perceived risks. Cancellation depends on an eligible order state, the designated authority and execution of the refund message. Neither choice turns a personal deadline into a protocol completion guarantee.

For a time-sensitive exchange, define whether eventual destination delivery remains acceptable before committing. If recovering funds becomes the priority, account for the refund asset and beneficiary as well as cancellation eligibility. Funds awaiting a source-chain refund cannot yet fund the next transaction from that beneficiary's wallet.

Debridge swap - common questions

Does receiving cancellation transaction data mean the order has been cancelled?

Receiving transaction data does not cancel the order. The API prepares a transaction that the authorized destination account must sign and submit. Its response describes the required sender, chain and transaction value; it does not prove successful execution. Successful cancellation on the destination chain prevents fulfillment; the subsequent source-chain claim releases the refund.

Which record identifies an order when requesting cancellation?

The order identifier identifies the cross-chain order for cancellation. Successful order creation returns that identifier and emits a creation event containing the order details. A transaction hash identifies a blockchain transaction, while the order identifier connects the order's fulfillment or cancellation records.

Is cancelling a hook the same as cancelling the swap order?

Cancelling a hook is a separate operation from cancelling the cross-chain order. A hook is an attached external call, and the API provides a distinct transaction-generation operation for its cancellation. The order record also tracks external-call status separately. A cancelled external call alone does not prove that the source input has been refunded.

Can a failed cancellation request prove that the exchange completed?

A failed cancellation request does not by itself prove fulfillment. Cancellation also requires the correct destination chain, authorized sender and transaction funding. An API error or rejected transaction therefore needs its own explanation. The destination order state establishes whether fulfillment occurred.