Skip to content

Instantly share code, notes, and snippets.

@tsjk
Created March 7, 2025 12:54
Show Gist options
  • Save tsjk/48b121f0d6b3d5cc732733cc3ea677ca to your computer and use it in GitHub Desktop.
Save tsjk/48b121f0d6b3d5cc732733cc3ea677ca to your computer and use it in GitHub Desktop.
BisqEasyBuyerAsTakerProtocol
stateDiagram-v2
    state BuyerAsTaker {
        [*] --> TakerSentTakeOfferRequest
        TakerSentTakeOfferRequest --> TakerReceivedOfferResponse: Option 1 - Buyer receives take offer response, then account details can be exchanged in any order.
        TakerReceivedOfferResponse --> BuyerSentBtcAddress: Option 1.1 - Buyer sends btc address first, then seller sends account data.
        TakerSentTakeOfferRequest --> TakerDidNotReceiveOfferResponse: Option 2 - Buyer takes offer and sends btc address right after that. Then receives take offer response and finally seller's account data.
        TakerReceivedOfferResponse --> BuyerReceivedAccountData: Option 1.2 - Seller sends account data first, then buyer sends btc address.
        BuyerReceivedAccountData --> BuyerSentBtcAddressAndReceivedAccountData
        BuyerSentBtcAddress --> BuyerSentBtcAddressAndReceivedAccountData
        TakerDidNotReceiveOfferResponse --> TakerReceivedOfferResponse_BuyerSentBtcAddress
        TakerReceivedOfferResponse_BuyerSentBtcAddress --> BuyerSentBtcAddressAndReceivedAccountData
        BuyerSentBtcAddressAndReceivedAccountData --> BuyerSentFiatSentConfirmation
        BuyerSentFiatSentConfirmation --> BuyerReceivedSellerFiatReceiptConfirmation
        BuyerReceivedSellerFiatReceiptConfirmation --> BuyerReceivedBtcSentConfirmation
        BuyerReceivedBtcSentConfirmation --> BtcConfirmed
        BtcConfirmed --> [*]

        TakerSentTakeOfferRequest --> Rejected: On local trade rejection
        TakerReceivedOfferResponse --> Rejected: On local trade rejection
        TakerDidNotReceiveOfferResponse --> Rejected: On local trade rejection
        Rejected --> [*]
        TakerSentTakeOfferRequest --> PeerRejected: On peer trade rejection
        TakerReceivedOfferResponse --> PeerRejected: On peer trade rejection
        TakerDidNotReceiveOfferResponse --> PeerRejected: On peer trade rejection
        PeerRejected --> [*]

        BuyerSentBtcAddress --> Cancelled: On local trade cancellation
        TakerReceivedOfferResponse_BuyerSentBtcAddress --> Cancelled: On local trade cancellation
        BuyerReceivedAccountData --> Cancelled: On local trade cancellation
        BuyerSentBtcAddressAndReceivedAccountData --> Cancelled: On local trade cancellation
        BuyerSentFiatSentConfirmation --> Cancelled: On local trade cancellation
        BuyerReceivedSellerFiatReceiptConfirmation --> Cancelled: On local trade cancellation
        BuyerReceivedBtcSentConfirmation --> Cancelled: On local trade cancellation
        Cancelled --> [*]

        BuyerSentBtcAddress --> PeerCancelled: On trade cancellation by peer
        TakerReceivedOfferResponse_BuyerSentBtcAddress --> PeerCancelled: On trade cancellation by peer
        BuyerReceivedAccountData --> PeerCancelled: On trade cancellation by peer
        BuyerSentBtcAddressAndReceivedAccountData --> PeerCancelled: On trade cancellation by peer
        BuyerSentFiatSentConfirmation --> PeerCancelled: On trade cancellation by peer
        BuyerReceivedSellerFiatReceiptConfirmation --> PeerCancelled: On trade cancellation by peer
        BuyerReceivedBtcSentConfirmation --> PeerCancelled: On trade cancellation by peer
        PeerCancelled --> [*]
    }
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment