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