@startuml actor "Buyer \n[frontend]" as User participant "Buyer \n[daemon]" as UserApp participant "Seller \n[daemon]" as SellerApp actor "Seller \n[frontend]" as Seller participant Oracle as Oracle participant Bitcoin as Bitcoin Seller -> SellerApp: publish sell order SellerApp -> Oracle: Attestation for sell order Oracle --> SellerApp: Attestation pubkey User -> UserApp: Start daemon & UI UserApp -> SellerApp: fetch current sell order SellerApp -->UserApp: current sell order UserApp -> User: Show sell order (1) User -> UserApp: Take order UserApp -> SellerApp: Take request (incl. protocol params?) SellerApp -> Seller: Notfiy seller about take request Seller -> SellerApp: Accept SellerApp --> UserApp: Take response (incl. protocol params?) group DLC setup UserApp -> SellerApp: protocol setup step 1..n SellerApp --> UserApp: protocol setup step 1..n note over UserApp : CETs generated note over SellerApp : CETs generated SellerApp -> Bitcoin: Publish DLC SellerApp -> SellerApp: Update CFD state: open SellerApp -> Seller: Sell position open note over SellerApp : Assumption: \nSeller publishes DLC \nBuyer CET upon closing position UserApp -> Bitcoin: Witness DLC UserApp -> UserApp: Update CFD state: open UserApp -> User: Buy position open end group Seller -> SellerApp: Republish new sell-order group DLC settlement User -> UserApp: Close long position UserApp -> Oracle: request attestation Oracle --> UserApp: attested price UserApp -> Bitcoin: CET according to price SellerApp -> SellerApp: Update position state to closed SellerApp -> Seller: Position was closed end group @enduml