Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Created October 2, 2020 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisajenkins/7ca510134910533ceff815cd723438f9 to your computer and use it in GitHub Desktop.
Save krisajenkins/7ca510134910533ceff815cd723438f9 to your computer and use it in GitHub Desktop.
Marlowe Smart Contract
When
[Case
(Deposit
(AccountId
0
(Role "alice")
)
(Role "alice")
(Token "" "")
(Constant 450)
)
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "alice")
)
[Bound 0 1]
)
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "bob")
)
[Bound 0 1]
)
(If
(ValueEQ
(ChoiceValue
(ChoiceId
"choice"
(Role "alice")
))
(ChoiceValue
(ChoiceId
"choice"
(Role "bob")
))
)
(If
(ValueEQ
(ChoiceValue
(ChoiceId
"choice"
(Role "alice")
))
(Constant 0)
)
(Pay
(AccountId
0
(Role "alice")
)
(Party (Role "bob"))
(Token "" "")
(Constant 450)
Close
)
Close
)
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 1 1]
)
Close , Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 0 0]
)
(Pay
(AccountId
0
(Role "alice")
)
(Party (Role "bob"))
(Token "" "")
(Constant 450)
Close
)]
100 Close
)
)]
60
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 1 1]
)
Close , Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 0 0]
)
(Pay
(AccountId
0
(Role "alice")
)
(Party (Role "bob"))
(Token "" "")
(Constant 450)
Close
)]
100 Close
)
), Case
(Choice
(ChoiceId
"choice"
(Role "bob")
)
[Bound 0 1]
)
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "alice")
)
[Bound 0 1]
)
(If
(ValueEQ
(ChoiceValue
(ChoiceId
"choice"
(Role "alice")
))
(ChoiceValue
(ChoiceId
"choice"
(Role "bob")
))
)
(If
(ValueEQ
(ChoiceValue
(ChoiceId
"choice"
(Role "alice")
))
(Constant 0)
)
(Pay
(AccountId
0
(Role "alice")
)
(Party (Role "bob"))
(Token "" "")
(Constant 450)
Close
)
Close
)
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 1 1]
)
Close , Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 0 0]
)
(Pay
(AccountId
0
(Role "alice")
)
(Party (Role "bob"))
(Token "" "")
(Constant 450)
Close
)]
100 Close
)
)]
60
(When
[Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 1 1]
)
Close , Case
(Choice
(ChoiceId
"choice"
(Role "carol")
)
[Bound 0 0]
)
(Pay
(AccountId
0
(Role "alice")
)
(Party (Role "bob"))
(Token "" "")
(Constant 450)
Close
)]
100 Close
)
)]
40 Close
)]
10 Close
[{"transactionWarnings":[],"transactionError":null,"state":{"minSlot":0,"choices":[],"boundValues":[],"accounts":[]},"slot":0,"possibleActions":[[{"role_token":"alice"},[[{"contents":[{"account_owner":{"role_token":"alice"},"account_number":0},{"role_token":"alice"},{"token_name":"","currency_symbol":""},450],"tag":"DepositInputId"},{"contents":[{"account_owner":{"role_token":"alice"},"account_number":0},{"role_token":"alice"},{"token_name":"","currency_symbol":""},450],"tag":"DepositInput"}]]],[{"role_token":"marlowe_other_actions"},[[{"tag":"MoveToSlotId"},{"s":1,"e":1,"c":[10],"tag":"MoveToSlot"}]]]],"pendingInputs":[],"moneyInContract":[],"log":[],"holes":[],"editorWarnings":[],"editorErrors":[],"contract":{"when":[{"then":{"when":[{"then":{"when":[{"then":{"then":{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"role_token":"bob"},"then":"close","pay":450,"from_account":{"account_owner":{"role_token":"alice"},"account_number":0}},"if":{"value":{"value_of_choice":{"choice_owner":{"role_token":"alice"},"choice_name":"choice"}},"equal_to":0},"else":"close"},"if":{"value":{"value_of_choice":{"choice_owner":{"role_token":"alice"},"choice_name":"choice"}},"equal_to":{"value_of_choice":{"choice_owner":{"role_token":"bob"},"choice_name":"choice"}}},"else":{"when":[{"then":"close","case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":1,"from":1}]}},{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"role_token":"bob"},"then":"close","pay":450,"from_account":{"account_owner":{"role_token":"alice"},"account_number":0}},"case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":0,"from":0}]}}],"timeout_continuation":"close","timeout":100}},"case":{"for_choice":{"choice_owner":{"role_token":"bob"},"choice_name":"choice"},"choose_between":[{"to":1,"from":0}]}}],"timeout_continuation":{"when":[{"then":"close","case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":1,"from":1}]}},{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"role_token":"bob"},"then":"close","pay":450,"from_account":{"account_owner":{"role_token":"alice"},"account_number":0}},"case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":0,"from":0}]}}],"timeout_continuation":"close","timeout":100},"timeout":60},"case":{"for_choice":{"choice_owner":{"role_token":"alice"},"choice_name":"choice"},"choose_between":[{"to":1,"from":0}]}},{"then":{"when":[{"then":{"then":{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"role_token":"bob"},"then":"close","pay":450,"from_account":{"account_owner":{"role_token":"alice"},"account_number":0}},"if":{"value":{"value_of_choice":{"choice_owner":{"role_token":"alice"},"choice_name":"choice"}},"equal_to":0},"else":"close"},"if":{"value":{"value_of_choice":{"choice_owner":{"role_token":"alice"},"choice_name":"choice"}},"equal_to":{"value_of_choice":{"choice_owner":{"role_token":"bob"},"choice_name":"choice"}}},"else":{"when":[{"then":"close","case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":1,"from":1}]}},{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"role_token":"bob"},"then":"close","pay":450,"from_account":{"account_owner":{"role_token":"alice"},"account_number":0}},"case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":0,"from":0}]}}],"timeout_continuation":"close","timeout":100}},"case":{"for_choice":{"choice_owner":{"role_token":"alice"},"choice_name":"choice"},"choose_between":[{"to":1,"from":0}]}}],"timeout_continuation":{"when":[{"then":"close","case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":1,"from":1}]}},{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"role_token":"bob"},"then":"close","pay":450,"from_account":{"account_owner":{"role_token":"alice"},"account_number":0}},"case":{"for_choice":{"choice_owner":{"role_token":"carol"},"choice_name":"choice"},"choose_between":[{"to":0,"from":0}]}}],"timeout_continuation":"close","timeout":100},"timeout":60},"case":{"for_choice":{"choice_owner":{"role_token":"bob"},"choice_name":"choice"},"choose_between":[{"to":1,"from":0}]}}],"timeout_continuation":"close","timeout":40},"case":{"party":{"role_token":"alice"},"of_token":{"token_name":"","currency_symbol":""},"into_account":{"account_owner":{"role_token":"alice"},"account_number":0},"deposits":450}}],"timeout_continuation":"close","timeout":10}}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment