Cancelling the Order

It can be the case that the given order remains unfulfilled for a prolonged period of time. The reason for this may be that the order became unprofitable, and no one is willing to fulfill it. In this case, the order must be cancelled to unlock the input amount of funds.
The only way to cancel the order is to initiate the cancellation procedure it was intended to be fulfilled on (the dstChainId parameter). During the cancellation process, the order is marked as cancelled (to prevent further fulfillment) and a cross-chain message is sent through the deBridge cross-chain messaging infrastructure to the DLN contract on the source chain to unlock the given funds. The funds locked on the source chain are returned in full including affiliate and protocol fees.
The cancellation procedure can only be initiated by the dstChainOrderAuthorityAddress in a separate transaction on the destination chain. Such transaction can be requested by calling the /v1.0/dln/order/:id/cancel-tx endpoint:
This gives the response with the transaction data ready to be signed and broadcasted to the destination chain:
"tx": {
"data": "0xd38d96260000000000000000000000000000000[...truncated...]",
"to": "0xe7351fd770a37282b91d153ee690b63579d6dd7f",
"value": "35957750149468810",
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"chainId": 43114
Several considerations:
  • the transaction can be submitted only to the chain where the order has been intended to be fulfilled on
  • the transaction call would be accepted only if made by the dstChainOrderAuthorityAddress specified during the given order creation
  • the funds locked on the source chain upon order created are returned to the srcChainOrderAuthorityAddress specified during the given order creation
  • the value for the transaction is always positive needed to cover:
    • the deBridge cross-chain messaging protocol fee (measured in the blockchain native currency where the message is being sent from) to make a cancellation message accepted. Consider looking at the details on retrieving the deBridge protocol fee;
    • a small amount to cover the gas on the source chain, which gives an incentive to keepers for the successful claim of the cross-chain message on the source chain. In other words, this is a prepayment for potential gas expenses, that will be transferred by the protocol.