BCD

Tezos Contract Explorer
Search Networks Deploy
  • Home
  • /
  • Ghostnet
  • /
  • KT1G5xY...aFUT
operations (1)Storage Code Interact Tokens Fork Statistics Details
Latest
​x
467
 
1
parameter (or
2
            (or (or (unit %addBalanceCounterparty) (unit %addBalanceOwner))
3
                (or (unit %authAdmin) (bytes %claimCounterparty)))
4
            (or (or (unit %claimOwner) (unit %undoWithdrawCounterparty))
5
                (or (unit %undoWithdrawOwner)
6
                    (or (unit %withdrawCounterparty) (unit %withdrawOwner)))));
7
storage (pair
8
          (pair
9
            (pair (address %admin)
10
                  (pair (mutez %balanceCounterparty) (mutez %balanceOwner)))
11
            (pair (address %counterparty)
12
                  (pair (bool %depositedCounterparty) (bool %depositedOwner))))
13
          (pair
14
            (pair (timestamp %epoch) (pair (mutez %fromCounterparty) (mutez %fromOwner)))
15
            (pair (pair (bytes %hashedSecret) (address %owner))
16
                  (pair (bool %withdrewCounterparty) (bool %withdrewOwner)))));
17
code { UNPAIR ;
18
       IF_LEFT
19
         { IF_LEFT
20
             { IF_LEFT
21
                 { DROP ;
22
                   DUP ;
23
                   CAR ;
24
                   GET 3 ;
25
                   SENDER ;
26
                   COMPARE ;
27
                   EQ ;
28
                   IF
29
                     {}
30
                     { PUSH string "You are not the counterparty of the contact. Only the counterparty can use this commnand." ;
31
                       FAILWITH } ;
32
                   DUP ;
33
                   CAR ;
34
                   CAR ;
35
                   GET 3 ;
36
                   PUSH mutez 0 ;
37
                   COMPARE ;
38
                   EQ ;
39
                   IF
40
                     {}
41
                     { PUSH string "You have already a pending balance in the contract. Please ensure that it is your first time depositing." ;
42
                       FAILWITH } ;
43
                   DUP ;
44
                   GET 3 ;
45
                   GET 3 ;
46
                   AMOUNT ;
47
                   COMPARE ;
48
                   EQ ;
49
                   IF
50
                     {}
51
                     { PUSH string "Inappropriate amount. Please check the correct amount to deposit." ;
52
                       FAILWITH } ;
53
                   DUP ;
54
                   UNPAIR ;
55
                   UNPAIR ;
56
                   UNPAIR ;
57
                   SWAP ;
58
                   CDR ;
59
                   DIG 4 ;
60
                   GET 3 ;
61
                   GET 3 ;
62
                   PAIR ;
63
                   SWAP ;
64
                   PAIR ;
65
                   SWAP ;
66
                   UNPAIR ;
67
                   SWAP ;
68
                   CDR ;
69
                   PUSH bool True ;
70
                   PAIR ;
71
                   SWAP ;
72
                   PAIR ;
73
                   SWAP ;
74
                   PAIR ;
75
                   PAIR }
76
                 { DROP ;
77
                   DUP ;
78
                   GET 5 ;
79
                   CDR ;
80
                   SENDER ;
81
                   COMPARE ;
82
                   EQ ;
83
                   IF
84
                     {}
85
                     { PUSH string "You are not the owner of the contact. Only the owner can use this command." ;
86
                       FAILWITH } ;
87
                   DUP ;
88
                   CAR ;
89
                   CAR ;
90
                   GET 4 ;
91
                   PUSH mutez 0 ;
92
                   COMPARE ;
93
                   EQ ;
94
                   IF
95
                     {}
96
                     { PUSH string "You have already a pending balance in the contract. Please ensure that it is your first time depositing." ;
97
                       FAILWITH } ;
98
                   DUP ;
99
                   GET 3 ;
100
                   GET 4 ;
101
                   AMOUNT ;
102
                   COMPARE ;
103
                   EQ ;
104
                   IF
105
                     {}
106
                     { PUSH string "Inappropriate amount. Please check the correct amount to deposit." ;
107
                       FAILWITH } ;
108
                   DUP ;
109
                   UNPAIR ;
110
                   UNPAIR ;
111
                   UNPAIR ;
112
                   SWAP ;
113
                   CAR ;
114
                   DIG 4 ;
115
                   GET 3 ;
116
                   GET 4 ;
117
                   SWAP ;
118
                   PAIR ;
119
                   SWAP ;
120
                   PAIR ;
121
                   SWAP ;
122
                   UNPAIR ;
123
                   SWAP ;
124
                   CAR ;
125
                   PUSH bool True ;
126
                   SWAP ;
127
                   PAIR ;
128
                   SWAP ;
129
                   PAIR ;
130
                   SWAP ;
131
                   PAIR ;
132
                   PAIR } ;
133
               NIL operation }
134
             { IF_LEFT
135
                 { DROP ;
136
                   DUP ;
137
                   CAR ;
138
                   CAR ;
139
                   CAR ;
140
                   SENDER ;
141
                   COMPARE ;
142
                   EQ ;
143
                   IF
144
                     {}
145
                     { PUSH string "You are not the admin of the contact. Only the admin can can authorize withdrawal.." ;
146
                       FAILWITH } ;
147
                   DUP ;
148
                   GET 8 ;
149
                   PUSH bool True ;
150
                   COMPARE ;
151
                   EQ ;
152
                   IF
153
                     {}
154
                     { PUSH string "The owner (and/or counterparty) has not yet withdrawn from the contract. Withdrawal cannot be authorized yet." ;
155
                       FAILWITH } ;
156
                   DUP ;
157
                   GET 7 ;
158
                   PUSH bool True ;
159
                   COMPARE ;
160
                   EQ ;
161
                   IF
162
                     {}
163
                     { PUSH string "The counterparty has not yet withdrawn from the contract. Withdrawal cannot be authorized yet." ;
164
                       FAILWITH } ;
165
                   DUP ;
166
                   GET 5 ;
167
                   CDR ;
168
                   CONTRACT unit ;
169
                   IF_NONE { PUSH int 90 ; FAILWITH } {} ;
170
                   NIL operation ;
171
                   SWAP ;
172
                   DUP 3 ;
173
                   GET 3 ;
174
                   GET 4 ;
175
                   UNIT ;
176
                   TRANSFER_TOKENS ;
177
                   CONS ;
178
                   SWAP ;
179
                   DUP ;
180
                   DUG 2 ;
181
                   CAR ;
182
                   GET 3 ;
183
                   CONTRACT unit ;
184
                   IF_NONE { PUSH int 91 ; FAILWITH } {} ;
185
                   DUP 3 ;
186
                   GET 3 ;
187
                   GET 3 ;
188
                   UNIT ;
189
                   TRANSFER_TOKENS ;
190
                   CONS ;
191
                   SWAP ;
192
                   UNPAIR ;
193
                   UNPAIR ;
194
                   SWAP ;
195
                   CAR ;
196
                   PUSH (pair bool bool) (Pair False False) ;
197
                   SWAP ;
198
                   PAIR ;
199
                   SWAP ;
200
                   PAIR ;
201
                   PAIR ;
202
                   PUSH bool False ;
203
                   UPDATE 8 ;
204
                   PUSH bool False ;
205
                   UPDATE 7 ;
206
                   UNPAIR ;
207
                   UNPAIR ;
208
                   CAR ;
209
                   PUSH (pair mutez mutez) (Pair 0 0) ;
210
                   SWAP ;
211
                   PAIR ;
212
                   PAIR ;
213
                   PAIR ;
214
                   SWAP }
215
                 { BLAKE2B ;
216
                   SWAP ;
217
                   DUP ;
218
                   DUG 2 ;
219
                   GET 5 ;
220
                   CAR ;
221
                   COMPARE ;
222
                   EQ ;
223
                   IF {} { PUSH string "Incorrect secret key." ; FAILWITH } ;
224
                   DUP ;
225
                   CAR ;
226
                   GET 3 ;
227
                   SENDER ;
228
                   COMPARE ;
229
                   EQ ;
230
                   IF
231
                     {}
232
                     { PUSH string "WrongCondition: sp.sender == self.data.counterparty" ;
233
                       FAILWITH } ;
234
                   DUP ;
235
                   CAR ;
236
                   GET 6 ;
237
                   PUSH bool True ;
238
                   COMPARE ;
239
                   EQ ;
240
                   IF
241
                     {}
242
                     { PUSH string "The owner (and/or the counterparty) has not yet deposited to the contract. The amount cannot be claimed yet." ;
243
                       FAILWITH } ;
244
                   DUP ;
245
                   CAR ;
246
                   GET 5 ;
247
                   PUSH bool True ;
248
                   COMPARE ;
249
                   EQ ;
250
                   IF
251
                     {}
252
                     { PUSH string "The counterparty has not yet deposited to the contract. The amount cannot be claimed yet." ;
253
                       FAILWITH } ;
254
                   DUP ;
255
                   CAR ;
256
                   GET 3 ;
257
                   CONTRACT unit ;
258
                   IF_NONE { PUSH int 41 ; FAILWITH } {} ;
259
                   NIL operation ;
260
                   SWAP ;
261
                   DIG 2 ;
262
                   DUP ;
263
                   CAR ;
264
                   CAR ;
265
                   GET 3 ;
266
                   SWAP ;
267
                   DUP ;
268
                   DUG 4 ;
269
                   CAR ;
270
                   CAR ;
271
                   GET 4 ;
272
                   ADD ;
273
                   UNIT ;
274
                   TRANSFER_TOKENS ;
275
                   CONS ;
276
                   SWAP ;
277
                   UNPAIR ;
278
                   UNPAIR ;
279
                   CAR ;
280
                   PUSH (pair mutez mutez) (Pair 0 0) ;
281
                   SWAP ;
282
                   PAIR ;
283
                   SWAP ;
284
                   CAR ;
285
                   PUSH (pair bool bool) (Pair False False) ;
286
                   SWAP ;
287
                   PAIR ;
288
                   SWAP ;
289
                   PAIR ;
290
                   PAIR ;
291
                   SWAP } } }
292
         { IF_LEFT
293
             { IF_LEFT
294
                 { DROP ;
295
                   DUP ;
296
                   GET 3 ;
297
                   CAR ;
298
                   NOW ;
299
                   COMPARE ;
300
                   GT ;
301
                   IF
302
                     {}
303
                     { PUSH string "WrongCondition: self.data.epoch < sp.now" ; FAILWITH } ;
304
                   DUP ;
305
                   GET 5 ;
306
                   CDR ;
307
                   SENDER ;
308
                   COMPARE ;
309
                   EQ ;
310
                   IF
311
                     {}
312
                     { PUSH string "WrongCondition: sp.sender == self.data.owner" ;
313
                       FAILWITH } ;
314
                   DUP ;
315
                   CAR ;
316
                   GET 6 ;
317
                   PUSH bool True ;
318
                   COMPARE ;
319
                   EQ ;
320
                   IF
321
                     {}
322
                     { PUSH string "The owner (and/or the counterparty) has not yet deposited to the contract. The amount cannot be claimed yet." ;
323
                       FAILWITH } ;
324
                   DUP ;
325
                   CAR ;
326
                   GET 5 ;
327
                   PUSH bool True ;
328
                   COMPARE ;
329
                   EQ ;
330
                   IF
331
                     {}
332
                     { PUSH string "The counterparty has not yet deposited to the contract. The amount cannot be claimed yet." ;
333
                       FAILWITH } ;
334
                   DUP ;
335
                   GET 5 ;
336
                   CDR ;
337
                   CONTRACT unit ;
338
                   IF_NONE { PUSH int 41 ; FAILWITH } {} ;
339
                   NIL operation ;
340
                   SWAP ;
341
                   DIG 2 ;
342
                   DUP ;
343
                   CAR ;
344
                   CAR ;
345
                   GET 3 ;
346
                   SWAP ;
347
                   DUP ;
348
                   DUG 4 ;
349
                   CAR ;
350
                   CAR ;
351
                   GET 4 ;
352
                   ADD ;
353
                   UNIT ;
354
                   TRANSFER_TOKENS ;
355
                   CONS ;
356
                   SWAP ;
357
                   UNPAIR ;
358
                   UNPAIR ;
359
                   CAR ;
360
                   PUSH (pair mutez mutez) (Pair 0 0) ;
361
                   SWAP ;
362
                   PAIR ;
363
                   SWAP ;
364
                   CAR ;
365
                   PUSH (pair bool bool) (Pair False False) ;
366
                   SWAP ;
367
                   PAIR ;
368
                   SWAP ;
369
                   PAIR ;
370
                   PAIR ;
371
                   SWAP }
372
                 { DROP ;
373
                   DUP ;
374
                   CAR ;
375
                   GET 3 ;
376
                   SENDER ;
377
                   COMPARE ;
378
                   EQ ;
379
                   IF
380
                     {}
381
                     { PUSH string "You are not the counterparty of the contact. Only the counterparty can use this command." ;
382
                       FAILWITH } ;
383
                   DUP ;
384
                   GET 7 ;
385
                   PUSH bool True ;
386
                   COMPARE ;
387
                   EQ ;
388
                   IF
389
                     {}
390
                     { PUSH string "You are not originally withdrawing from the contract. There's no need to undo." ;
391
                       FAILWITH } ;
392
                   PUSH bool False ;
393
                   UPDATE 7 ;
394
                   NIL operation } }
395
             { IF_LEFT
396
                 { DROP ;
397
                   DUP ;
398
                   GET 5 ;
399
                   CDR ;
400
                   SENDER ;
401
                   COMPARE ;
402
                   EQ ;
403
                   IF
404
                     {}
405
                     { PUSH string "You are not the owner of the contact. Only the owner can use this command." ;
406
                       FAILWITH } ;
407
                   DUP ;
408
                   GET 8 ;
409
                   PUSH bool True ;
410
                   COMPARE ;
411
                   EQ ;
412
                   IF
413
                     {}
414
                     { PUSH string "You are not originally withdrawing from the contract. There's no need to undo." ;
415
                       FAILWITH } ;
416
                   PUSH bool False ;
417
                   UPDATE 8 }
418
                 { IF_LEFT
419
                     { DROP ;
420
                       DUP ;
421
                       CAR ;
422
                       GET 3 ;
423
                       SENDER ;
424
                       COMPARE ;
425
                       EQ ;
426
                       IF
427
                         {}
428
                         { PUSH string "You are not the counterparty of the contact. Only the counterparty can use this command." ;
429
                           FAILWITH } ;
430
                       DUP ;
431
                       GET 7 ;
432
                       PUSH bool False ;
433
                       COMPARE ;
434
                       EQ ;
435
                       IF
436
                         {}
437
                         { PUSH string "You are already withdrawing from the contract. There's no need to execute withdraw command again." ;
438
                           FAILWITH } ;
439
                       PUSH bool True ;
440
                       UPDATE 7 }
441
                     { DROP ;
442
                       DUP ;
443
                       GET 5 ;
444
                       CDR ;
445
                       SENDER ;
446
                       COMPARE ;
447
                       EQ ;
448
                       IF
449
                         {}
450
                         { PUSH string "You are not the owner of the contact. Only the owner can use this command." ;
451
                           FAILWITH } ;
452
                       DUP ;
453
                       GET 8 ;
454
                       PUSH bool False ;
455
                       COMPARE ;
456
                       EQ ;
457
                       IF
458
                         {}
459
                         { PUSH string "You are already withdrawing from the contract. There's no need to execute withdraw command again." ;
460
                           FAILWITH } ;
461
                       PUSH bool True ;
462
                       UPDATE 8 } } ;
463
               NIL operation } } ;
464
       NIL operation ;
465
       SWAP ;
466
       ITER { CONS } ;
467
       PAIR }