Cancel order

An admin can cancel an order, most of the time this is done when admin is solving a dispute, for this the admin will need to send an order message to Mostro with action admin-cancel with the id of the order like this:

[
  {
    "order": {
      "version": 2,
      "id": "<Order Id>",
      "action": "admin-cancel",
      "payload": null
    }
  },
  null,
  null
]

Bond resolution payload

When solving a dispute, the admin can optionally slash one or both parties' bonds independently from the trade outcome (settle vs. cancel). To do this, the payload is set to a bond_resolution object with two booleans, slash_seller and slash_buyer:

[
  {
    "order": {
      "version": 2,
      "id": "<Order Id>",
      "action": "admin-cancel",
      "payload": {
        "bond_resolution": {
          "slash_seller": true,
          "slash_buyer": false
        }
      }
    }
  },
  null,
  null
]

Accepted combinations on admin-cancel:

  • { "slash_seller": false, "slash_buyer": false } — cancel without slashing any bond
  • { "slash_seller": true, "slash_buyer": false } — cancel and slash the seller's bond
  • { "slash_seller": false, "slash_buyer": true } — cancel and slash the buyer's bond
  • { "slash_seller": true, "slash_buyer": true } — cancel and slash both bonds
  • payload: null — legacy clients; interpreted server-side as "no slash"

bond_resolution is only valid on admin-cancel and admin-settle; it is rejected on every other action.

Whenever a side is slashed and the operator has configured slash_node_share_pct < 1.0, the non-slashed counterparty is subsequently asked to provide a Lightning invoice for their share of the bond via Bond payout invoice.

Each slashed party is also sent a bond-slashed forfeiture notice for the slashed bond amount, in addition to the admin-canceled confirmation below.

Cancel an order waiting for its maker bond

admin-cancel also accepts an order still waiting for its maker bond (daemon-internal waiting-maker-bond), but only when the message is signed with the Mostro node's own key: this is how an operator clears unpublished orders, for example before a maintenance. A solver's admin-cancel on such an order receives cant-do with reason not_authorized.

The order was never published, so Mostro closes it as canceled-by-admin in its database only, with no addressable event. It releases the maker bond, which cancels its hold invoice, and sends the maker admin-canceled (the message below). If the bond locked a moment earlier and the order is not published yet, the request receives cant-do with reason not_allowed_by_status; once the order is pending, admin-cancel cancels it as a published order. bond_resolution is ignored on this path: nothing is slashed.

Mostro response

Mostro will send this message to the both parties buyer/seller and to the admin:

[
  {
    "order": {
      "version": 2,
      "id": "<Order Id>",
      "action": "admin-canceled",
      "payload": null
    }
  },
  null,
  null
]

Mostro updates addressable events

Mostro will publish two addressable events, one for the order to update the status to canceled, this means that the hold invoice was canceled and the seller's funds were returned:

[
  "EVENT",
  "RAND",
  {
    "id": "3d74ce3f10096d163603aa82beb5778bd1686226fdfcfba5d4c3a2c3137929ea",
    "pubkey": "<Mostro's pubkey>",
    "created_at": 1703260182,
    "kind": 38383,
    "tags": [
      ["d", "<Order Id>"],
      ["k", "sell"],
      ["f", "VES"],
      ["s", "canceled"],
      ["amt", "7851"],
      ["fa", "100"],
      ["pm", "face to face"],
      ["premium", "1"],
      ["y", "mostro", "[Mostro instance name]"],
      ["z", "order"]
    ],
    "content": "",
    "sig": "<Mostro's signature>"
  }
]

The second event updates the addressable dispute event with status seller-refunded:

[
  "EVENT",
  "RAND",
  {
    "id": "098e8622eae022a79bc793984fccbc5ea3f6641bdcdffaa031c00d3bd33ca5a0",
    "pubkey": "<Mostro's pubkey>",
    "created_at": 1703274022,
    "kind": 38386,
    "tags": [
      ["d", "efc75871-2568-40b9-a6ee-c382d4d6de01"],
      ["s", "seller-refunded"],
      ["published_at", "1703016565"],
      ["y", "mostro", "[Mostro instance name]"],
      ["z", "dispute"]
    ],
    "content": "",
    "sig": "<Mostro's signature>"
  }
]