tx · EdfWdReYG35iPxzcvkLnBuoejGpwLnxDAy6owMks9hNL 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ: -0.01700000 Waves 2023.12.14 02:33 [2885619] smart account 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ > SELF 0.00000000 Waves
{ "type": 13, "id": "EdfWdReYG35iPxzcvkLnBuoejGpwLnxDAy6owMks9hNL", "fee": 1700000, "feeAssetId": null, "timestamp": 1702510477624, "version": 2, "chainId": 84, "sender": "3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ", "senderPublicKey": "CQoe8BRHR78TuPQLcK3Ykv39w9CeNLhjKdj6TNbJ5FrM", "proofs": [ "4jHJhvghXtU34vK4j1r1AvUFospZeoKJjYNgNBKHqFZRQTTjjsQ6VLzuCWpfGMhiAFd4BUkdb1Bxkj7FZ4nRRfRZ" ], "script": "base64:BgIaCAISBgoECAgBCBIDCgEEEgMKAQgSBAoCCAJGAANTRVACAl9fAAdXQVZFU0lEAQQTq9kzAAZXQVZFU0QAgMLXLwAJR0FNRV9OQU1FAglYbWFzIFRyZWUADFJBTkRPTV9SQU5HRQAFAAhOVU1fQkVUUwABAQxnZXRTdHJPckZhaWwCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUHYWRkcmVzcwUDa2V5CQC5CQIJAMwIAgIKbWFuZGF0b3J5IAkAzAgCCQClCAEFB2FkZHJlc3MJAMwIAgIBLgkAzAgCBQNrZXkJAMwIAgIPIGlzIG5vdCBkZWZpbmVkBQNuaWwCAAEMZ2V0SW50T3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCaCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJAMwIAgkApQgBBQdhZGRyZXNzCQDMCAICAS4JAMwIAgUDa2V5CQDMCAICDyBpcyBub3QgZGVmaW5lZAUDbmlsAgABDWdldEJ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9uQnlBc3NldElkeAEFCGFzc2V0SWR4AAADCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EA3N0eAUHJG1hdGNoMAoBB2NoZWNrZXICA2FjYwVhc3NldAMFA2FjYwkAAAIJAQhnZXRJbnRPcgIJARhrZXlSZXNlcnZhdGlvbkJ5QXNzZXRTdHIBBQVhc3NldAAAAAAHCgACJGwFBkFTU0VUUwoAAiRzCQCQAwEFAiRsCgAFJGFjYzAGCgEFJGYwXzECAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAQdjaGVja2VyAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhRMaXN0IHNpemUgZXhjZWVkcyAxMAkBBSRmMF8yAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgUFJGFjYzAAAAABAAIAAwAEAAUABgAHAAgACQAKAwkAAQIFByRtYXRjaDACF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBANpdHgFByRtYXRjaDADCQAAAggFA2l0eARkQXBwBQR0aGlzCQAAAggFA2l0eAhmdW5jdGlvbgINY29uc3RydWN0b3JWMQcHB84Lbx8=", "height": 2885619, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FVqNv7XDFmUrVZFSrqi9Nj9qdFQFi7jjj4DXPMEgA8FA Next: 21aDeFnoHRnS7syp874NGDYWeiYoVyQBJYSNc56u944U Diff:
Old | New | Differences | |
---|---|---|---|
243 | 243 | } | |
244 | 244 | let areas = $t079748041._1 | |
245 | 245 | let totalArea = $t079748041._2 | |
246 | - | let rand = (toInt(sha256(rsaSign)) % totalArea) | |
246 | + | let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea) | |
247 | 247 | func check (acc,area) = { | |
248 | 248 | let i = acc._1 | |
249 | 249 | let newArea = (acc._2 + area) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let WAVESID = base58'WAVES' | |
7 | 7 | ||
8 | 8 | let WAVESD = 100000000 | |
9 | 9 | ||
10 | 10 | let GAME_NAME = "Xmas Tree" | |
11 | 11 | ||
12 | 12 | let RANDOM_RANGE = 5 | |
13 | 13 | ||
14 | 14 | let NUM_BETS = 1 | |
15 | 15 | ||
16 | 16 | func getStrOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | let allowedAssetsKey = "%s%s__cfg__allowedAssets" | |
26 | 26 | ||
27 | 27 | let assetsDecimalsKey = "%s%s__cfg__assetsDecimals" | |
28 | 28 | ||
29 | 29 | let betDividersKey = "%s%s__cfg__assetsBetDividers" | |
30 | 30 | ||
31 | 31 | let RSAPUBLIC64KEY = "%s%s__cfg__rsaPublic64" | |
32 | 32 | ||
33 | 33 | let SERVERADDRESSKEY = "%s%s__cfg__benzAddress" | |
34 | 34 | ||
35 | 35 | let RANDTIMEFRAMEKEY = "%s%s__cfg__withdrawTimeFrame" | |
36 | 36 | ||
37 | 37 | let GAMESCOUNTERKEY = "%s%s__runtime__gameNum" | |
38 | 38 | ||
39 | 39 | let blockedKey = "%s%s__runtime__contractIsBlocked" | |
40 | 40 | ||
41 | 41 | let reservedAmountsKey = "%s%s__runtime__reservedAmounts" | |
42 | 42 | ||
43 | 43 | func getIntArray (key) = { | |
44 | 44 | let a = getStrOrFail(this, key) | |
45 | 45 | func filler (acc,el) = (acc :+ parseIntValue(el)) | |
46 | 46 | ||
47 | 47 | let $l = split(a, SEP) | |
48 | 48 | let $s = size($l) | |
49 | 49 | let $acc0 = nil | |
50 | 50 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
51 | 51 | then $a | |
52 | 52 | else filler($a, $l[$i]) | |
53 | 53 | ||
54 | 54 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
55 | 55 | then $a | |
56 | 56 | else throw("List size exceeds 10") | |
57 | 57 | ||
58 | 58 | $f0_2($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) | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | let ASSETS = split(getStrOrFail(this, allowedAssetsKey), SEP) | |
63 | 63 | ||
64 | 64 | let DECIMALS = getIntArray(assetsDecimalsKey) | |
65 | 65 | ||
66 | 66 | let BETDIVIDERS = getIntArray(betDividersKey) | |
67 | 67 | ||
68 | 68 | func keyReservationByAssetStr (assetStr) = ("$RESERVED_AMOUNT_" + assetStr) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func keyReservationByAssetIdx (assetIdx) = keyReservationByAssetStr(ASSETS[assetIdx]) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | let MINFEEWAVES = ((5 * WAVESD) / 1000) | |
75 | 75 | ||
76 | 76 | let idxAssets = 0 | |
77 | 77 | ||
78 | 78 | let idxDecimals = 1 | |
79 | 79 | ||
80 | 80 | let idxDividers = 2 | |
81 | 81 | ||
82 | 82 | let BET1 = 1 | |
83 | 83 | ||
84 | 84 | let BET2 = 2 | |
85 | 85 | ||
86 | 86 | let BET4 = 4 | |
87 | 87 | ||
88 | 88 | let BET8 = 8 | |
89 | 89 | ||
90 | 90 | let BET14 = 14 | |
91 | 91 | ||
92 | 92 | let RATEMULT = 10000 | |
93 | 93 | ||
94 | 94 | let RATE = 250000 | |
95 | 95 | ||
96 | 96 | let BETS = [BET2] | |
97 | 97 | ||
98 | 98 | let IdxGameState = 0 | |
99 | 99 | ||
100 | 100 | let IdxPlayerChoice = 1 | |
101 | 101 | ||
102 | 102 | let IdxPlayerPubKey58 = 2 | |
103 | 103 | ||
104 | 104 | let IdxStartedHeight = 3 | |
105 | 105 | ||
106 | 106 | let IdxWinAmount = 4 | |
107 | 107 | ||
108 | 108 | let IdxAssetId = 5 | |
109 | 109 | ||
110 | 110 | let STATESUBMITTED = "SUBMITTED" | |
111 | 111 | ||
112 | 112 | let STATEWON = "WON" | |
113 | 113 | ||
114 | 114 | let STATELOST = "LOST" | |
115 | 115 | ||
116 | 116 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " key is not specified in this.state")) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | let RSAPUBLIC = fromBase64String(getStringOrFail(RSAPUBLIC64KEY)) | |
120 | 120 | ||
121 | 121 | let SERVER = addressFromStringValue(getStringOrFail(SERVERADDRESSKEY)) | |
122 | 122 | ||
123 | 123 | let RANDORACLETIMEFRAME = valueOrElse(getInteger(this, RANDTIMEFRAMEKEY), 7200) | |
124 | 124 | ||
125 | 125 | func getIntOr (key,default) = if (isDefined(getInteger(key))) | |
126 | 126 | then getIntegerValue(key) | |
127 | 127 | else default | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func setInt (key,value) = IntegerEntry(key, value) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1)) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by)) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func assetIdToStr (assetIdOrUnit) = match assetIdOrUnit { | |
140 | 140 | case b: ByteVector => | |
141 | 141 | toBase58String(b) | |
142 | 142 | case _ => | |
143 | 143 | "WAVES" | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func assetIdFromStr (assetIdStr) = if ((assetIdStr == "WAVES")) | |
148 | 148 | then unit | |
149 | 149 | else fromBase58String(assetIdStr) | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func getAssetBalance (assetIdOrUnit) = match assetIdOrUnit { | |
153 | 153 | case assetId: ByteVector => | |
154 | 154 | assetBalance(this, assetId) | |
155 | 155 | case _ => | |
156 | 156 | wavesBalance(this).available | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func increaseReserveAmount (winAmount,assetIdx) = { | |
161 | 161 | let assetIdStr = ASSETS[assetIdx] | |
162 | 162 | let newReservedAmount = (getIntOr(keyReservationByAssetIdx(assetIdx), 0) + winAmount) | |
163 | 163 | if ((newReservedAmount > getAssetBalance(assetIdFromStr(assetIdStr)))) | |
164 | 164 | then throw((("Insufficient funds on " + GAME_NAME) + " account. Transaction was rejected for your safety.")) | |
165 | 165 | else newReservedAmount | |
166 | 166 | } | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | func decreaseReservedAmount (gameId,assetIdx,winAmount) = if ((0 > (getIntOr(keyReservationByAssetIdx(assetIdx), 0) - winAmount))) | |
170 | 170 | then throw((("Invalid " + GAME_NAME) + " account state - reserved amount is less than 0")) | |
171 | 171 | else changeInt(keyReservationByAssetIdx(assetIdx), -(winAmount)) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func validateAndGetAssetIdx (assetIdStr) = { | |
175 | 175 | let idx = indexOf(ASSETS, assetIdStr) | |
176 | 176 | if (!(isDefined(idx))) | |
177 | 177 | then throw("Invalid payment asset") | |
178 | 178 | else value(idx) | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | func validateBetAndGetWinAmount (bet,internalAssetIdx,playerChoice) = { | |
183 | 183 | let dicesCount = size(playerChoice) | |
184 | 184 | func checkAmount (a,x) = if (a) | |
185 | 185 | then true | |
186 | 186 | else (bet == ((x * DECIMALS[internalAssetIdx]) / BETDIVIDERS[internalAssetIdx])) | |
187 | 187 | ||
188 | 188 | if (!({ | |
189 | 189 | let $l = BETS | |
190 | 190 | let $s = size($l) | |
191 | 191 | let $acc0 = false | |
192 | 192 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
193 | 193 | then $a | |
194 | 194 | else checkAmount($a, $l[$i]) | |
195 | 195 | ||
196 | 196 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
197 | 197 | then $a | |
198 | 198 | else throw("List size exceeds 5") | |
199 | 199 | ||
200 | 200 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
201 | 201 | })) | |
202 | 202 | then throw("Bet amount is not valid") | |
203 | 203 | else if ((parseInt(playerChoice) == unit)) | |
204 | 204 | then throw("Invalid player's choice") | |
205 | 205 | else if ((dicesCount != NUM_BETS)) | |
206 | 206 | then throw("Invalid length of player's choice") | |
207 | 207 | else fraction(bet, RATE, RATEMULT) | |
208 | 208 | } | |
209 | 209 | ||
210 | 210 | ||
211 | 211 | let HOR_LINES = [[491, 506, 44], [455, 542, 120], [404, 596, 166], [441, 556, 177], [387, 620, 232], [423, 620, 232], [410, 592, 244], [329, 665, 321], [370, 666, 337], [355, 645, 349], [313, 692, 384], [289, 682, 405], [324, 657, 461], [450, 575, 525], [505, 505, 532]] | |
212 | 212 | ||
213 | 213 | let HALF = 5000 | |
214 | 214 | ||
215 | 215 | let M4 = 10000 | |
216 | 216 | ||
217 | 217 | func getCoords (gameId,rsaSign) = { | |
218 | 218 | func calcAreas (acc,ignored) = { | |
219 | 219 | let i = acc._3 | |
220 | 220 | if ((i == 14)) | |
221 | 221 | then acc | |
222 | 222 | else { | |
223 | 223 | let top = HOR_LINES[i] | |
224 | 224 | let bottom = HOR_LINES[(i + 1)] | |
225 | 225 | let area4 = (((((top[1] - top[0]) + bottom[1]) - bottom[0]) * (bottom[2] - top[2])) * 5000) | |
226 | 226 | $Tuple3((acc._1 :+ area4), (acc._2 + area4), (acc._3 + 1)) | |
227 | 227 | } | |
228 | 228 | } | |
229 | 229 | ||
230 | 230 | let $t079748041 = { | |
231 | 231 | let $l = HOR_LINES | |
232 | 232 | let $s = size($l) | |
233 | 233 | let $acc0 = $Tuple3(nil, 0, 0) | |
234 | 234 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
235 | 235 | then $a | |
236 | 236 | else calcAreas($a, $l[$i]) | |
237 | 237 | ||
238 | 238 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
239 | 239 | then $a | |
240 | 240 | else throw("List size exceeds 15") | |
241 | 241 | ||
242 | 242 | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
243 | 243 | } | |
244 | 244 | let areas = $t079748041._1 | |
245 | 245 | let totalArea = $t079748041._2 | |
246 | - | let rand = (toInt(sha256(rsaSign)) % totalArea) | |
246 | + | let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea) | |
247 | 247 | func check (acc,area) = { | |
248 | 248 | let i = acc._1 | |
249 | 249 | let newArea = (acc._2 + area) | |
250 | 250 | $Tuple3((i + 1), newArea, if (if ((0 > acc._3)) | |
251 | 251 | then (newArea > rand) | |
252 | 252 | else false) | |
253 | 253 | then i | |
254 | 254 | else acc._3) | |
255 | 255 | } | |
256 | 256 | ||
257 | 257 | let j = ( let $l = areas | |
258 | 258 | let $s = size($l) | |
259 | 259 | let $acc0 = $Tuple3(0, 0, -1) | |
260 | 260 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
261 | 261 | then $a | |
262 | 262 | else check($a, $l[$i]) | |
263 | 263 | ||
264 | 264 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
265 | 265 | then $a | |
266 | 266 | else throw("List size exceeds 14") | |
267 | 267 | ||
268 | 268 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14))._3 | |
269 | 269 | let top = HOR_LINES[j] | |
270 | 270 | let bottom = HOR_LINES[(j + 1)] | |
271 | 271 | let mx04 = ((top[0] + bottom[0]) * HALF) | |
272 | 272 | let mx14 = ((top[1] + bottom[1]) * HALF) | |
273 | 273 | let h4 = ((bottom[2] - top[2]) * M4) | |
274 | 274 | let my4 = ((top[2] + bottom[2]) * HALF) | |
275 | 275 | let randX4 = (mx04 + (toInt(sha256((rsaSign + toBytes(j)))) % (mx14 - mx04))) | |
276 | 276 | let randY4 = ((top[2] * M4) + (toInt(sha256((rsaSign + toBytes(randX4)))) % h4)) | |
277 | 277 | let a4 = ((top[2] * M4) - randY4) | |
278 | 278 | let b4 = ((bottom[2] * M4) - randY4) | |
279 | 279 | let x04 = fraction(((top[0] * b4) - (bottom[0] * a4)), M4, h4) | |
280 | 280 | let x14 = fraction(((top[1] * b4) - (bottom[1] * a4)), M4, h4) | |
281 | 281 | if ((x04 > randX4)) | |
282 | 282 | then [((2 * mx04) - randX4), ((2 * my4) - randY4)] | |
283 | 283 | else if ((randX4 > x14)) | |
284 | 284 | then [((2 * mx14) - randX4), ((2 * my4) - randY4)] | |
285 | 285 | else [randX4, randY4] | |
286 | 286 | } | |
287 | 287 | ||
288 | 288 | ||
289 | 289 | func generateRandChoice (gameId,rsaSign) = { | |
290 | 290 | let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
291 | 291 | if (!(rsaSigValid)) | |
292 | 292 | then throw("Invalid RSA signature") | |
293 | 293 | else { | |
294 | 294 | let rand = (toInt(sha256(rsaSign)) % RANDOM_RANGE) | |
295 | 295 | toString((rand + 1)) | |
296 | 296 | } | |
297 | 297 | } | |
298 | 298 | ||
299 | 299 | ||
300 | 300 | func isPlayerWin (playerChoice,randChoise) = { | |
301 | 301 | let s = size(playerChoice) | |
302 | 302 | func check (a,x) = if (a) | |
303 | 303 | then true | |
304 | 304 | else if ((s >= x)) | |
305 | 305 | then (take(drop(playerChoice, (x - 1)), 1) == randChoise) | |
306 | 306 | else false | |
307 | 307 | ||
308 | 308 | let $l = [1, 2, 3, 4, 5] | |
309 | 309 | let $s = size($l) | |
310 | 310 | let $acc0 = false | |
311 | 311 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
312 | 312 | then $a | |
313 | 313 | else check($a, $l[$i]) | |
314 | 314 | ||
315 | 315 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
316 | 316 | then $a | |
317 | 317 | else throw("List size exceeds 5") | |
318 | 318 | ||
319 | 319 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
320 | 320 | } | |
321 | 321 | ||
322 | 322 | ||
323 | 323 | func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == "")) | |
324 | 324 | then "" | |
325 | 325 | else randOrEmpty, xCoord, yCoord], "_") | |
326 | 326 | ||
327 | 327 | ||
328 | 328 | func formatGameData (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord) = formatGameDataS(gameStatus, playerChoice, playerPubKey58, toString(startedHeight), toString(winAmount), toString(assetIdx), randOrEmpty, toString(xCoord), toString(yCoord)) | |
329 | 329 | ||
330 | 330 | ||
331 | 331 | func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord) = { | |
332 | 332 | let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord)) | |
333 | 333 | if (winByTimeout) | |
334 | 334 | then (finishGameData + "_TIMEOUT") | |
335 | 335 | else finishGameData | |
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | 339 | func extractGameData (gameId) = split(match getString(this, gameId) { | |
340 | 340 | case str: String => | |
341 | 341 | str | |
342 | 342 | case _ => | |
343 | 343 | throw((("Game: " + gameId) + " not found.")) | |
344 | 344 | }, "_") | |
345 | 345 | ||
346 | 346 | ||
347 | 347 | @Callable(i) | |
348 | 348 | func constructorV1 (rsaPublic64,benzAddress,randOracleTimeFrame,tokensDescriptor) = if ((i.caller != this)) | |
349 | 349 | then throw("not authorized") | |
350 | 350 | else { | |
351 | 351 | func splitter (acc,elem) = { | |
352 | 352 | let tokList = split(elem, ":") | |
353 | 353 | if ((size(tokList) != 3)) | |
354 | 354 | then throw("Invalid asset record") | |
355 | 355 | else $Tuple3((acc._1 :+ tokList[idxAssets]), (acc._2 :+ tokList[idxDecimals]), (acc._3 :+ tokList[idxDividers])) | |
356 | 356 | } | |
357 | 357 | ||
358 | 358 | let r = { | |
359 | 359 | let $l = split_4C(tokensDescriptor, "_") | |
360 | 360 | let $s = size($l) | |
361 | 361 | let $acc0 = $Tuple3(nil, nil, nil) | |
362 | 362 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
363 | 363 | then $a | |
364 | 364 | else splitter($a, $l[$i]) | |
365 | 365 | ||
366 | 366 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
367 | 367 | then $a | |
368 | 368 | else throw("List size exceeds 10") | |
369 | 369 | ||
370 | 370 | $f0_2($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) | |
371 | 371 | } | |
372 | 372 | [StringEntry(RSAPUBLIC64KEY, rsaPublic64), StringEntry(SERVERADDRESSKEY, benzAddress), IntegerEntry(RANDTIMEFRAMEKEY, randOracleTimeFrame), StringEntry(allowedAssetsKey, makeString_2C(r._1, SEP)), StringEntry(assetsDecimalsKey, makeString(r._2, SEP)), StringEntry(betDividersKey, makeString(r._3, SEP))] | |
373 | 373 | } | |
374 | 374 | ||
375 | 375 | ||
376 | 376 | ||
377 | 377 | @Callable(i) | |
378 | 378 | func maintenance (blocked) = if ((i.caller != SERVER)) | |
379 | 379 | then throw("not authorized") | |
380 | 380 | else [BooleanEntry(blockedKey, blocked)] | |
381 | 381 | ||
382 | 382 | ||
383 | 383 | ||
384 | 384 | @Callable(i) | |
385 | 385 | func bet (playerChoice) = if (valueOrElse(getBoolean(blockedKey), false)) | |
386 | 386 | then throw("Game is stopped for maintenence") | |
387 | 387 | else { | |
388 | 388 | let gameId = toBase58String(i.transactionId) | |
389 | 389 | if ((1 >= size(i.payments))) | |
390 | 390 | then throw("2 payments must be attached") | |
391 | 391 | else if (isDefined(getString(this, gameId))) | |
392 | 392 | then throw((("Bet for: " + gameId) + " was already made.")) | |
393 | 393 | else { | |
394 | 394 | let betPmt = value(i.payments[0]) | |
395 | 395 | let feePmt = value(i.payments[1]) | |
396 | 396 | if (isDefined(feePmt.assetId)) | |
397 | 397 | then throw("feePmt (2nd payment) assetId must be in Waves") | |
398 | 398 | else if ((MINFEEWAVES > feePmt.amount)) | |
399 | 399 | then throw("feePmt (2nd payment) must be >= 0.005 Waves") | |
400 | 400 | else { | |
401 | 401 | let assetIdStr = assetIdToStr(betPmt.assetId) | |
402 | 402 | let internalAssetIdx = validateAndGetAssetIdx(assetIdStr) | |
403 | 403 | let commission = feePmt.amount | |
404 | 404 | let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetIdx, playerChoice) | |
405 | 405 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
406 | 406 | let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1) | |
407 | 407 | [IntegerEntry(keyReservationByAssetIdx(internalAssetIdx), increaseReserveAmount(winAmount, internalAssetIdx)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)] | |
408 | 408 | } | |
409 | 409 | } | |
410 | 410 | } | |
411 | 411 | ||
412 | 412 | ||
413 | 413 | ||
414 | 414 | @Callable(i) | |
415 | 415 | func withdraw (gameId,rsaSign) = { | |
416 | 416 | let gameData = extractGameData(gameId) | |
417 | 417 | let gameState = gameData[IdxGameState] | |
418 | 418 | let playerChoice = gameData[IdxPlayerChoice] | |
419 | 419 | let startedHeight = parseIntValue(gameData[IdxStartedHeight]) | |
420 | 420 | let winAmount = parseIntValue(gameData[IdxWinAmount]) | |
421 | 421 | let assetIdx = parseIntValue(gameData[IdxAssetId]) | |
422 | 422 | let playerPubKey58 = gameData[IdxPlayerPubKey58] | |
423 | 423 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
424 | 424 | if ((gameState != STATESUBMITTED)) | |
425 | 425 | then throw("Invalid game state for passed gameId") | |
426 | 426 | else if ((i.caller != SERVER)) | |
427 | 427 | then throw("Regular withdraw can be done by server only") | |
428 | 428 | else { | |
429 | 429 | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
430 | 430 | let randChoice = if (winByTimeout) | |
431 | 431 | then take(playerChoice, 1) | |
432 | 432 | else generateRandChoice(gameId, rsaSign) | |
433 | 433 | let playerWin = isPlayerWin(playerChoice, randChoice) | |
434 | 434 | let newGameStatus = if (playerWin) | |
435 | 435 | then STATEWON | |
436 | 436 | else STATELOST | |
437 | 437 | let coords = if (playerWin) | |
438 | 438 | then [-(M4), -(M4)] | |
439 | 439 | else getCoords(gameId, rsaSign) | |
440 | 440 | let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4)) | |
441 | 441 | ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetIdx, winAmount)] ++ (if (playerWin) | |
442 | 442 | then [ScriptTransfer(playerAddress, winAmount, assetIdFromStr(ASSETS[assetIdx]))] | |
443 | 443 | else nil)) | |
444 | 444 | } | |
445 | 445 | } | |
446 | 446 | ||
447 | 447 | ||
448 | 448 | @Verifier(tx) | |
449 | 449 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
450 | 450 | then match tx { | |
451 | 451 | case ttx: TransferTransaction => | |
452 | 452 | let assetIdx = validateAndGetAssetIdx(assetIdToStr(ttx.assetId)) | |
453 | 453 | ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(keyReservationByAssetIdx(assetIdx), 0)) | |
454 | 454 | case stx: SetScriptTransaction => | |
455 | 455 | func checker (acc,asset) = if (acc) | |
456 | 456 | then (getIntOr(keyReservationByAssetStr(asset), 0) == 0) | |
457 | 457 | else false | |
458 | 458 | ||
459 | 459 | let $l = ASSETS | |
460 | 460 | let $s = size($l) | |
461 | 461 | let $acc0 = true | |
462 | 462 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
463 | 463 | then $a | |
464 | 464 | else checker($a, $l[$i]) | |
465 | 465 | ||
466 | 466 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
467 | 467 | then $a | |
468 | 468 | else throw("List size exceeds 10") | |
469 | 469 | ||
470 | 470 | $f0_2($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) | |
471 | 471 | case itx: InvokeScriptTransaction => | |
472 | 472 | if ((itx.dApp == this)) | |
473 | 473 | then (itx.function == "constructorV1") | |
474 | 474 | else false | |
475 | 475 | case _ => | |
476 | 476 | false | |
477 | 477 | } | |
478 | 478 | else false | |
479 | 479 |
github/deemru/w8io/026f985 87.70 ms ◑