34 | | - | let p = "PLACEBETBUY" |
---|
35 | | - | |
---|
36 | | - | let q = "PLACEBETLOSE" |
---|
37 | | - | |
---|
38 | | - | let r = "PLACEBETLAY" |
---|
39 | | - | |
---|
40 | | - | let s = "PLACEBETWIN" |
---|
41 | | - | |
---|
42 | | - | let t = "G_GAMECOUNTER" |
---|
43 | | - | |
---|
44 | | - | let u = "G_TOTALBETS" |
---|
45 | | - | |
---|
46 | | - | let v = "G_PROCESSEDBETS" |
---|
47 | | - | |
---|
48 | | - | let w = "G_TOTALFIELD_ODDS_BETS" |
---|
49 | | - | |
---|
50 | | - | let x = "G_PROCESSEDFIEL_ODDS_BETS" |
---|
51 | | - | |
---|
52 | | - | func y (z) = (("G_" + toString(z)) + "_STARTHEIGHT") |
---|
53 | | - | |
---|
54 | | - | |
---|
55 | | - | func A (z) = (("G_" + toString(z)) + "_ENDHEIGHT") |
---|
56 | | - | |
---|
57 | | - | |
---|
58 | | - | func B (z) = getInteger(this, y(z)) |
---|
59 | | - | |
---|
60 | | - | |
---|
61 | | - | func C (z) = getInteger(this, A(z)) |
---|
62 | | - | |
---|
63 | | - | |
---|
64 | | - | func D (E) = (("B_" + toString(E)) + "_BETDETAILS") |
---|
65 | | - | |
---|
66 | | - | |
---|
67 | | - | func F (E) = (("B_" + toString(E)) + "_BETFIELODDSDDETAILS") |
---|
68 | | - | |
---|
69 | | - | |
---|
70 | | - | func G (E) = getString(this, D(E)) |
---|
71 | | - | |
---|
72 | | - | |
---|
73 | | - | func H (E) = getString(this, F(E)) |
---|
74 | | - | |
---|
75 | | - | |
---|
76 | | - | func I (J) = (J != a) |
---|
77 | | - | |
---|
78 | | - | |
---|
79 | | - | func K (z) = (("G_" + toString(z)) + "_LASTPOINT") |
---|
80 | | - | |
---|
81 | | - | |
---|
82 | | - | func L (z) = (("G_" + toString(z)) + "_FIRSTPOINT") |
---|
83 | | - | |
---|
84 | | - | |
---|
85 | | - | func M (z,E,N) = ((((((("W_" + "BET_TYPE_") + N) + "_") + toString(E)) + "_WINNING_BET_") + toString(z)) + "_GAME_NUMBER") |
---|
86 | | - | |
---|
87 | | - | |
---|
88 | | - | func O (z) = (("G_" + toString(z)) + "_STATE") |
---|
89 | | - | |
---|
90 | | - | |
---|
91 | | - | func P (z) = (("G_" + toString(z)) + "_SUMSHA") |
---|
92 | | - | |
---|
93 | | - | |
---|
94 | | - | func Q (z) = (("G_" + toString(z)) + "_RANDOMHASH") |
---|
95 | | - | |
---|
96 | | - | |
---|
97 | | - | func R () = getInteger(this, u) |
---|
98 | | - | |
---|
99 | | - | |
---|
100 | | - | func S () = getInteger(this, v) |
---|
101 | | - | |
---|
102 | | - | |
---|
103 | | - | func T () = getInteger(this, w) |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | func U () = getInteger(this, x) |
---|
107 | | - | |
---|
108 | | - | |
---|
109 | | - | func V (z) = getInteger(this, O(z)) |
---|
110 | | - | |
---|
111 | | - | |
---|
112 | | - | func W (z) = getString(this, P(z)) |
---|
113 | | - | |
---|
114 | | - | |
---|
115 | | - | func X (z) = getString(this, Q(z)) |
---|
116 | | - | |
---|
117 | | - | |
---|
118 | | - | func Y (z) = (("G_" + toString(z)) + "_ROLLSCOUNT") |
---|
119 | | - | |
---|
120 | | - | |
---|
121 | | - | func Z (z,aa) = (((("G_" + toString(z)) + "_") + toString(aa)) + "_GAMENUMBER_ROLLDICE") |
---|
122 | | - | |
---|
123 | | - | |
---|
124 | | - | func ab (E) = (("B_" + toString(E)) + "_FIELD_ODDS_BET_ROLLDICE") |
---|
125 | | - | |
---|
126 | | - | |
---|
127 | | - | func ac (z) = getInteger(this, Y(z)) |
---|
128 | | - | |
---|
129 | | - | |
---|
130 | | - | func ad (z,aa) = getInteger(this, Z(z, aa)) |
---|
131 | | - | |
---|
132 | | - | |
---|
133 | | - | func ae (E) = getInteger(this, ab(E)) |
---|
134 | | - | |
---|
135 | | - | |
---|
136 | | - | func af (ag) = (("B_" + toString(ag)) + "_BET_GAMENUMBER") |
---|
137 | | - | |
---|
138 | | - | |
---|
139 | | - | func ah (ag) = (("B_" + toString(ag)) + "_FIELD_ODDS_BET_GAMENUMBER") |
---|
140 | | - | |
---|
141 | | - | |
---|
142 | | - | func ai (ag) = getInteger(this, af(ag)) |
---|
143 | | - | |
---|
144 | | - | |
---|
145 | | - | func aj (ag) = getInteger(this, ah(ag)) |
---|
146 | | - | |
---|
147 | | - | |
---|
148 | | - | func ak () = getInteger(this, t) |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | func al (z) = getInteger(this, L(z)) |
---|
152 | | - | |
---|
153 | | - | |
---|
154 | | - | func am (z) = { |
---|
155 | | - | let an = getInteger(this, K(z)) |
---|
156 | | - | if ($isInstanceOf(an, "Int")) |
---|
157 | | - | then { |
---|
158 | | - | let ao = an |
---|
159 | | - | ao |
---|
160 | | - | } |
---|
161 | | - | else 0 |
---|
| 34 | + | @Callable(p) |
---|
| 35 | + | func getWinningAmount (q,r,s) = { |
---|
| 36 | + | let t = split(q, "_")[2] |
---|
| 37 | + | let u = value(parseInt(split(q, "_")[5])) |
---|
| 38 | + | let v = value(parseInt(split(q, "_")[1])) |
---|
| 39 | + | if ((t == i)) |
---|
| 40 | + | then if ((r == 12)) |
---|
| 41 | + | then [IntegerEntry("price", (v * 4))] |
---|
| 42 | + | else if ((r == 2)) |
---|
| 43 | + | then [IntegerEntry("price", (v * 3))] |
---|
| 44 | + | else if (if (if (if ((r == 5)) |
---|
| 45 | + | then true |
---|
| 46 | + | else (r == 6)) |
---|
| 47 | + | then true |
---|
| 48 | + | else (r == 7)) |
---|
| 49 | + | then true |
---|
| 50 | + | else (r == 8)) |
---|
| 51 | + | then [IntegerEntry("price", 0)] |
---|
| 52 | + | else [IntegerEntry("price", (v * 2))] |
---|
| 53 | + | else if ((t == j)) |
---|
| 54 | + | then if (if ((u == 4)) |
---|
| 55 | + | then true |
---|
| 56 | + | else (u == 10)) |
---|
| 57 | + | then [IntegerEntry("price", (v * 7))] |
---|
| 58 | + | else if (if ((u == 5)) |
---|
| 59 | + | then true |
---|
| 60 | + | else (u == 8)) |
---|
| 61 | + | then [IntegerEntry("price", (v * 9))] |
---|
| 62 | + | else if (if ((u == 3)) |
---|
| 63 | + | then true |
---|
| 64 | + | else (u == 11)) |
---|
| 65 | + | then [IntegerEntry("price", (v * 15))] |
---|
| 66 | + | else if (if ((u == 2)) |
---|
| 67 | + | then true |
---|
| 68 | + | else (u == 12)) |
---|
| 69 | + | then [IntegerEntry("price", (v * 30))] |
---|
| 70 | + | else if (if ((u == 10)) |
---|
| 71 | + | then true |
---|
| 72 | + | else (u == 4)) |
---|
| 73 | + | then [IntegerEntry("price", (v * 30))] |
---|
| 74 | + | else if ((u == 7)) |
---|
| 75 | + | then [IntegerEntry("price", (v * 4))] |
---|
| 76 | + | else if (if ((u == 100)) |
---|
| 77 | + | then if (if ((r == 3)) |
---|
| 78 | + | then true |
---|
| 79 | + | else (r == 12)) |
---|
| 80 | + | then true |
---|
| 81 | + | else (r == 2) |
---|
| 82 | + | else false) |
---|
| 83 | + | then [IntegerEntry("price", (v * 7))] |
---|
| 84 | + | else [IntegerEntry("price", 0)] |
---|
| 85 | + | else if ((t == k)) |
---|
| 86 | + | then if (if ((r == 6)) |
---|
| 87 | + | then true |
---|
| 88 | + | else (r == 8)) |
---|
| 89 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 90 | + | else [IntegerEntry("price", 0)] |
---|
| 91 | + | else if (if ((t == n)) |
---|
| 92 | + | then true |
---|
| 93 | + | else (t == m)) |
---|
| 94 | + | then if ((r == 7)) |
---|
| 95 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 96 | + | else if ((r == u)) |
---|
| 97 | + | then [IntegerEntry("price", 0)] |
---|
| 98 | + | else [IntegerEntry("price", -1)] |
---|
| 99 | + | else if (if ((t == l)) |
---|
| 100 | + | then true |
---|
| 101 | + | else (t == o)) |
---|
| 102 | + | then if ((r == 7)) |
---|
| 103 | + | then [IntegerEntry("price", 0)] |
---|
| 104 | + | else if ((r == u)) |
---|
| 105 | + | then [IntegerEntry("price", 2)] |
---|
| 106 | + | else [IntegerEntry("price", -1)] |
---|
| 107 | + | else if ((t == g)) |
---|
| 108 | + | then { |
---|
| 109 | + | let w = value(parseInt(split(q, "_")[6])) |
---|
| 110 | + | if ((s == 2)) |
---|
| 111 | + | then if (if ((r == 7)) |
---|
| 112 | + | then true |
---|
| 113 | + | else (r == 11)) |
---|
| 114 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 115 | + | else if (if (if ((r == 2)) |
---|
| 116 | + | then true |
---|
| 117 | + | else (r == 12)) |
---|
| 118 | + | then true |
---|
| 119 | + | else (r == 3)) |
---|
| 120 | + | then [IntegerEntry("price", 0)] |
---|
| 121 | + | else if ((r == w)) |
---|
| 122 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 123 | + | else [IntegerEntry("price", -1)] |
---|
| 124 | + | else if ((s > 2)) |
---|
| 125 | + | then if ((r == 7)) |
---|
| 126 | + | then [IntegerEntry("price", 0)] |
---|
| 127 | + | else if ((r == w)) |
---|
| 128 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 129 | + | else [IntegerEntry("price", -1)] |
---|
| 130 | + | else throw("Not Allow in The Beginning") |
---|
| 131 | + | } |
---|
| 132 | + | else if ((t == h)) |
---|
| 133 | + | then { |
---|
| 134 | + | let w = value(parseInt(split(q, "_")[6])) |
---|
| 135 | + | if ((s == 2)) |
---|
| 136 | + | then if (if ((r == 7)) |
---|
| 137 | + | then true |
---|
| 138 | + | else (r == 11)) |
---|
| 139 | + | then [IntegerEntry("price", 0)] |
---|
| 140 | + | else if (if (if ((r == 2)) |
---|
| 141 | + | then true |
---|
| 142 | + | else (r == 12)) |
---|
| 143 | + | then true |
---|
| 144 | + | else (r == 3)) |
---|
| 145 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 146 | + | else if ((r == w)) |
---|
| 147 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 148 | + | else [IntegerEntry("price", -1)] |
---|
| 149 | + | else if ((s > 1)) |
---|
| 150 | + | then if ((r == 7)) |
---|
| 151 | + | then [IntegerEntry("price", (v * 2))] |
---|
| 152 | + | else if ((r == w)) |
---|
| 153 | + | then [IntegerEntry("price", 0)] |
---|
| 154 | + | else [IntegerEntry("price", -1)] |
---|
| 155 | + | else throw("Not Allow in The Beginning") |
---|
| 156 | + | } |
---|
| 157 | + | else [IntegerEntry("price", 0)] |
---|
294 | | - | func aG (aH,aI,aJ,z,at,az,aA,au) = [IntegerEntry(ah(aH), z), StringEntry(F(aH), ((((((aA + "_") + at) + "_") + az) + "_active_pending_") + toString(au))), StringEntry(F(aI), ((((((aA + "_") + at) + "_") + az) + "_inactive_rolled_") + toString(au))), IntegerEntry(x, aI), IntegerEntry(w, aH), IntegerEntry(ab(aH), aJ)] |
---|
295 | | - | |
---|
296 | | - | |
---|
297 | | - | func aK (aL,at,aM,aI,aJ,ag,N,aN,au) = if ((aL == g)) |
---|
298 | | - | then aG((aM + 1), (aI + 1), 1, (ag + 1), toString(at), N, aN, au) |
---|
299 | | - | else aG((aM + 1), (aI + 1), (aJ + 1), ag, toString(at), N, aN, au) |
---|
300 | | - | |
---|
301 | | - | |
---|
302 | | - | func aO (aL,aP,av,at,aM,aI,aJ,ag,N,aN,au) = { |
---|
303 | | - | let aQ = value(parseInt(split(aP, "_")[5])) |
---|
304 | | - | let aR = value(parseInt(split(aP, "_")[6])) |
---|
305 | | - | let aS = value(ad(aQ, aR)) |
---|
306 | | - | if ((av == 7)) |
---|
307 | | - | then if ((aP == k)) |
---|
308 | | - | then throw("Only Field Type of Bet can be proceed") |
---|
309 | | - | else throw("Only Field Type of Bet can be proceed") |
---|
310 | | - | else if ((av == aS)) |
---|
311 | | - | then throw("Only Field Type of Bet can be proceed") |
---|
312 | | - | else if ((aL == g)) |
---|
313 | | - | then aK(aL, at, (aM + 1), (aI + 1), 1, (ag + 1), N, aN, au) |
---|
314 | | - | else aK(aL, at, (aM + 1), (aI + 1), (aJ + 1), ag, N, aN, au) |
---|
315 | | - | } |
---|
316 | | - | |
---|
317 | | - | |
---|
318 | | - | func aT (z,at,az,aA) = { |
---|
319 | | - | let an = R() |
---|
320 | | - | if ($isInstanceOf(an, "Int")) |
---|
321 | | - | then { |
---|
322 | | - | let aU = an |
---|
323 | | - | let aV = (aU + 1) |
---|
324 | | - | [IntegerEntry(af(aV), z), StringEntry(D(aV), (((((aA + "_") + at) + "_") + az) + "_active_pending")), IntegerEntry(u, aV)] |
---|
325 | | - | } |
---|
326 | | - | else throw("Game has not bee initialized") |
---|
327 | | - | } |
---|
328 | | - | |
---|
329 | | - | |
---|
330 | | - | func aW (aX,ag,aY,aZ,ba) = { |
---|
331 | | - | let bb = (aX + "_lost") |
---|
332 | | - | [StringEntry(aZ, bb), IntegerEntry(ba, aY)] |
---|
333 | | - | } |
---|
334 | | - | |
---|
335 | | - | |
---|
336 | | - | func bc (aX,ag,aY,aZ,ba,bd) = { |
---|
337 | | - | let bb = ((aX + "_lost_") + toString(bd)) |
---|
338 | | - | [StringEntry(aZ, bb), IntegerEntry(ba, aY)] |
---|
339 | | - | } |
---|
340 | | - | |
---|
341 | | - | |
---|
342 | | - | func be (aX,ag,bf,aN,aw,N,aZ,ba) = { |
---|
343 | | - | let bb = (aX + "_won_") |
---|
344 | | - | [StringEntry(M(ag, bf, N), ((aN + "_amount_") + toString(aw))), StringEntry(aZ, aX), IntegerEntry(ba, bf), ScriptTransfer(value(addressFromString(aN)), aw, unit)] |
---|
345 | | - | } |
---|
346 | | - | |
---|
347 | | - | |
---|
348 | | - | func bg (bh,ag,aU,aD,bi,bj,bk) = [IntegerEntry(O(ag), bk), IntegerEntry(bh, aU), IntegerEntry(Y(ag), aD), IntegerEntry(A(ag), (bi + h)), StringEntry(Q(ag), toBase64String(bj)), IntegerEntry(Z(ag, aD), aU)] |
---|
349 | | - | |
---|
350 | | - | |
---|
351 | | - | @Callable(bl) |
---|
352 | | - | func processNextBet () = if (I(bl.callerPublicKey)) |
---|
353 | | - | then throw("processFieldBet_FORBIDDEN") |
---|
354 | | - | else { |
---|
355 | | - | let an = R() |
---|
356 | | - | if ($isInstanceOf(an, "Int")) |
---|
357 | | - | then { |
---|
358 | | - | let aH = an |
---|
359 | | - | let aC = S() |
---|
360 | | - | if ($isInstanceOf(aC, "Int")) |
---|
361 | | - | then { |
---|
362 | | - | let bm = aC |
---|
363 | | - | let bn = (bm + 1) |
---|
364 | | - | if ((bn > aH)) |
---|
365 | | - | then throw("Next bet has not been places.") |
---|
366 | | - | else { |
---|
367 | | - | let bo = ai(bn) |
---|
368 | | - | if ($isInstanceOf(bo, "Int")) |
---|
369 | | - | then { |
---|
370 | | - | let ag = bo |
---|
371 | | - | let bp = V(ag) |
---|
372 | | - | if ($isInstanceOf(bp, "Int")) |
---|
373 | | - | then { |
---|
374 | | - | let aL = bp |
---|
375 | | - | if (if ((aL == e)) |
---|
376 | | - | then true |
---|
377 | | - | else (aL == f)) |
---|
378 | | - | then throw("Game has to finished in order to process NON-FIELD bets") |
---|
379 | | - | else { |
---|
380 | | - | let aP = value(G(bn)) |
---|
381 | | - | let N = split(aP, "_")[2] |
---|
382 | | - | let aN = split(aP, "_")[0] |
---|
383 | | - | let at = value(parseInt(split(aP, "_")[1])) |
---|
384 | | - | let bq = value(addressFromString(aN)) |
---|
385 | | - | let br = am(bn) |
---|
386 | | - | let bs = al(bn) |
---|
387 | | - | let aX = (((((aN + "_") + split(aP, "_")[1]) + "_") + split(aP, "_")[2]) + "_inactive_") |
---|
388 | | - | if ((N == i)) |
---|
389 | | - | then if ((br == 0)) |
---|
390 | | - | then if (if ((bs == 7)) |
---|
391 | | - | then true |
---|
392 | | - | else (bs == 11)) |
---|
393 | | - | then { |
---|
394 | | - | let aw = (at * 2) |
---|
395 | | - | be(aX, ag, bn, aN, aw, N, D(bn), v) |
---|
396 | | - | } |
---|
397 | | - | else aW(aX, ag, bn, D(bn), v) |
---|
398 | | - | else if ((bs == br)) |
---|
399 | | - | then { |
---|
400 | | - | let aw = (at * 2) |
---|
401 | | - | be(aX, ag, bn, aN, aw, N, D(bn), v) |
---|
402 | | - | } |
---|
403 | | - | else if ((br == 7)) |
---|
404 | | - | then aW(aX, ag, bn, D(bn), v) |
---|
405 | | - | else aW(aX, ag, bn, D(bn), v) |
---|
406 | | - | else if ((N == j)) |
---|
407 | | - | then if ((br == 0)) |
---|
408 | | - | then if (if ((bs == 2)) |
---|
409 | | - | then true |
---|
410 | | - | else (bs == 3)) |
---|
411 | | - | then { |
---|
412 | | - | let aw = (at * 2) |
---|
413 | | - | be(aX, ag, bn, aN, aw, N, D(bn), v) |
---|
414 | | - | } |
---|
415 | | - | else if (if ((br == 7)) |
---|
416 | | - | then true |
---|
417 | | - | else (br == 11)) |
---|
418 | | - | then aW(aX, ag, bn, D(bn), v) |
---|
419 | | - | else aW(aX, ag, bn, D(bn), v) |
---|
420 | | - | else if (if ((br == 2)) |
---|
421 | | - | then true |
---|
422 | | - | else (br == 3)) |
---|
423 | | - | then { |
---|
424 | | - | let aw = (at * 2) |
---|
425 | | - | be(aX, ag, bn, aN, aw, N, D(bn), v) |
---|
426 | | - | } |
---|
427 | | - | else if ((br == 7)) |
---|
428 | | - | then aW(aX, ag, bn, D(bn), v) |
---|
429 | | - | else aW(aX, ag, bn, D(bn), v) |
---|
430 | | - | else throw((((((("Only " + i) + ", ") + j) + " allowed in processNextBet()") + " currentBetType ") + N)) |
---|
431 | | - | } |
---|
432 | | - | } |
---|
433 | | - | else throw("Game does not exist or has already ended.") |
---|
434 | | - | } |
---|
435 | | - | else throw("Error") |
---|
436 | | - | } |
---|
437 | | - | } |
---|
438 | | - | else throw("Game has not been initialized, next bets not found") |
---|
439 | | - | } |
---|
440 | | - | else throw("Game has not been initialized, next bets not found") |
---|
441 | | - | } |
---|
442 | | - | |
---|
443 | | - | |
---|
444 | | - | |
---|
445 | | - | @Callable(bl) |
---|
446 | | - | func processOneRoundBet () = if (I(bl.callerPublicKey)) |
---|
447 | | - | then throw("processFieldBet_FORBIDDEN") |
---|
448 | | - | else { |
---|
449 | | - | let an = T() |
---|
450 | | - | if ($isInstanceOf(an, "Int")) |
---|
451 | | - | then { |
---|
452 | | - | let aM = an |
---|
453 | | - | let aC = U() |
---|
454 | | - | if ($isInstanceOf(aC, "Int")) |
---|
455 | | - | then { |
---|
456 | | - | let aI = aC |
---|
457 | | - | let bn = (aI + 1) |
---|
458 | | - | if ((bn > aM)) |
---|
459 | | - | then throw("Next Field Bet has not been places.") |
---|
460 | | - | else { |
---|
461 | | - | let bo = aj(bn) |
---|
462 | | - | if ($isInstanceOf(bo, "Int")) |
---|
463 | | - | then { |
---|
464 | | - | let ag = bo |
---|
465 | | - | let bp = V(ag) |
---|
466 | | - | if ($isInstanceOf(bp, "Int")) |
---|
467 | | - | then { |
---|
468 | | - | let aL = bp |
---|
469 | | - | if ((aL == e)) |
---|
470 | | - | then throw("Game has not started yet") |
---|
471 | | - | else { |
---|
472 | | - | let aP = value(H(bn)) |
---|
473 | | - | let N = split(aP, "_")[2] |
---|
474 | | - | let aN = split(aP, "_")[0] |
---|
475 | | - | let at = value(parseInt(split(aP, "_")[1])) |
---|
476 | | - | let au = value(parseInt(split(aP, "_")[5])) |
---|
477 | | - | let bq = value(addressFromString(aN)) |
---|
478 | | - | let aJ = value(ae(bn)) |
---|
479 | | - | let bt = ad(ag, aJ) |
---|
480 | | - | if ($isInstanceOf(bt, "Int")) |
---|
481 | | - | then { |
---|
482 | | - | let av = bt |
---|
483 | | - | let aX = (((((aN + "_") + split(aP, "_")[1]) + "_") + split(aP, "_")[2]) + "_inactive_") |
---|
484 | | - | if ((N == m)) |
---|
485 | | - | then { |
---|
486 | | - | let aw = ax(at, av) |
---|
487 | | - | if ((aw == 0)) |
---|
488 | | - | then aW(aX, ag, bn, F(ag), x) |
---|
489 | | - | else be(aX, ag, bn, aN, aw, N, F(bn), x) |
---|
490 | | - | } |
---|
491 | | - | else if ((N == n)) |
---|
492 | | - | then { |
---|
493 | | - | let aw = as(at, au, av) |
---|
494 | | - | if ((aw == 0)) |
---|
495 | | - | then be((aX + "_won_"), ag, bn, aN, aw, N, F(bn), x) |
---|
496 | | - | else bc(aX, ag, bn, F(bn), x, au) |
---|
497 | | - | } |
---|
498 | | - | else if ((N == o)) |
---|
499 | | - | then if (if ((av == 6)) |
---|
500 | | - | then true |
---|
501 | | - | else (av == 8)) |
---|
502 | | - | then { |
---|
503 | | - | let aw = (2 * at) |
---|
504 | | - | be((aX + "_won_"), ag, bn, aN, aw, N, F(bn), x) |
---|
505 | | - | } |
---|
506 | | - | else bc(aX, ag, bn, F(bn), x, au) |
---|
507 | | - | else if (if ((N == p)) |
---|
508 | | - | then true |
---|
509 | | - | else (N == s)) |
---|
510 | | - | then if ((av == 7)) |
---|
511 | | - | then bc(aX, ag, bn, F(bn), x, au) |
---|
512 | | - | else if ((av == au)) |
---|
513 | | - | then { |
---|
514 | | - | let aw = (at * 2) |
---|
515 | | - | be((aX + "_won_"), ag, bn, aN, aw, N, F(bn), x) |
---|
516 | | - | } |
---|
517 | | - | else aK(aL, at, (aM + 1), (aI + 1), 1, (ag + 1), N, aN, au) |
---|
518 | | - | else if (if ((N == r)) |
---|
519 | | - | then true |
---|
520 | | - | else (N == q)) |
---|
521 | | - | then if ((av == 7)) |
---|
522 | | - | then { |
---|
523 | | - | let aw = (at * 2) |
---|
524 | | - | be(aX, ag, bn, aN, aw, N, F(bn), x) |
---|
525 | | - | } |
---|
526 | | - | else if ((av == au)) |
---|
527 | | - | then bc(aX, ag, bn, F(bn), x, au) |
---|
528 | | - | else aK(aL, at, (aM + 1), (aI + 1), 1, (ag + 1), N, aN, au) |
---|
529 | | - | else if (if ((N == k)) |
---|
530 | | - | then true |
---|
531 | | - | else (N == l)) |
---|
532 | | - | then aO(aL, aP, av, at, aM, aI, aJ, ag, N, aN, au) |
---|
533 | | - | else throw("Only Field Type of Bet can be proceed") |
---|
534 | | - | } |
---|
535 | | - | else throw("There is no result for this round yet") |
---|
536 | | - | } |
---|
537 | | - | } |
---|
538 | | - | else throw("Game does not exist or has already ended") |
---|
539 | | - | } |
---|
540 | | - | else throw("Error") |
---|
541 | | - | } |
---|
542 | | - | } |
---|
543 | | - | else throw("Game has not been initialized, next bets not found") |
---|
544 | | - | } |
---|
545 | | - | else throw("Game has not been initialized, next bets not found") |
---|
546 | | - | } |
---|
547 | | - | |
---|
548 | | - | |
---|
549 | | - | |
---|
550 | | - | @Callable(bl) |
---|
551 | | - | func initGame () = if (I(bl.callerPublicKey)) |
---|
552 | | - | then throw("initGame_FORBIDDEN") |
---|
553 | | - | else { |
---|
554 | | - | let an = ak() |
---|
555 | | - | if ($isInstanceOf(an, "Int")) |
---|
556 | | - | then { |
---|
557 | | - | let bu = an |
---|
558 | | - | throw("INIT_ALREADY_DONE") |
---|
559 | | - | } |
---|
560 | | - | else [IntegerEntry(t, 0), IntegerEntry(u, 0), IntegerEntry(v, 0), IntegerEntry(w, 0), IntegerEntry(x, 0)] |
---|
561 | | - | } |
---|
562 | | - | |
---|
563 | | - | |
---|
564 | | - | |
---|
565 | | - | @Callable(bl) |
---|
566 | | - | func startGame (bj) = if (I(bl.callerPublicKey)) |
---|
567 | | - | then throw("startGame_FORBIDDEN") |
---|
568 | | - | else { |
---|
569 | | - | let an = ak() |
---|
570 | | - | if ($isInstanceOf(an, "Int")) |
---|
571 | | - | then { |
---|
572 | | - | let aU = an |
---|
573 | | - | if ((aU == 0)) |
---|
574 | | - | then { |
---|
575 | | - | let bv = (aU + 1) |
---|
576 | | - | [IntegerEntry(t, bv), IntegerEntry(O(bv), e), IntegerEntry(y(bv), lastBlock.height), IntegerEntry(A(bv), (lastBlock.height + h)), IntegerEntry(Y(bv), 0), StringEntry(P(bv), toBase58String(sha256(fromBase64String(bj))))] |
---|
577 | | - | } |
---|
578 | | - | else { |
---|
579 | | - | let aC = V(aU) |
---|
580 | | - | if ($isInstanceOf(aC, "Int")) |
---|
581 | | - | then { |
---|
582 | | - | let bk = aC |
---|
583 | | - | if (if ((bk == f)) |
---|
584 | | - | then true |
---|
585 | | - | else (bk == e)) |
---|
586 | | - | then throw("The previous game is still in progress") |
---|
587 | | - | else { |
---|
588 | | - | let bv = (aU + 1) |
---|
589 | | - | [IntegerEntry(t, bv), IntegerEntry(O(bv), e), IntegerEntry(y(bv), lastBlock.height), IntegerEntry(A(bv), (lastBlock.height + h)), IntegerEntry(Y(bv), 0), StringEntry(P(bv), toBase58String(sha256(fromBase64String(bj))))] |
---|
590 | | - | } |
---|
591 | | - | } |
---|
592 | | - | else throw("Error") |
---|
593 | | - | } |
---|
594 | | - | } |
---|
595 | | - | else throw("INIT_NEED") |
---|
596 | | - | } |
---|
597 | | - | |
---|
598 | | - | |
---|
599 | | - | |
---|
600 | | - | @Callable(bl) |
---|
601 | | - | func placeBet (az) = if (ap(az)) |
---|
602 | | - | then if ((size(bl.payments) == 0)) |
---|
603 | | - | then throw("Payment not attached") |
---|
604 | | - | else { |
---|
605 | | - | let an = ak() |
---|
606 | | - | if ($isInstanceOf(an, "Int")) |
---|
607 | | - | then { |
---|
608 | | - | let bw = an |
---|
609 | | - | let bx = bl.payments[0] |
---|
610 | | - | let aC = V(bw) |
---|
611 | | - | if ($isInstanceOf(aC, "Int")) |
---|
612 | | - | then { |
---|
613 | | - | let bk = aC |
---|
614 | | - | if ((bk == e)) |
---|
615 | | - | then if (if ((az == i)) |
---|
616 | | - | then true |
---|
617 | | - | else (az == j)) |
---|
618 | | - | then aT(bw, toString(bx.amount), az, toBase58String(bl.caller.bytes)) |
---|
619 | | - | else throw((((((("Only " + i) + ", ") + j) + " and ") + m) + " are allowed in the Beginning of Game")) |
---|
620 | | - | else if ((bk == f)) |
---|
621 | | - | then throw((((((("Only " + k) + ", ") + l) + " and ") + m) + " ARE ALLOWED at Start.")) |
---|
622 | | - | else if ((bk == g)) |
---|
623 | | - | then throw("Game already ended.") |
---|
624 | | - | else throw("Unknown Game State.") |
---|
625 | | - | } |
---|
626 | | - | else throw("Game does not exist or has already ended.") |
---|
627 | | - | } |
---|
628 | | - | else throw("Game has not been initialized.") |
---|
629 | | - | } |
---|
630 | | - | else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + i) + ", ") + j) + ", ") + k) + ", ") + l) + ", ") + m)) |
---|
631 | | - | |
---|
632 | | - | |
---|
633 | | - | |
---|
634 | | - | @Callable(bl) |
---|
635 | | - | func placeRoundBet (az,bd) = if (ar(az)) |
---|
636 | | - | then if ((size(bl.payments) == 0)) |
---|
637 | | - | then throw("Payment not attached") |
---|
638 | | - | else { |
---|
639 | | - | let an = ak() |
---|
640 | | - | if ($isInstanceOf(an, "Int")) |
---|
641 | | - | then { |
---|
642 | | - | let bw = an |
---|
643 | | - | let bx = bl.payments[0] |
---|
644 | | - | let aC = V(bw) |
---|
645 | | - | if ($isInstanceOf(aC, "Int")) |
---|
646 | | - | then { |
---|
647 | | - | let bk = aC |
---|
648 | | - | if ((bk == g)) |
---|
649 | | - | then throw("Game already ended.") |
---|
650 | | - | else if (if ((az == k)) |
---|
651 | | - | then true |
---|
652 | | - | else (az == l)) |
---|
653 | | - | then if ((bk == e)) |
---|
654 | | - | then throw("Cannot place COME OR DONTCOME BET IF GAME HAS NOT STARTED") |
---|
655 | | - | else ay(bw, toString(bx.amount), az, toBase58String(bl.caller.bytes), 0) |
---|
656 | | - | else ay(bw, toString(bx.amount), az, toBase58String(bl.caller.bytes), bd) |
---|
657 | | - | } |
---|
658 | | - | else throw("Game does not exist or has already ended.") |
---|
659 | | - | } |
---|
660 | | - | else throw("Game has not been initialized.") |
---|
661 | | - | } |
---|
662 | | - | else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + n) + ", ") + j) + ", ") + k) + ", ") + l) + ", ") + m)) |
---|
663 | | - | |
---|
664 | | - | |
---|
665 | | - | |
---|
666 | | - | @Callable(bl) |
---|
667 | | - | func throwDices (by,ag) = if (I(bl.callerPublicKey)) |
---|
668 | | - | then throw("throwDices_FORBIDDEN") |
---|
669 | | - | else { |
---|
670 | | - | let an = V(ag) |
---|
671 | | - | if ($isInstanceOf(an, "Int")) |
---|
672 | | - | then { |
---|
673 | | - | let bk = an |
---|
674 | | - | if ((bk == g)) |
---|
675 | | - | then throw("Game is finished") |
---|
676 | | - | else { |
---|
677 | | - | let bi = lastBlock.height |
---|
678 | | - | let bz = value(C(ag)) |
---|
679 | | - | if ((bi >= bz)) |
---|
680 | | - | then { |
---|
681 | | - | let aC = W(ag) |
---|
682 | | - | if ($isInstanceOf(aC, "String")) |
---|
683 | | - | then { |
---|
684 | | - | let bA = aC |
---|
685 | | - | let bB = fromBase64String(by) |
---|
686 | | - | let bC = rsaVerify(SHA256, fromBase58String(bA), bB, d) |
---|
687 | | - | let bo = blockInfoByHeight((lastBlock.height - 1)) |
---|
688 | | - | if ($isInstanceOf(bo, "BlockInfo")) |
---|
689 | | - | then { |
---|
690 | | - | let bD = bo |
---|
691 | | - | let bj = sha256((take(bB, 4) + take(bD.generationSignature, 8))) |
---|
692 | | - | if (!(bC)) |
---|
693 | | - | then throw("INVALID_RSA_SIGN") |
---|
694 | | - | else { |
---|
695 | | - | let bE = (toInt(bj) % 11) |
---|
696 | | - | let aU = b[bE] |
---|
697 | | - | let bp = ac(ag) |
---|
698 | | - | if ($isInstanceOf(bp, "Int")) |
---|
699 | | - | then { |
---|
700 | | - | let bF = bp |
---|
701 | | - | let bG = (bF + 1) |
---|
702 | | - | if ((bk == e)) |
---|
703 | | - | then if (if (if (if (if ((aU == 7)) |
---|
704 | | - | then true |
---|
705 | | - | else (aU == 11)) |
---|
706 | | - | then true |
---|
707 | | - | else (aU == 2)) |
---|
708 | | - | then true |
---|
709 | | - | else (aU == 3)) |
---|
710 | | - | then true |
---|
711 | | - | else (aU == 12)) |
---|
712 | | - | then bg(L(ag), ag, aU, bG, bi, bj, g) |
---|
713 | | - | else bg(L(ag), ag, aU, bG, bi, bj, f) |
---|
714 | | - | else { |
---|
715 | | - | let br = value(am(ag)) |
---|
716 | | - | let bs = value(al(ag)) |
---|
717 | | - | if ((br == 0)) |
---|
718 | | - | then if (if ((aU == 7)) |
---|
719 | | - | then true |
---|
720 | | - | else (bs == aU)) |
---|
721 | | - | then bg(K(ag), ag, aU, bG, bi, bj, g) |
---|
722 | | - | else bg(K(ag), ag, aU, bG, bi, bj, f) |
---|
723 | | - | else if (if ((aU == 7)) |
---|
724 | | - | then true |
---|
725 | | - | else (bs == aU)) |
---|
726 | | - | then bg(K(ag), ag, aU, bG, bi, bj, g) |
---|
727 | | - | else bg(K(ag), ag, aU, bG, bi, bj, f) |
---|
728 | | - | } |
---|
729 | | - | } |
---|
730 | | - | else throw("No dices have been thrown") |
---|
731 | | - | } |
---|
732 | | - | } |
---|
733 | | - | else throw("Last block doesn't exist.") |
---|
734 | | - | } |
---|
735 | | - | else throw("SHA doesn't exist") |
---|
736 | | - | } |
---|
737 | | - | else throw("Throw dice not allow still waiting for block to process") |
---|
738 | | - | } |
---|
739 | | - | } |
---|
740 | | - | else throw("Game does not exist or has already ended.") |
---|
741 | | - | } |
---|
742 | | - | |
---|
743 | | - | |
---|
744 | | - | @Verifier(bH) |
---|
745 | | - | func bI () = { |
---|
746 | | - | let an = bH |
---|
747 | | - | sigVerify(bH.bodyBytes, bH.proofs[0], bH.senderPublicKey) |
---|
| 201 | + | @Verifier(A) |
---|
| 202 | + | func B () = { |
---|
| 203 | + | let C = A |
---|
| 204 | + | sigVerify(A.bodyBytes, A.proofs[0], A.senderPublicKey) |
---|