Last active
October 28, 2019 19:29
-
-
Save rudolph9/50388601108aa2ef1aeaccc6b4e63dc9 to your computer and use it in GitHub Desktop.
Marlowe Smart Contract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Swap where | |
import Language.Marlowe | |
main :: IO () | |
main = print . pretty $ contract | |
{- Simply swap two payments between parties -} | |
contract :: Contract | |
contract = | |
When [Case (Deposit (AccountId 1 "CertRecipient") "CertRecipient" (Constant 1)) | |
(When [Case (Deposit (AccountId 2 "CertRecipient") "CertRecipient" (Constant 1)) | |
(When [Case (Choice (ChoiceId "Base10HashOfCert" "CertIssuer") [(Bound 0 256)]) | |
(Pay (AccountId 1 "CertRecipient") | |
(Party "CertIssuer") | |
(AvailableMoney (AccountId 1 "CertRecipient")) | |
(Pay (AccountId 2 "CertRecipient") | |
(Party "CertRevoker") | |
(AvailableMoney (AccountId 2 "CertRecipient")) | |
(When [Case (Choice (ChoiceId "CertRvoked" "CertRevoker") [(Bound 0 1)]) | |
Refund] 25 Refund)))] 20 Refund)] 20 Refund)] 15 Refund | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment