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