Skip to content

Instantly share code, notes, and snippets.

@brunjlar
Last active January 20, 2021 19:43
Show Gist options
  • Save brunjlar/4a127c6191a27bce56079a06b5996e18 to your computer and use it in GitHub Desktop.
Save brunjlar/4a127c6191a27bce56079a06b5996e18 to your computer and use it in GitHub Desktop.
Exercise3
<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>
{-# 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)) $
When [] (Slot 10) Close
] (Slot 5) Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment