tx · E4hcche2nVENgLZA29jHVUsB5Z2TCDktD716RhguQUie

3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ:  -0.01700000 Waves

2023.12.12 20:48 [2883829] smart account 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ > SELF 0.00000000 Waves

{ "type": 13, "id": "E4hcche2nVENgLZA29jHVUsB5Z2TCDktD716RhguQUie", "fee": 1700000, "feeAssetId": null, "timestamp": 1702403381997, "version": 2, "chainId": 84, "sender": "3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ", "senderPublicKey": "CQoe8BRHR78TuPQLcK3Ykv39w9CeNLhjKdj6TNbJ5FrM", "proofs": [ "M8Sk2sgejdCB8AdrgXZstuMTmPT3o83g4aW2g4VgkZ7eqPBnoxnsjYQ3JQAbGuDLVAj8sTMbjvAavck413Vu6S6" ], "script": "base64:BgIaCAISBgoECAgBCBIDCgEEEgMKAQgSBAoCCAJGAANTRVACAl9fAAdXQVZFU0lEAQQTq9kzAAZXQVZFU0QAgMLXLwAJR0FNRV9OQU1FAglYbWFzIFRyZWUADFJBTkRPTV9SQU5HRQAFAAhOVU1fQkVUUwABAQxnZXRTdHJPckZhaWwCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUHYWRkcmVzcwUDa2V5CQC5CQIJAMwIAgIKbWFuZGF0b3J5IAkAzAgCCQClCAEFB2FkZHJlc3MJAMwIAgIBLgkAzAgCBQNrZXkJAMwIAgIPIGlzIG5vdCBkZWZpbmVkBQNuaWwCAAEMZ2V0SW50T3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCaCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJAMwIAgkApQgBBQdhZGRyZXNzCQDMCAICAS4JAMwIAgUDa2V5CQDMCAICDyBpcyBub3QgZGVmaW5lZAUDbmlsAgABDWdldEJvb2xPckZha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AQIFByRtYXRjaDACFFNldFNjcmlwdFRyYW5zYWN0aW9uBANzdHgFByRtYXRjaDAKAQdjaGVja2VyAgNhY2MFYXNzZXQDBQNhY2MJAAACCQEIZ2V0SW50T3ICCQEYa2V5UmVzZXJ2YXRpb25CeUFzc2V0U3RyAQUFYXNzZXQAAAAABwoAAiRsBQZBU1NFVFMKAAIkcwkAkAMBBQIkbAoABSRhY2MwBgoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQEHY2hlY2tlcgIFAiRhCQCRAwIFAiRsBQIkaQoBBSRmMF8yAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQACAQIUTGlzdCBzaXplIGV4Y2VlZHMgMTAJAQUkZjBfMgIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIFBSRhY2MwAAAAAQACAAMABAAFAAYABwAIAAkACgMJAAECBQckbWF0Y2gwAhdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgQDaXR4BQckbWF0Y2gwAwkAAAIIBQNpdHgEZEFwcAUEdGhpcwkAAAIIBQNpdHgIZnVuY3Rpb24CDWNvbnN0cnVjdG9yVjEHBwfnhVQo", "height": 2883829, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2fKnLFXeMRi15d4aYSuwwSv34kWdRbmGpWC3qgVUyJf5 Next: FVqNv7XDFmUrVZFSrqi9Nj9qdFQFi7jjj4DXPMEgA8FA Diff:
OldNewDifferences
247247 func check (acc,area) = {
248248 let i = acc._1
249249 let newArea = (acc._2 + area)
250- $Tuple3((i + 1), newArea, if ((newArea > rand))
250+ $Tuple3((i + 1), newArea, if (if ((0 > acc._3))
251+ then (newArea > rand)
252+ else false)
251253 then i
252254 else acc._3)
253255 }
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
246246 let rand = (toInt(sha256(rsaSign)) % totalArea)
247247 func check (acc,area) = {
248248 let i = acc._1
249249 let newArea = (acc._2 + area)
250- $Tuple3((i + 1), newArea, if ((newArea > rand))
250+ $Tuple3((i + 1), newArea, if (if ((0 > acc._3))
251+ then (newArea > rand)
252+ else false)
251253 then i
252254 else acc._3)
253255 }
254256
255257 let j = ( let $l = areas
256258 let $s = size($l)
257259 let $acc0 = $Tuple3(0, 0, -1)
258260 func $f1_1 ($a,$i) = if (($i >= $s))
259261 then $a
260262 else check($a, $l[$i])
261263
262264 func $f1_2 ($a,$i) = if (($i >= $s))
263265 then $a
264266 else throw("List size exceeds 14")
265267
266268 $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
267269 let top = HOR_LINES[j]
268270 let bottom = HOR_LINES[(j + 1)]
269271 let mx04 = ((top[0] + bottom[0]) * HALF)
270272 let mx14 = ((top[1] + bottom[1]) * HALF)
271273 let h4 = ((bottom[2] - top[2]) * M4)
272274 let my4 = ((top[2] + bottom[2]) * HALF)
273275 let randX4 = (mx04 + (toInt(sha256((rsaSign + toBytes(j)))) % (mx14 - mx04)))
274276 let randY4 = (top[2] + (toInt(sha256((rsaSign + toBytes(randX4)))) % h4))
275277 let a4 = ((top[2] * M4) - randY4)
276278 let b4 = ((bottom[2] * M4) - randY4)
277279 let x04 = fraction(((top[0] * b4) - (bottom[0] * a4)), M4, h4)
278280 let x14 = fraction(((top[1] * b4) - (bottom[1] * a4)), M4, h4)
279281 if ((x04 > randX4))
280282 then [((2 * mx04) - randX4), ((2 * my4) - randY4)]
281283 else if ((randX4 > x14))
282284 then [((2 * mx14) - randX4), ((2 * my4) - randY4)]
283285 else [randX4, randY4]
284286 }
285287
286288
287289 func generateRandChoice (gameId,rsaSign) = {
288290 let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
289291 if (!(rsaSigValid))
290292 then throw("Invalid RSA signature")
291293 else {
292294 let rand = (toInt(sha256(rsaSign)) % RANDOM_RANGE)
293295 toString((rand + 1))
294296 }
295297 }
296298
297299
298300 func isPlayerWin (playerChoice,randChoise) = {
299301 let s = size(playerChoice)
300302 func check (a,x) = if (a)
301303 then true
302304 else if ((s >= x))
303305 then (take(drop(playerChoice, (x - 1)), 1) == randChoise)
304306 else false
305307
306308 let $l = [1, 2, 3, 4, 5]
307309 let $s = size($l)
308310 let $acc0 = false
309311 func $f0_1 ($a,$i) = if (($i >= $s))
310312 then $a
311313 else check($a, $l[$i])
312314
313315 func $f0_2 ($a,$i) = if (($i >= $s))
314316 then $a
315317 else throw("List size exceeds 5")
316318
317319 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
318320 }
319321
320322
321323 func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == ""))
322324 then ""
323325 else randOrEmpty, xCoord, yCoord], "_")
324326
325327
326328 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))
327329
328330
329331 func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord) = {
330332 let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord))
331333 if (winByTimeout)
332334 then (finishGameData + "_TIMEOUT")
333335 else finishGameData
334336 }
335337
336338
337339 func extractGameData (gameId) = split(match getString(this, gameId) {
338340 case str: String =>
339341 str
340342 case _ =>
341343 throw((("Game: " + gameId) + " not found."))
342344 }, "_")
343345
344346
345347 @Callable(i)
346348 func constructorV1 (rsaPublic64,benzAddress,randOracleTimeFrame,tokensDescriptor) = if ((i.caller != this))
347349 then throw("not authorized")
348350 else {
349351 func splitter (acc,elem) = {
350352 let tokList = split(elem, ":")
351353 if ((size(tokList) != 3))
352354 then throw("Invalid asset record")
353355 else $Tuple3((acc._1 :+ tokList[idxAssets]), (acc._2 :+ tokList[idxDecimals]), (acc._3 :+ tokList[idxDividers]))
354356 }
355357
356358 let r = {
357359 let $l = split_4C(tokensDescriptor, "_")
358360 let $s = size($l)
359361 let $acc0 = $Tuple3(nil, nil, nil)
360362 func $f0_1 ($a,$i) = if (($i >= $s))
361363 then $a
362364 else splitter($a, $l[$i])
363365
364366 func $f0_2 ($a,$i) = if (($i >= $s))
365367 then $a
366368 else throw("List size exceeds 10")
367369
368370 $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)
369371 }
370372 [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))]
371373 }
372374
373375
374376
375377 @Callable(i)
376378 func maintenance (blocked) = if ((i.caller != SERVER))
377379 then throw("not authorized")
378380 else [BooleanEntry(blockedKey, blocked)]
379381
380382
381383
382384 @Callable(i)
383385 func bet (playerChoice) = if (valueOrElse(getBoolean(blockedKey), false))
384386 then throw("Game is stopped for maintenence")
385387 else {
386388 let gameId = toBase58String(i.transactionId)
387389 if ((1 >= size(i.payments)))
388390 then throw("2 payments must be attached")
389391 else if (isDefined(getString(this, gameId)))
390392 then throw((("Bet for: " + gameId) + " was already made."))
391393 else {
392394 let betPmt = value(i.payments[0])
393395 let feePmt = value(i.payments[1])
394396 if (isDefined(feePmt.assetId))
395397 then throw("feePmt (2nd payment) assetId must be in Waves")
396398 else if ((MINFEEWAVES > feePmt.amount))
397399 then throw("feePmt (2nd payment) must be >= 0.005 Waves")
398400 else {
399401 let assetIdStr = assetIdToStr(betPmt.assetId)
400402 let internalAssetIdx = validateAndGetAssetIdx(assetIdStr)
401403 let commission = feePmt.amount
402404 let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetIdx, playerChoice)
403405 let playerPubKey58 = toBase58String(i.callerPublicKey)
404406 let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1)
405407 [IntegerEntry(keyReservationByAssetIdx(internalAssetIdx), increaseReserveAmount(winAmount, internalAssetIdx)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)]
406408 }
407409 }
408410 }
409411
410412
411413
412414 @Callable(i)
413415 func withdraw (gameId,rsaSign) = {
414416 let gameData = extractGameData(gameId)
415417 let gameState = gameData[IdxGameState]
416418 let playerChoice = gameData[IdxPlayerChoice]
417419 let startedHeight = parseIntValue(gameData[IdxStartedHeight])
418420 let winAmount = parseIntValue(gameData[IdxWinAmount])
419421 let assetIdx = parseIntValue(gameData[IdxAssetId])
420422 let playerPubKey58 = gameData[IdxPlayerPubKey58]
421423 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
422424 if ((gameState != STATESUBMITTED))
423425 then throw("Invalid game state for passed gameId")
424426 else if ((i.caller != SERVER))
425427 then throw("Regular withdraw can be done by server only")
426428 else {
427429 let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
428430 let randChoice = if (winByTimeout)
429431 then take(playerChoice, 1)
430432 else generateRandChoice(gameId, rsaSign)
431433 let playerWin = isPlayerWin(playerChoice, randChoice)
432434 let newGameStatus = if (playerWin)
433435 then STATEWON
434436 else STATELOST
435437 let coords = if (playerWin)
436438 then [-(M4), -(M4)]
437439 else getCoords(gameId, rsaSign)
438440 let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4))
439441 ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetIdx, winAmount)] ++ (if (playerWin)
440442 then [ScriptTransfer(playerAddress, winAmount, assetIdFromStr(ASSETS[assetIdx]))]
441443 else nil))
442444 }
443445 }
444446
445447
446448 @Verifier(tx)
447449 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
448450 then match tx {
449451 case ttx: TransferTransaction =>
450452 let assetIdx = validateAndGetAssetIdx(assetIdToStr(ttx.assetId))
451453 ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(keyReservationByAssetIdx(assetIdx), 0))
452454 case stx: SetScriptTransaction =>
453455 func checker (acc,asset) = if (acc)
454456 then (getIntOr(keyReservationByAssetStr(asset), 0) == 0)
455457 else false
456458
457459 let $l = ASSETS
458460 let $s = size($l)
459461 let $acc0 = true
460462 func $f0_1 ($a,$i) = if (($i >= $s))
461463 then $a
462464 else checker($a, $l[$i])
463465
464466 func $f0_2 ($a,$i) = if (($i >= $s))
465467 then $a
466468 else throw("List size exceeds 10")
467469
468470 $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)
469471 case itx: InvokeScriptTransaction =>
470472 if ((itx.dApp == this))
471473 then (itx.function == "constructorV1")
472474 else false
473475 case _ =>
474476 false
475477 }
476478 else false
477479

github/deemru/w8io/169f3d6 
51.17 ms