tx · CSVycTpXFweKEpZrm1A8a6pseMHK56Ltqx9b44rHhpMn

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.01100000 Waves

2023.08.09 11:41 [2702827] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "CSVycTpXFweKEpZrm1A8a6pseMHK56Ltqx9b44rHhpMn", "fee": 1100000, "feeAssetId": null, "timestamp": 1691570507158, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "QcnYq2281jnoLUYhzr3xtqoQwR1R4Gb1Sz7sWueH3FSBHfWUAZpdtqJDhhZfWmhwGX4FepQDMJzdw2QLogiYo4M" ], "script": "base64:BgIZCAISBgoEAQEBARIAEgASBAoCCAESAwoBATMAD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhARRrZXlTdGFrZWREdWNrQnlPd25lcgEJb3duZXJBZGRyCQCsAgICEnN0YWtlZER1Y2tCeU93bmVyXwUJb3duZXJBZGRyAQ9rZXlEdWNrTG9jYXRpb24BC2R1Y2tBc3NldElkCQCsAgICDWR1Y2tMb2NhdGlvbl8FC2R1Y2tBc3NldElkAA1sYXN0VG91cklkS2V5Ag4lc19fbGFzdFRvdXJJZAEVa2V5VG91clN0YXRpY0RhdGFCeUlkAQN0SWQJAKwCAgIWJXMlZF9fdG91clN0YXRpY0RhdGFfXwkApAMBBQN0SWQBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBA3RJZAkArAICAhclcyVkX190b3VyRHluYW1pY0RhdGFfXwkApAMBBQN0SWQBF2tleUFsbFJlZ2lzdHJhbnRzQnlUb3VyAQN0SWQJAKwCAgIWJXMlZF9fYWxsUmVnaXN0cmFudHNfXwkApAMBBQN0SWQACWlkeFN0YXRpYwAAAAppZHhEeW5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Bmxhc3RJZAUSdXBkYXRlZER5bmFtaWNEYXRhBQNuaWwAAAFpARBmaW5pc2hUb3VybmFtZW50AQN0SWQEBmNhbGxlcgkApQgBCAUBaQZjYWxsZXIDCQEBIQEJAQ9jb250YWluc0VsZW1lbnQCBQphZG1pbnNMaXN0BQZjYWxsZXIJAAIBAhFQZXJtaXNzaW9uIGRlbmllZAQFdERhdGEJAQtnZXRUb3VyRGF0YQIFBHRoaXMFA3RJZAQHZHluYW1pYwkAkQMCBQV0RGF0YQUKaWR4RHluYW1pYwQGc3RhdHVzCQCRAwIFB2R5bmFtaWMFDnREeW5hbWljU3RhdHVzAwkAAAIFBnN0YXR1cwIIQVJDSElWRUQJAAIBCQCsAgIJAKwCAgILVG91cm5hbWVudCAJAKQDAQUDdElkAhQgaXMgYWxyZWFkeSBBUkNISVZFRAQSdXBkYXRlZER5bmFtaWNEYXRhCQELZHluYW1pY0RhdGEFAghBUkNISVZFRAkAkQMCBQdkeW5hbWljBQ90RHluYW1pY1dpbkR1Y2sJAQ1wYXJzZUludFZhbHVlAQkAkQMCBQdkeW5hbWljBRF0RHluYW1pY1dpblJlc3VsdAkBDXBhcnNlSW50VmFsdWUBCQCRAwIFB2R5bmFtaWMFFXREeW5hbWljVG90YWxSZWdDb3VudAkBDXBhcnNlSW50VmFsdWUBCQCRAwIFB2R5bmFtaWMFFXREeW5hbWljVG90YWxBdHRlbXB0cwkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQIJARZrZXlUb3VyRHluYW1pY0RhdGFCeUlkAQUDdElkBRJ1cGRhdGVkRHluYW1pY0RhdGEFA25pbAAAAKTYyzA=", "height": 2702827, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8LvbRt3f1VS1rKLqBbpBw6YUBpCpK6g8zWGi7hWSUnFm Next: FzD3K9KbTurZU1zhdsQ2q35o6VpyX3W8KbsbLfRS6Kjq Diff:
OldNewDifferences
324324 }
325325
326326
327+
328+@Callable(i)
329+func finishTournament (tId) = {
330+ let caller = toString(i.caller)
331+ if (!(containsElement(adminsList, caller)))
332+ then throw("Permission denied")
333+ else {
334+ let tData = getTourData(this, tId)
335+ let dynamic = tData[idxDynamic]
336+ let status = dynamic[tDynamicStatus]
337+ if ((status == "ARCHIVED"))
338+ then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
339+ else {
340+ let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
341+ $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
342+ }
343+ }
344+ }
345+
346+
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 keyAllRegistrantsByTour (tId) = ("%s%d__allRegistrants__" + toString(tId))
2121
2222
2323 let idxStatic = 0
2424
2525 let idxDynamic = 1
2626
2727 func getTourData (tourContract,tId) = {
2828 let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
2929 let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
3030 [static, dynamic]
3131 }
3232
3333
3434 let tStaticRegisterCost = 2
3535
3636 let tStaticStart = 5
3737
3838 let tStaticEnd = 6
3939
4040 let tDynamicStatus = 1
4141
4242 let tDynamicWinDuck = 2
4343
4444 let tDynamicWinResult = 3
4545
4646 let tDynamicTotalRegCount = 4
4747
4848 let tDynamicTotalAttempts = 5
4949
5050 let locIdxContinent = 0
5151
5252 let locIdxType = 1
5353
5454 let locIdxId = 2
5555
5656 let chain = take(drop(this.bytes, 1), 1)
5757
5858 let defaultRestAddressStr = match chain {
5959 case _ =>
6060 if ((base58'2W' == $match0))
6161 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
6262 else if ((base58'2T' == $match0))
6363 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
6464 else throw("Unknown chain")
6565 }
6666
6767 let SEP = "__"
6868
6969 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
7070
7171
7272 let IdxCfgStakingDapp = 1
7373
7474 let IdxCfgWlgDapp = 4
7575
7676 func keyRestCfg () = "%s__restConfig"
7777
7878
7979 func keyRestAddress () = "%s__restAddr"
8080
8181
8282 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
8383
8484
8585 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
8686
8787
8888 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
8989
9090 let restCfg = readRestCfgOrFail(restContract)
9191
9292 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
9393
9494 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
9595
9696 let wlgAssetIdKey = "wlg_assetId"
9797
9898 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
9999
100100 func asString (v) = match v {
101101 case s: String =>
102102 s
103103 case _ =>
104104 throw("fail to cast into String")
105105 }
106106
107107
108108 func asInt (v) = match v {
109109 case n: Int =>
110110 n
111111 case _ =>
112112 throw("fail to cast into Int")
113113 }
114114
115115
116116 func fixedPoint (val,decimals) = {
117117 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
118118 let lowPart = toString((val % tenPow))
119119 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
120120 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
121121 }
122122
123123
124124 let MAXTOURNAMENTLENGTH = 432000000
125125
126126 let HOUR = 3600000
127127
128128 let adminsList = [toString(this), match chain {
129129 case _ =>
130130 if ((base58'2W' == $match0))
131131 then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7"
132132 else if ((base58'2T' == $match0))
133133 then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY"
134134 else throw("Unknown chain")
135135 }]
136136
137137 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
138138
139139
140140 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], SEP)
141141
142142
143143 func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], SEP)
144144
145145
146146 func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], SEP)
147147
148148
149149 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)
150150
151151
152152 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
153153
154154
155155 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
156156
157157
158158 func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
159159
160160
161161 @Callable(i)
162162 func createTournament (startTime,endTime,registerCost,attemptCost) = {
163163 let caller = toString(i.caller)
164164 if (!(containsElement(adminsList, caller)))
165165 then throw("Permission denied")
166166 else {
167167 let lastId = getInteger(lastTourIdKey)
168168 let tId = if (isDefined(lastId))
169169 then {
170170 let lastTourId = value(lastId)
171171 let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data"))
172172 let status = split(dynamic, SEP)[tDynamicStatus]
173173 if ((status != "ARCHIVED"))
174174 then throw(("Current tournement is not completed, status=" + status))
175175 else (lastTourId + 1)
176176 }
177177 else 1
178178 let now = lastBlock.timestamp
179179 if ((now > startTime))
180180 then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now)))
181181 else if ((startTime > endTime))
182182 then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime)))
183183 else if (((endTime - startTime) > MAXTOURNAMENTLENGTH))
184184 then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH)))
185185 else if (if ((0 >= registerCost))
186186 then true
187187 else (0 >= attemptCost))
188188 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
189189 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)
190190 }
191191 }
192192
193193
194194
195195 @Callable(i)
196196 func register () = {
197197 let prologResult = prolog()
198198 if ((size(i.payments) != 1))
199199 then throw("exactly 1 payment must be attached")
200200 else {
201201 let pmt = i.payments[0]
202202 let wlgAmt = pmt.amount
203203 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
204204 if ((pmtAssetId != wlgAssetId))
205205 then throw("WLGOLD payments only!")
206206 else {
207207 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
208208 let now = lastBlock.timestamp
209209 let tData = getTourData(this, lastId)
210210 let static = tData[idxStatic]
211211 let dynamic = tData[idxDynamic]
212212 let status = dynamic[tDynamicStatus]
213213 if (!(if (if (if ((status == "CREATED"))
214214 then (now > parseIntValue(static[tStaticStart]))
215215 else false)
216216 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
217217 else false)
218218 then true
219219 else if ((status == "INPROGRESS"))
220220 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
221221 else false))
222222 then throw("Cannot register now")
223223 else {
224224 let regCost = parseIntValue(static[tStaticRegisterCost])
225225 if ((wlgAmt != regCost))
226226 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
227227 else {
228228 let duckAssetId = duckByCaller(i.originCaller)
229229 let oldRegistrants = valueOrElse(getString(keyAllRegistrantsByTour(lastId)), "")
230230 let regList = if ((oldRegistrants == ""))
231231 then nil
232232 else split_51C(oldRegistrants, "_")
233233 if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))
234234 then true
235235 else containsElement(regList, duckAssetId))
236236 then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId)))
237237 else {
238238 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts]))
239239 $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyAllRegistrantsByTour(lastId), makeString_11C((regList :+ duckAssetId), "_")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult)
240240 }
241241 }
242242 }
243243 }
244244 }
245245 }
246246
247247
248248
249249 @Callable(i)
250250 func newAttempt () = {
251251 let prologResult = prolog()
252252 let duckAssetId = duckByCaller(i.originCaller)
253253 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
254254 let now = lastBlock.timestamp
255255 let tData = getTourData(this, lastId)
256256 let static = tData[idxStatic]
257257 let dynamic = tData[idxDynamic]
258258 let status = dynamic[tDynamicStatus]
259259 if (!(if ((status == "INPROGRESS"))
260260 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
261261 else false))
262262 then throw("Attempt is not possible")
263263 else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
264264 then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
265265 else {
266266 let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
267267 let lastAttempt = getInteger(attemptsIteratorKey)
268268 let $t065527185 = if (!(isDefined(lastAttempt)))
269269 then $Tuple2(0, 0)
270270 else if ((size(i.payments) != 1))
271271 then throw("exactly 1 payment must be attached")
272272 else {
273273 let pmt = i.payments[0]
274274 let wlgAmt = pmt.amount
275275 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
276276 if ((pmtAssetId != wlgAssetId))
277277 then throw("WLGOLD payments only!")
278278 else {
279279 let attCost = parseIntValue(static[tStaticRegisterCost])
280280 if ((wlgAmt != attCost))
281281 then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
282282 else $Tuple2((value(lastAttempt) + 1), 1)
283283 }
284284 }
285285 let payedAttempts = $t065527185._1
286286 let increment = $t065527185._2
287287 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
288288 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
289289 let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
290290 let best = if (if ((curLocation[locIdxType] == "T"))
291291 then (parseIntValue(curLocation[locIdxContinent]) == lastId)
292292 else false)
293293 then {
294294 let bestResult = valueOrElse(getInteger(bestResultKey), 0)
295295 let curResult = parseIntValue(curLocation[locIdxId])
296296 max([bestResult, curResult])
297297 }
298298 else 0
299299 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
300300 $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
301301 }
302302 }
303303
304304
305305
306306 @Callable(i)
307307 func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract))
308308 then throw("Access denied")
309309 else {
310310 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
311311 let tData = getTourData(this, lastId)
312312 let static = tData[idxStatic]
313313 let dynamic = tData[idxDynamic]
314314 if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest))
315315 then true
316316 else (dynamic[tDynamicStatus] != "INPROGRESS"))
317317 then true
318318 else (lastBlock.timestamp > parseIntValue(static[tStaticEnd])))
319319 then $Tuple2(nil, 0)
320320 else {
321321 let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
322322 $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0)
323323 }
324324 }
325325
326326
327+
328+@Callable(i)
329+func finishTournament (tId) = {
330+ let caller = toString(i.caller)
331+ if (!(containsElement(adminsList, caller)))
332+ then throw("Permission denied")
333+ else {
334+ let tData = getTourData(this, tId)
335+ let dynamic = tData[idxDynamic]
336+ let status = dynamic[tDynamicStatus]
337+ if ((status == "ARCHIVED"))
338+ then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
339+ else {
340+ let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
341+ $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
342+ }
343+ }
344+ }
345+
346+

github/deemru/w8io/169f3d6 
44.13 ms