tx · 3aoN9AuXMwdLHaBekAL7buTEmtTJQuxrgBgzypWPaab7

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.01200000 Waves

2023.09.05 16:25 [2742135] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "3aoN9AuXMwdLHaBekAL7buTEmtTJQuxrgBgzypWPaab7", "fee": 1200000, "feeAssetId": null, "timestamp": 1693920398119, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "18wBmDuhtPoNgRvvWtGQCkN6N3bqhpyUDVo1hjvmAk8GBCC2MNK7sToFLNrk7yKP9Mt9kTQmKgzadoNKh8ZaHrX" ], "script": "base64:BgIgCAISBwoFAQEBAQESABIAEgQKAggBEgQKAggBEgMKAQE0AA9ERUZBVUxUTE9DQVRJT04CD0FmcmljYV9GX0FmcmljYQEUa2V5U3Rha2VkRHVja0J5T3duZXIBCW93bmVyQWRkcgkArAICAhJzdGFrZWREdWNrQnlPd25lcl8FCW93bmVyQWRkcgEPa2V5RHVja0xvY2F0aW9uAQtkdWNrQXNzZXRJZAkArAICAg1kdWNrTG9jYXRpb25fBQtkdWNrQXNzZXRJZAANbGFzdFRvdXJJZEtleQIOJXNfX2xhc3RUb3VySWQBFWtleVRvdXJTdGF0aWNEYXRhQnlJZAEDdElkCQCsAgICFiVzJWRfX3RvdXJTdGF0aWNEYXRhX18JAKQDAQUDdElkARZrZXlUb3VyRHluYW1pY0RhdGFCeUlkAQN0SWQJAKwCAgIXJXMlZF9fdG91ckR5bmFtaWNEYXRhX18JAKQDAQUDdElkARNrZXlTY29yZUJvYXJkQnlUb3VyAQN0SWQJAKwCAgISJXMlZF9fc2NvcmVCb2FyZF9fCQCkAwEFA3RJZAEba2V5TGFzdFJlZ2lzdGVyZWRUb3V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JZAUSdXBkYXRlZER5bmFtaWNEYXRhBQNuaWwAAADd0Buc", "height": 2742135, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9YC1hZU7qSPga9Ts4kUWFAtsycG6RRXnCFPiP3exZyRE Next: 9iiwT1LASVMPfQGFTWbMTRfNsirwT1jUcnHy6CQqRRkw Diff:
OldNewDifferences
153153 else throw("Unknown chain")
154154 }]
155155
156-func staticData (txId,registerCost,attemptCost,creationTime,startTime,endTime) = makeString(["%s%d%d%d%d%d", txId, toString(registerCost), toString(attemptCost), toString(creationTime), toString(startTime), toString(endTime)], SEP)
156+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)
157157
158158
159159 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
166166
167167
168168 @Callable(i)
169-func createTournament (startTime,endTime,registerCost,attemptCost) = {
169+func createTournament (startTime,endTime,registerCost,attemptCost,numGrands) = {
170170 let caller = toString(i.caller)
171171 if (!(containsElement(adminsList, caller)))
172172 then throw("Permission denied")
193193 then true
194194 else (0 >= attemptCost))
195195 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
196- else $Tuple2([IntegerEntry(lastTourIdKey, tId), StringEntry(keyTourStaticDataById(tId), staticData(toBase58String(i.transactionId), registerCost, attemptCost, now, startTime, endTime)), StringEntry(keyTourDynamicDataById(tId), dynamicData("CREATED", " ", 0, 0, 0))], tId)
196+ else if ((0 > numGrands))
197+ then throw("Number of Grand Prizes should be non-negative")
198+ 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)
197199 }
198200 }
199201
271273 else {
272274 let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
273275 let lastAttempt = getInteger(attemptsIteratorKey)
274- let $t059246556 = if (!(isDefined(lastAttempt)))
276+ let $t060886720 = if (!(isDefined(lastAttempt)))
275277 then $Tuple2(0, 0)
276278 else if ((size(i.payments) != 1))
277279 then throw("exactly 1 payment must be attached")
288290 else $Tuple2((value(lastAttempt) + 1), 1)
289291 }
290292 }
291- let payedAttempts = $t059246556._1
292- let increment = $t059246556._2
293+ let payedAttempts = $t060886720._1
294+ let increment = $t060886720._2
293295 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
294296 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
295297 $Tuple2([IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
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 keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
2424
2525
2626 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__")
2727
2828
2929 func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__")
3030
3131
3232 func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__")
3333
3434
3535 let idxStatic = 0
3636
3737 let idxDynamic = 1
3838
3939 func getTourData (tourContract,tId) = {
4040 let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
4141 let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
4242 [static, dynamic]
4343 }
4444
4545
4646 let tStaticRegisterCost = 2
4747
4848 let tStaticAttemptCost = 3
4949
5050 let tStaticStart = 5
5151
5252 let tStaticEnd = 6
5353
5454 let tDynamicStatus = 1
5555
5656 let tDynamicWinDuck = 2
5757
5858 let tDynamicWinResult = 3
5959
6060 let tDynamicTotalRegCount = 4
6161
6262 let tDynamicTotalAttempts = 5
6363
6464 let locIdxContinent = 0
6565
6666 let locIdxType = 1
6767
6868 let chain = take(drop(this.bytes, 1), 1)
6969
7070 let defaultRestAddressStr = match chain {
7171 case _ =>
7272 if ((base58'2W' == $match0))
7373 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
7474 else if ((base58'2T' == $match0))
7575 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
7676 else throw("Unknown chain")
7777 }
7878
7979 let SEP = "__"
8080
8181 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
8282
8383
8484 let IdxCfgStakingDapp = 1
8585
8686 let IdxCfgWlgDapp = 4
8787
8888 func keyRestCfg () = "%s__restConfig"
8989
9090
9191 func keyRestAddress () = "%s__restAddr"
9292
9393
9494 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
9595
9696
9797 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
9898
9999
100100 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
101101
102102 let restCfg = readRestCfgOrFail(restContract)
103103
104104 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
105105
106106 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
107107
108108 let wlgAssetIdKey = "wlg_assetId"
109109
110110 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
111111
112112 func asString (v) = match v {
113113 case s: String =>
114114 s
115115 case _ =>
116116 throw("fail to cast into String")
117117 }
118118
119119
120120 func asInt (v) = match v {
121121 case n: Int =>
122122 n
123123 case _ =>
124124 throw("fail to cast into Int")
125125 }
126126
127127
128128 func fixedPoint (val,decimals) = {
129129 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
130130 let lowPart = toString((val % tenPow))
131131 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
132132 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
133133 }
134134
135135
136136 func padL (val,len) = {
137137 let valS = toString(val)
138138 let zeroes = drop(toString(pow(10, 0, (len - size(valS)), 0, 0, DOWN)), 1)
139139 (zeroes + valS)
140140 }
141141
142142
143143 let MAXTOURNAMENTLENGTH = 432000000
144144
145145 let HOUR = 3600000
146146
147147 let adminsList = [toString(this), match chain {
148148 case _ =>
149149 if ((base58'2W' == $match0))
150150 then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7"
151151 else if ((base58'2T' == $match0))
152152 then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY"
153153 else throw("Unknown chain")
154154 }]
155155
156-func staticData (txId,registerCost,attemptCost,creationTime,startTime,endTime) = makeString(["%s%d%d%d%d%d", txId, toString(registerCost), toString(attemptCost), toString(creationTime), toString(startTime), toString(endTime)], SEP)
156+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)
157157
158158
159159 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
160160
161161
162162 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
163163
164164
165165 func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
166166
167167
168168 @Callable(i)
169-func createTournament (startTime,endTime,registerCost,attemptCost) = {
169+func createTournament (startTime,endTime,registerCost,attemptCost,numGrands) = {
170170 let caller = toString(i.caller)
171171 if (!(containsElement(adminsList, caller)))
172172 then throw("Permission denied")
173173 else {
174174 let lastId = getInteger(lastTourIdKey)
175175 let tId = if (isDefined(lastId))
176176 then {
177177 let lastTourId = value(lastId)
178178 let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data"))
179179 let status = split(dynamic, SEP)[tDynamicStatus]
180180 if ((status != "ARCHIVED"))
181181 then throw(("Current tournement is not completed, status=" + status))
182182 else (lastTourId + 1)
183183 }
184184 else 1
185185 let now = lastBlock.timestamp
186186 if ((now > startTime))
187187 then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now)))
188188 else if ((startTime > endTime))
189189 then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime)))
190190 else if (((endTime - startTime) > MAXTOURNAMENTLENGTH))
191191 then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH)))
192192 else if (if ((0 >= registerCost))
193193 then true
194194 else (0 >= attemptCost))
195195 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
196- else $Tuple2([IntegerEntry(lastTourIdKey, tId), StringEntry(keyTourStaticDataById(tId), staticData(toBase58String(i.transactionId), registerCost, attemptCost, now, startTime, endTime)), StringEntry(keyTourDynamicDataById(tId), dynamicData("CREATED", " ", 0, 0, 0))], tId)
196+ else if ((0 > numGrands))
197+ then throw("Number of Grand Prizes should be non-negative")
198+ 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)
197199 }
198200 }
199201
200202
201203
202204 @Callable(i)
203205 func register () = {
204206 let prologResult = prolog()
205207 if ((size(i.payments) != 1))
206208 then throw("exactly 1 payment must be attached")
207209 else {
208210 let pmt = i.payments[0]
209211 let wlgAmt = pmt.amount
210212 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
211213 if ((pmtAssetId != wlgAssetId))
212214 then throw("WLGOLD payments only!")
213215 else {
214216 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
215217 let now = lastBlock.timestamp
216218 let tData = getTourData(this, lastId)
217219 let static = tData[idxStatic]
218220 let dynamic = tData[idxDynamic]
219221 let status = dynamic[tDynamicStatus]
220222 if (!(if (if (if ((status == "CREATED"))
221223 then (now > parseIntValue(static[tStaticStart]))
222224 else false)
223225 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
224226 else false)
225227 then true
226228 else if ((status == "INPROGRESS"))
227229 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
228230 else false))
229231 then throw("Cannot register now")
230232 else {
231233 let regCost = parseIntValue(static[tStaticRegisterCost])
232234 if ((wlgAmt != regCost))
233235 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
234236 else {
235237 let duckAssetId = duckByCaller(i.originCaller)
236238 let oldScoreBoard = valueOrElse(getString(keyScoreBoardByTour(lastId)), "")
237239 if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))
238240 then true
239241 else contains(oldScoreBoard, duckAssetId))
240242 then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId)))
241243 else {
242244 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts]))
243245 $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyScoreBoardByTour(lastId), if ((oldScoreBoard == ""))
244246 then (duckAssetId + ":000")
245247 else (((oldScoreBoard + "_") + duckAssetId) + ":000")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult)
246248 }
247249 }
248250 }
249251 }
250252 }
251253 }
252254
253255
254256
255257 @Callable(i)
256258 func newAttempt () = {
257259 let prologResult = prolog()
258260 let duckAssetId = duckByCaller(i.originCaller)
259261 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
260262 let now = lastBlock.timestamp
261263 let tData = getTourData(this, lastId)
262264 let static = tData[idxStatic]
263265 let dynamic = tData[idxDynamic]
264266 let status = dynamic[tDynamicStatus]
265267 if (!(if ((status == "INPROGRESS"))
266268 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
267269 else false))
268270 then throw("Attempt is not possible")
269271 else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
270272 then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
271273 else {
272274 let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
273275 let lastAttempt = getInteger(attemptsIteratorKey)
274- let $t059246556 = if (!(isDefined(lastAttempt)))
276+ let $t060886720 = if (!(isDefined(lastAttempt)))
275277 then $Tuple2(0, 0)
276278 else if ((size(i.payments) != 1))
277279 then throw("exactly 1 payment must be attached")
278280 else {
279281 let pmt = i.payments[0]
280282 let wlgAmt = pmt.amount
281283 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
282284 if ((pmtAssetId != wlgAssetId))
283285 then throw("WLGOLD payments only!")
284286 else {
285287 let attCost = parseIntValue(static[tStaticAttemptCost])
286288 if ((wlgAmt != attCost))
287289 then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
288290 else $Tuple2((value(lastAttempt) + 1), 1)
289291 }
290292 }
291- let payedAttempts = $t059246556._1
292- let increment = $t059246556._2
293+ let payedAttempts = $t060886720._1
294+ let increment = $t060886720._2
293295 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
294296 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
295297 $Tuple2([IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
296298 }
297299 }
298300
299301
300302
301303 @Callable(i)
302304 func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract))
303305 then throw("Access denied")
304306 else {
305307 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
306308 let tData = getTourData(this, lastId)
307309 let static = tData[idxStatic]
308310 let dynamic = tData[idxDynamic]
309311 if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest))
310312 then true
311313 else (dynamic[tDynamicStatus] != "INPROGRESS"))
312314 then true
313315 else (lastBlock.timestamp > parseIntValue(static[tStaticEnd])))
314316 then $Tuple2(nil, 0)
315317 else {
316318 let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
317319 $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0)
318320 }
319321 }
320322
321323
322324
323325 @Callable(i)
324326 func saveDuckResult (duckAssetId,newBest) = if ((i.caller != stakingContract))
325327 then throw("Access denied")
326328 else {
327329 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
328330 let tData = getTourData(this, lastId)
329331 let static = tData[idxStatic]
330332 let dynamic = tData[idxDynamic]
331333 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
332334 let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
333335 if (if (if (if ((curLocation[locIdxType] == "T"))
334336 then (parseIntValue(curLocation[locIdxContinent]) == lastId)
335337 else false)
336338 then (dynamic[tDynamicStatus] == "INPROGRESS")
337339 else false)
338340 then (parseIntValue(static[tStaticEnd]) >= lastBlock.timestamp)
339341 else false)
340342 then {
341343 let oldBestResult = valueOrElse(getInteger(bestResultKey), 0)
342344 let scoreKey = keyScoreBoardByTour(lastId)
343345 let oldScoreBoard = valueOrElse(getString(scoreKey), "")
344346 let updated = if ((newBest > oldBestResult))
345347 then if (!(contains(oldScoreBoard, duckAssetId)))
346348 then throw(("scoreBoard does not contain " + duckAssetId))
347349 else {
348350 let parts = split_51C(oldScoreBoard, duckAssetId)
349351 ((((parts[0] + duckAssetId) + ":") + padL(newBest, 3)) + drop(parts[1], 4))
350352 }
351353 else oldScoreBoard
352354 $Tuple2([IntegerEntry(bestResultKey, max([oldBestResult, newBest])), StringEntry(scoreKey, updated)], 0)
353355 }
354356 else $Tuple2(nil, 0)
355357 }
356358
357359
358360
359361 @Callable(i)
360362 func finishTournament (tId) = {
361363 let caller = toString(i.caller)
362364 if (!(containsElement(adminsList, caller)))
363365 then throw("Permission denied")
364366 else {
365367 let tData = getTourData(this, tId)
366368 let dynamic = tData[idxDynamic]
367369 let status = dynamic[tDynamicStatus]
368370 if ((status == "ARCHIVED"))
369371 then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
370372 else {
371373 let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
372374 $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
373375 }
374376 }
375377 }
376378
377379

github/deemru/w8io/169f3d6 
64.27 ms