Created
November 18, 2020 16:40
-
-
Save nau/fe535b745aa30420d33701c6b73dbe31 to your computer and use it in GitHub Desktop.
Kraken Swap
This file contains hidden or 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="110" y="210"><statement name="BaseContractType"><block type="WhenContractType" id="XUM1#N6GJSV~Fip7L6uT"><field name="timeout">100</field><statement name="case"><block type="DepositActionType" id="Z4ue+%rx**vM/_{{)l+o"><value name="from_party"><block type="RolePartyType" id="bM?EQRuaN:=JBR2,c(kN"><field name="role">Alice</field></block></value><value name="value"><block type="ConstantValueType" id="eobj`F9p=p913f[ZC9t,"><field name="constant">5000000000</field></block></value><value name="token"><block type="AdaTokenType" id="b{Zk*GP#[;F/LAofyzIn"/></value><value name="party"><block type="RolePartyType" id="8`,K?vX2vYLqt1/f8C63"><field name="role">Alice</field></block></value><statement name="contract"><block type="WhenContractType" id="lY%o?9Oriq-ZvXyBfTge"><field name="timeout">200</field><statement name="case"><block type="ChoiceActionType" id="?KXZvW48m%3$#d-c;J=C"><field name="choice_name">adausdt</field><value name="party"><block type="RolePartyType" id="s_JQ^]`~GXwyb_UdZP^H"><field name="role">kraken</field></block></value><statement name="bounds"><block type="BoundsType" id="W.o!Byf8QUpgp7%eEn^%"><field name="from">1000000</field><field name="to">1000000000</field></block></statement></block></statement><statement name="contract"><block type="CloseContractType" id="P1ur*$nc9D.7D4++~y|*"/></statement></block></statement></block></statement><statement name="contract"><block type="CloseContractType" id="#b?jN^[Yh;96R*jP`SDx"/></statement></block></statement></block></xml> |
This file contains hidden or 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
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) | |
This file contains hidden or 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 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 |
This file contains hidden or 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