Skip to content

Commit

Permalink
Settle order and tags updates (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
grunch authored Dec 22, 2023
1 parent 21e9f11 commit 05203d9
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 27 deletions.
1 change: 1 addition & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
- [Rate user](./user_rating.md)
- [Cancel](./cancel.md)
- [Dispute](./dispute.md)
- [Settle order](./settle_order.md)
- [Actions](./actions.md)
8 changes: 4 additions & 4 deletions book/src/cancel.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down Expand Up @@ -123,8 +123,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down
8 changes: 5 additions & 3 deletions book/src/dispute.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Here is an example of the nip 33 event sent by Mostro:
"tags": [
["d", "efc75871-2568-40b9-a6ee-c382d4d6de01"],
["s", "Pending"],
["data_label", "dispute"]
["y", "mostrop2p"],
["z", "dispute"]
],
"content": "",
"sig": "00a1da45c00684c5af18cf292ca11697c9e70f2a691e6cd397211e717d2f54362dd401d7567da8184a5c596f48a09693479e67214c23e773523a63d0b1c3f537"
Expand Down Expand Up @@ -97,7 +98,7 @@ Mostro will send a confirmation message to the admin with the Order details:
"Order": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "Pending",
"status": "Active",
"amount": 0,
"fiat_code": "VES",
"fiat_amount": 100,
Expand Down Expand Up @@ -127,7 +128,8 @@ Also Mostro will broadcast a new nip33 dispute event to update the Dispute `stat
"tags": [
["d", "efc75871-2568-40b9-a6ee-c382d4d6de01"],
["s", "InProgress"],
["data_label", "dispute"]
["y", "mostrop2p"],
["z", "dispute"]
],
"content": "",
"sig": "20d454a0704cfac1d4a6660d234ce407deb56db8f08598741af5d38c0698a96234fd326a34e7efb2ac20c1c0ed0a921fd50513aab8f5c4b83e2509f2d32794d2"
Expand Down
4 changes: 2 additions & 2 deletions book/src/fiatsent.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down
4 changes: 2 additions & 2 deletions book/src/new_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ Mostro publishes this order as an event kind `38383` with status `Pending`:
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "7e8fe1eb644f33ff51d8805c02a0e1a6d034e6234eac50ef7a7e0dac68a0414f7910366204fa8217086f90eddaa37ded71e61f736d1838e37c0b73f6a16c4af2"
Expand Down
8 changes: 4 additions & 4 deletions book/src/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down Expand Up @@ -109,8 +109,8 @@ Seconds later Mostro will try to pay the buyer's invoice, if the payment is succ
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down
4 changes: 2 additions & 2 deletions book/src/seller_pay_hold_invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down
143 changes: 143 additions & 0 deletions book/src/settle_order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Settle order

An admin can settle 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 `AdminSettle` with the `Id` of the order like this:

```json
{
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AdminSettle",
"content": null
}
}
```

## Mostro response

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

```json
{
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AdminSettle,",
"content": null
}
}
```

## Mostro send a nip 33 event to show the order is settled by the admin

```json
[
"EVENT",
"RAND",
{
"id": "3d74ce3f10096d163603aa82beb5778bd1686226fdfcfba5d4c3a2c3137929ea",
"pubkey": "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a",
"created_at": 1703260182,
"kind": 38383,
"tags": [
["d", "ede61c96-4c13-4519-bf3a-dcf7f1e9d842"],
["k", "Sell"],
["f", "VES"],
["s", "SettledByAdmin"],
["amt", "7851"],
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "76bfc5e9ce089757dd4074472e1df421da700ce133c874f40b1136607121eca8acfdd2b8b4b374adaa83fa0c7d99672eb21a1068b6b6b774742d5de5bfc932ba"
}
]
```

Mostro updates the nip 33 order event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `SettledByAdmin`:

```json
[
"EVENT",
"RAND",
{
"id": "316cf27758b0ae358dbc1fdcf27da38d80910543c8f74efeb77e7230910770ca",
"pubkey": "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a",
"created_at": 1703274022,
"kind": 38383,
"tags": [
["d", "ede61c96-4c13-4519-bf3a-dcf7f1e9d842"],
["k", "Sell"],
["f", "VES"],
["s", "SettledByAdmin"],
["amt", "7851"],
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "27803a0f0f9961bff3ebdcd94c489dc27910002c51cbf297a0d95d8ced4f5d40d7b021ae342e90aa31acfdaee4536097368271b89239d9aed5de4dc986f6ed0b"
}
]
```

And updates nip33 dispute event with status `Settled`:

```json
[
"EVENT",
"RAND",
{
"id": "098e8622eae022a79bc793984fccbc5ea3f6641bdcdffaa031c00d3bd33ca5a0",
"pubkey": "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a",
"created_at": 1703274022,
"kind": 38383,
"tags": [
["d", "efc75871-2568-40b9-a6ee-c382d4d6de01"],
["s", "Settled"],
["y", "mostrop2p"],
["z", "dispute"]
],
"content": "",
"sig": "6d7ca7bef7b696f1f6f8cfc33b3fe1beb2fdc6b7647efc93be669c6c1a9d4bafc770d9b0d25432c204dd487d48b39e589dfd7b03bf0e808483921b8937bd5367"
}
]
```

## Mostro tries to pay buyer's invoice

If the buyer's invoice is paid successfully Mostro will update the nip33 order event status `Success`:

```json
[
"EVENT",
"RAND",
{
"id": "6170892aca6a73906142e58a9c29734d49b399a3811f6216ce553b4a77a8a11e",
"pubkey": "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a",
"created_at": 1703274032,
"kind": 38383,
"tags": [
["d", "b374ca1a-d596-419b-8d95-b8866044d892"],
["k", "Sell"],
["f", "VES"],
["s", "Success"],
["amt", "7851"],
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "1670a9e61f7bc99f7121a95a2d479456970fbd9bc84d663160e35d1a95d71a006c7986db050ea584d5040927879fd9dcc85dc0ab5c6367f679c9fd5fd33a3cfb"
}
]
```
12 changes: 6 additions & 6 deletions book/src/take_buy.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down Expand Up @@ -140,8 +140,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down Expand Up @@ -217,8 +217,8 @@ Finally Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dc
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down
8 changes: 4 additions & 4 deletions book/src/take_sell.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down Expand Up @@ -143,8 +143,8 @@ Mostro updates the nip 33 event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d8
["fa", "100"],
["pm", "face to face"],
["premium", "1"],
["l", "MostroP2P"],
["data_label", "order"]
["y", "mostrop2p"],
["z", "order"]
],
"content": "",
"sig": "a835f8620db3ebdd9fa142ae99c599a61da86321c60f7c9fed0cc57169950f4121757ff64a5e998baccf6b68272aa51819c3e688d8ad586c0177b3cd1ab09c0f"
Expand Down

0 comments on commit 05203d9

Please sign in to comment.