4 | | - | let a = "3MtaCL4v1bjTabUqs7oU4ofS8fbai34WM1i" |
---|
5 | | - | |
---|
6 | | - | let b = 1000000000 |
---|
7 | | - | |
---|
8 | | - | let c = (100 * b) |
---|
9 | | - | |
---|
10 | | - | let d = "," |
---|
11 | | - | |
---|
12 | | - | func e () = ["01C", "02C", "03C", "04C", "05C", "06C", "07C", "08C", "09C", "10C", "11C", "12C", "13C", "01D", "02D", "03D", "04D", "05D", "06D", "07D", "08D", "09D", "10D", "11D", "12D", "13D", "01H", "02H", "03H", "04H", "05H", "06H", "07H", "08H", "09H", "10H", "11H", "12H", "13H", "01S", "02S", "03S", "04S", "05S", "06S", "07S", "08S", "09S", "10S", "11S", "12S", "13S"] |
---|
15 | | - | func f () = (((((e() ++ e()) ++ e()) ++ e()) ++ e()) ++ e()) |
---|
16 | | - | |
---|
17 | | - | |
---|
18 | | - | func g (h) = if ((0 >= size(h))) |
---|
19 | | - | then f() |
---|
20 | | - | else h |
---|
21 | | - | |
---|
22 | | - | |
---|
23 | | - | func i (j,k,l) = { |
---|
24 | | - | let m = sha256(toBytes((j + k))) |
---|
25 | | - | let n = toInt(m) |
---|
26 | | - | let o = (n % l) |
---|
27 | | - | if ((0 > o)) |
---|
28 | | - | then ((-1 * o) + 1) |
---|
29 | | - | else (o + 1) |
---|
30 | | - | } |
---|
31 | | - | |
---|
32 | | - | |
---|
33 | | - | func p (q) = { |
---|
34 | | - | let r = getInteger(this, (q + "_LastRandonNumber")) |
---|
35 | | - | if ($isInstanceOf(r, "Int")) |
---|
36 | | - | then { |
---|
37 | | - | let s = r |
---|
38 | | - | toString(s) |
---|
39 | | - | } |
---|
40 | | - | else q |
---|
41 | | - | } |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | func t (u,v) = { |
---|
45 | | - | let r = getInteger(u, v) |
---|
46 | | - | if ($isInstanceOf(r, "Int")) |
---|
47 | | - | then { |
---|
48 | | - | let w = r |
---|
49 | | - | w |
---|
50 | | - | } |
---|
51 | | - | else 0 |
---|
52 | | - | } |
---|
53 | | - | |
---|
54 | | - | |
---|
55 | | - | func x (y) = if ((size(y.payments) == 0)) |
---|
56 | | - | then throw("Payment must be attached") |
---|
57 | | - | else { |
---|
58 | | - | let z = y.payments[0] |
---|
59 | | - | if (isDefined(z.assetId)) |
---|
60 | | - | then throw("This function accepts WAVES tokens only") |
---|
61 | | - | else z.amount |
---|
62 | | - | } |
---|
63 | | - | |
---|
64 | | - | |
---|
65 | | - | func A (B) = { |
---|
66 | | - | let C = parseIntValue(take(B, 2)) |
---|
67 | | - | if ((C == 1)) |
---|
68 | | - | then 20 |
---|
69 | | - | else C |
---|
70 | | - | } |
---|
71 | | - | |
---|
72 | | - | |
---|
73 | | - | func D (E,F,G,a) = { |
---|
74 | | - | let C = A(E) |
---|
75 | | - | let H = A(F) |
---|
76 | | - | if ((C > H)) |
---|
77 | | - | then G |
---|
78 | | - | else a |
---|
79 | | - | } |
---|
80 | | - | |
---|
81 | | - | |
---|
82 | | - | func I () = if ((1 >= 1)) |
---|
83 | | - | then throw("exit") |
---|
84 | | - | else throw("message") |
---|
85 | | - | |
---|
86 | | - | |
---|
87 | | - | func J (u,K) = if (isDefined(getString(u, K))) |
---|
88 | | - | then { |
---|
89 | | - | let L = getStringValue(u, K) |
---|
90 | | - | let h = split(L, d) |
---|
91 | | - | g(h) |
---|
92 | | - | } |
---|
93 | | - | else f() |
---|
94 | | - | |
---|
95 | | - | |
---|
96 | | - | func M (N,G,h) = { |
---|
97 | | - | let O = g(h) |
---|
98 | | - | let P = i(((N + makeString(O, d)) + G), p(G), size(O)) |
---|
99 | | - | let Q = O[(P % size(O))] |
---|
100 | | - | let R = removeByIndex(O, (P % size(O))) |
---|
101 | | - | $Tuple3(Q, P, R) |
---|
102 | | - | } |
---|
103 | | - | |
---|
104 | | - | |
---|
105 | | - | @Callable(y) |
---|
106 | | - | func bet1 (S) = { |
---|
107 | | - | let G = toBase58String(y.caller.bytes) |
---|
108 | | - | let T = I() |
---|
109 | | - | let N = S |
---|
110 | | - | let C = x(y) |
---|
111 | | - | let U = t(c2, (S + "_sumBets")) |
---|
112 | | - | let V = { |
---|
113 | | - | let r = getInteger(c2, (S + "_drawSequence")) |
---|
114 | | - | if ($isInstanceOf(r, "Int")) |
---|
115 | | - | then { |
---|
116 | | - | let w = r |
---|
117 | | - | (w + 1) |
---|
118 | | - | } |
---|
119 | | - | else 0 |
---|
120 | | - | } |
---|
121 | | - | let W = { |
---|
122 | | - | let r = getString(c2, (S + "_player")) |
---|
123 | | - | if ($isInstanceOf(r, "String")) |
---|
124 | | - | then { |
---|
125 | | - | let w = r |
---|
126 | | - | w |
---|
127 | | - | } |
---|
128 | | - | else unit |
---|
129 | | - | } |
---|
130 | | - | let X = { |
---|
131 | | - | let r = getInteger(c2, (S + "_initialBet")) |
---|
132 | | - | if ($isInstanceOf(r, "Int")) |
---|
133 | | - | then { |
---|
134 | | - | let w = r |
---|
135 | | - | w |
---|
136 | | - | } |
---|
137 | | - | else C |
---|
138 | | - | } |
---|
139 | | - | let K = (N + "_available") |
---|
140 | | - | let Y = (U + C) |
---|
141 | | - | if (if (isDefined(getBoolean(c2, (S + "_stop")))) |
---|
142 | | - | then true |
---|
143 | | - | else isDefined(getString(c2, S))) |
---|
144 | | - | then throw("This round is already played") |
---|
145 | | - | else if (if (isDefined(getString(c2, (S + "_player")))) |
---|
146 | | - | then (W != G) |
---|
147 | | - | else false) |
---|
148 | | - | then throw("This is not your game") |
---|
149 | | - | else if ((Y > c)) |
---|
150 | | - | then throw(((("Maximum amount of bets for round " + toString(c)) + ". With your bet it's ") + toString(Y))) |
---|
151 | | - | else if ((X != C)) |
---|
152 | | - | then throw(((("Initial bet not maching original:" + toString(X)) + ", actual:") + toString(C))) |
---|
153 | | - | else { |
---|
154 | | - | let Z = J(c2, K) |
---|
155 | | - | let aa = M(N, G, Z) |
---|
156 | | - | let E = aa._1 |
---|
157 | | - | let ab = aa._2 |
---|
158 | | - | let ac = aa._3 |
---|
159 | | - | let ad = M(N, G, ac) |
---|
160 | | - | let F = ad._1 |
---|
161 | | - | let ae = ad._2 |
---|
162 | | - | let O = ad._3 |
---|
163 | | - | if ((A(E) == A(F))) |
---|
164 | | - | then [StringEntry(K, makeString(O, d)), StringEntry((S + "_player"), G), IntegerEntry((S + "_initialBet"), X), StringEntry((N + "_salt_debug"), N), IntegerEntry((N + "_LastRandonNumber"), ae), IntegerEntry((S + "_sumBets"), Y), StringEntry((N + "_playerCard"), E), StringEntry((N + "_casinoCard"), F), IntegerEntry((S + "_drawSequence"), (V + 1))] |
---|
165 | | - | else { |
---|
166 | | - | let af = D(E, F, G, a) |
---|
167 | | - | [StringEntry(K, makeString(O, d)), StringEntry((S + "_player"), G), IntegerEntry((S + "_initialBet"), X), StringEntry((N + "_salt_debug"), N), IntegerEntry((N + "_LastRandonNumber"), ae), IntegerEntry((S + "_sumBets"), Y), StringEntry((N + "_playerCard"), E), StringEntry((N + "_casinoCard"), F), BooleanEntry((S + "_stop"), true), StringEntry((S + "_winner"), af)] |
---|
168 | | - | } |
---|
169 | | - | } |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func bet2 (b) = { |
---|
| 8 | + | let c = toBase58String(a.caller.bytes) |
---|
| 9 | + | throw("called") |
---|
174 | | - | @Callable(y) |
---|
175 | | - | func withdraw1 (S) = { |
---|
176 | | - | let G = toBase58String(y.caller.bytes) |
---|
177 | | - | let N = ((S + "_") + G) |
---|
178 | | - | let ag = (S + "_withdraw") |
---|
179 | | - | if (isDefined(getString(c2, ag))) |
---|
180 | | - | then throw("You have already got your prize") |
---|
181 | | - | else if (!(isDefined(getString(c2, (S + "_winner"))))) |
---|
182 | | - | then throw("There is no winner, it was a draw") |
---|
183 | | - | else { |
---|
184 | | - | let af = getStringValue(c2, (S + "_winner")) |
---|
185 | | - | let ah = getStringValue(c2, (S + "_player")) |
---|
186 | | - | let ai = getIntegerValue(c2, (S + "_sumBets")) |
---|
187 | | - | if ((ai == 0)) |
---|
188 | | - | then throw("You won nothing this round") |
---|
189 | | - | else if (if ((af == G)) |
---|
190 | | - | then (af == a) |
---|
191 | | - | else false) |
---|
192 | | - | then [StringEntry(ag, toString(ai)), ScriptTransfer(y.caller, ai, unit)] |
---|
193 | | - | else if (if ((af == G)) |
---|
194 | | - | then (af == ah) |
---|
195 | | - | else false) |
---|
196 | | - | then [StringEntry(ag, toString((ai * 2))), ScriptTransfer(y.caller, (ai * 2), unit)] |
---|
197 | | - | else throw("You are not the winner") |
---|
198 | | - | } |
---|
| 14 | + | @Callable(a) |
---|
| 15 | + | func withdraw2 (b) = { |
---|
| 16 | + | let c = toBase58String(a.caller.bytes) |
---|
| 17 | + | throw("called") |
---|