tx · 8grEGtQLZFPHu5TNrVYrYLGcT3b7oYDcAZHm58CsBk4z

3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ:  -0.01800000 Waves

2023.12.14 20:20 [2886687] smart account 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
66.19 ms