Last active
January 20, 2021 19:40
-
-
Save brunjlar/5f60350e031fc76e02d3cce71d066d5e to your computer and use it in GitHub Desktop.
Exercise2
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
<xml xmlns="https://developers.google.com/blockly/xml"><block type="BaseContractType" id="root_contract" deletable="false" x="13" y="187"><statement name="BaseContractType"><block type="WhenContractType" id="bVBC$S@(@^$uwGA-bvO$"><field name="timeout">5</field><statement name="case"><block type="DepositActionType" id="~6K;R])%}[!Ofg@uMmGa"><value name="from_party"><block type="RolePartyType" id="jX8]]wn{R_:Fhdcl84o6"><field name="role">Alice</field></block></value><value name="value"><block type="ConstantValueType" id="oyw,4pH.N|%_w[9j/0?K"><field name="constant">100</field></block></value><value name="token"><block type="AdaTokenType" id="!Ka2:4h--DvJB(+XVkAh"/></value><value name="party"><block type="RolePartyType" id="LSJLsU:AdArIHyB^tT#Y"><field name="role">Alice</field></block></value><statement name="contract"><block type="PayContractType" id=",SA:hjWn,rfteerPo[Un"><value name="payee"><block type="PartyPayeeType" id="ha*gf9OyyEcm^ok]@(0b"><value name="party"><block type="RolePartyType" id="qi_GS_@jfMc1]mH9q-mt"><field name="role">Bob</field></block></value></block></value><value name="value"><block type="ConstantValueType" id="S#0.v17N1{f%Q8C|=?(b"><field name="constant">100</field></block></value><value name="token"><block type="AdaTokenType" id="1M5lz[)p0)-j{YOA,Sg/"/></value><value name="party"><block type="RolePartyType" id="yP,?E#@rdOG%3+t7kY^i"><field name="role">Alice</field></block></value><statement name="contract"><block type="CloseContractType" id="4PlAG:O8g?af_%.kv7Gg"/></statement></block></statement></block></statement><statement name="contract"><block type="CloseContractType" id="7F)2Hky4jqF]IxMSW#rb"/></statement></block></statement></block></xml> |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Example where | |
import Language.Marlowe | |
main :: IO () | |
main = print . pretty $ contract | |
{- Define a contract, Close is the simplest contract which just ends the contract straight away | |
-} | |
contract :: Contract | |
contract = When | |
[ Case (Deposit "Alice" "Alice" ada (Constant 100)) $ | |
Pay "Alice" (Party "Bob") ada (Constant 50) $ | |
Pay "Alice" (Party "Charlie") ada (Constant 50) $ | |
Close | |
] (Slot 5) 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
When | |
[Case | |
(Deposit | |
(Role "Alice") | |
(Role "Alice") | |
(Token "" "") | |
(Constant 100) | |
) | |
(Pay | |
(Role "Alice") | |
(Party (Role "Bob")) | |
(Token "" "") | |
(Constant 100) | |
Close | |
)] | |
5 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