Skip to content

Instantly share code, notes, and snippets.

@nau
Created November 18, 2020 13:10
Show Gist options
  • Save nau/849da73793f8237b7aca5df0750167b8 to your computer and use it in GitHub Desktop.
Save nau/849da73793f8237b7aca5df0750167b8 to your computer and use it in GitHub Desktop.
Untitled Project
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 Alice = Role("Alice")
const Bob = Role("Bob")
const contract: Contract = When([Case(Deposit(Alice, Alice, ada, 5000_000000), Close)], 100, Close)
When
[Case
(Deposit
(Role "Alice")
(Role "Alice")
(Token "" "")
(Constant 5000000000)
)
(When
[Case
(Choice
(ChoiceId
"adausdt"
(Role "kraken")
)
[Bound 1000000 1000000000]
)
(Let
"USDTCents"
(Scale
(1%1000000000000)
(MulValue
(Constant 5000000000)
(ChoiceValue
(ChoiceId
"adausdt"
(Role "kraken")
))
)
)
(When
[Case
(Deposit
(Role "Alice")
(Role "Bob")
(Token "00" "USDT")
(UseValue "USDTCents")
)
(Pay
(Role "Alice")
(Party (Role "Bob"))
(Token "" "")
(AvailableMoney (Role "Alice") (Token "" ""))
Close
)]
300 Close
)
)]
200 Close
)]
100 Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment