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:BgIZCAISBgoEAQEBARIAEgASBAoCCAESAwoBATMAD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhARRrZXlTdGFrZWREdWNrQnlPd25lcgEJb3duZXJBZGRyCQCsAgICEnN0YWtlZER1Y2tCeU93bmVyXwUJb3duZXJBZGRyAQ9rZXlEdWNrTG9jYXRpb24BC2R1Y2tBc3NldElkCQCsAgICDWR1Y2tMb2NhdGlvbl8FC2R1Y2tBc3NldElkAA1sYXN0VG91cklkS2V5Ag4lc19fbGFzdFRvdXJJZAEVa2V5VG91clN0YXRpY0RhdGFCeUlkAQN0SWQJAKwCAgIWJXMlZF9fdG91clN0YXRpY0RhdGFfXwkApAMBBQN0SWQBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBA3RJZAkArAICAhclcyVkX190b3VyRHluYW1pY0RhdGFfXwkApAMBBQN0SWQBF2tleUFsbFJlZ2lzdHJhbnRzQnlUb3VyAQN0SWQJAKwCAgIWJXMlZF9fYWxsUmVnaXN0cmFudHNfXwkApAMBBQN0SWQACWlkeFN0YXRpYwAAAAppZHhEeW5h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mxhc3RJZAUSdXBkYXRlZER5bmFtaWNEYXRhBQNuaWwAAAFpARBmaW5pc2hUb3VybmFtZW50AQN0SWQEBmNhbGxlcgkApQgBCAUBaQZjYWxsZXIDCQEBIQEJAQ9jb250YWluc0VsZW1lbnQCBQphZG1pbnNMaXN0BQZjYWxsZXIJAAIBAhFQZXJtaXNzaW9uIGRlbmllZAQFdERhdGEJAQtnZXRUb3VyRGF0YQIFBHRoaXMFA3RJZAQHZHluYW1pYwkAkQMCBQV0RGF0YQUKaWR4RHluYW1pYwQGc3RhdHVzCQCRAwIFB2R5bmFtaWMFDnREeW5hbWljU3RhdHVzAwkAAAIFBnN0YXR1cwIIQVJDSElWRUQJAAIBCQCsAgIJAKwCAgILVG91cm5hbWVudCAJAKQDAQUDdElkAhQgaXMgYWxyZWFkeSBBUkNISVZFRAQSdXBkYXRlZER5bmFtaWNEYXRhCQELZHluYW1pY0RhdGEFAghBUkNISVZFRAkAkQMCBQdkeW5hbWljBQ90RHluYW1pY1dpbkR1Y2sJAQ1wYXJzZUludFZhbHVlAQkAkQMCBQdkeW5hbWljBRF0RHluYW1pY1dpblJlc3VsdAkBDXBhcnNlSW50VmFsdWUBCQCRAwIFB2R5bmFtaWMFFXREeW5hbWljVG90YWxSZWdDb3VudAkBDXBhcnNlSW50VmFsdWUBCQCRAwIFB2R5bmFtaWMFFXREeW5hbWljVG90YWxBdHRlbXB0cwkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQIJARZrZXlUb3VyRHluYW1pY0RhdGFCeUlkAQUDdElkBRJ1cGRhdGVkRHluYW1pY0RhdGEFA25pbAAAAKTYyzA=", "height": 2702827, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8LvbRt3f1VS1rKLqBbpBw6YUBpCpK6g8zWGi7hWSUnFm Next: FzD3K9KbTurZU1zhdsQ2q35o6VpyX3W8KbsbLfRS6Kjq Diff:
Old | New | Differences | |
---|---|---|---|
324 | 324 | } | |
325 | 325 | ||
326 | 326 | ||
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 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let DEFAULTLOCATION = "Africa_F_Africa" | |
5 | 5 | ||
6 | 6 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | let lastTourIdKey = "%s__lastTourId" | |
13 | 13 | ||
14 | 14 | func keyTourStaticDataById (tId) = ("%s%d__tourStaticData__" + toString(tId)) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyTourDynamicDataById (tId) = ("%s%d__tourDynamicData__" + toString(tId)) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyAllRegistrantsByTour (tId) = ("%s%d__allRegistrants__" + toString(tId)) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | let idxStatic = 0 | |
24 | 24 | ||
25 | 25 | let idxDynamic = 1 | |
26 | 26 | ||
27 | 27 | func getTourData (tourContract,tId) = { | |
28 | 28 | let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__") | |
29 | 29 | let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__") | |
30 | 30 | [static, dynamic] | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | let tStaticRegisterCost = 2 | |
35 | 35 | ||
36 | 36 | let tStaticStart = 5 | |
37 | 37 | ||
38 | 38 | let tStaticEnd = 6 | |
39 | 39 | ||
40 | 40 | let tDynamicStatus = 1 | |
41 | 41 | ||
42 | 42 | let tDynamicWinDuck = 2 | |
43 | 43 | ||
44 | 44 | let tDynamicWinResult = 3 | |
45 | 45 | ||
46 | 46 | let tDynamicTotalRegCount = 4 | |
47 | 47 | ||
48 | 48 | let tDynamicTotalAttempts = 5 | |
49 | 49 | ||
50 | 50 | let locIdxContinent = 0 | |
51 | 51 | ||
52 | 52 | let locIdxType = 1 | |
53 | 53 | ||
54 | 54 | let locIdxId = 2 | |
55 | 55 | ||
56 | 56 | let chain = take(drop(this.bytes, 1), 1) | |
57 | 57 | ||
58 | 58 | let defaultRestAddressStr = match chain { | |
59 | 59 | case _ => | |
60 | 60 | if ((base58'2W' == $match0)) | |
61 | 61 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
62 | 62 | else if ((base58'2T' == $match0)) | |
63 | 63 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
64 | 64 | else throw("Unknown chain") | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | let SEP = "__" | |
68 | 68 | ||
69 | 69 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | let IdxCfgStakingDapp = 1 | |
73 | 73 | ||
74 | 74 | let IdxCfgWlgDapp = 4 | |
75 | 75 | ||
76 | 76 | func keyRestCfg () = "%s__restConfig" | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func keyRestAddress () = "%s__restAddr" | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
89 | 89 | ||
90 | 90 | let restCfg = readRestCfgOrFail(restContract) | |
91 | 91 | ||
92 | 92 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
93 | 93 | ||
94 | 94 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
95 | 95 | ||
96 | 96 | let wlgAssetIdKey = "wlg_assetId" | |
97 | 97 | ||
98 | 98 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet") | |
99 | 99 | ||
100 | 100 | func asString (v) = match v { | |
101 | 101 | case s: String => | |
102 | 102 | s | |
103 | 103 | case _ => | |
104 | 104 | throw("fail to cast into String") | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func asInt (v) = match v { | |
109 | 109 | case n: Int => | |
110 | 110 | n | |
111 | 111 | case _ => | |
112 | 112 | throw("fail to cast into Int") | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func fixedPoint (val,decimals) = { | |
117 | 117 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
118 | 118 | let lowPart = toString((val % tenPow)) | |
119 | 119 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
120 | 120 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | let MAXTOURNAMENTLENGTH = 432000000 | |
125 | 125 | ||
126 | 126 | let HOUR = 3600000 | |
127 | 127 | ||
128 | 128 | let adminsList = [toString(this), match chain { | |
129 | 129 | case _ => | |
130 | 130 | if ((base58'2W' == $match0)) | |
131 | 131 | then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7" | |
132 | 132 | else if ((base58'2T' == $match0)) | |
133 | 133 | then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY" | |
134 | 134 | else throw("Unknown chain") | |
135 | 135 | }] | |
136 | 136 | ||
137 | 137 | func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], SEP) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], SEP) | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], SEP) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | 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) | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil)) | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked") | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | @Callable(i) | |
162 | 162 | func createTournament (startTime,endTime,registerCost,attemptCost) = { | |
163 | 163 | let caller = toString(i.caller) | |
164 | 164 | if (!(containsElement(adminsList, caller))) | |
165 | 165 | then throw("Permission denied") | |
166 | 166 | else { | |
167 | 167 | let lastId = getInteger(lastTourIdKey) | |
168 | 168 | let tId = if (isDefined(lastId)) | |
169 | 169 | then { | |
170 | 170 | let lastTourId = value(lastId) | |
171 | 171 | let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data")) | |
172 | 172 | let status = split(dynamic, SEP)[tDynamicStatus] | |
173 | 173 | if ((status != "ARCHIVED")) | |
174 | 174 | then throw(("Current tournement is not completed, status=" + status)) | |
175 | 175 | else (lastTourId + 1) | |
176 | 176 | } | |
177 | 177 | else 1 | |
178 | 178 | let now = lastBlock.timestamp | |
179 | 179 | if ((now > startTime)) | |
180 | 180 | then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now))) | |
181 | 181 | else if ((startTime > endTime)) | |
182 | 182 | then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime))) | |
183 | 183 | else if (((endTime - startTime) > MAXTOURNAMENTLENGTH)) | |
184 | 184 | then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH))) | |
185 | 185 | else if (if ((0 >= registerCost)) | |
186 | 186 | then true | |
187 | 187 | else (0 >= attemptCost)) | |
188 | 188 | then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost))) | |
189 | 189 | 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) | |
190 | 190 | } | |
191 | 191 | } | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | ||
195 | 195 | @Callable(i) | |
196 | 196 | func register () = { | |
197 | 197 | let prologResult = prolog() | |
198 | 198 | if ((size(i.payments) != 1)) | |
199 | 199 | then throw("exactly 1 payment must be attached") | |
200 | 200 | else { | |
201 | 201 | let pmt = i.payments[0] | |
202 | 202 | let wlgAmt = pmt.amount | |
203 | 203 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!") | |
204 | 204 | if ((pmtAssetId != wlgAssetId)) | |
205 | 205 | then throw("WLGOLD payments only!") | |
206 | 206 | else { | |
207 | 207 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
208 | 208 | let now = lastBlock.timestamp | |
209 | 209 | let tData = getTourData(this, lastId) | |
210 | 210 | let static = tData[idxStatic] | |
211 | 211 | let dynamic = tData[idxDynamic] | |
212 | 212 | let status = dynamic[tDynamicStatus] | |
213 | 213 | if (!(if (if (if ((status == "CREATED")) | |
214 | 214 | then (now > parseIntValue(static[tStaticStart])) | |
215 | 215 | else false) | |
216 | 216 | then ((parseIntValue(static[tStaticEnd]) - HOUR) > now) | |
217 | 217 | else false) | |
218 | 218 | then true | |
219 | 219 | else if ((status == "INPROGRESS")) | |
220 | 220 | then ((parseIntValue(static[tStaticEnd]) - HOUR) > now) | |
221 | 221 | else false)) | |
222 | 222 | then throw("Cannot register now") | |
223 | 223 | else { | |
224 | 224 | let regCost = parseIntValue(static[tStaticRegisterCost]) | |
225 | 225 | if ((wlgAmt != regCost)) | |
226 | 226 | then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD")) | |
227 | 227 | else { | |
228 | 228 | let duckAssetId = duckByCaller(i.originCaller) | |
229 | 229 | let oldRegistrants = valueOrElse(getString(keyAllRegistrantsByTour(lastId)), "") | |
230 | 230 | let regList = if ((oldRegistrants == "")) | |
231 | 231 | then nil | |
232 | 232 | else split_51C(oldRegistrants, "_") | |
233 | 233 | if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)) | |
234 | 234 | then true | |
235 | 235 | else containsElement(regList, duckAssetId)) | |
236 | 236 | then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId))) | |
237 | 237 | else { | |
238 | 238 | let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts])) | |
239 | 239 | $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyAllRegistrantsByTour(lastId), makeString_11C((regList :+ duckAssetId), "_")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult) | |
240 | 240 | } | |
241 | 241 | } | |
242 | 242 | } | |
243 | 243 | } | |
244 | 244 | } | |
245 | 245 | } | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | ||
249 | 249 | @Callable(i) | |
250 | 250 | func newAttempt () = { | |
251 | 251 | let prologResult = prolog() | |
252 | 252 | let duckAssetId = duckByCaller(i.originCaller) | |
253 | 253 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
254 | 254 | let now = lastBlock.timestamp | |
255 | 255 | let tData = getTourData(this, lastId) | |
256 | 256 | let static = tData[idxStatic] | |
257 | 257 | let dynamic = tData[idxDynamic] | |
258 | 258 | let status = dynamic[tDynamicStatus] | |
259 | 259 | if (!(if ((status == "INPROGRESS")) | |
260 | 260 | then ((parseIntValue(static[tStaticEnd]) - HOUR) > now) | |
261 | 261 | else false)) | |
262 | 262 | then throw("Attempt is not possible") | |
263 | 263 | else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))) | |
264 | 264 | then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId))) | |
265 | 265 | else { | |
266 | 266 | let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId) | |
267 | 267 | let lastAttempt = getInteger(attemptsIteratorKey) | |
268 | 268 | let $t065527185 = if (!(isDefined(lastAttempt))) | |
269 | 269 | then $Tuple2(0, 0) | |
270 | 270 | else if ((size(i.payments) != 1)) | |
271 | 271 | then throw("exactly 1 payment must be attached") | |
272 | 272 | else { | |
273 | 273 | let pmt = i.payments[0] | |
274 | 274 | let wlgAmt = pmt.amount | |
275 | 275 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!") | |
276 | 276 | if ((pmtAssetId != wlgAssetId)) | |
277 | 277 | then throw("WLGOLD payments only!") | |
278 | 278 | else { | |
279 | 279 | let attCost = parseIntValue(static[tStaticRegisterCost]) | |
280 | 280 | if ((wlgAmt != attCost)) | |
281 | 281 | then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD")) | |
282 | 282 | else $Tuple2((value(lastAttempt) + 1), 1) | |
283 | 283 | } | |
284 | 284 | } | |
285 | 285 | let payedAttempts = $t065527185._1 | |
286 | 286 | let increment = $t065527185._2 | |
287 | 287 | let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment)) | |
288 | 288 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
289 | 289 | let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId) | |
290 | 290 | let best = if (if ((curLocation[locIdxType] == "T")) | |
291 | 291 | then (parseIntValue(curLocation[locIdxContinent]) == lastId) | |
292 | 292 | else false) | |
293 | 293 | then { | |
294 | 294 | let bestResult = valueOrElse(getInteger(bestResultKey), 0) | |
295 | 295 | let curResult = parseIntValue(curLocation[locIdxId]) | |
296 | 296 | max([bestResult, curResult]) | |
297 | 297 | } | |
298 | 298 | else 0 | |
299 | 299 | let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil)) | |
300 | 300 | $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc]) | |
301 | 301 | } | |
302 | 302 | } | |
303 | 303 | ||
304 | 304 | ||
305 | 305 | ||
306 | 306 | @Callable(i) | |
307 | 307 | func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract)) | |
308 | 308 | then throw("Access denied") | |
309 | 309 | else { | |
310 | 310 | let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments") | |
311 | 311 | let tData = getTourData(this, lastId) | |
312 | 312 | let static = tData[idxStatic] | |
313 | 313 | let dynamic = tData[idxDynamic] | |
314 | 314 | if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest)) | |
315 | 315 | then true | |
316 | 316 | else (dynamic[tDynamicStatus] != "INPROGRESS")) | |
317 | 317 | then true | |
318 | 318 | else (lastBlock.timestamp > parseIntValue(static[tStaticEnd]))) | |
319 | 319 | then $Tuple2(nil, 0) | |
320 | 320 | else { | |
321 | 321 | let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts])) | |
322 | 322 | $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0) | |
323 | 323 | } | |
324 | 324 | } | |
325 | 325 | ||
326 | 326 | ||
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 ◑