MPP - Choice, If & Let
This file contains 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
{"valueParameterInfo":[["Amount",{"valueParameterFormat":{"contents":[6,"ada"],"tag":"DecimalFormat"},"valueParameterDescription":"Amount to deposit."}]],"timeParameterDescriptions":[["DepositDeadline","Deadline for the deposit."],["ChoiceDeadline","Deadline for the choice."]],"roleDescriptions":[["Chooser","CHooses who will receive the deposit."],["Giver","Makes the deposit."],["Receiver1","The first potential receiver."],["Receiver2","The second potential receiver."]],"contractType":"Other","contractShortDescription":"Simple choice.","contractName":"MPP - Choice & If","contractLongDescription":"The \"Chooser\" can decide whether to give the money deposited by \"Giver\" to \"Receiver1\" or \"Receiver2\".","choiceInfo":[["Choice",{"choiceFormat":{"contents":null,"tag":"DefaultFormat"},"choiceDescription":"Which receiver should receive the doposit?"}]]} |
This file contains 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
Let | |
"amount" | |
(ConstantParam "Amount") | |
(When | |
[Case | |
(Deposit | |
(Role "Giver") | |
(Role "Giver") | |
(Token "" "") | |
(UseValue "amount") | |
) | |
(When | |
[Case | |
(Choice | |
(ChoiceId | |
"Choice" | |
(Role "Chooser") | |
) | |
[Bound 1 2] | |
) | |
(If | |
(ValueEQ | |
(ChoiceValue | |
(ChoiceId | |
"Choice" | |
(Role "Chooser") | |
)) | |
(Constant 1) | |
) | |
(Pay | |
(Role "Giver") | |
(Account (Role "Receiver1")) | |
(Token "" "") | |
(UseValue "amount") | |
Close | |
) | |
(Pay | |
(Role "Giver") | |
(Account (Role "Receiver2")) | |
(Token "" "") | |
(UseValue "amount") | |
Close | |
) | |
)] | |
(TimeParam "ChoiceDeadline") | |
Close | |
)] | |
(TimeParam "DepositDeadline") | |
Close | |
) |
This file contains 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
{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment