tx · 8gD9UxYGB6JYS8QeDdKLxRdm8RZd47cvaqELfvDLkhzX 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx: -0.01000000 Waves 2023.08.07 16:53 [2700252] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves
{ "type": 13, "id": "8gD9UxYGB6JYS8QeDdKLxRdm8RZd47cvaqELfvDLkhzX", "fee": 1000000, "feeAssetId": null, "timestamp": 1691416473720, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "35k5LUnWCYg8DZCDfZRdLehK7WyjVzPViRX7YpLHXM7cpgAXhrRBAUVBMjMf1h5i4RWHyqipHY15m6Nz61Uo8bT9" ], "script": "base64:BgIUCAISBgoEAQEBARIAEgASBAoCCAEzAA9ERUZBVUxUTE9DQVRJT04CD0FmcmljYV9GX0FmcmljYQEUa2V5U3Rha2VkRHVja0J5T3duZXIBCW93bmVyQWRkcgkArAICAhJzdGFrZWREdWNrQnlPd25lcl8FCW93bmVyQWRkcgEPa2V5RHVja0xvY2F0aW9uAQtkdWNrQXNzZXRJZAkArAICAg1kdWNrTG9jYXRpb25fBQtkdWNrQXNzZXRJZAANbGFzdFRvdXJJZEtleQIOJXNfX2xhc3RUb3VySWQBFWtleVRvdXJTdGF0aWNEYXRhQnlJZAEDdElkCQCsAgICFiVzJWRfX3RvdXJTdGF0aWNEYXRhX18JAKQDAQUDdElkARZrZXlUb3VyRHluYW1pY0RhdGFCeUlkAQN0SWQJAKwCAgIXJXMlZF9fdG91ckR5bmFtaWNEYXRhX18JAKQDAQUDdElkARdrZXlBbGxSZWdpc3RyYW50c0J5VG91cgEDdElkCQCsAgICFiVzJWRfX2FsbFJlZ2lzdHJhbnRzX18JAKQDAQUDdElkAAlpZHhTdGF0aWMAAAAKaWR4RHluYW1pYwABA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leVRvdXJEeW5hbWljRGF0YUJ5SWQBBQZsYXN0SWQFEnVwZGF0ZWREeW5hbWljRGF0YQUDbmlsAAAA9qX1TA==", "height": 2700252, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5pWhgbRucrwfVGuWWfGmBaNpxMoWMacRu5K3s4zEfxcx Next: 8LvbRt3f1VS1rKLqBbpBw6YUBpCpK6g8zWGi7hWSUnFm Diff:
Old | New | Differences | |
---|---|---|---|
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 | - | 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) | |
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 | ||
265 | 265 | else { | |
266 | 266 | let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId) | |
267 | 267 | let lastAttempt = getInteger(attemptsIteratorKey) | |
268 | - | let $ | |
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") | |
282 | 282 | else $Tuple2((value(lastAttempt) + 1), 1) | |
283 | 283 | } | |
284 | 284 | } | |
285 | - | let payedAttempts = $ | |
286 | - | let increment = $ | |
285 | + | let payedAttempts = $t065527185._1 | |
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) |
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 | - | 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) | |
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 | - | let $ | |
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 | - | let payedAttempts = $ | |
286 | - | let increment = $ | |
285 | + | let payedAttempts = $t065527185._1 | |
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 |
github/deemru/w8io/169f3d6 52.31 ms ◑