Skip to content

Instantly share code, notes, and snippets.

@marco-martins
Last active June 9, 2022 18:42
Show Gist options
  • Select an option

  • Save marco-martins/826c575a0ca7bd39219895e823403da0 to your computer and use it in GitHub Desktop.

Select an option

Save marco-martins/826c575a0ca7bd39219895e823403da0 to your computer and use it in GitHub Desktop.
MPP - Choice & If
{"valueParameterInfo":[["Amount",{"valueParameterFormat":{"contents":[6,"Ada"],"tag":"DecimalFormat"},"valueParameterDescription":"Amount"}]],"timeParameterDescriptions":[["despositDeadline","Deadline for the deposit"],["choiceDeadline","Deadline for the choice"]],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Unknown","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 "despositDeadline")
Close
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment