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:BgIaCAISBgoECAgBCBIDCgEEEgMKAQgSBAoCCAJGAANTRVACAl9fAAdXQVZFU0lEAQQTq9kzAAZXQVZFU0QAgMLXLwAJR0FNRV9OQU1FAglYbWFzIFRyZWUADFJBTkRPTV9SQU5HRQAFAAhOVU1fQkVUUwABAQxnZXRTdHJPckZhaWwCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUHYWRkcmVzcwUDa2V5CQC5CQIJAMwIAgIKbWFuZGF0b3J5IAkAzAgCCQClCAEFB2FkZHJlc3MJAMwIAgIBLgkAzAgCBQNrZXkJAMwIAgIPIGlzIG5vdCBkZWZpbmVkBQNuaWwCAAEMZ2V0SW50T3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCaCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJAMwIAgkApQgBBQdhZGRyZXNzCQDMCAICAS4JAMwIAgUDa2V5CQDMCAICDyBpcyBub3QgZGVmaW5lZAUDbmlsAgABDWdldE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W9uQnlBc3NldElkeAEFCGFzc2V0SWR4AAADCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EA3N0eAUHJG1hdGNoMAoBB2NoZWNrZXICA2FjYwVhc3NldAMFA2FjYwkAAAIJAQhnZXRJbnRPcgIJARhrZXlSZXNlcnZhdGlvbkJ5QXNzZXRTdHIBBQVhc3NldAAAAAAHCgACJGwFBkFTU0VUUwoAAiRzCQCQAwEFAiRsCgAFJGFjYzAGCgEFJGYwXzECAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAQdjaGVja2VyAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhRMaXN0IHNpemUgZXhjZWVkcyAxMAkBBSRmMF8yAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgUFJGFjYzAAAAABAAIAAwAEAAUABgAHAAgACQAKAwkAAQIFByRtYXRjaDACF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBANpdHgFByRtYXRjaDADCQAAAggFA2l0eARkQXBwBQR0aGlzCQAAAggFA2l0eAhmdW5jdGlvbgINY29uc3RydWN0b3JWMQcHB84Lbx8=", "height": 2885619, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FVqNv7XDFmUrVZFSrqi9Nj9qdFQFi7jjj4DXPMEgA8FA Next: 21aDeFnoHRnS7syp874NGDYWeiYoVyQBJYSNc56u944U Diff:
OldNewDifferences
243243 }
244244 let areas = $t079748041._1
245245 let totalArea = $t079748041._2
246- let rand = (toInt(sha256(rsaSign)) % totalArea)
246+ let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea)
247247 func check (acc,area) = {
248248 let i = acc._1
249249 let newArea = (acc._2 + area)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let WAVESID = base58'WAVES'
77
88 let WAVESD = 100000000
99
1010 let GAME_NAME = "Xmas Tree"
1111
1212 let RANDOM_RANGE = 5
1313
1414 let NUM_BETS = 1
1515
1616 func getStrOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
1717
1818
1919 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
2020
2121
2222 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
2323
2424
2525 let allowedAssetsKey = "%s%s__cfg__allowedAssets"
2626
2727 let assetsDecimalsKey = "%s%s__cfg__assetsDecimals"
2828
2929 let betDividersKey = "%s%s__cfg__assetsBetDividers"
3030
3131 let RSAPUBLIC64KEY = "%s%s__cfg__rsaPublic64"
3232
3333 let SERVERADDRESSKEY = "%s%s__cfg__benzAddress"
3434
3535 let RANDTIMEFRAMEKEY = "%s%s__cfg__withdrawTimeFrame"
3636
3737 let GAMESCOUNTERKEY = "%s%s__runtime__gameNum"
3838
3939 let blockedKey = "%s%s__runtime__contractIsBlocked"
4040
4141 let reservedAmountsKey = "%s%s__runtime__reservedAmounts"
4242
4343 func getIntArray (key) = {
4444 let a = getStrOrFail(this, key)
4545 func filler (acc,el) = (acc :+ parseIntValue(el))
4646
4747 let $l = split(a, SEP)
4848 let $s = size($l)
4949 let $acc0 = nil
5050 func $f0_1 ($a,$i) = if (($i >= $s))
5151 then $a
5252 else filler($a, $l[$i])
5353
5454 func $f0_2 ($a,$i) = if (($i >= $s))
5555 then $a
5656 else throw("List size exceeds 10")
5757
5858 $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)
5959 }
6060
6161
6262 let ASSETS = split(getStrOrFail(this, allowedAssetsKey), SEP)
6363
6464 let DECIMALS = getIntArray(assetsDecimalsKey)
6565
6666 let BETDIVIDERS = getIntArray(betDividersKey)
6767
6868 func keyReservationByAssetStr (assetStr) = ("$RESERVED_AMOUNT_" + assetStr)
6969
7070
7171 func keyReservationByAssetIdx (assetIdx) = keyReservationByAssetStr(ASSETS[assetIdx])
7272
7373
7474 let MINFEEWAVES = ((5 * WAVESD) / 1000)
7575
7676 let idxAssets = 0
7777
7878 let idxDecimals = 1
7979
8080 let idxDividers = 2
8181
8282 let BET1 = 1
8383
8484 let BET2 = 2
8585
8686 let BET4 = 4
8787
8888 let BET8 = 8
8989
9090 let BET14 = 14
9191
9292 let RATEMULT = 10000
9393
9494 let RATE = 250000
9595
9696 let BETS = [BET2]
9797
9898 let IdxGameState = 0
9999
100100 let IdxPlayerChoice = 1
101101
102102 let IdxPlayerPubKey58 = 2
103103
104104 let IdxStartedHeight = 3
105105
106106 let IdxWinAmount = 4
107107
108108 let IdxAssetId = 5
109109
110110 let STATESUBMITTED = "SUBMITTED"
111111
112112 let STATEWON = "WON"
113113
114114 let STATELOST = "LOST"
115115
116116 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " key is not specified in this.state"))
117117
118118
119119 let RSAPUBLIC = fromBase64String(getStringOrFail(RSAPUBLIC64KEY))
120120
121121 let SERVER = addressFromStringValue(getStringOrFail(SERVERADDRESSKEY))
122122
123123 let RANDORACLETIMEFRAME = valueOrElse(getInteger(this, RANDTIMEFRAMEKEY), 7200)
124124
125125 func getIntOr (key,default) = if (isDefined(getInteger(key)))
126126 then getIntegerValue(key)
127127 else default
128128
129129
130130 func setInt (key,value) = IntegerEntry(key, value)
131131
132132
133133 func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1))
134134
135135
136136 func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by))
137137
138138
139139 func assetIdToStr (assetIdOrUnit) = match assetIdOrUnit {
140140 case b: ByteVector =>
141141 toBase58String(b)
142142 case _ =>
143143 "WAVES"
144144 }
145145
146146
147147 func assetIdFromStr (assetIdStr) = if ((assetIdStr == "WAVES"))
148148 then unit
149149 else fromBase58String(assetIdStr)
150150
151151
152152 func getAssetBalance (assetIdOrUnit) = match assetIdOrUnit {
153153 case assetId: ByteVector =>
154154 assetBalance(this, assetId)
155155 case _ =>
156156 wavesBalance(this).available
157157 }
158158
159159
160160 func increaseReserveAmount (winAmount,assetIdx) = {
161161 let assetIdStr = ASSETS[assetIdx]
162162 let newReservedAmount = (getIntOr(keyReservationByAssetIdx(assetIdx), 0) + winAmount)
163163 if ((newReservedAmount > getAssetBalance(assetIdFromStr(assetIdStr))))
164164 then throw((("Insufficient funds on " + GAME_NAME) + " account. Transaction was rejected for your safety."))
165165 else newReservedAmount
166166 }
167167
168168
169169 func decreaseReservedAmount (gameId,assetIdx,winAmount) = if ((0 > (getIntOr(keyReservationByAssetIdx(assetIdx), 0) - winAmount)))
170170 then throw((("Invalid " + GAME_NAME) + " account state - reserved amount is less than 0"))
171171 else changeInt(keyReservationByAssetIdx(assetIdx), -(winAmount))
172172
173173
174174 func validateAndGetAssetIdx (assetIdStr) = {
175175 let idx = indexOf(ASSETS, assetIdStr)
176176 if (!(isDefined(idx)))
177177 then throw("Invalid payment asset")
178178 else value(idx)
179179 }
180180
181181
182182 func validateBetAndGetWinAmount (bet,internalAssetIdx,playerChoice) = {
183183 let dicesCount = size(playerChoice)
184184 func checkAmount (a,x) = if (a)
185185 then true
186186 else (bet == ((x * DECIMALS[internalAssetIdx]) / BETDIVIDERS[internalAssetIdx]))
187187
188188 if (!({
189189 let $l = BETS
190190 let $s = size($l)
191191 let $acc0 = false
192192 func $f0_1 ($a,$i) = if (($i >= $s))
193193 then $a
194194 else checkAmount($a, $l[$i])
195195
196196 func $f0_2 ($a,$i) = if (($i >= $s))
197197 then $a
198198 else throw("List size exceeds 5")
199199
200200 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
201201 }))
202202 then throw("Bet amount is not valid")
203203 else if ((parseInt(playerChoice) == unit))
204204 then throw("Invalid player's choice")
205205 else if ((dicesCount != NUM_BETS))
206206 then throw("Invalid length of player's choice")
207207 else fraction(bet, RATE, RATEMULT)
208208 }
209209
210210
211211 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]]
212212
213213 let HALF = 5000
214214
215215 let M4 = 10000
216216
217217 func getCoords (gameId,rsaSign) = {
218218 func calcAreas (acc,ignored) = {
219219 let i = acc._3
220220 if ((i == 14))
221221 then acc
222222 else {
223223 let top = HOR_LINES[i]
224224 let bottom = HOR_LINES[(i + 1)]
225225 let area4 = (((((top[1] - top[0]) + bottom[1]) - bottom[0]) * (bottom[2] - top[2])) * 5000)
226226 $Tuple3((acc._1 :+ area4), (acc._2 + area4), (acc._3 + 1))
227227 }
228228 }
229229
230230 let $t079748041 = {
231231 let $l = HOR_LINES
232232 let $s = size($l)
233233 let $acc0 = $Tuple3(nil, 0, 0)
234234 func $f0_1 ($a,$i) = if (($i >= $s))
235235 then $a
236236 else calcAreas($a, $l[$i])
237237
238238 func $f0_2 ($a,$i) = if (($i >= $s))
239239 then $a
240240 else throw("List size exceeds 15")
241241
242242 $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)
243243 }
244244 let areas = $t079748041._1
245245 let totalArea = $t079748041._2
246- let rand = (toInt(sha256(rsaSign)) % totalArea)
246+ let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea)
247247 func check (acc,area) = {
248248 let i = acc._1
249249 let newArea = (acc._2 + area)
250250 $Tuple3((i + 1), newArea, if (if ((0 > acc._3))
251251 then (newArea > rand)
252252 else false)
253253 then i
254254 else acc._3)
255255 }
256256
257257 let j = ( let $l = areas
258258 let $s = size($l)
259259 let $acc0 = $Tuple3(0, 0, -1)
260260 func $f1_1 ($a,$i) = if (($i >= $s))
261261 then $a
262262 else check($a, $l[$i])
263263
264264 func $f1_2 ($a,$i) = if (($i >= $s))
265265 then $a
266266 else throw("List size exceeds 14")
267267
268268 $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
269269 let top = HOR_LINES[j]
270270 let bottom = HOR_LINES[(j + 1)]
271271 let mx04 = ((top[0] + bottom[0]) * HALF)
272272 let mx14 = ((top[1] + bottom[1]) * HALF)
273273 let h4 = ((bottom[2] - top[2]) * M4)
274274 let my4 = ((top[2] + bottom[2]) * HALF)
275275 let randX4 = (mx04 + (toInt(sha256((rsaSign + toBytes(j)))) % (mx14 - mx04)))
276276 let randY4 = ((top[2] * M4) + (toInt(sha256((rsaSign + toBytes(randX4)))) % h4))
277277 let a4 = ((top[2] * M4) - randY4)
278278 let b4 = ((bottom[2] * M4) - randY4)
279279 let x04 = fraction(((top[0] * b4) - (bottom[0] * a4)), M4, h4)
280280 let x14 = fraction(((top[1] * b4) - (bottom[1] * a4)), M4, h4)
281281 if ((x04 > randX4))
282282 then [((2 * mx04) - randX4), ((2 * my4) - randY4)]
283283 else if ((randX4 > x14))
284284 then [((2 * mx14) - randX4), ((2 * my4) - randY4)]
285285 else [randX4, randY4]
286286 }
287287
288288
289289 func generateRandChoice (gameId,rsaSign) = {
290290 let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
291291 if (!(rsaSigValid))
292292 then throw("Invalid RSA signature")
293293 else {
294294 let rand = (toInt(sha256(rsaSign)) % RANDOM_RANGE)
295295 toString((rand + 1))
296296 }
297297 }
298298
299299
300300 func isPlayerWin (playerChoice,randChoise) = {
301301 let s = size(playerChoice)
302302 func check (a,x) = if (a)
303303 then true
304304 else if ((s >= x))
305305 then (take(drop(playerChoice, (x - 1)), 1) == randChoise)
306306 else false
307307
308308 let $l = [1, 2, 3, 4, 5]
309309 let $s = size($l)
310310 let $acc0 = false
311311 func $f0_1 ($a,$i) = if (($i >= $s))
312312 then $a
313313 else check($a, $l[$i])
314314
315315 func $f0_2 ($a,$i) = if (($i >= $s))
316316 then $a
317317 else throw("List size exceeds 5")
318318
319319 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
320320 }
321321
322322
323323 func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == ""))
324324 then ""
325325 else randOrEmpty, xCoord, yCoord], "_")
326326
327327
328328 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))
329329
330330
331331 func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord) = {
332332 let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord))
333333 if (winByTimeout)
334334 then (finishGameData + "_TIMEOUT")
335335 else finishGameData
336336 }
337337
338338
339339 func extractGameData (gameId) = split(match getString(this, gameId) {
340340 case str: String =>
341341 str
342342 case _ =>
343343 throw((("Game: " + gameId) + " not found."))
344344 }, "_")
345345
346346
347347 @Callable(i)
348348 func constructorV1 (rsaPublic64,benzAddress,randOracleTimeFrame,tokensDescriptor) = if ((i.caller != this))
349349 then throw("not authorized")
350350 else {
351351 func splitter (acc,elem) = {
352352 let tokList = split(elem, ":")
353353 if ((size(tokList) != 3))
354354 then throw("Invalid asset record")
355355 else $Tuple3((acc._1 :+ tokList[idxAssets]), (acc._2 :+ tokList[idxDecimals]), (acc._3 :+ tokList[idxDividers]))
356356 }
357357
358358 let r = {
359359 let $l = split_4C(tokensDescriptor, "_")
360360 let $s = size($l)
361361 let $acc0 = $Tuple3(nil, nil, nil)
362362 func $f0_1 ($a,$i) = if (($i >= $s))
363363 then $a
364364 else splitter($a, $l[$i])
365365
366366 func $f0_2 ($a,$i) = if (($i >= $s))
367367 then $a
368368 else throw("List size exceeds 10")
369369
370370 $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)
371371 }
372372 [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))]
373373 }
374374
375375
376376
377377 @Callable(i)
378378 func maintenance (blocked) = if ((i.caller != SERVER))
379379 then throw("not authorized")
380380 else [BooleanEntry(blockedKey, blocked)]
381381
382382
383383
384384 @Callable(i)
385385 func bet (playerChoice) = if (valueOrElse(getBoolean(blockedKey), false))
386386 then throw("Game is stopped for maintenence")
387387 else {
388388 let gameId = toBase58String(i.transactionId)
389389 if ((1 >= size(i.payments)))
390390 then throw("2 payments must be attached")
391391 else if (isDefined(getString(this, gameId)))
392392 then throw((("Bet for: " + gameId) + " was already made."))
393393 else {
394394 let betPmt = value(i.payments[0])
395395 let feePmt = value(i.payments[1])
396396 if (isDefined(feePmt.assetId))
397397 then throw("feePmt (2nd payment) assetId must be in Waves")
398398 else if ((MINFEEWAVES > feePmt.amount))
399399 then throw("feePmt (2nd payment) must be >= 0.005 Waves")
400400 else {
401401 let assetIdStr = assetIdToStr(betPmt.assetId)
402402 let internalAssetIdx = validateAndGetAssetIdx(assetIdStr)
403403 let commission = feePmt.amount
404404 let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetIdx, playerChoice)
405405 let playerPubKey58 = toBase58String(i.callerPublicKey)
406406 let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1)
407407 [IntegerEntry(keyReservationByAssetIdx(internalAssetIdx), increaseReserveAmount(winAmount, internalAssetIdx)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)]
408408 }
409409 }
410410 }
411411
412412
413413
414414 @Callable(i)
415415 func withdraw (gameId,rsaSign) = {
416416 let gameData = extractGameData(gameId)
417417 let gameState = gameData[IdxGameState]
418418 let playerChoice = gameData[IdxPlayerChoice]
419419 let startedHeight = parseIntValue(gameData[IdxStartedHeight])
420420 let winAmount = parseIntValue(gameData[IdxWinAmount])
421421 let assetIdx = parseIntValue(gameData[IdxAssetId])
422422 let playerPubKey58 = gameData[IdxPlayerPubKey58]
423423 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
424424 if ((gameState != STATESUBMITTED))
425425 then throw("Invalid game state for passed gameId")
426426 else if ((i.caller != SERVER))
427427 then throw("Regular withdraw can be done by server only")
428428 else {
429429 let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
430430 let randChoice = if (winByTimeout)
431431 then take(playerChoice, 1)
432432 else generateRandChoice(gameId, rsaSign)
433433 let playerWin = isPlayerWin(playerChoice, randChoice)
434434 let newGameStatus = if (playerWin)
435435 then STATEWON
436436 else STATELOST
437437 let coords = if (playerWin)
438438 then [-(M4), -(M4)]
439439 else getCoords(gameId, rsaSign)
440440 let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4))
441441 ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetIdx, winAmount)] ++ (if (playerWin)
442442 then [ScriptTransfer(playerAddress, winAmount, assetIdFromStr(ASSETS[assetIdx]))]
443443 else nil))
444444 }
445445 }
446446
447447
448448 @Verifier(tx)
449449 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
450450 then match tx {
451451 case ttx: TransferTransaction =>
452452 let assetIdx = validateAndGetAssetIdx(assetIdToStr(ttx.assetId))
453453 ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(keyReservationByAssetIdx(assetIdx), 0))
454454 case stx: SetScriptTransaction =>
455455 func checker (acc,asset) = if (acc)
456456 then (getIntOr(keyReservationByAssetStr(asset), 0) == 0)
457457 else false
458458
459459 let $l = ASSETS
460460 let $s = size($l)
461461 let $acc0 = true
462462 func $f0_1 ($a,$i) = if (($i >= $s))
463463 then $a
464464 else checker($a, $l[$i])
465465
466466 func $f0_2 ($a,$i) = if (($i >= $s))
467467 then $a
468468 else throw("List size exceeds 10")
469469
470470 $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)
471471 case itx: InvokeScriptTransaction =>
472472 if ((itx.dApp == this))
473473 then (itx.function == "constructorV1")
474474 else false
475475 case _ =>
476476 false
477477 }
478478 else false
479479

github/deemru/w8io/026f985 
87.70 ms