forked from baking-bad/etherlink-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathticket-router-tester.tz
100 lines (99 loc) · 3.55 KB
/
ticket-router-tester.tz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ parameter
(or (nat %deposit)
(or (pair %mint (pair %content nat (option bytes)) (nat %amount))
(or (pair %withdraw (address %receiver) (ticket %ticket (pair nat (option bytes))))
(or (ticket %default (pair nat (option bytes)))
(pair %set
(address %target)
(or %entrypoint
(unit %default)
(or (address %routerWithdraw) (bytes %rollupDeposit)))
(mutez %xtz_amount)))))) ;
storage
(pair (pair %internal_call
(address %target)
(or %entrypoint
(unit %default)
(or (address %routerWithdraw) (bytes %rollupDeposit)))
(mutez %xtz_amount))
(big_map %metadata string bytes)) ;
code { LAMBDA
(pair (ticket (pair nat (option bytes)))
(pair address (or unit (or address bytes)) mutez)
(big_map string bytes))
operation
{ UNPAIR ;
SWAP ;
CAR ;
UNPAIR 3 ;
SWAP ;
IF_LEFT
{ DROP ;
CONTRACT (ticket (pair nat (option bytes))) ;
IF_NONE { PUSH string "FAILED_TO_GET_TKT_ENTRYPOINT" ; FAILWITH } {} ;
SWAP ;
DIG 2 ;
TRANSFER_TOKENS }
{ IF_LEFT
{ SWAP ;
CONTRACT %withdraw
(pair (address %receiver) (ticket %ticket (pair nat (option bytes)))) ;
IF_NONE { PUSH string "ROUTER_ENTRYPOINT_NOT_FOUND" ; FAILWITH } {} ;
DIG 2 ;
DIG 3 ;
DIG 3 ;
PAIR ;
TRANSFER_TOKENS }
{ DIG 3 ;
SWAP ;
PAIR ;
LEFT bytes ;
LEFT bytes ;
SWAP ;
CONTRACT
(or (or (pair %deposit (bytes %routing_info) (ticket %ticket (pair nat (option bytes))))
(bytes %b))
(bytes %c)) ;
IF_NONE { PUSH string "ROLLUP_DEPOSIT_NOT_FOUND" ; FAILWITH } {} ;
DUG 2 ;
TRANSFER_TOKENS } } } ;
SWAP ;
UNPAIR ;
IF_LEFT
{ DIG 2 ; DROP 2 ; NIL operation }
{ IF_LEFT
{ UNPAIR ;
TICKET ;
IF_NONE { PUSH string "TKT_CREATION_FAILED" ; FAILWITH } {} ;
DUP 2 ;
NIL operation ;
DIG 3 ;
DIG 3 ;
PAIR ;
DIG 3 ;
SWAP ;
EXEC ;
CONS }
{ IF_LEFT
{ DUP 2 ;
NIL operation ;
DIG 3 ;
DIG 3 ;
CDR ;
PAIR ;
DIG 3 ;
SWAP ;
EXEC ;
CONS }
{ IF_LEFT
{ DUP 2 ;
NIL operation ;
DIG 3 ;
DIG 3 ;
PAIR ;
DIG 3 ;
SWAP ;
EXEC ;
CONS }
{ DIG 2 ; DROP ; UPDATE 1 ; NIL operation } } } } ;
PAIR } }