tx · 3ht3ky6EiWoUVFj3ELX3HZtz5fH4cPMPphKnfLbgVn9M 3MrfLFw1uz3BDr45RQLvrRnAwT2nHpB4KiX: -0.01000000 Waves 2023.06.11 15:59 [2618045] smart account 3MrfLFw1uz3BDr45RQLvrRnAwT2nHpB4KiX > SELF 0.00000000 Waves
{ "type": 13, "id": "3ht3ky6EiWoUVFj3ELX3HZtz5fH4cPMPphKnfLbgVn9M", "fee": 1000000, "feeAssetId": null, "timestamp": 1686488425174, "version": 2, "chainId": 84, "sender": "3MrfLFw1uz3BDr45RQLvrRnAwT2nHpB4KiX", "senderPublicKey": "5iiNX4Sz3qZzcerumQLc1y7u9TH2X46jDV4f9Xivtmtv", "proofs": [ "3TGowUtWjFJT61T99wXddG6XrsVaVnbe41NTL3c3iuvyrKZHXtvxVk8tkmHjUobByMefBuxiMGotVjpNxXqLMBX1" ], "script": "base64:BgIHCAISAwoBARoBCm51bVRvV2F2ZXMBA251bQkAaAIFA251bQCAwtcvAQtpc1BheW1lbnRPawIBaQNzdW0EEWFjY2VwdGFibGVBc3NldElkAQQTq9kzBAFwCQCRAwIIBQFpCHBheW1lbnRzAAADCQBnAggFAXAGYW1vdW50CQEKbnVtVG9XYXZlcwEFA3N1bQkAAAIIBQFwB2Fzc2V0SWQFBHVuaXQHAQttYXBJbnRUb1N0cgIFYWNjdW0EbmV4dAkAzAgCCQCkAwEFBG5leHQFBWFjY3VtAQttYXBTdHJUb0ludAIFYWNjdW0EbmV4dAkAzAgCCQENcGFyc2VJbnRWYWx1ZQEFBG5leHQFBWFjY3VtAQttYXBJbnRUb1N1bQIFYWNjdW0EbmV4dAkAZAIFBWFjY3VtBQRuZXh0AQxsaXN0SW50VG9TdW0BA2FycgoAAiRsBQNhcnIKAAIkcwkAkAMBBQIkbAoABSRhY2MwAAAKAQUkZjBfMQICJGECJGkDCQBnAgUCJGkFAiRzBQIkYQkBC21hcEludFRvU3VtAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAi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c2FnZQIJAO0HAQUMY29tbWl0SGVpZ2h0AhF1bmV4Y3BlY3RlZCBlcnJvcgQDdnJmCQETdmFsdWVPckVycm9yTWVzc2FnZQIIBQtyZXZlYWxCbG9jawN2cmYCEXVuZXhjcGVjdGVkIGVycm9yBApyYW5kb21IYXNoCQD3AwEJAQV2YWx1ZQEFA3ZyZgQMcmV2ZWFsQmxvY2syCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAO0HAQkAZQIFDGNvbW1pdEhlaWdodAAKAhF1bmV4Y3BlY3RlZCBlcnJvcgQEdnJmMgkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCAULcmV2ZWFsQmxvY2sDdnJmAhF1bmV4Y3BlY3RlZCBlcnJvcgQLcmFuZG9tSGFzaDIJAPcDAQkBBXZhbHVlAQUDdnJmBAxyZXZlYWxCbG9jazMJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkA7QcBCQBlAgUMY29tbWl0SGVpZ2h0ABQCEXVuZXhjcGVjdGVkIGVycm9yBAR2cmYzCQETdmFsdWVPckVycm9yTWVzc2FnZQIIBQtyZXZlYWxCbG9jawN2cmYCEXVuZXhjcGVjdGVkIGVycm9yBAtyYW5kb21IYXNoMwkA9wMBCQEFdmFsdWUBBQN2cmYEA251bQkAagIJAGgCCQBpAgkAsgkCBQpyYW5kb21IYXNoABAJALIJAgULcmFuZG9tSGFzaDIAEAkAsgkCBQtyYW5kb21IYXNoMgAQACUJAAIBCQCkAwEFA251bQBvD55Y", "height": 2618045, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C7Wxtv1w3sYZsK1NRX9r6z99girsT23g7aaYkr3DH31a Next: Ar5DA7EkuQSw4TQq4TEsYLJPdj3nKKcwoL4Hs2b3jrMR Diff:
Old | New | Differences | |
---|---|---|---|
196 | 196 | let ad = valueOrErrorMessage(blockInfoByHeight((E - 10)), "unexcpected error") | |
197 | 197 | let ae = valueOrErrorMessage(F.vrf, "unexcpected error") | |
198 | 198 | let af = sha256(value(G)) | |
199 | - | let b = ((toInt(H, 16) / toInt(af, 16)) % 37) | |
199 | + | let ag = valueOrErrorMessage(blockInfoByHeight((E - 20)), "unexcpected error") | |
200 | + | let ah = valueOrErrorMessage(F.vrf, "unexcpected error") | |
201 | + | let ai = sha256(value(G)) | |
202 | + | let b = (((toInt(H, 16) / toInt(af, 16)) * toInt(af, 16)) % 37) | |
200 | 203 | throw(toString(b)) | |
201 | - | } | |
202 | - | ||
203 | - | ||
204 | - | ||
205 | - | @Callable(d) | |
206 | - | func Roulette_commit (L,M,N) = { | |
207 | - | let g = d.payments[0] | |
208 | - | if (!(c(d, L))) | |
209 | - | then throw("Wrong payment amount or asset!") | |
210 | - | else [IntegerEntry(P(d), (height + 1)), IntegerEntry(Q(d), L), StringEntry(R(d), A(M)), StringEntry(S(d), N), StringEntry(U(d), ((((("| status: commit | revealBlock: " + toString((height + 1))) + " | betAmount: ") + toString(L)) + " | selectedNumbers: ") + A(M)))] | |
211 | - | } | |
212 | - | ||
213 | - | ||
214 | - | ||
215 | - | @Callable(d) | |
216 | - | func Roulette_reveal () = { | |
217 | - | let E = valueOrErrorMessage(getIntegerValue(P(d)), "Bet not found") | |
218 | - | let L = valueOrErrorMessage(getIntegerValue(Q(d)), "Bet amount not found") | |
219 | - | let ag = valueOrErrorMessage(getStringValue(R(d)), "Selected numbers not found") | |
220 | - | let ah = valueOrErrorMessage(getStringValue(S(d)), "Direction not found") | |
221 | - | let ai = B(ag) | |
222 | - | if ((E > height)) | |
223 | - | then throw((("Wait " + toString((E - height))) + " blocks to reveal this id")) | |
224 | - | else { | |
225 | - | let F = valueOrErrorMessage(blockInfoByHeight(E), "unexcpected error") | |
226 | - | let G = valueOrErrorMessage(F.vrf, "unexcpected error") | |
227 | - | let H = sha256(value(G)) | |
228 | - | let K = (toInt(H, 16) % 37) | |
229 | - | let aj = a(J(K, L, ai, ah)) | |
230 | - | let ak = ((((((((("| commitHeight: " + toString(E)) + " | betAmount: ") + toString(L)) + " | winningAmount: ") + toString(aj)) + " | selectedNumbers: ") + A(ai)) + " | randomNumber: ") + toString(K)) | |
231 | - | let al = ((((((((("| status: reveal | winningAmount: " + toString(aj)) + " | selectedNumbers: ") + A(ai)) + " | randomNumber: ") + toString(K)) + " | betAmount: ") + toString(L)) + " | selectedNumbers: ") + A(ai)) | |
232 | - | if ((aj > 0)) | |
233 | - | then [DeleteEntry(P(d)), DeleteEntry(Q(d)), DeleteEntry(R(d)), DeleteEntry(S(d)), ScriptTransfer(d.caller, aj, unit), StringEntry(T(d), ak), StringEntry(U(d), al)] | |
234 | - | else [DeleteEntry(P(d)), DeleteEntry(Q(d)), DeleteEntry(R(d)), DeleteEntry(S(d)), IntegerEntry(T(d), aj), StringEntry(T(d), ak), StringEntry(U(d), al)] | |
235 | - | } | |
236 | - | } | |
237 | - | ||
238 | - | ||
239 | - | ||
240 | - | @Callable(d) | |
241 | - | func LuckyWheel_commit () = if (!(c(d, 1))) | |
242 | - | then throw("Wrong payment amount or asset") | |
243 | - | else [IntegerEntry(V(d), (height + 1)), DeleteEntry(X(d)), DeleteEntry(W(d)), StringEntry(ac(d), "| status: commit")] | |
244 | - | ||
245 | - | ||
246 | - | ||
247 | - | @Callable(d) | |
248 | - | func LuckyWheel_reveal () = { | |
249 | - | let E = valueOrErrorMessage(getIntegerValue(V(d)), "Bet not found") | |
250 | - | if ((E > height)) | |
251 | - | then throw((("Wait " + toString((E - height))) + " blocks to reveal this id")) | |
252 | - | else { | |
253 | - | let F = valueOrErrorMessage(blockInfoByHeight(E), "unexcpected error") | |
254 | - | let G = valueOrErrorMessage(F.vrf, "unexcpected error") | |
255 | - | let H = sha256(value(G)) | |
256 | - | let ad = valueOrErrorMessage(blockInfoByHeight((E - 1)), "unexcpected error") | |
257 | - | let ae = valueOrErrorMessage(F.vrf, "unexcpected error") | |
258 | - | let af = sha256(value(G)) | |
259 | - | let am = (toInt(H, 16) + (toInt(H, 10) / toInt(H, 5))) | |
260 | - | let K = (am % 12) | |
261 | - | let aj = Z(K) | |
262 | - | let al = (((("| status: reveal | winningAmount: " + toString(aj)) + " | selectedNumbers: ") + " | randomNumber: ") + toString(K)) | |
263 | - | if ((aj > 0)) | |
264 | - | then [DeleteEntry(V(d)), ScriptTransfer(d.caller, aj, unit), IntegerEntry(W(d), aj), IntegerEntry(X(d), K), StringEntry(ac(d), al)] | |
265 | - | else [DeleteEntry(V(d)), IntegerEntry(W(d), aj), IntegerEntry(X(d), K), StringEntry(ac(d), al)] | |
266 | - | } | |
267 | 204 | } | |
268 | 205 | ||
269 | 206 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func a (b) = (b * 100000000) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func c (d,e) = { | |
8 | 8 | let f = base58'WAVES' | |
9 | 9 | let g = d.payments[0] | |
10 | 10 | if ((g.amount >= a(e))) | |
11 | 11 | then (g.assetId == unit) | |
12 | 12 | else false | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func h (i,j) = toString(j) :: i | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func k (i,j) = parseIntValue(j) :: i | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func l (i,j) = (i + j) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func m (n) = { | |
26 | 26 | let o = n | |
27 | 27 | let p = size(o) | |
28 | 28 | let q = 0 | |
29 | 29 | func r (s,t) = if ((t >= p)) | |
30 | 30 | then s | |
31 | 31 | else l(s, o[t]) | |
32 | 32 | ||
33 | 33 | func u (s,t) = if ((t >= p)) | |
34 | 34 | then s | |
35 | 35 | else throw("List size exceeds 50") | |
36 | 36 | ||
37 | 37 | u(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(q, 0), 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) | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func v (n) = { | |
42 | 42 | let o = n | |
43 | 43 | let p = size(o) | |
44 | 44 | let q = nil | |
45 | 45 | func r (s,t) = if ((t >= p)) | |
46 | 46 | then s | |
47 | 47 | else h(s, o[t]) | |
48 | 48 | ||
49 | 49 | func u (s,t) = if ((t >= p)) | |
50 | 50 | then s | |
51 | 51 | else throw("List size exceeds 50") | |
52 | 52 | ||
53 | 53 | u(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(q, 0), 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) | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func w (n) = { | |
58 | 58 | let o = n | |
59 | 59 | let p = size(o) | |
60 | 60 | let q = nil | |
61 | 61 | func r (s,t) = if ((t >= p)) | |
62 | 62 | then s | |
63 | 63 | else k(s, o[t]) | |
64 | 64 | ||
65 | 65 | func u (s,t) = if ((t >= p)) | |
66 | 66 | then s | |
67 | 67 | else throw("List size exceeds 50") | |
68 | 68 | ||
69 | 69 | u(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(q, 0), 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) | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func x (n) = makeString(n, "|") | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func y (z) = split(z, "|") | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func A (n) = makeString(v(n), "|") | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func B (C) = w(split(C, "|")) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func D (E) = { | |
86 | 86 | let F = valueOrErrorMessage(blockInfoByHeight(E), "unexcpected error") | |
87 | 87 | let G = valueOrErrorMessage(F.vrf, "unexcpected error") | |
88 | 88 | let H = sha256(value(G)) | |
89 | 89 | let I = toInt(H, 16) | |
90 | 90 | (I % 37) | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func J (K,L,M,N) = { | |
95 | 95 | let O = [32, 19, 21, 25, 34, 27, 36, 30, 23, 5, 16, 1, 14, 9, 18, 7, 12, 3] | |
96 | 96 | if (if ((size(M) == 1)) | |
97 | 97 | then (N == "num") | |
98 | 98 | else false) | |
99 | 99 | then if ((M[0] == K)) | |
100 | 100 | then (L * 36) | |
101 | 101 | else 0 | |
102 | 102 | else if ((size(M) == 2)) | |
103 | 103 | then if (containsElement(M, K)) | |
104 | 104 | then (L * 18) | |
105 | 105 | else 0 | |
106 | 106 | else if ((size(M) == 3)) | |
107 | 107 | then if (containsElement(M, K)) | |
108 | 108 | then (L * 12) | |
109 | 109 | else 0 | |
110 | 110 | else if ((size(M) == 4)) | |
111 | 111 | then if (containsElement(M, K)) | |
112 | 112 | then (L * 9) | |
113 | 113 | else 0 | |
114 | 114 | else if ((size(M) == 12)) | |
115 | 115 | then if (containsElement(M, K)) | |
116 | 116 | then (L * 3) | |
117 | 117 | else 0 | |
118 | 118 | else if ((N == "red")) | |
119 | 119 | then if (containsElement(O, K)) | |
120 | 120 | then (L * 2) | |
121 | 121 | else 0 | |
122 | 122 | else if ((N == "black")) | |
123 | 123 | then if (if (!(containsElement(O, K))) | |
124 | 124 | then (K != 0) | |
125 | 125 | else false) | |
126 | 126 | then (L * 2) | |
127 | 127 | else 0 | |
128 | 128 | else if ((N == "odd")) | |
129 | 129 | then if (((K % 2) != 0)) | |
130 | 130 | then (L * 2) | |
131 | 131 | else 0 | |
132 | 132 | else if ((N == "even")) | |
133 | 133 | then if (((K % 2) == 0)) | |
134 | 134 | then (L * 2) | |
135 | 135 | else 0 | |
136 | 136 | else if ((size(M) == 18)) | |
137 | 137 | then if (containsElement(M, K)) | |
138 | 138 | then (L * 2) | |
139 | 139 | else 0 | |
140 | 140 | else 0 | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func P (d) = ("bet_Roulette_" + toString(d.caller)) | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func Q (d) = ("betAmount_Roulette_" + toString(d.caller)) | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func R (d) = ("selectedNumbers_Roulette_" + toString(d.caller)) | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func S (d) = ("direction_Roulette_" + toString(d.caller)) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func T (d) = ((("log_Roulette_" + toString(d.caller)) + "_") + toBase58String(d.transactionId)) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func U (d) = ("status_Roulette_" + toString(d.caller)) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func V (d) = ("bet_LuckyWheel_" + toString(d.caller)) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func W (d) = ("won_LuckyWheel_" + toString(d.caller)) | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func X (d) = ("randomNumber_LuckyWheel_" + toString(d.caller)) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func Y (d) = ((("log_LuckyWheel_" + toString(d.caller)) + "_") + toBase58String(d.transactionId)) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func Z (aa) = { | |
175 | 175 | let ab = aa | |
176 | 176 | if ((1 == ab)) | |
177 | 177 | then a(2) | |
178 | 178 | else if ((3 == ab)) | |
179 | 179 | then a(1) | |
180 | 180 | else if ((7 == ab)) | |
181 | 181 | then a(6) | |
182 | 182 | else if ((9 == ab)) | |
183 | 183 | then a(1) | |
184 | 184 | else 0 | |
185 | 185 | } | |
186 | 186 | ||
187 | 187 | ||
188 | 188 | func ac (d) = ("status_Roulette_" + toString(d.caller)) | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | @Callable(d) | |
192 | 192 | func testRandomNumber (E) = { | |
193 | 193 | let F = valueOrErrorMessage(blockInfoByHeight(E), "unexcpected error") | |
194 | 194 | let G = valueOrErrorMessage(F.vrf, "unexcpected error") | |
195 | 195 | let H = sha256(value(G)) | |
196 | 196 | let ad = valueOrErrorMessage(blockInfoByHeight((E - 10)), "unexcpected error") | |
197 | 197 | let ae = valueOrErrorMessage(F.vrf, "unexcpected error") | |
198 | 198 | let af = sha256(value(G)) | |
199 | - | let b = ((toInt(H, 16) / toInt(af, 16)) % 37) | |
199 | + | let ag = valueOrErrorMessage(blockInfoByHeight((E - 20)), "unexcpected error") | |
200 | + | let ah = valueOrErrorMessage(F.vrf, "unexcpected error") | |
201 | + | let ai = sha256(value(G)) | |
202 | + | let b = (((toInt(H, 16) / toInt(af, 16)) * toInt(af, 16)) % 37) | |
200 | 203 | throw(toString(b)) | |
201 | - | } | |
202 | - | ||
203 | - | ||
204 | - | ||
205 | - | @Callable(d) | |
206 | - | func Roulette_commit (L,M,N) = { | |
207 | - | let g = d.payments[0] | |
208 | - | if (!(c(d, L))) | |
209 | - | then throw("Wrong payment amount or asset!") | |
210 | - | else [IntegerEntry(P(d), (height + 1)), IntegerEntry(Q(d), L), StringEntry(R(d), A(M)), StringEntry(S(d), N), StringEntry(U(d), ((((("| status: commit | revealBlock: " + toString((height + 1))) + " | betAmount: ") + toString(L)) + " | selectedNumbers: ") + A(M)))] | |
211 | - | } | |
212 | - | ||
213 | - | ||
214 | - | ||
215 | - | @Callable(d) | |
216 | - | func Roulette_reveal () = { | |
217 | - | let E = valueOrErrorMessage(getIntegerValue(P(d)), "Bet not found") | |
218 | - | let L = valueOrErrorMessage(getIntegerValue(Q(d)), "Bet amount not found") | |
219 | - | let ag = valueOrErrorMessage(getStringValue(R(d)), "Selected numbers not found") | |
220 | - | let ah = valueOrErrorMessage(getStringValue(S(d)), "Direction not found") | |
221 | - | let ai = B(ag) | |
222 | - | if ((E > height)) | |
223 | - | then throw((("Wait " + toString((E - height))) + " blocks to reveal this id")) | |
224 | - | else { | |
225 | - | let F = valueOrErrorMessage(blockInfoByHeight(E), "unexcpected error") | |
226 | - | let G = valueOrErrorMessage(F.vrf, "unexcpected error") | |
227 | - | let H = sha256(value(G)) | |
228 | - | let K = (toInt(H, 16) % 37) | |
229 | - | let aj = a(J(K, L, ai, ah)) | |
230 | - | let ak = ((((((((("| commitHeight: " + toString(E)) + " | betAmount: ") + toString(L)) + " | winningAmount: ") + toString(aj)) + " | selectedNumbers: ") + A(ai)) + " | randomNumber: ") + toString(K)) | |
231 | - | let al = ((((((((("| status: reveal | winningAmount: " + toString(aj)) + " | selectedNumbers: ") + A(ai)) + " | randomNumber: ") + toString(K)) + " | betAmount: ") + toString(L)) + " | selectedNumbers: ") + A(ai)) | |
232 | - | if ((aj > 0)) | |
233 | - | then [DeleteEntry(P(d)), DeleteEntry(Q(d)), DeleteEntry(R(d)), DeleteEntry(S(d)), ScriptTransfer(d.caller, aj, unit), StringEntry(T(d), ak), StringEntry(U(d), al)] | |
234 | - | else [DeleteEntry(P(d)), DeleteEntry(Q(d)), DeleteEntry(R(d)), DeleteEntry(S(d)), IntegerEntry(T(d), aj), StringEntry(T(d), ak), StringEntry(U(d), al)] | |
235 | - | } | |
236 | - | } | |
237 | - | ||
238 | - | ||
239 | - | ||
240 | - | @Callable(d) | |
241 | - | func LuckyWheel_commit () = if (!(c(d, 1))) | |
242 | - | then throw("Wrong payment amount or asset") | |
243 | - | else [IntegerEntry(V(d), (height + 1)), DeleteEntry(X(d)), DeleteEntry(W(d)), StringEntry(ac(d), "| status: commit")] | |
244 | - | ||
245 | - | ||
246 | - | ||
247 | - | @Callable(d) | |
248 | - | func LuckyWheel_reveal () = { | |
249 | - | let E = valueOrErrorMessage(getIntegerValue(V(d)), "Bet not found") | |
250 | - | if ((E > height)) | |
251 | - | then throw((("Wait " + toString((E - height))) + " blocks to reveal this id")) | |
252 | - | else { | |
253 | - | let F = valueOrErrorMessage(blockInfoByHeight(E), "unexcpected error") | |
254 | - | let G = valueOrErrorMessage(F.vrf, "unexcpected error") | |
255 | - | let H = sha256(value(G)) | |
256 | - | let ad = valueOrErrorMessage(blockInfoByHeight((E - 1)), "unexcpected error") | |
257 | - | let ae = valueOrErrorMessage(F.vrf, "unexcpected error") | |
258 | - | let af = sha256(value(G)) | |
259 | - | let am = (toInt(H, 16) + (toInt(H, 10) / toInt(H, 5))) | |
260 | - | let K = (am % 12) | |
261 | - | let aj = Z(K) | |
262 | - | let al = (((("| status: reveal | winningAmount: " + toString(aj)) + " | selectedNumbers: ") + " | randomNumber: ") + toString(K)) | |
263 | - | if ((aj > 0)) | |
264 | - | then [DeleteEntry(V(d)), ScriptTransfer(d.caller, aj, unit), IntegerEntry(W(d), aj), IntegerEntry(X(d), K), StringEntry(ac(d), al)] | |
265 | - | else [DeleteEntry(V(d)), IntegerEntry(W(d), aj), IntegerEntry(X(d), K), StringEntry(ac(d), al)] | |
266 | - | } | |
267 | 204 | } | |
268 | 205 | ||
269 | 206 |
github/deemru/w8io/026f985 44.45 ms ◑