From a068b8b0a303162062dead084dae74b5849a7822 Mon Sep 17 00:00:00 2001 From: f321x Date: Fri, 5 Jul 2024 16:47:06 +0200 Subject: [PATCH] add comments --- docs/TapTrade_obs/.obsidian/workspace.json | 16 ++++++++-------- .../coordinator/src/communication/mod.rs | 12 ++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/TapTrade_obs/.obsidian/workspace.json b/docs/TapTrade_obs/.obsidian/workspace.json index e29cddb..23fadd5 100755 --- a/docs/TapTrade_obs/.obsidian/workspace.json +++ b/docs/TapTrade_obs/.obsidian/workspace.json @@ -13,11 +13,11 @@ "state": { "type": "canvas", "state": { - "file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas", + "file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas", "viewState": { - "x": 31, - "y": 52.90863555471327, - "zoom": -0.4572735104698888 + "x": -125.12881895131909, + "y": 859.308783676805, + "zoom": 0.20434041253440594 } } } @@ -88,7 +88,7 @@ "state": { "type": "backlink", "state": { - "file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas", + "file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -105,7 +105,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas", + "file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -128,7 +128,7 @@ "state": { "type": "outline", "state": { - "file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas" + "file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas" } } } @@ -151,8 +151,8 @@ }, "active": "bdb9fd88a01a8909", "lastOpenFiles": [ - "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas", "Research/Trade Pipelines/new concepts/concept locking script 1.canvas", + "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas", "Research/Bitcoin fundamentals/Knowledge sources.md", "assets/ptlc2.png", "assets/ptlc.png", diff --git a/taptrade-cli-demo/coordinator/src/communication/mod.rs b/taptrade-cli-demo/coordinator/src/communication/mod.rs index 0ccce08..80d6a0d 100755 --- a/taptrade-cli-demo/coordinator/src/communication/mod.rs +++ b/taptrade-cli-demo/coordinator/src/communication/mod.rs @@ -149,6 +149,9 @@ async fn request_offer_status_maker( } /// receives the signed escrow psbt and verifies it +/// Supposed to be the endpoint that both maker & taker will send their part of the PSBT to (with signatures), the +/// coordinator then has to check if their signatures are valid and everything else is according to the agreed upon contract. +/// Once the coordinator has received both partitial signed PSBTs he can assemble them together to a transaction and publish it to the bitcoin network. async fn submit_escrow_psbt( Extension(database): Extension, Extension(wallet): Extension, @@ -157,6 +160,11 @@ async fn submit_escrow_psbt( panic!("implement") } +/// Will get polled by the traders once they submitted their PSBT part. The coorinator will return status code 200 once he received both PSBTs and they got mined, +/// then the traders will know it is secure to begin with the fiat exchange and can continue with the trade (exchange information in the chat and transfer fiat). +/// We can implement this once the PSBT is done. +/// In theory this polling mechanism could also be replaced by the traders scanning the blockchain themself so they could also see once the tx is confirmed. +/// We have to see what makes more sense later, but maybe this would be more elegant. TBD. async fn poll_escrow_confirmation( Extension(database): Extension, Extension(wallet): Extension, @@ -173,6 +181,10 @@ async fn submit_obligation_confirmation( panic!("implement") } +/// Is supposed to get polled by the traders once they clicked on "i sent the fiat" or "i received the fiat". +/// If both agree then the payout logic (tbd) will be called (assembly of a payout transaction out of the escrow contract to their payout addresses). +/// If one of them is not happy and initiating escrow (e.g. claiming they didn't receive the fiat) then this +/// endpoint can return 201 and the escrow mediation logic will get executed (tbd). async fn poll_final_payout( Extension(database): Extension, Extension(wallet): Extension,