tx · JCAiMj8rGMrTfSuT3YTSsNhpWeBMudoTzZzdCGTscLRG

3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ:  -0.01700000 Waves

2023.12.14 16:22 [2886444] smart account 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ > SELF 0.00000000 Waves

{ "type": 13, "id": "JCAiMj8rGMrTfSuT3YTSsNhpWeBMudoTzZzdCGTscLRG", "fee": 1700000, "feeAssetId": null, "timestamp": 1702560203414, "version": 2, "chainId": 84, "sender": "3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ", "senderPublicKey": "CQoe8BRHR78TuPQLcK3Ykv39w9CeNLhjKdj6TNbJ5FrM", "proofs": [ "491cYvY3A1QHvSkUkhtUttVmCCgS8Mbckq95ygx9Ft7mAVnLTzjMgJTuuPfLhN3ZeXd1de4caV8fHgMXtLT1uZqC" ], "script": "base64:BgIaCAISBgoECAgBCBIDCgEEEgMKAQgSBAoCCAJIAANTRVACAl9fAAdXQVZFU0lEAQQTq9kzAAZXQVZFU0QAgMLXLwAJR0FNRV9OQU1FAglYbWFzIFRyZWUADFJBTkRPTV9SQU5HRQAFAAhOVU1fQkVUUwABAA9NQVhfREVDT1JBVElPTlMADwEMZ2V0U3RyT3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJAMwIAgkApQgBBQdhZGRyZXNzCQDMCAICAS4JAMwIAgUDa2V5CQDMCAICDyBpcyBub3QgZGVmaW5lZAUDbmlsAgABDGdldEludE9yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZ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ded", "spentComplexity": 0 } View: original | compacted Prev: 21aDeFnoHRnS7syp874NGDYWeiYoVyQBJYSNc56u944U Next: 8xh42kktAgjFWFNQXm2y4Nm3zpvCwAJry7zUqhZj7RnX Diff:
OldNewDifferences
1212 let RANDOM_RANGE = 5
1313
1414 let NUM_BETS = 1
15+
16+let MAX_DECORATIONS = 15
1517
1618 func getStrOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
1719
227229 }
228230 }
229231
230- let $t079718038 = {
232+ let $t079968063 = {
231233 let $l = HOR_LINES
232234 let $s = size($l)
233235 let $acc0 = $Tuple3(nil, 0, 0)
241243
242244 $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)
243245 }
244- let areas = $t079718038._1
245- let totalArea = $t079718038._2
246+ let areas = $t079968063._1
247+ let totalArea = $t079968063._2
246248 let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea)
247249 func check (acc,area) = {
248250 let i = acc._1
286288 }
287289
288290
291+func getDecorationIndex (gameId,rsaSign) = (toInt(sha256((toBytes(gameId) + rsaSign))) % MAX_DECORATIONS)
292+
293+
289294 func generateRandChoice (gameId,rsaSign) = {
290295 let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
291296 if (!(rsaSigValid))
320325 }
321326
322327
323-func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == ""))
328+func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord,prizeIndex) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == ""))
324329 then ""
325- else randOrEmpty, xCoord, yCoord], "_")
330+ else randOrEmpty, xCoord, yCoord, prizeIndex], "_")
326331
327332
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))
333+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))
329334
330335
331-func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord) = {
332- let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord))
336+func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord,prizeIndex) = {
337+ let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord), toString(prizeIndex))
333338 if (winByTimeout)
334339 then (finishGameData + "_TIMEOUT")
335340 else finishGameData
403408 let commission = feePmt.amount
404409 let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetIdx, playerChoice)
405410 let playerPubKey58 = toBase58String(i.callerPublicKey)
406- let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1)
411+ let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1, -1)
407412 [IntegerEntry(keyReservationByAssetIdx(internalAssetIdx), increaseReserveAmount(winAmount, internalAssetIdx)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)]
408413 }
409414 }
437442 let coords = if (playerWin)
438443 then [-(M4), -(M4)]
439444 else getCoords(gameId, rsaSign)
440- let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4))
445+ let prizeIndex = if (playerWin)
446+ then -1
447+ else getDecorationIndex(gameId, rsaSign)
448+ let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4), prizeIndex)
441449 ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetIdx, winAmount)] ++ (if (playerWin)
442450 then [ScriptTransfer(playerAddress, winAmount, assetIdFromStr(ASSETS[assetIdx]))]
443451 else nil))
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
15+
16+let MAX_DECORATIONS = 15
1517
1618 func getStrOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
1719
1820
1921 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
2022
2123
2224 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
2325
2426
2527 let allowedAssetsKey = "%s%s__cfg__allowedAssets"
2628
2729 let assetsDecimalsKey = "%s%s__cfg__assetsDecimals"
2830
2931 let betDividersKey = "%s%s__cfg__assetsBetDividers"
3032
3133 let RSAPUBLIC64KEY = "%s%s__cfg__rsaPublic64"
3234
3335 let SERVERADDRESSKEY = "%s%s__cfg__benzAddress"
3436
3537 let RANDTIMEFRAMEKEY = "%s%s__cfg__withdrawTimeFrame"
3638
3739 let GAMESCOUNTERKEY = "%s%s__runtime__gameNum"
3840
3941 let blockedKey = "%s%s__runtime__contractIsBlocked"
4042
4143 let reservedAmountsKey = "%s%s__runtime__reservedAmounts"
4244
4345 func getIntArray (key) = {
4446 let a = getStrOrFail(this, key)
4547 func filler (acc,el) = (acc :+ parseIntValue(el))
4648
4749 let $l = split(a, SEP)
4850 let $s = size($l)
4951 let $acc0 = nil
5052 func $f0_1 ($a,$i) = if (($i >= $s))
5153 then $a
5254 else filler($a, $l[$i])
5355
5456 func $f0_2 ($a,$i) = if (($i >= $s))
5557 then $a
5658 else throw("List size exceeds 10")
5759
5860 $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)
5961 }
6062
6163
6264 let ASSETS = split(getStrOrFail(this, allowedAssetsKey), SEP)
6365
6466 let DECIMALS = getIntArray(assetsDecimalsKey)
6567
6668 let BETDIVIDERS = getIntArray(betDividersKey)
6769
6870 func keyReservationByAssetStr (assetStr) = ("$RESERVED_AMOUNT_" + assetStr)
6971
7072
7173 func keyReservationByAssetIdx (assetIdx) = keyReservationByAssetStr(ASSETS[assetIdx])
7274
7375
7476 let MINFEEWAVES = ((5 * WAVESD) / 1000)
7577
7678 let idxAssets = 0
7779
7880 let idxDecimals = 1
7981
8082 let idxDividers = 2
8183
8284 let BET1 = 1
8385
8486 let BET2 = 2
8587
8688 let BET4 = 4
8789
8890 let BET8 = 8
8991
9092 let BET14 = 14
9193
9294 let RATEMULT = 10000
9395
9496 let RATE = 40000
9597
9698 let BETS = [BET2]
9799
98100 let IdxGameState = 0
99101
100102 let IdxPlayerChoice = 1
101103
102104 let IdxPlayerPubKey58 = 2
103105
104106 let IdxStartedHeight = 3
105107
106108 let IdxWinAmount = 4
107109
108110 let IdxAssetId = 5
109111
110112 let STATESUBMITTED = "SUBMITTED"
111113
112114 let STATEWON = "WON"
113115
114116 let STATELOST = "LOST"
115117
116118 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " key is not specified in this.state"))
117119
118120
119121 let RSAPUBLIC = fromBase64String(getStringOrFail(RSAPUBLIC64KEY))
120122
121123 let SERVER = addressFromStringValue(getStringOrFail(SERVERADDRESSKEY))
122124
123125 let RANDORACLETIMEFRAME = valueOrElse(getInteger(this, RANDTIMEFRAMEKEY), 7200)
124126
125127 func getIntOr (key,default) = if (isDefined(getInteger(key)))
126128 then getIntegerValue(key)
127129 else default
128130
129131
130132 func setInt (key,value) = IntegerEntry(key, value)
131133
132134
133135 func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1))
134136
135137
136138 func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by))
137139
138140
139141 func assetIdToStr (assetIdOrUnit) = match assetIdOrUnit {
140142 case b: ByteVector =>
141143 toBase58String(b)
142144 case _ =>
143145 "WAVES"
144146 }
145147
146148
147149 func assetIdFromStr (assetIdStr) = if ((assetIdStr == "WAVES"))
148150 then unit
149151 else fromBase58String(assetIdStr)
150152
151153
152154 func getAssetBalance (assetIdOrUnit) = match assetIdOrUnit {
153155 case assetId: ByteVector =>
154156 assetBalance(this, assetId)
155157 case _ =>
156158 wavesBalance(this).available
157159 }
158160
159161
160162 func increaseReserveAmount (winAmount,assetIdx) = {
161163 let assetIdStr = ASSETS[assetIdx]
162164 let newReservedAmount = (getIntOr(keyReservationByAssetIdx(assetIdx), 0) + winAmount)
163165 if ((newReservedAmount > getAssetBalance(assetIdFromStr(assetIdStr))))
164166 then throw((("Insufficient funds on " + GAME_NAME) + " account. Transaction was rejected for your safety."))
165167 else newReservedAmount
166168 }
167169
168170
169171 func decreaseReservedAmount (gameId,assetIdx,winAmount) = if ((0 > (getIntOr(keyReservationByAssetIdx(assetIdx), 0) - winAmount)))
170172 then throw((("Invalid " + GAME_NAME) + " account state - reserved amount is less than 0"))
171173 else changeInt(keyReservationByAssetIdx(assetIdx), -(winAmount))
172174
173175
174176 func validateAndGetAssetIdx (assetIdStr) = {
175177 let idx = indexOf(ASSETS, assetIdStr)
176178 if (!(isDefined(idx)))
177179 then throw("Invalid payment asset")
178180 else value(idx)
179181 }
180182
181183
182184 func validateBetAndGetWinAmount (bet,internalAssetIdx,playerChoice) = {
183185 let dicesCount = size(playerChoice)
184186 func checkAmount (a,x) = if (a)
185187 then true
186188 else (bet == ((x * DECIMALS[internalAssetIdx]) / BETDIVIDERS[internalAssetIdx]))
187189
188190 if (!({
189191 let $l = BETS
190192 let $s = size($l)
191193 let $acc0 = false
192194 func $f0_1 ($a,$i) = if (($i >= $s))
193195 then $a
194196 else checkAmount($a, $l[$i])
195197
196198 func $f0_2 ($a,$i) = if (($i >= $s))
197199 then $a
198200 else throw("List size exceeds 5")
199201
200202 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
201203 }))
202204 then throw("Bet amount is not valid")
203205 else if ((parseInt(playerChoice) == unit))
204206 then throw("Invalid player's choice")
205207 else if ((dicesCount != NUM_BETS))
206208 then throw("Invalid length of player's choice")
207209 else fraction(bet, RATE, RATEMULT)
208210 }
209211
210212
211213 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]]
212214
213215 let HALF = 5000
214216
215217 let M4 = 10000
216218
217219 func getCoords (gameId,rsaSign) = {
218220 func calcAreas (acc,ignored) = {
219221 let i = acc._3
220222 if ((i == 14))
221223 then acc
222224 else {
223225 let top = HOR_LINES[i]
224226 let bottom = HOR_LINES[(i + 1)]
225227 let area4 = (((((top[1] - top[0]) + bottom[1]) - bottom[0]) * (bottom[2] - top[2])) * 5000)
226228 $Tuple3((acc._1 :+ area4), (acc._2 + area4), (acc._3 + 1))
227229 }
228230 }
229231
230- let $t079718038 = {
232+ let $t079968063 = {
231233 let $l = HOR_LINES
232234 let $s = size($l)
233235 let $acc0 = $Tuple3(nil, 0, 0)
234236 func $f0_1 ($a,$i) = if (($i >= $s))
235237 then $a
236238 else calcAreas($a, $l[$i])
237239
238240 func $f0_2 ($a,$i) = if (($i >= $s))
239241 then $a
240242 else throw("List size exceeds 15")
241243
242244 $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)
243245 }
244- let areas = $t079718038._1
245- let totalArea = $t079718038._2
246+ let areas = $t079968063._1
247+ let totalArea = $t079968063._2
246248 let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea)
247249 func check (acc,area) = {
248250 let i = acc._1
249251 let newArea = (acc._2 + area)
250252 $Tuple3((i + 1), newArea, if (if ((0 > acc._3))
251253 then (newArea > rand)
252254 else false)
253255 then i
254256 else acc._3)
255257 }
256258
257259 let j = ( let $l = areas
258260 let $s = size($l)
259261 let $acc0 = $Tuple3(0, 0, -1)
260262 func $f1_1 ($a,$i) = if (($i >= $s))
261263 then $a
262264 else check($a, $l[$i])
263265
264266 func $f1_2 ($a,$i) = if (($i >= $s))
265267 then $a
266268 else throw("List size exceeds 14")
267269
268270 $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
269271 let top = HOR_LINES[j]
270272 let bottom = HOR_LINES[(j + 1)]
271273 let mx04 = ((top[0] + bottom[0]) * HALF)
272274 let mx14 = ((top[1] + bottom[1]) * HALF)
273275 let h4 = ((bottom[2] - top[2]) * M4)
274276 let my4 = ((top[2] + bottom[2]) * HALF)
275277 let randX4 = (mx04 + (toInt(sha256((rsaSign + toBytes(j)))) % (mx14 - mx04)))
276278 let randY4 = ((top[2] * M4) + (toInt(sha256((rsaSign + toBytes(randX4)))) % h4))
277279 let a4 = ((top[2] * M4) - randY4)
278280 let b4 = ((bottom[2] * M4) - randY4)
279281 let x04 = fraction(((top[0] * b4) - (bottom[0] * a4)), M4, h4)
280282 let x14 = fraction(((top[1] * b4) - (bottom[1] * a4)), M4, h4)
281283 if ((x04 > randX4))
282284 then [((2 * mx04) - randX4), ((2 * my4) - randY4)]
283285 else if ((randX4 > x14))
284286 then [((2 * mx14) - randX4), ((2 * my4) - randY4)]
285287 else [randX4, randY4]
286288 }
287289
288290
291+func getDecorationIndex (gameId,rsaSign) = (toInt(sha256((toBytes(gameId) + rsaSign))) % MAX_DECORATIONS)
292+
293+
289294 func generateRandChoice (gameId,rsaSign) = {
290295 let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
291296 if (!(rsaSigValid))
292297 then throw("Invalid RSA signature")
293298 else {
294299 let rand = (toInt(sha256(rsaSign)) % RANDOM_RANGE)
295300 toString((rand + 1))
296301 }
297302 }
298303
299304
300305 func isPlayerWin (playerChoice,randChoise) = {
301306 let s = size(playerChoice)
302307 func check (a,x) = if (a)
303308 then true
304309 else if ((s >= x))
305310 then (take(drop(playerChoice, (x - 1)), 1) == randChoise)
306311 else false
307312
308313 let $l = [1, 2, 3, 4, 5]
309314 let $s = size($l)
310315 let $acc0 = false
311316 func $f0_1 ($a,$i) = if (($i >= $s))
312317 then $a
313318 else check($a, $l[$i])
314319
315320 func $f0_2 ($a,$i) = if (($i >= $s))
316321 then $a
317322 else throw("List size exceeds 5")
318323
319324 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
320325 }
321326
322327
323-func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == ""))
328+func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord,prizeIndex) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == ""))
324329 then ""
325- else randOrEmpty, xCoord, yCoord], "_")
330+ else randOrEmpty, xCoord, yCoord, prizeIndex], "_")
326331
327332
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))
333+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))
329334
330335
331-func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord) = {
332- let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord))
336+func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord,prizeIndex) = {
337+ let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord), toString(prizeIndex))
333338 if (winByTimeout)
334339 then (finishGameData + "_TIMEOUT")
335340 else finishGameData
336341 }
337342
338343
339344 func extractGameData (gameId) = split(match getString(this, gameId) {
340345 case str: String =>
341346 str
342347 case _ =>
343348 throw((("Game: " + gameId) + " not found."))
344349 }, "_")
345350
346351
347352 @Callable(i)
348353 func constructorV1 (rsaPublic64,benzAddress,randOracleTimeFrame,tokensDescriptor) = if ((i.caller != this))
349354 then throw("not authorized")
350355 else {
351356 func splitter (acc,elem) = {
352357 let tokList = split(elem, ":")
353358 if ((size(tokList) != 3))
354359 then throw("Invalid asset record")
355360 else $Tuple3((acc._1 :+ tokList[idxAssets]), (acc._2 :+ tokList[idxDecimals]), (acc._3 :+ tokList[idxDividers]))
356361 }
357362
358363 let r = {
359364 let $l = split_4C(tokensDescriptor, "_")
360365 let $s = size($l)
361366 let $acc0 = $Tuple3(nil, nil, nil)
362367 func $f0_1 ($a,$i) = if (($i >= $s))
363368 then $a
364369 else splitter($a, $l[$i])
365370
366371 func $f0_2 ($a,$i) = if (($i >= $s))
367372 then $a
368373 else throw("List size exceeds 10")
369374
370375 $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)
371376 }
372377 [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))]
373378 }
374379
375380
376381
377382 @Callable(i)
378383 func maintenance (blocked) = if ((i.caller != SERVER))
379384 then throw("not authorized")
380385 else [BooleanEntry(blockedKey, blocked)]
381386
382387
383388
384389 @Callable(i)
385390 func bet (playerChoice) = if (valueOrElse(getBoolean(blockedKey), false))
386391 then throw("Game is stopped for maintenence")
387392 else {
388393 let gameId = toBase58String(i.transactionId)
389394 if ((1 >= size(i.payments)))
390395 then throw("2 payments must be attached")
391396 else if (isDefined(getString(this, gameId)))
392397 then throw((("Bet for: " + gameId) + " was already made."))
393398 else {
394399 let betPmt = value(i.payments[0])
395400 let feePmt = value(i.payments[1])
396401 if (isDefined(feePmt.assetId))
397402 then throw("feePmt (2nd payment) assetId must be in Waves")
398403 else if ((MINFEEWAVES > feePmt.amount))
399404 then throw("feePmt (2nd payment) must be >= 0.005 Waves")
400405 else {
401406 let assetIdStr = assetIdToStr(betPmt.assetId)
402407 let internalAssetIdx = validateAndGetAssetIdx(assetIdStr)
403408 let commission = feePmt.amount
404409 let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetIdx, playerChoice)
405410 let playerPubKey58 = toBase58String(i.callerPublicKey)
406- let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1)
411+ let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1, -1)
407412 [IntegerEntry(keyReservationByAssetIdx(internalAssetIdx), increaseReserveAmount(winAmount, internalAssetIdx)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)]
408413 }
409414 }
410415 }
411416
412417
413418
414419 @Callable(i)
415420 func withdraw (gameId,rsaSign) = {
416421 let gameData = extractGameData(gameId)
417422 let gameState = gameData[IdxGameState]
418423 let playerChoice = gameData[IdxPlayerChoice]
419424 let startedHeight = parseIntValue(gameData[IdxStartedHeight])
420425 let winAmount = parseIntValue(gameData[IdxWinAmount])
421426 let assetIdx = parseIntValue(gameData[IdxAssetId])
422427 let playerPubKey58 = gameData[IdxPlayerPubKey58]
423428 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
424429 if ((gameState != STATESUBMITTED))
425430 then throw("Invalid game state for passed gameId")
426431 else if ((i.caller != SERVER))
427432 then throw("Regular withdraw can be done by server only")
428433 else {
429434 let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
430435 let randChoice = if (winByTimeout)
431436 then take(playerChoice, 1)
432437 else generateRandChoice(gameId, rsaSign)
433438 let playerWin = isPlayerWin(playerChoice, randChoice)
434439 let newGameStatus = if (playerWin)
435440 then STATEWON
436441 else STATELOST
437442 let coords = if (playerWin)
438443 then [-(M4), -(M4)]
439444 else getCoords(gameId, rsaSign)
440- let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4))
445+ let prizeIndex = if (playerWin)
446+ then -1
447+ else getDecorationIndex(gameId, rsaSign)
448+ let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, (coords[0] / M4), (coords[1] / M4), prizeIndex)
441449 ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetIdx, winAmount)] ++ (if (playerWin)
442450 then [ScriptTransfer(playerAddress, winAmount, assetIdFromStr(ASSETS[assetIdx]))]
443451 else nil))
444452 }
445453 }
446454
447455
448456 @Verifier(tx)
449457 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
450458 then match tx {
451459 case ttx: TransferTransaction =>
452460 let assetIdx = validateAndGetAssetIdx(assetIdToStr(ttx.assetId))
453461 ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(keyReservationByAssetIdx(assetIdx), 0))
454462 case stx: SetScriptTransaction =>
455463 func checker (acc,asset) = if (acc)
456464 then (getIntOr(keyReservationByAssetStr(asset), 0) == 0)
457465 else false
458466
459467 let $l = ASSETS
460468 let $s = size($l)
461469 let $acc0 = true
462470 func $f0_1 ($a,$i) = if (($i >= $s))
463471 then $a
464472 else checker($a, $l[$i])
465473
466474 func $f0_2 ($a,$i) = if (($i >= $s))
467475 then $a
468476 else throw("List size exceeds 10")
469477
470478 $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)
471479 case itx: InvokeScriptTransaction =>
472480 if ((itx.dApp == this))
473481 then (itx.function == "constructorV1")
474482 else false
475483 case _ =>
476484 false
477485 }
478486 else false
479487

github/deemru/w8io/169f3d6 
72.05 ms