tx · CcWe6nSyg5XsK2swkVP3k79v1Bcz5gZcbb9cm25Kq1xP

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.01300000 Waves

2023.09.05 23:49 [2742578] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "CcWe6nSyg5XsK2swkVP3k79v1Bcz5gZcbb9cm25Kq1xP", "fee": 1300000, "feeAssetId": null, "timestamp": 1693946976532, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "yyPCQzqPB97r5zngrX9NJ8t9tb4KWNjPPoEKP41H92qTfYqjEUhKjEjERnoBPBH6K6BChzc9sL3qpSgnbGyv9pT" ], "script": "base64:BgIlCAISBwoFAQEBAQESABIAEgQKAggBEgQKAggBEgMKAQESAwoBATYAD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhARRrZXlTdGFrZWREdWNrQnlPd25lcgEJb3duZXJBZGRyCQCsAgICEnN0YWtlZER1Y2tCeU93bmVyXwUJb3duZXJBZGRyAQ9rZXlEdWNrTG9jYXRpb24BC2R1Y2tBc3NldElkCQCsAgICDWR1Y2tMb2NhdGlvbl8FC2R1Y2tBc3NldElkAA1sYXN0VG91cklkS2V5Ag4lc19fbGFzdFRvdXJJZAEVa2V5VG91clN0YXRpY0RhdGFCeUlkAQN0SWQJAKwCAgIWJXMlZF9fdG91clN0YXRpY0RhdGFfXwkApAMBBQN0SWQBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBA3RJZAkArAICAhclcyVkX190b3VyRHluYW1pY0RhdGFfXwkApAMBBQN0SWQBE2tleVNjb3JlQm9hcmRCeVRvdXIBA3RJZAkArAICAhIlcyVkX19zY29yZUJvYXJkX18JAKQDAQUDdElkARJrZXlTdW1TY29yZXNCeVRvdX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BRJ1cGRhdGVkRHluYW1pY0RhdGEFA25pbAAAAAgTRDY=", "height": 2742578, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9iiwT1LASVMPfQGFTWbMTRfNsirwT1jUcnHy6CQqRRkw Next: 9cd9kgwP15GTNXrGwYWsftcYSCoRWkWkiPRpVYtqhCjo Diff:
OldNewDifferences
2121
2222
2323 func keySumScoresByTour (tId) = ("%s%d__sumScores__" + toString(tId))
24+
25+
26+func keyWinnersByTour (tId) = ("%s%d__winners__" + toString(tId))
2427
2528
2629 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
311314 let tData = getTourData(this, lastId)
312315 let static = tData[idxStatic]
313316 let dynamic = tData[idxDynamic]
314- if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest))
317+ let oldBest = parseIntValue(dynamic[tDynamicWinResult])
318+ if (if (if ((oldBest > newBest))
315319 then true
316320 else (dynamic[tDynamicStatus] != "INPROGRESS"))
317321 then true
318322 else (lastBlock.timestamp > parseIntValue(static[tStaticEnd])))
319323 then $Tuple2(nil, 0)
320324 else {
325+ let winnersKey = keyWinnersByTour(lastId)
326+ let winners = getString(winnersKey)
327+ let oldWinnersList = if (!(isDefined(winners)))
328+ then nil
329+ else split_4C(value(winners), "_")
330+ let newWinnersList = if ((newBest > oldBest))
331+ then [duckAssetId]
332+ else if (containsElement(oldWinnersList, duckAssetId))
333+ then oldWinnersList
334+ else (oldWinnersList :+ duckAssetId)
321335 let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
322- $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0)
336+ $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData), StringEntry(winnersKey, makeString_2C(newWinnersList, "_"))], 0)
323337 }
324338 }
325339
348362 let duckOldBest = valueOrElse(getInteger(bestResultKey), 0)
349363 let scoreKey = keyScoreBoardByTour(lastId)
350364 let oldScoreBoard = valueOrElse(getString(scoreKey), "")
351- let $t092539652 = if ((duckNewBest > duckOldBest))
365+ let $t0969710096 = if ((duckNewBest > duckOldBest))
352366 then if (!(contains(oldScoreBoard, duckAssetId)))
353367 then throw(("scoreBoard does not contain " + duckAssetId))
354368 else {
356370 $Tuple2(((((parts[0] + duckAssetId) + ":") + padL(duckNewBest, 3)) + drop(parts[1], 4)), ((oldSumScores + duckNewBest) - duckOldBest))
357371 }
358372 else $Tuple2(oldScoreBoard, oldSumScores)
359- let newScoreBoard = $t092539652._1
360- let newSumScores = $t092539652._2
373+ let newScoreBoard = $t0969710096._1
374+ let newSumScores = $t0969710096._2
361375 $Tuple2([IntegerEntry(bestResultKey, max([duckOldBest, duckNewBest])), IntegerEntry(sumScoresKey, newSumScores), StringEntry(scoreKey, newScoreBoard)], 0)
362376 }
363377 else $Tuple2(nil, 0)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let DEFAULTLOCATION = "Africa_F_Africa"
55
66 func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr)
77
88
99 func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId)
1010
1111
1212 let lastTourIdKey = "%s__lastTourId"
1313
1414 func keyTourStaticDataById (tId) = ("%s%d__tourStaticData__" + toString(tId))
1515
1616
1717 func keyTourDynamicDataById (tId) = ("%s%d__tourDynamicData__" + toString(tId))
1818
1919
2020 func keyScoreBoardByTour (tId) = ("%s%d__scoreBoard__" + toString(tId))
2121
2222
2323 func keySumScoresByTour (tId) = ("%s%d__sumScores__" + toString(tId))
24+
25+
26+func keyWinnersByTour (tId) = ("%s%d__winners__" + toString(tId))
2427
2528
2629 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
2730
2831
2932 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__")
3033
3134
3235 func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__")
3336
3437
3538 func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__")
3639
3740
3841 let idxStatic = 0
3942
4043 let idxDynamic = 1
4144
4245 func getTourData (tourContract,tId) = {
4346 let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
4447 let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
4548 [static, dynamic]
4649 }
4750
4851
4952 let tStaticRegisterCost = 2
5053
5154 let tStaticAttemptCost = 3
5255
5356 let tStaticStart = 5
5457
5558 let tStaticEnd = 6
5659
5760 let tDynamicStatus = 1
5861
5962 let tDynamicWinDuck = 2
6063
6164 let tDynamicWinResult = 3
6265
6366 let tDynamicTotalRegCount = 4
6467
6568 let tDynamicTotalAttempts = 5
6669
6770 let locIdxContinent = 0
6871
6972 let locIdxType = 1
7073
7174 let chain = take(drop(this.bytes, 1), 1)
7275
7376 let defaultRestAddressStr = match chain {
7477 case _ =>
7578 if ((base58'2W' == $match0))
7679 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
7780 else if ((base58'2T' == $match0))
7881 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
7982 else throw("Unknown chain")
8083 }
8184
8285 let SEP = "__"
8386
8487 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
8588
8689
8790 let IdxCfgStakingDapp = 1
8891
8992 let IdxCfgWlgDapp = 4
9093
9194 func keyRestCfg () = "%s__restConfig"
9295
9396
9497 func keyRestAddress () = "%s__restAddr"
9598
9699
97100 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
98101
99102
100103 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
101104
102105
103106 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
104107
105108 let restCfg = readRestCfgOrFail(restContract)
106109
107110 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
108111
109112 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
110113
111114 let wlgAssetIdKey = "wlg_assetId"
112115
113116 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
114117
115118 func asString (v) = match v {
116119 case s: String =>
117120 s
118121 case _ =>
119122 throw("fail to cast into String")
120123 }
121124
122125
123126 func asInt (v) = match v {
124127 case n: Int =>
125128 n
126129 case _ =>
127130 throw("fail to cast into Int")
128131 }
129132
130133
131134 func fixedPoint (val,decimals) = {
132135 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
133136 let lowPart = toString((val % tenPow))
134137 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
135138 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
136139 }
137140
138141
139142 func padL (val,len) = {
140143 let valS = toString(val)
141144 let zeroes = drop(toString(pow(10, 0, (len - size(valS)), 0, 0, DOWN)), 1)
142145 (zeroes + valS)
143146 }
144147
145148
146149 let MAXTOURNAMENTLENGTH = 432000000
147150
148151 let HOUR = 3600000
149152
150153 let adminsList = [toString(this), match chain {
151154 case _ =>
152155 if ((base58'2W' == $match0))
153156 then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7"
154157 else if ((base58'2T' == $match0))
155158 then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY"
156159 else throw("Unknown chain")
157160 }]
158161
159162 func staticData (txId,registerCost,attemptCost,creationTime,startTime,endTime,numGrands) = makeString(["%s%d%d%d%d%d%d", txId, toString(registerCost), toString(attemptCost), toString(creationTime), toString(startTime), toString(endTime), toString(numGrands)], SEP)
160163
161164
162165 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
163166
164167
165168 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
166169
167170
168171 func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
169172
170173
171174 @Callable(i)
172175 func createTournament (startTime,endTime,registerCost,attemptCost,numGrands) = {
173176 let caller = toString(i.caller)
174177 if (!(containsElement(adminsList, caller)))
175178 then throw("Permission denied")
176179 else {
177180 let lastId = getInteger(lastTourIdKey)
178181 let tId = if (isDefined(lastId))
179182 then {
180183 let lastTourId = value(lastId)
181184 let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data"))
182185 let status = split(dynamic, SEP)[tDynamicStatus]
183186 if ((status != "ARCHIVED"))
184187 then throw(("Current tournement is not completed, status=" + status))
185188 else (lastTourId + 1)
186189 }
187190 else 1
188191 let now = lastBlock.timestamp
189192 if ((now > startTime))
190193 then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now)))
191194 else if ((startTime > endTime))
192195 then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime)))
193196 else if (((endTime - startTime) > MAXTOURNAMENTLENGTH))
194197 then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH)))
195198 else if (if ((0 >= registerCost))
196199 then true
197200 else (0 >= attemptCost))
198201 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
199202 else if ((0 > numGrands))
200203 then throw("Number of Grand Prizes should be non-negative")
201204 else $Tuple2([IntegerEntry(lastTourIdKey, tId), StringEntry(keyTourStaticDataById(tId), staticData(toBase58String(i.transactionId), registerCost, attemptCost, now, startTime, endTime, numGrands)), StringEntry(keyTourDynamicDataById(tId), dynamicData("CREATED", " ", 0, 0, 0))], tId)
202205 }
203206 }
204207
205208
206209
207210 @Callable(i)
208211 func register () = {
209212 let prologResult = prolog()
210213 if ((size(i.payments) != 1))
211214 then throw("exactly 1 payment must be attached")
212215 else {
213216 let pmt = i.payments[0]
214217 let wlgAmt = pmt.amount
215218 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
216219 if ((pmtAssetId != wlgAssetId))
217220 then throw("WLGOLD payments only!")
218221 else {
219222 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
220223 let now = lastBlock.timestamp
221224 let tData = getTourData(this, lastId)
222225 let static = tData[idxStatic]
223226 let dynamic = tData[idxDynamic]
224227 let status = dynamic[tDynamicStatus]
225228 if (!(if (if (if ((status == "CREATED"))
226229 then (now > parseIntValue(static[tStaticStart]))
227230 else false)
228231 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
229232 else false)
230233 then true
231234 else if ((status == "INPROGRESS"))
232235 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
233236 else false))
234237 then throw("Cannot register now")
235238 else {
236239 let regCost = parseIntValue(static[tStaticRegisterCost])
237240 if ((wlgAmt != regCost))
238241 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
239242 else {
240243 let duckAssetId = duckByCaller(i.originCaller)
241244 let oldScoreBoard = valueOrElse(getString(keyScoreBoardByTour(lastId)), "")
242245 if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))
243246 then true
244247 else contains(oldScoreBoard, duckAssetId))
245248 then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId)))
246249 else {
247250 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts]))
248251 $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyScoreBoardByTour(lastId), if ((oldScoreBoard == ""))
249252 then (duckAssetId + ":000")
250253 else (((oldScoreBoard + "_") + duckAssetId) + ":000")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult)
251254 }
252255 }
253256 }
254257 }
255258 }
256259 }
257260
258261
259262
260263 @Callable(i)
261264 func newAttempt () = {
262265 let prologResult = prolog()
263266 let duckAssetId = duckByCaller(i.originCaller)
264267 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
265268 let now = lastBlock.timestamp
266269 let tData = getTourData(this, lastId)
267270 let static = tData[idxStatic]
268271 let dynamic = tData[idxDynamic]
269272 let status = dynamic[tDynamicStatus]
270273 if (!(if ((status == "INPROGRESS"))
271274 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
272275 else false))
273276 then throw("Attempt is not possible")
274277 else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
275278 then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
276279 else {
277280 let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
278281 let lastAttempt = getInteger(attemptsIteratorKey)
279282 let $t060886720 = if (!(isDefined(lastAttempt)))
280283 then $Tuple2(0, 0)
281284 else if ((size(i.payments) != 1))
282285 then throw("exactly 1 payment must be attached")
283286 else {
284287 let pmt = i.payments[0]
285288 let wlgAmt = pmt.amount
286289 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
287290 if ((pmtAssetId != wlgAssetId))
288291 then throw("WLGOLD payments only!")
289292 else {
290293 let attCost = parseIntValue(static[tStaticAttemptCost])
291294 if ((wlgAmt != attCost))
292295 then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
293296 else $Tuple2((value(lastAttempt) + 1), 1)
294297 }
295298 }
296299 let payedAttempts = $t060886720._1
297300 let increment = $t060886720._2
298301 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
299302 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
300303 $Tuple2([IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
301304 }
302305 }
303306
304307
305308
306309 @Callable(i)
307310 func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract))
308311 then throw("Access denied")
309312 else {
310313 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
311314 let tData = getTourData(this, lastId)
312315 let static = tData[idxStatic]
313316 let dynamic = tData[idxDynamic]
314- if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest))
317+ let oldBest = parseIntValue(dynamic[tDynamicWinResult])
318+ if (if (if ((oldBest > newBest))
315319 then true
316320 else (dynamic[tDynamicStatus] != "INPROGRESS"))
317321 then true
318322 else (lastBlock.timestamp > parseIntValue(static[tStaticEnd])))
319323 then $Tuple2(nil, 0)
320324 else {
325+ let winnersKey = keyWinnersByTour(lastId)
326+ let winners = getString(winnersKey)
327+ let oldWinnersList = if (!(isDefined(winners)))
328+ then nil
329+ else split_4C(value(winners), "_")
330+ let newWinnersList = if ((newBest > oldBest))
331+ then [duckAssetId]
332+ else if (containsElement(oldWinnersList, duckAssetId))
333+ then oldWinnersList
334+ else (oldWinnersList :+ duckAssetId)
321335 let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
322- $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0)
336+ $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData), StringEntry(winnersKey, makeString_2C(newWinnersList, "_"))], 0)
323337 }
324338 }
325339
326340
327341
328342 @Callable(i)
329343 func saveDuckResult (duckAssetId,duckNewBest) = if ((i.caller != stakingContract))
330344 then throw("Access denied")
331345 else {
332346 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
333347 let tData = getTourData(this, lastId)
334348 let static = tData[idxStatic]
335349 let dynamic = tData[idxDynamic]
336350 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
337351 let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
338352 let sumScoresKey = keySumScoresByTour(lastId)
339353 let oldSumScores = valueOrElse(getInteger(sumScoresKey), 0)
340354 if (if (if (if ((curLocation[locIdxType] == "T"))
341355 then (parseIntValue(curLocation[locIdxContinent]) == lastId)
342356 else false)
343357 then (dynamic[tDynamicStatus] == "INPROGRESS")
344358 else false)
345359 then (parseIntValue(static[tStaticEnd]) >= lastBlock.timestamp)
346360 else false)
347361 then {
348362 let duckOldBest = valueOrElse(getInteger(bestResultKey), 0)
349363 let scoreKey = keyScoreBoardByTour(lastId)
350364 let oldScoreBoard = valueOrElse(getString(scoreKey), "")
351- let $t092539652 = if ((duckNewBest > duckOldBest))
365+ let $t0969710096 = if ((duckNewBest > duckOldBest))
352366 then if (!(contains(oldScoreBoard, duckAssetId)))
353367 then throw(("scoreBoard does not contain " + duckAssetId))
354368 else {
355369 let parts = split_51C(oldScoreBoard, duckAssetId)
356370 $Tuple2(((((parts[0] + duckAssetId) + ":") + padL(duckNewBest, 3)) + drop(parts[1], 4)), ((oldSumScores + duckNewBest) - duckOldBest))
357371 }
358372 else $Tuple2(oldScoreBoard, oldSumScores)
359- let newScoreBoard = $t092539652._1
360- let newSumScores = $t092539652._2
373+ let newScoreBoard = $t0969710096._1
374+ let newSumScores = $t0969710096._2
361375 $Tuple2([IntegerEntry(bestResultKey, max([duckOldBest, duckNewBest])), IntegerEntry(sumScoresKey, newSumScores), StringEntry(scoreKey, newScoreBoard)], 0)
362376 }
363377 else $Tuple2(nil, 0)
364378 }
365379
366380
367381
368382 @Callable(i)
369383 func processTournament (tId) = {
370384 let caller = toString(i.caller)
371385 if (!(containsElement(adminsList, caller)))
372386 then throw("Permission denied")
373387 else {
374388 let now = lastBlock.timestamp
375389 let tData = getTourData(this, tId)
376390 let static = tData[idxStatic]
377391 let dynamic = tData[idxDynamic]
378392 let status = dynamic[tDynamicStatus]
379393 if ((status == "ARCHIVED"))
380394 then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
381395 else if (if ((status == "INPROGRESS"))
382396 then (parseIntValue(static[tStaticEnd]) > now)
383397 else false)
384398 then throw((("Tournament " + toString(tId)) + " is not over yet"))
385399 else {
386400 let updatedDynamicData = dynamicData("PROCESSING", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
387401 $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
388402 }
389403 }
390404 }
391405
392406
393407
394408 @Callable(i)
395409 func finishTournament (tId) = {
396410 let caller = toString(i.caller)
397411 if (!(containsElement(adminsList, caller)))
398412 then throw("Permission denied")
399413 else {
400414 let tData = getTourData(this, tId)
401415 let dynamic = tData[idxDynamic]
402416 let status = dynamic[tDynamicStatus]
403417 if ((status == "ARCHIVED"))
404418 then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
405419 else {
406420 let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
407421 $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
408422 }
409423 }
410424 }
411425
412426

github/deemru/w8io/169f3d6 
61.44 ms