tx · 8A2eeXo63p65V9LfZHerbXJnotXYNFRS1fGE71iKhnrF 3N8mB685DHj1jER6q33drLYFusBVtxrRame: -0.01000000 Waves 2023.06.20 10:16 [2630649] smart account 3N8mB685DHj1jER6q33drLYFusBVtxrRame > SELF 0.00000000 Waves
{ "type": 13, "id": "8A2eeXo63p65V9LfZHerbXJnotXYNFRS1fGE71iKhnrF", "fee": 1000000, "feeAssetId": null, "timestamp": 1687245439922, "version": 2, "chainId": 84, "sender": "3N8mB685DHj1jER6q33drLYFusBVtxrRame", "senderPublicKey": "jk6fUkpq9pS4xCNgvJPDbFjWiZVCf9zoog6Gtmb8EtD", "proofs": [ "3VdGD587b3RTNjinz1RmMgbZhWycb1EuqBJ1osqHcH1P5NuG99bX3xeABzkqaK54vyQDDmcQdEBZusdNCAxQVALE" ], "script": "base64:BgIJCAISAwoBARIAHwEKbnVtVG9XYXZlcwEDbnVtCQBoAgUDbnVtAIDC1y8BC2lzUGF5bWVudE9rAgFpA3N1bQQRYWNjZXB0YWJsZUFzc2V0SWQBBBOr2TMEAXAJAJEDAggFAWkIcGF5bWVudHMAAAMJAGcCCAUBcAZhbW91bnQJAQpudW1Ub1dhdmVzAQUDc3VtCQAAAggFAXAHYXNzZXRJZAUEdW5pdAcBC21hcEludFRvU3RyAgVhY2N1bQRuZXh0CQDMCAIJAKQDAQUEbmV4dAUFYWNjdW0BC21hcFN0clRvSW50AgVhY2N1bQRuZXh0CQDMCAIJAQ1wYXJzZUludFZhbHVlAQUEbmV4dAUFYWNjdW0BC21hcEludFRvU3VtAgVhY2N1bQRuZXh0CQBkAgUFYWNjdW0FBG5leHQBDGxpc3RJbnRUb1N1bQEDYXJyCgACJGwFA2FycgoAAiRzCQCQAwEFAiRsCgAFJGFjYzAAAAoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQELbWFwSW50VG9TdW0CBQIkYQkAkQMCBQIkbAUCJGkKAQUkZjBfMgICJGECJGkDCQBnAgUCJGkFAiRzB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xvY2tzIHRvIHJldmVhbCB0aGlzIGlkBAxyYW5kb21OdW1iZXIJAQtnZXRSYW5kb21TTQEFDGNvbW1pdEhlaWdodAkAAgEJAKwCAgkArAICCQCsAgIJAKwCAgkApAMBCQCRAwIFDHJhbmRvbU51bWJlcgAAAgF8CQCkAwEJAJEDAgUMcmFuZG9tTnVtYmVyAAECAXwJAKQDAQkAkQMCBQxyYW5kb21OdW1iZXIAAgD9Ahbo", "height": 2630649, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7gZzTyNDUeyQMhv7zc9tZNCiicaCEABS3ZDcrAzatDRF Next: 8hiNLS1DXzhBP3MvKSsZohoW5QShVrHdAn5S8aq5Brmi Diff:
Old | New | Differences | |
---|---|---|---|
216 | 216 | let randomHash = sha256((value(value(blockInfoByHeight(commitHeight)).vrf) + toBytes(commitHeight))) | |
217 | 217 | let hashInt = toInt(randomHash, 24) | |
218 | 218 | let randomNumber = (hashInt % 6) | |
219 | - | let randomHash2 = sha256((value(value(blockInfoByHeight((commitHeight - (randomNumber * 3000)))).vrf) + toBytes(randomNumber))) | |
219 | + | let randomHash2 = sha256((value(value(blockInfoByHeight((commitHeight - ((randomNumber + 10) * 3000)))).vrf) + toBytes((randomNumber + 10)))) | |
220 | 220 | let hashInt2 = toInt(randomHash2, 24) | |
221 | 221 | let randomNumber2 = (hashInt2 % 6) | |
222 | - | let randomHash3 = sha256((value(value(blockInfoByHeight((commitHeight - (randomNumber2 * 1100)))).vrf) + toBytes(randomNumber2))) | |
222 | + | let randomHash3 = sha256((value(value(blockInfoByHeight((commitHeight - ((randomNumber2 + 60) * 1100)))).vrf) + toBytes((randomNumber2 + 60)))) | |
223 | 223 | let hashInt3 = toInt(randomHash3, 24) | |
224 | 224 | let randomNumber3 = (hashInt3 % 6) | |
225 | 225 | [randomNumber, randomNumber2, randomNumber3] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func numToWaves (num) = (num * 100000000) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func isPaymentOk (i,sum) = { | |
8 | 8 | let acceptableAssetId = base58'WAVES' | |
9 | 9 | let p = i.payments[0] | |
10 | 10 | if ((p.amount >= numToWaves(sum))) | |
11 | 11 | then (p.assetId == unit) | |
12 | 12 | else false | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func mapIntToStr (accum,next) = toString(next) :: accum | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func mapStrToInt (accum,next) = parseIntValue(next) :: accum | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func mapIntToSum (accum,next) = (accum + next) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func listIntToSum (arr) = { | |
26 | 26 | let $l = arr | |
27 | 27 | let $s = size($l) | |
28 | 28 | let $acc0 = 0 | |
29 | 29 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
30 | 30 | then $a | |
31 | 31 | else mapIntToSum($a, $l[$i]) | |
32 | 32 | ||
33 | 33 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
34 | 34 | then $a | |
35 | 35 | else throw("List size exceeds 50") | |
36 | 36 | ||
37 | 37 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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 listIntToListString (arr) = { | |
42 | 42 | let $l = arr | |
43 | 43 | let $s = size($l) | |
44 | 44 | let $acc0 = nil | |
45 | 45 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
46 | 46 | then $a | |
47 | 47 | else mapIntToStr($a, $l[$i]) | |
48 | 48 | ||
49 | 49 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
50 | 50 | then $a | |
51 | 51 | else throw("List size exceeds 50") | |
52 | 52 | ||
53 | 53 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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 listStringToListIng (arr) = { | |
58 | 58 | let $l = arr | |
59 | 59 | let $s = size($l) | |
60 | 60 | let $acc0 = nil | |
61 | 61 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
62 | 62 | then $a | |
63 | 63 | else mapStrToInt($a, $l[$i]) | |
64 | 64 | ||
65 | 65 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
66 | 66 | then $a | |
67 | 67 | else throw("List size exceeds 50") | |
68 | 68 | ||
69 | 69 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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 listStringCompressToString (arr) = makeString(arr, "|") | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func stringDecompressToListString (str) = split(str, "|") | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func listIntCompressToString (arr) = makeString(listIntToListString(arr), "|") | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func stringDecompressToListInt (arrStr) = listStringToListIng(split(arrStr, "|")) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getRandom (commitHeight) = { | |
86 | 86 | let revealBlock = valueOrErrorMessage(blockInfoByHeight(commitHeight), "unexcpected error") | |
87 | 87 | let vrf = valueOrErrorMessage(revealBlock.vrf, "unexcpected error") | |
88 | 88 | let randomHash = sha256(value(vrf)) | |
89 | 89 | let hash = toInt(randomHash, 16) | |
90 | 90 | (hash % 37) | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func getRandomRoulette (commitHeight) = { | |
95 | 95 | let randomHash = sha256((value(value(blockInfoByHeight(commitHeight)).vrf) + toBytes(commitHeight))) | |
96 | 96 | let hashInt = toInt(randomHash, 24) | |
97 | 97 | let randomNumber = (hashInt % 37) | |
98 | 98 | randomNumber | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func R_WinCalculator (randomNumber,betAmount,selectedNumberBets,betDirection) = { | |
103 | 103 | let RED_SECTORS = [32, 19, 21, 25, 34, 27, 36, 30, 23, 5, 16, 1, 14, 9, 18, 7, 12, 3] | |
104 | 104 | let BLACK_SECTORS = [2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35] | |
105 | 105 | if ((betDirection == "red")) | |
106 | 106 | then if (containsElement(RED_SECTORS, randomNumber)) | |
107 | 107 | then (betAmount * 2) | |
108 | 108 | else 0 | |
109 | 109 | else if ((betDirection == "black")) | |
110 | 110 | then if (containsElement(BLACK_SECTORS, randomNumber)) | |
111 | 111 | then (betAmount * 2) | |
112 | 112 | else 0 | |
113 | 113 | else if ((betDirection == "odd")) | |
114 | 114 | then if (if (((randomNumber % 2) != 0)) | |
115 | 115 | then (randomNumber != 0) | |
116 | 116 | else false) | |
117 | 117 | then (betAmount * 2) | |
118 | 118 | else 0 | |
119 | 119 | else if ((betDirection == "even")) | |
120 | 120 | then if (if (((randomNumber % 2) == 0)) | |
121 | 121 | then (randomNumber != 0) | |
122 | 122 | else false) | |
123 | 123 | then (betAmount * 2) | |
124 | 124 | else 0 | |
125 | 125 | else if (if ((size(selectedNumberBets) == 1)) | |
126 | 126 | then (betDirection == "num") | |
127 | 127 | else false) | |
128 | 128 | then if ((selectedNumberBets[0] == randomNumber)) | |
129 | 129 | then (betAmount * 36) | |
130 | 130 | else 0 | |
131 | 131 | else if ((size(selectedNumberBets) == 2)) | |
132 | 132 | then if (containsElement(selectedNumberBets, randomNumber)) | |
133 | 133 | then (betAmount * 18) | |
134 | 134 | else 0 | |
135 | 135 | else if ((size(selectedNumberBets) == 3)) | |
136 | 136 | then if (containsElement(selectedNumberBets, randomNumber)) | |
137 | 137 | then (betAmount * 12) | |
138 | 138 | else 0 | |
139 | 139 | else if ((size(selectedNumberBets) == 4)) | |
140 | 140 | then if (containsElement(selectedNumberBets, randomNumber)) | |
141 | 141 | then (betAmount * 9) | |
142 | 142 | else 0 | |
143 | 143 | else if ((size(selectedNumberBets) == 12)) | |
144 | 144 | then if (if (containsElement(selectedNumberBets, randomNumber)) | |
145 | 145 | then (randomNumber != 0) | |
146 | 146 | else false) | |
147 | 147 | then (betAmount * 3) | |
148 | 148 | else 0 | |
149 | 149 | else if ((size(selectedNumberBets) == 18)) | |
150 | 150 | then if (if (containsElement(selectedNumberBets, randomNumber)) | |
151 | 151 | then (randomNumber != 0) | |
152 | 152 | else false) | |
153 | 153 | then (betAmount * 2) | |
154 | 154 | else 0 | |
155 | 155 | else 0 | |
156 | 156 | } | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func R_getBetKey (i) = ("bet_Roulette_" + toString(i.caller)) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func R_getBetAmountKey (i) = ("betAmount_Roulette_" + toString(i.caller)) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func R_getSelectedNumbersKey (i) = ("selectedNumbers_Roulette_" + toString(i.caller)) | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func R_getDirectionKey (i) = ("direction_Roulette_" + toString(i.caller)) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func R_getLogKey (i) = ((("log_Roulette_" + toString(i.caller)) + "_") + toBase58String(i.transactionId)) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func R_getStatusKey (i) = ("status_Roulette_" + toString(i.caller)) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func LW_getBetKey (i) = ("bet_LuckyWheel_" + toString(i.caller)) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func LW_getWonKey (i) = ("won_LuckyWheel_" + toString(i.caller)) | |
181 | 181 | ||
182 | 182 | ||
183 | 183 | func LW_getRandomNumberKey (i) = ("randomNumber_LuckyWheel_" + toString(i.caller)) | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func LW_getLogKey (i) = ((("log_LuckyWheel_" + toString(i.caller)) + "_") + toBase58String(i.transactionId)) | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func LW_whatUserWon (value) = match value { | |
190 | 190 | case _ => | |
191 | 191 | if ((1 == $match0)) | |
192 | 192 | then numToWaves(2) | |
193 | 193 | else if ((3 == $match0)) | |
194 | 194 | then numToWaves(1) | |
195 | 195 | else if ((7 == $match0)) | |
196 | 196 | then numToWaves(6) | |
197 | 197 | else if ((9 == $match0)) | |
198 | 198 | then numToWaves(1) | |
199 | 199 | else 0 | |
200 | 200 | } | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func LW_getStatusKey (i) = ("status_Roulette_" + toString(i.caller)) | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | func SM_getBetKey (i) = ("bet_SM_" + toString(i.caller)) | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | func SM_getBetAmountKey (i) = ("betAmount_SM_" + toString(i.caller)) | |
210 | 210 | ||
211 | 211 | ||
212 | 212 | func SM_getStatusKey (i) = ("status_SM_" + toString(i.caller)) | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | func getRandomSM (commitHeight) = { | |
216 | 216 | let randomHash = sha256((value(value(blockInfoByHeight(commitHeight)).vrf) + toBytes(commitHeight))) | |
217 | 217 | let hashInt = toInt(randomHash, 24) | |
218 | 218 | let randomNumber = (hashInt % 6) | |
219 | - | let randomHash2 = sha256((value(value(blockInfoByHeight((commitHeight - (randomNumber * 3000)))).vrf) + toBytes(randomNumber))) | |
219 | + | let randomHash2 = sha256((value(value(blockInfoByHeight((commitHeight - ((randomNumber + 10) * 3000)))).vrf) + toBytes((randomNumber + 10)))) | |
220 | 220 | let hashInt2 = toInt(randomHash2, 24) | |
221 | 221 | let randomNumber2 = (hashInt2 % 6) | |
222 | - | let randomHash3 = sha256((value(value(blockInfoByHeight((commitHeight - (randomNumber2 * 1100)))).vrf) + toBytes(randomNumber2))) | |
222 | + | let randomHash3 = sha256((value(value(blockInfoByHeight((commitHeight - ((randomNumber2 + 60) * 1100)))).vrf) + toBytes((randomNumber2 + 60)))) | |
223 | 223 | let hashInt3 = toInt(randomHash3, 24) | |
224 | 224 | let randomNumber3 = (hashInt3 % 6) | |
225 | 225 | [randomNumber, randomNumber2, randomNumber3] | |
226 | 226 | } | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | @Callable(i) | |
230 | 230 | func SlotMachine_commit (betAmount) = { | |
231 | 231 | let p = i.payments[0] | |
232 | 232 | if (!(isPaymentOk(i, betAmount))) | |
233 | 233 | then throw("Wrong payment amount or asset!") | |
234 | 234 | else [IntegerEntry(SM_getBetKey(i), (height + 1)), IntegerEntry(SM_getBetAmountKey(i), betAmount), StringEntry(SM_getStatusKey(i), ((("| status: commit | revealBlock: " + toString((height + 1))) + " | betAmount: ") + toString(betAmount)))] | |
235 | 235 | } | |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | 239 | @Callable(i) | |
240 | 240 | func SlotMachine_reveal () = { | |
241 | 241 | let commitHeight = valueOrErrorMessage(getIntegerValue(SM_getBetKey(i)), "Bet not found") | |
242 | 242 | let betAmount = valueOrErrorMessage(getIntegerValue(SM_getBetAmountKey(i)), "Bet amount not found") | |
243 | 243 | if ((commitHeight > height)) | |
244 | 244 | then throw((("Wait " + toString((commitHeight - height))) + " blocks to reveal this id")) | |
245 | 245 | else { | |
246 | 246 | let randomNumber = getRandomSM(commitHeight) | |
247 | 247 | throw(((((toString(randomNumber[0]) + "|") + toString(randomNumber[1])) + "|") + toString(randomNumber[2]))) | |
248 | 248 | } | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 |
github/deemru/w8io/169f3d6 54.94 ms ◑