Skip to content

Instantly share code, notes, and snippets.

@ajuggler
Last active June 9, 2022 19:06
Show Gist options
  • Save ajuggler/3756cff038ba3f82c4dd5f6ee57a49bd to your computer and use it in GitHub Desktop.
Save ajuggler/3756cff038ba3f82c4dd5f6ee57a49bd to your computer and use it in GitHub Desktop.
simple choice
{"valueParameterInfo":[["Amount",{"valueParameterFormat":{"contents":[6,"ada"],"tag":"DecimalFormat"},"valueParameterDescription":"Amount to be transferred"}]],"timeParameterDescriptions":[["DepositDeadline","Deposit deadline"],["ChoiceDeadline","Make choice deadline"]],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Simple Choice","contractLongDescription":"We couldn't find information about this contract","choiceInfo":[]}
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
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment