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