Skip to content

Commit

Permalink
Add fromatter tests for new primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Oct 8, 2023
1 parent abd10a2 commit c9131dd
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/bcd/formatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func IsFramed(n gjson.Result) bool {
"key", "unit", "signature", "operation",
"int", "nat", "string", "bytes", "mutez", "bool", "key_hash", "timestamp", "address",
"bls12_381_g1", "bls12_381_g2", "bls12_381_fr", "chain_id", "never",
"chest", "chest_key", "tx_rollup_l2_address",
}) {
return n.Get("annots").Exists()
}
Expand Down
3 changes: 3 additions & 0 deletions internal/bcd/formatter/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func TestMichelineToMichelson(t *testing.T) {
"KT1WhouvVKZFH94VXj9pa8v4szvfrBwXoBUj",
"KT1XFnSFqmXsBmNQVPByuYYkBFoNcXne4Ktu",
"KT1XRwPmdw7j4LhHgTw8S2dTVbmsXqT6VtpX",
"KT1LfmcX6usZoHYNf9LPrBL1sYCGDDeuApJq",
"KT1U4Gb8FjnmyyiUxu4Uy5iFuBRzp4ezbYa7",
"KT1BcTXqU4TW1tPuujvyWYvnUJ2VrpY3WnzY",
}

for _, tt := range tests {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"prim":"parameter","args":[{"prim":"pair","args":[{"prim":"string"},{"prim":"nat"},{"prim":"tx_rollup_l2_address"},{"prim":"address"}]}]},{"prim":"storage","args":[{"prim":"unit"}]},{"prim":"code","args":[[{"prim":"CAR"},{"prim":"UNPAIR","args":[{"int":"4"}]},{"prim":"TICKET_DEPRECATED"},{"prim":"PAIR"},{"prim":"SWAP"},{"prim":"CONTRACT","args":[{"prim":"pair","args":[{"prim":"ticket","args":[{"prim":"string"}]},{"prim":"tx_rollup_l2_address"}]}],"annots":["%deposit"]},[{"prim":"IF_NONE","args":[[[{"prim":"UNIT"},{"prim":"FAILWITH"}]],[]]}],{"prim":"SWAP"},{"prim":"PUSH","args":[{"prim":"mutez"},{"int":"0"}]},{"prim":"SWAP"},{"prim":"TRANSFER_TOKENS"},{"prim":"UNIT"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"DIG","args":[{"int":"2"}]},{"prim":"CONS"},{"prim":"PAIR"}]]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
parameter (pair string nat tx_rollup_l2_address address);
storage unit;
code { CAR ;
UNPAIR 4 ;
TICKET_DEPRECATED ;
PAIR ;
SWAP ;
CONTRACT %deposit (pair (ticket string) tx_rollup_l2_address) ;
{ IF_NONE { { UNIT ; FAILWITH } } {} } ;
SWAP ;
PUSH mutez 0 ;
SWAP ;
TRANSFER_TOKENS ;
UNIT ;
NIL operation ;
DIG 2 ;
CONS ;
PAIR }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"prim":"parameter","args":[{"prim":"or","args":[{"prim":"or","args":[{"prim":"chest","annots":["%commit"]},{"prim":"pair","args":[{"prim":"address","annots":["%target"]},{"prim":"chest_key","annots":["%proposedKey"]}],"annots":["%reveal"]}]},{"prim":"unit","annots":["%roll"]}]}]},{"prim":"storage","args":[{"prim":"pair","args":[{"prim":"nat","annots":["%lotterykey"]},{"prim":"pair","args":[{"prim":"nat","annots":["%chest_time"]},{"prim":"map","args":[{"prim":"address"},{"prim":"pair","args":[{"prim":"chest","annots":["%randomhash"]},{"prim":"bool","annots":["%revealed"]}]}],"annots":["%participants"]}]}]}]},{"prim":"code","args":[[{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"DIG","args":[{"int":"1"}]},{"prim":"UNPAIR"},{"prim":"DIP","args":[[{"prim":"UNPAIR","args":[{"int":"3"}]}]]},{"prim":"IF_LEFT","args":[[{"prim":"IF_LEFT","args":[[{"prim":"PUSH","args":[{"prim":"mutez"},{"int":"1000000"}]},{"prim":"AMOUNT"},{"prim":"COMPARE"},{"prim":"GE"},{"prim":"NOT"},{"prim":"IF","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"Entry cost is 1tz"}]},{"prim":"FAILWITH"}],[]]},{"prim":"DUP","args":[{"int":"4"}]},{"prim":"SENDER"},{"prim":"MEM"},{"prim":"IF","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"participants"}]},{"prim":"PUSH","args":[{"prim":"string"},{"string":"KeyExists"}]},{"prim":"PAIR"},{"prim":"FAILWITH"}],[{"prim":"DUP","args":[{"int":"4"}]},{"prim":"PUSH","args":[{"prim":"bool"},{"prim":"False"}]},{"prim":"DUP","args":[{"int":"3"}]},{"prim":"PAIR"},{"prim":"SOME"},{"prim":"SENDER"},{"prim":"UPDATE"},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"3"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"3"}]}]]},{"prim":"DROP"},{"prim":"PAIR","args":[{"int":"3"}]},{"prim":"DIG","args":[{"int":"1"}]},{"prim":"PAIR"}],[{"prim":"UNPAIR"},{"prim":"SWAP"},{"prim":"PUSH","args":[{"prim":"timestamp"},{"int":"1654436582"}]},{"prim":"NOW"},{"prim":"COMPARE"},{"prim":"LT"},{"prim":"IF","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"The lottery has been closed"}]},{"prim":"FAILWITH"}],[]]},{"prim":"DUP","args":[{"int":"5"}]},{"prim":"SENDER"},{"prim":"GET"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"participants"}]},{"prim":"PUSH","args":[{"prim":"string"},{"string":"AssetNotFound"}]},{"prim":"PAIR"},{"prim":"FAILWITH"}],[]]},{"prim":"CDR"},{"prim":"IF","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"You have already revealed your key"}]},{"prim":"FAILWITH"}],[]]},{"prim":"DUP","args":[{"int":"4"}]},{"prim":"DUP","args":[{"int":"6"}]},{"prim":"DUP","args":[{"int":"4"}]},{"prim":"GET"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"participants"}]},{"prim":"PUSH","args":[{"prim":"string"},{"string":"AssetNotFound"}]},{"prim":"PAIR"},{"prim":"FAILWITH"}],[]]},{"prim":"CAR"},{"prim":"DUP","args":[{"int":"3"}]},{"prim":"OPEN_CHEST"},{"prim":"IF_LEFT","args":[[{"prim":"DUP"},{"prim":"UNPACK","args":[{"prim":"nat"}]},{"prim":"IF_NONE","args":[[{"prim":"DUP","args":[{"int":"6"}]},{"prim":"NONE","args":[{"prim":"pair","args":[{"prim":"chest"},{"prim":"bool"}]}]},{"prim":"DUP","args":[{"int":"5"}]},{"prim":"UPDATE"},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"5"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"5"}]}],[{"prim":"DUP"},{"prim":"DUP","args":[{"int":"6"}]},{"prim":"ADD"},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"4"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"4"}]},{"prim":"DUP","args":[{"int":"7"}]},{"prim":"DUP","args":[{"int":"8"}]},{"prim":"SENDER"},{"prim":"GET"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"participants"}]},{"prim":"PUSH","args":[{"prim":"string"},{"string":"AssetNotFound"}]},{"prim":"PAIR"},{"prim":"FAILWITH"}],[]]},{"prim":"UNPAIR"},{"prim":"SWAP"},{"prim":"DROP"},{"prim":"PUSH","args":[{"prim":"bool"},{"prim":"True"}]},{"prim":"SWAP"},{"prim":"PAIR"},{"prim":"SOME"},{"prim":"SENDER"},{"prim":"UPDATE"},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"6"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"6"}]},{"prim":"DROP"}]]},{"prim":"DROP"}],[{"prim":"DUP"},{"prim":"IF","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"INVALID_CHEST_KEY"}]},{"prim":"FAILWITH"}],[{"prim":"DUP","args":[{"int":"6"}]},{"prim":"NONE","args":[{"prim":"pair","args":[{"prim":"chest"},{"prim":"bool"}]}]},{"prim":"DUP","args":[{"int":"5"}]},{"prim":"UPDATE"},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"5"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"5"}]}]]},{"prim":"DROP"}]]},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"DUP","args":[{"int":"8"}]},{"prim":"ITER","args":[[{"prim":"CONS"}]]},{"prim":"SENDER"},{"prim":"CONTRACT","args":[{"prim":"unit"}]},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"EntryNotFound"}]},{"prim":"FAILWITH"}],[]]},{"prim":"PUSH","args":[{"prim":"mutez"},{"int":"350000"}]},{"prim":"UNIT"},{"prim":"TRANSFER_TOKENS"},{"prim":"CONS"},{"prim":"ITER","args":[[{"prim":"CONS"}]]},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"5"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"5"}]},{"prim":"DROP","args":[{"int":"2"}]},{"prim":"PAIR","args":[{"int":"3"}]},{"prim":"DIG","args":[{"int":"1"}]},{"prim":"PAIR"}]]}],[{"prim":"DROP"},{"prim":"PUSH","args":[{"prim":"address"},{"string":"tz1f8jaMYrtQ1qRv7JG5ZX6AJEtTzaDUT2vk"}]},{"prim":"SENDER"},{"prim":"COMPARE"},{"prim":"EQ"},{"prim":"NOT"},{"prim":"IF","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"InvalidCaller"}]},{"prim":"FAILWITH"}],[]]},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"DUP","args":[{"int":"6"}]},{"prim":"ITER","args":[[{"prim":"CONS"}]]},{"prim":"NONE","args":[{"prim":"address"}]},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"0"}]},{"prim":"PAIR"},{"prim":"DUP","args":[{"int":"6"}]},{"prim":"ITER","args":[[{"prim":"UNPAIR"},{"prim":"DUP","args":[{"int":"8"}]},{"prim":"SIZE"},{"prim":"INT"},{"prim":"DUP","args":[{"int":"7"}]},{"prim":"INT"},{"prim":"EDIV"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"DivByZero"}]},{"prim":"FAILWITH"}],[{"prim":"DUP"},{"prim":"CDR"},{"prim":"SWAP"},{"prim":"DROP"}]]},{"prim":"DUP","args":[{"int":"4"}]},{"prim":"CAR"},{"prim":"COMPARE"},{"prim":"EQ"},{"prim":"IF","args":[[{"prim":"DUP"},{"prim":"SOME"},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"1"}]},{"prim":"DUP","args":[{"int":"5"}]},{"prim":"CAR"},{"prim":"ADD"},{"prim":"PAIR"}],[{"prim":"DUP","args":[{"int":"3"}]},{"prim":"CDR"},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"1"}]},{"prim":"DUP","args":[{"int":"5"}]},{"prim":"CAR"},{"prim":"ADD"},{"prim":"PAIR"}]]},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"2"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"2"}]},{"prim":"DROP","args":[{"int":"2"}]}]]},{"prim":"CDR"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"NotFound"}]},{"prim":"FAILWITH"}],[]]},{"prim":"CONTRACT","args":[{"prim":"unit"}]},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"string"},{"string":"EntryNotFound"}]},{"prim":"FAILWITH"}],[]]},{"prim":"BALANCE"},{"prim":"UNIT"},{"prim":"TRANSFER_TOKENS"},{"prim":"CONS"},{"prim":"ITER","args":[[{"prim":"CONS"}]]},{"prim":"DIP","args":[[{"prim":"DIG","args":[{"int":"3"}]},{"prim":"DROP"}]]},{"prim":"DUG","args":[{"int":"3"}]},{"prim":"PAIR","args":[{"int":"3"}]},{"prim":"DIG","args":[{"int":"1"}]},{"prim":"PAIR"}]]}]]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
parameter (or (or (chest %commit) (pair %reveal (address %target) (chest_key %proposedKey)))
(unit %roll));
storage (pair (nat %lotterykey)
(pair (nat %chest_time)
(map %participants address (pair (chest %randomhash) (bool %revealed)))));
code { NIL operation ;
DIG 1 ;
UNPAIR ;
DIP { UNPAIR 3 } ;
IF_LEFT
{ IF_LEFT
{ PUSH mutez 1000000 ;
AMOUNT ;
COMPARE ;
GE ;
NOT ;
IF { PUSH string "Entry cost is 1tz" ; FAILWITH } {} ;
DUP 4 ;
SENDER ;
MEM ;
IF
{ PUSH string "participants" ; PUSH string "KeyExists" ; PAIR ; FAILWITH }
{ DUP 4 ;
PUSH bool False ;
DUP 3 ;
PAIR ;
SOME ;
SENDER ;
UPDATE ;
DIP { DIG 3 ; DROP } ;
DUG 3 } ;
DROP ;
PAIR 3 ;
DIG 1 ;
PAIR }
{ UNPAIR ;
SWAP ;
PUSH timestamp 1654436582 ;
NOW ;
COMPARE ;
LT ;
IF { PUSH string "The lottery has been closed" ; FAILWITH } {} ;
DUP 5 ;
SENDER ;
GET ;
IF_NONE
{ PUSH string "participants" ; PUSH string "AssetNotFound" ; PAIR ; FAILWITH }
{} ;
CDR ;
IF { PUSH string "You have already revealed your key" ; FAILWITH } {} ;
DUP 4 ;
DUP 6 ;
DUP 4 ;
GET ;
IF_NONE
{ PUSH string "participants" ; PUSH string "AssetNotFound" ; PAIR ; FAILWITH }
{} ;
CAR ;
DUP 3 ;
OPEN_CHEST ;
IF_LEFT
{ DUP ;
UNPACK nat ;
IF_NONE
{ DUP 6 ;
NONE (pair chest bool) ;
DUP 5 ;
UPDATE ;
DIP { DIG 5 ; DROP } ;
DUG 5 }
{ DUP ;
DUP 6 ;
ADD ;
DIP { DIG 4 ; DROP } ;
DUG 4 ;
DUP 7 ;
DUP 8 ;
SENDER ;
GET ;
IF_NONE
{ PUSH string "participants" ;
PUSH string "AssetNotFound" ;
PAIR ;
FAILWITH }
{} ;
UNPAIR ;
SWAP ;
DROP ;
PUSH bool True ;
SWAP ;
PAIR ;
SOME ;
SENDER ;
UPDATE ;
DIP { DIG 6 ; DROP } ;
DUG 6 ;
DROP } ;
DROP }
{ DUP ;
IF
{ PUSH string "INVALID_CHEST_KEY" ; FAILWITH }
{ DUP 6 ;
NONE (pair chest bool) ;
DUP 5 ;
UPDATE ;
DIP { DIG 5 ; DROP } ;
DUG 5 } ;
DROP } ;
NIL operation ;
NIL operation ;
DUP 8 ;
ITER { CONS } ;
SENDER ;
CONTRACT unit ;
IF_NONE { PUSH string "EntryNotFound" ; FAILWITH } {} ;
PUSH mutez 350000 ;
UNIT ;
TRANSFER_TOKENS ;
CONS ;
ITER { CONS } ;
DIP { DIG 5 ; DROP } ;
DUG 5 ;
DROP 2 ;
PAIR 3 ;
DIG 1 ;
PAIR } }
{ DROP ;
PUSH address "tz1f8jaMYrtQ1qRv7JG5ZX6AJEtTzaDUT2vk" ;
SENDER ;
COMPARE ;
EQ ;
NOT ;
IF { PUSH string "InvalidCaller" ; FAILWITH } {} ;
NIL operation ;
NIL operation ;
DUP 6 ;
ITER { CONS } ;
NONE address ;
PUSH nat 0 ;
PAIR ;
DUP 6 ;
ITER { UNPAIR ;
DUP 8 ;
SIZE ;
INT ;
DUP 7 ;
INT ;
EDIV ;
IF_NONE
{ PUSH string "DivByZero" ; FAILWITH }
{ DUP ; CDR ; SWAP ; DROP } ;
DUP 4 ;
CAR ;
COMPARE ;
EQ ;
IF
{ DUP ; SOME ; PUSH nat 1 ; DUP 5 ; CAR ; ADD ; PAIR }
{ DUP 3 ; CDR ; PUSH nat 1 ; DUP 5 ; CAR ; ADD ; PAIR } ;
DIP { DIG 2 ; DROP } ;
DUG 2 ;
DROP 2 } ;
CDR ;
IF_NONE { PUSH string "NotFound" ; FAILWITH } {} ;
CONTRACT unit ;
IF_NONE { PUSH string "EntryNotFound" ; FAILWITH } {} ;
BALANCE ;
UNIT ;
TRANSFER_TOKENS ;
CONS ;
ITER { CONS } ;
DIP { DIG 3 ; DROP } ;
DUG 3 ;
PAIR 3 ;
DIG 1 ;
PAIR } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"prim":"parameter","args":[{"prim":"or","args":[{"prim":"unit","annots":["%auto_call"]},{"prim":"ticket","args":[{"prim":"int"}],"annots":["%run"]}]}]},{"prim":"storage","args":[{"prim":"pair","args":[{"prim":"option","args":[{"prim":"ticket","args":[{"prim":"int"}]}],"annots":["%x"]},{"prim":"option","args":[{"prim":"ticket","args":[{"prim":"string"}]}],"annots":["%y"]}]}]},{"prim":"code","args":[[{"prim":"UNPAIR"},{"prim":"IF_LEFT","args":[[{"prim":"DROP"},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"43"}]},{"prim":"PUSH","args":[{"prim":"int"},{"int":"1"}]},{"prim":"TICKET_DEPRECATED"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"SELF","annots":["%run"]},{"prim":"PUSH","args":[{"prim":"mutez"},{"int":"0"}]},{"prim":"DIG","args":[{"int":"3"}]},{"prim":"TRANSFER_TOKENS"},{"prim":"CONS"}],[{"prim":"READ_TICKET"},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"42"}]},{"prim":"PUSH","args":[{"prim":"string"},{"string":"abc"}]},{"prim":"TICKET_DEPRECATED"},{"prim":"DIG","args":[{"int":"3"}]},{"prim":"SWAP"},{"prim":"SOME"},{"prim":"SWAP"},{"prim":"CAR"},{"prim":"PAIR"},{"prim":"DUG","args":[{"int":"2"}]},{"prim":"GET","args":[{"int":"4"}]},{"prim":"DUP"},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"3"}]},{"prim":"SWAP"},{"prim":"EDIV"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"int"},{"int":"20"}]},{"prim":"FAILWITH"}],[{"prim":"CAR"}]]},{"prim":"SWAP"},{"prim":"DUP"},{"prim":"DUG","args":[{"int":"2"}]},{"prim":"SUB"},{"prim":"ISNAT"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"int"},{"int":"20"}]},{"prim":"FAILWITH"}],[]]},{"prim":"PUSH","args":[{"prim":"nat"},{"int":"3"}]},{"prim":"DIG","args":[{"int":"2"}]},{"prim":"EDIV"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"int"},{"int":"20"}]},{"prim":"FAILWITH"}],[{"prim":"CAR"}]]},{"prim":"PAIR"},{"prim":"SWAP"},{"prim":"SPLIT_TICKET"},{"prim":"IF_NONE","args":[[{"prim":"PUSH","args":[{"prim":"int"},{"int":"20"}]},{"prim":"FAILWITH"}],[]]},{"prim":"UNPAIR"},{"prim":"SWAP"},{"prim":"PAIR"},{"prim":"JOIN_TICKETS"},{"prim":"SWAP"},{"prim":"CDR"},{"prim":"SWAP"},{"prim":"PAIR"},{"prim":"NIL","args":[{"prim":"operation"}]}]]},{"prim":"PAIR"}]]}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
parameter (or (unit %auto_call) (ticket %run int));
storage (pair (option %x (ticket int)) (option %y (ticket string)));
code { UNPAIR ;
IF_LEFT
{ DROP ;
PUSH nat 43 ;
PUSH int 1 ;
TICKET_DEPRECATED ;
NIL operation ;
SELF %run ;
PUSH mutez 0 ;
DIG 3 ;
TRANSFER_TOKENS ;
CONS }
{ READ_TICKET ;
PUSH nat 42 ;
PUSH string "abc" ;
TICKET_DEPRECATED ;
DIG 3 ;
SWAP ;
SOME ;
SWAP ;
CAR ;
PAIR ;
DUG 2 ;
GET 4 ;
DUP ;
PUSH nat 3 ;
SWAP ;
EDIV ;
IF_NONE { PUSH int 20 ; FAILWITH } { CAR } ;
SWAP ;
DUP ;
DUG 2 ;
SUB ;
ISNAT ;
IF_NONE { PUSH int 20 ; FAILWITH } {} ;
PUSH nat 3 ;
DIG 2 ;
EDIV ;
IF_NONE { PUSH int 20 ; FAILWITH } { CAR } ;
PAIR ;
SWAP ;
SPLIT_TICKET ;
IF_NONE { PUSH int 20 ; FAILWITH } {} ;
UNPAIR ;
SWAP ;
PAIR ;
JOIN_TICKETS ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
NIL operation } ;
PAIR }

0 comments on commit c9131dd

Please sign in to comment.