Skip to content

Instantly share code, notes, and snippets.

@Dave-Lindberg
Last active June 9, 2022 22:08
Show Gist options
  • Save Dave-Lindberg/5d2557001ed076f30d22228e3044270d to your computer and use it in GitHub Desktop.
Save Dave-Lindberg/5d2557001ed076f30d22228e3044270d to your computer and use it in GitHub Desktop.
week-3_double-donation
{"valueParameterInfo":[["donation",{"valueParameterFormat":{"contents":null,"tag":"DefaultFormat"},"valueParameterDescription":"In Lovelace"}]],"timeParameterDescriptions":[["initial-deadline",""],["donation1-deadline",""],["donation2-deadline",""]],"roleDescriptions":[["Giver1","Donor #1"],["Giver2","Donor #2"],["Receiver","Recipient of all donations"]],"contractType":"Other","contractShortDescription":"Two donors give funds to a recipient","contractName":"Double Donation, Week 3","contractLongDescription":"Two donors give funds to a recipient","choiceInfo":[["initial-donor",{"choiceFormat":{"contents":null,"tag":"DefaultFormat"},"choiceDescription":"input \"1\" for Giver1, \"2\" for Giver2"}]]}
If
(ValueLT
(ConstantParam "donation")
?value2
)
(When
[Case
(Deposit
(Role "Giver1")
(Role "Giver1")
(Token "" "")
(ConstantParam "donation")
)
(When
[Case
(Deposit
(Role "Giver2")
(Role "Giver2")
(Token "" "")
(ConstantParam "donation")
)
(Pay
(Role "Giver2")
(Party (Role "Receiver"))
(Token "" "")
(ConstantParam "donation")
(Pay
(Role "Giver1")
(Party (Role "Receiver"))
(Token "" "")
(ConstantParam "donation")
Close
)
)]
(TimeParam "donation2-giver2-deadline")
Close
)]
(TimeParam "donation1-giver1-deadline")
Close
)
(When
[Case
(Deposit
(Role "Giver2")
(Role "Giver2")
(Token "" "")
(ConstantParam "donation")
)
(When
[Case
(Deposit
(Role "Giver1")
(Role "Giver1")
(Token "" "")
(ConstantParam "donation")
)
(Pay
(Role "Giver2")
(Party (Role "Receiver"))
(Token "" "")
(ConstantParam "donation")
(Pay
(Role "Giver1")
(Party (Role "Receiver"))
(Token "" "")
(ConstantParam "donation")
Close
)
)]
(TimeParam "donation2-giver1-deadline")
Close
)]
(TimeParam "donation1-giver2-deadline")
Close
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment