Skip to content

Instantly share code, notes, and snippets.

@heathdrobertson
Last active October 30, 2020 12:05
Show Gist options
  • Save heathdrobertson/4ee88731a003b7bafb15a4f0c056a810 to your computer and use it in GitHub Desktop.
Save heathdrobertson/4ee88731a003b7bafb15a4f0c056a810 to your computer and use it in GitHub Desktop.
first_contract
<xml xmlns="https://developers.google.com/blockly/xml"><block type="BaseContractType" id="root_contract" deletable="false" x="13" y="187"/></xml>
<xml xmlns="https://developers.google.com/blockly/xml"><block type="BaseContractType" id="root_contract" deletable="false" x="-1470" y="50"><statement name="BaseContractType"><block type="WhenContractType" id="hZTsX8W!EJ5vAImzdvs$"><field name="timeout">100</field><statement name="case"><block type="DepositActionType" id="ReJksdE=Dy$l$*(Sx(~."><value name="from_party"><block type="RolePartyType" id="r+%S!SoU,#-*[0bUt2):"><field name="role">donor</field></block></value><value name="value"><block type="ConstantValueType" id="Gw=:S-#k`f.^X?ciiE%3"><field name="constant">1000</field></block></value><value name="token"><block type="AdaTokenType" id="X(/%/IVR`eW[ZWnLjpiZ"/></value><value name="party"><block type="RolePartyType" id="-w(d-uSHQ^kcSDHp=/PV"><field name="role">recipient</field></block></value><statement name="contract"><block type="PayContractType" id="$Jg~KWu%g4o:.JHoBX]U"><value name="payee"><block type="PartyPayeeType" id="{fKv%gVH~IB=V)gBX?sw"><value name="party"><block type="RolePartyType" id="m!x3_UFY`9@5yEmkSr!R"><field name="role">donor</field></block></value></block></value><value name="value"><block type="ConstantValueType" id="NOj#+gY]$/=Hb9_-uevr"><field name="constant">900</field></block></value><value name="token"><block type="AdaTokenType" id="0aQ94^pZioy_k7XVwDEz"/></value><value name="party"><block type="RolePartyType" id="CVzs.ETT*]Ltot6yy9l("><field name="role">recipient</field></block></value><statement name="contract"><block type="CloseContractType" id="UanOSwa_BGC0%L0ZC41P"/></statement></block></statement></block></statement><statement name="contract"><block type="CloseContractType" id="Eys#aBo;HK0-KiB[UWqt"/></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 = Close
import { PK, Role, Account, Party, ada, AvailableMoney, Constant, NegValue, AddValue,
SubValue, MulValue, Scale, ChoiceValue, SlotIntervalStart, SlotIntervalEnd,
UseValue, Cond, AndObs, OrObs, NotObs, ChoseSomething, ValueGE, ValueGT,
ValueLT, ValueLE, ValueEQ, TrueObs, FalseObs, Deposit, Choice, Notify,
Close, Pay, If, When, Let, Assert, SomeNumber, AccountId, ChoiceId, Token,
ValueId, Value, EValue, Observation, Bound, Action, Payee, Case, Contract } from 'marlowe-js';
/* === Code above this comment will be removed at compile time === */
const contract : Contract = Close
When
[Case
(Deposit
(Role "recipient")
(Role "donor")
(Token "" "")
(Constant 1000)
)
(Pay
(Role "recipient")
(Party (Role "donor"))
(Token "" "")
(Constant 900)
Close
)]
100 Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment