tx · k9we15it79grTzFQsYa925Nh4fPwNyc3xGEWdPeZHqm

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.01200000 Waves

2023.08.31 17:28 [2734971] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "k9we15it79grTzFQsYa925Nh4fPwNyc3xGEWdPeZHqm", "fee": 1200000, "feeAssetId": null, "timestamp": 1693492209449, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "51PJJQ6LxToakii9pomJUHZ6QT481g7Q5mr9z7o6qdiEYgCBwTMAUuhfCUMf9wGM6iF1STGyscL6buPheWsGZNhF" ], "script": "base64:BgIfCAISBgoEAQEBARIAEgASBAoCCAESBAoCCAESAwoBATQAD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhARRrZXlTdGFrZWREdWNrQnlPd25lcgEJb3duZXJBZGRyCQCsAgICEnN0YWtlZER1Y2tCeU93bmVyXwUJb3duZXJBZGRyAQ9rZXlEdWNrTG9jYXRpb24BC2R1Y2tBc3NldElkCQCsAgICDWR1Y2tMb2NhdGlvbl8FC2R1Y2tBc3NldElkAA1sYXN0VG91cklkS2V5Ag4lc19fbGFzdFRvdXJJZAEVa2V5VG91clN0YXRpY0RhdGFCeUlkAQN0SWQJAKwCAgIWJXMlZF9fdG91clN0YXRpY0RhdGFfXwkApAMBBQN0SWQBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBA3RJZAkArAICAhclcyVkX190b3VyRHluYW1pY0RhdGFfXwkApAMBBQN0SWQBE2tleVNjb3JlQm9hcmRCeVRvdXIBA3RJZAkArAICAhIlcyVkX19zY29yZUJvYXJkX18JAKQDAQUDdElkARtrZXlMYXN0UmVnaXN0ZXJlZFRvdXJCeUR1Y2sBC2R1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W5hbWljRGF0YQUDbmlsAAAA8n+NqA==", "height": 2734971, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ard2KekPMgzREu9fkdMxuL8atrT6Sn8u33oYpCRjYiE8 Next: 9YC1hZU7qSPga9Ts4kUWFAtsycG6RRXnCFPiP3exZyRE Diff:
OldNewDifferences
6464 let locIdxContinent = 0
6565
6666 let locIdxType = 1
67-
68-let locIdxId = 2
6967
7068 let chain = take(drop(this.bytes, 1), 1)
7169
294292 let increment = $t059246556._2
295293 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
296294 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
297- let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
298- let best = if (if ((curLocation[locIdxType] == "T"))
299- then (parseIntValue(curLocation[locIdxContinent]) == lastId)
300- else false)
301- then {
302- let bestResult = valueOrElse(getInteger(bestResultKey), 0)
303- let curResult = parseIntValue(curLocation[locIdxId])
304- max([bestResult, curResult])
305- }
306- else 0
307295 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
308- $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
296+ $Tuple2([IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
309297 }
310298 }
311299
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 keyScoreBoardByTour (tId) = ("%s%d__scoreBoard__" + toString(tId))
2121
2222
2323 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
2424
2525
2626 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__")
2727
2828
2929 func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__")
3030
3131
3232 func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__")
3333
3434
3535 let idxStatic = 0
3636
3737 let idxDynamic = 1
3838
3939 func getTourData (tourContract,tId) = {
4040 let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
4141 let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
4242 [static, dynamic]
4343 }
4444
4545
4646 let tStaticRegisterCost = 2
4747
4848 let tStaticAttemptCost = 3
4949
5050 let tStaticStart = 5
5151
5252 let tStaticEnd = 6
5353
5454 let tDynamicStatus = 1
5555
5656 let tDynamicWinDuck = 2
5757
5858 let tDynamicWinResult = 3
5959
6060 let tDynamicTotalRegCount = 4
6161
6262 let tDynamicTotalAttempts = 5
6363
6464 let locIdxContinent = 0
6565
6666 let locIdxType = 1
67-
68-let locIdxId = 2
6967
7068 let chain = take(drop(this.bytes, 1), 1)
7169
7270 let defaultRestAddressStr = match chain {
7371 case _ =>
7472 if ((base58'2W' == $match0))
7573 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
7674 else if ((base58'2T' == $match0))
7775 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
7876 else throw("Unknown chain")
7977 }
8078
8179 let SEP = "__"
8280
8381 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
8482
8583
8684 let IdxCfgStakingDapp = 1
8785
8886 let IdxCfgWlgDapp = 4
8987
9088 func keyRestCfg () = "%s__restConfig"
9189
9290
9391 func keyRestAddress () = "%s__restAddr"
9492
9593
9694 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
9795
9896
9997 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
10098
10199
102100 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
103101
104102 let restCfg = readRestCfgOrFail(restContract)
105103
106104 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
107105
108106 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
109107
110108 let wlgAssetIdKey = "wlg_assetId"
111109
112110 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
113111
114112 func asString (v) = match v {
115113 case s: String =>
116114 s
117115 case _ =>
118116 throw("fail to cast into String")
119117 }
120118
121119
122120 func asInt (v) = match v {
123121 case n: Int =>
124122 n
125123 case _ =>
126124 throw("fail to cast into Int")
127125 }
128126
129127
130128 func fixedPoint (val,decimals) = {
131129 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
132130 let lowPart = toString((val % tenPow))
133131 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
134132 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
135133 }
136134
137135
138136 func padL (val,len) = {
139137 let valS = toString(val)
140138 let zeroes = drop(toString(pow(10, 0, (len - size(valS)), 0, 0, DOWN)), 1)
141139 (zeroes + valS)
142140 }
143141
144142
145143 let MAXTOURNAMENTLENGTH = 432000000
146144
147145 let HOUR = 3600000
148146
149147 let adminsList = [toString(this), match chain {
150148 case _ =>
151149 if ((base58'2W' == $match0))
152150 then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7"
153151 else if ((base58'2T' == $match0))
154152 then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY"
155153 else throw("Unknown chain")
156154 }]
157155
158156 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)
159157
160158
161159 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
162160
163161
164162 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
165163
166164
167165 func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
168166
169167
170168 @Callable(i)
171169 func createTournament (startTime,endTime,registerCost,attemptCost) = {
172170 let caller = toString(i.caller)
173171 if (!(containsElement(adminsList, caller)))
174172 then throw("Permission denied")
175173 else {
176174 let lastId = getInteger(lastTourIdKey)
177175 let tId = if (isDefined(lastId))
178176 then {
179177 let lastTourId = value(lastId)
180178 let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data"))
181179 let status = split(dynamic, SEP)[tDynamicStatus]
182180 if ((status != "ARCHIVED"))
183181 then throw(("Current tournement is not completed, status=" + status))
184182 else (lastTourId + 1)
185183 }
186184 else 1
187185 let now = lastBlock.timestamp
188186 if ((now > startTime))
189187 then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now)))
190188 else if ((startTime > endTime))
191189 then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime)))
192190 else if (((endTime - startTime) > MAXTOURNAMENTLENGTH))
193191 then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH)))
194192 else if (if ((0 >= registerCost))
195193 then true
196194 else (0 >= attemptCost))
197195 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
198196 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)
199197 }
200198 }
201199
202200
203201
204202 @Callable(i)
205203 func register () = {
206204 let prologResult = prolog()
207205 if ((size(i.payments) != 1))
208206 then throw("exactly 1 payment must be attached")
209207 else {
210208 let pmt = i.payments[0]
211209 let wlgAmt = pmt.amount
212210 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
213211 if ((pmtAssetId != wlgAssetId))
214212 then throw("WLGOLD payments only!")
215213 else {
216214 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
217215 let now = lastBlock.timestamp
218216 let tData = getTourData(this, lastId)
219217 let static = tData[idxStatic]
220218 let dynamic = tData[idxDynamic]
221219 let status = dynamic[tDynamicStatus]
222220 if (!(if (if (if ((status == "CREATED"))
223221 then (now > parseIntValue(static[tStaticStart]))
224222 else false)
225223 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
226224 else false)
227225 then true
228226 else if ((status == "INPROGRESS"))
229227 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
230228 else false))
231229 then throw("Cannot register now")
232230 else {
233231 let regCost = parseIntValue(static[tStaticRegisterCost])
234232 if ((wlgAmt != regCost))
235233 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
236234 else {
237235 let duckAssetId = duckByCaller(i.originCaller)
238236 let oldScoreBoard = valueOrElse(getString(keyScoreBoardByTour(lastId)), "")
239237 if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))
240238 then true
241239 else contains(oldScoreBoard, duckAssetId))
242240 then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId)))
243241 else {
244242 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts]))
245243 $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyScoreBoardByTour(lastId), if ((oldScoreBoard == ""))
246244 then (duckAssetId + ":000")
247245 else (((oldScoreBoard + "_") + duckAssetId) + ":000")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult)
248246 }
249247 }
250248 }
251249 }
252250 }
253251 }
254252
255253
256254
257255 @Callable(i)
258256 func newAttempt () = {
259257 let prologResult = prolog()
260258 let duckAssetId = duckByCaller(i.originCaller)
261259 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
262260 let now = lastBlock.timestamp
263261 let tData = getTourData(this, lastId)
264262 let static = tData[idxStatic]
265263 let dynamic = tData[idxDynamic]
266264 let status = dynamic[tDynamicStatus]
267265 if (!(if ((status == "INPROGRESS"))
268266 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
269267 else false))
270268 then throw("Attempt is not possible")
271269 else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
272270 then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
273271 else {
274272 let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
275273 let lastAttempt = getInteger(attemptsIteratorKey)
276274 let $t059246556 = if (!(isDefined(lastAttempt)))
277275 then $Tuple2(0, 0)
278276 else if ((size(i.payments) != 1))
279277 then throw("exactly 1 payment must be attached")
280278 else {
281279 let pmt = i.payments[0]
282280 let wlgAmt = pmt.amount
283281 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
284282 if ((pmtAssetId != wlgAssetId))
285283 then throw("WLGOLD payments only!")
286284 else {
287285 let attCost = parseIntValue(static[tStaticAttemptCost])
288286 if ((wlgAmt != attCost))
289287 then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
290288 else $Tuple2((value(lastAttempt) + 1), 1)
291289 }
292290 }
293291 let payedAttempts = $t059246556._1
294292 let increment = $t059246556._2
295293 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
296294 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
297- let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
298- let best = if (if ((curLocation[locIdxType] == "T"))
299- then (parseIntValue(curLocation[locIdxContinent]) == lastId)
300- else false)
301- then {
302- let bestResult = valueOrElse(getInteger(bestResultKey), 0)
303- let curResult = parseIntValue(curLocation[locIdxId])
304- max([bestResult, curResult])
305- }
306- else 0
307295 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
308- $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
296+ $Tuple2([IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
309297 }
310298 }
311299
312300
313301
314302 @Callable(i)
315303 func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract))
316304 then throw("Access denied")
317305 else {
318306 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
319307 let tData = getTourData(this, lastId)
320308 let static = tData[idxStatic]
321309 let dynamic = tData[idxDynamic]
322310 if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest))
323311 then true
324312 else (dynamic[tDynamicStatus] != "INPROGRESS"))
325313 then true
326314 else (lastBlock.timestamp > parseIntValue(static[tStaticEnd])))
327315 then $Tuple2(nil, 0)
328316 else {
329317 let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
330318 $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0)
331319 }
332320 }
333321
334322
335323
336324 @Callable(i)
337325 func saveDuckResult (duckAssetId,newBest) = if ((i.caller != stakingContract))
338326 then throw("Access denied")
339327 else {
340328 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
341329 let tData = getTourData(this, lastId)
342330 let static = tData[idxStatic]
343331 let dynamic = tData[idxDynamic]
344332 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
345333 let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
346334 if (if (if (if ((curLocation[locIdxType] == "T"))
347335 then (parseIntValue(curLocation[locIdxContinent]) == lastId)
348336 else false)
349337 then (dynamic[tDynamicStatus] == "INPROGRESS")
350338 else false)
351339 then (parseIntValue(static[tStaticEnd]) >= lastBlock.timestamp)
352340 else false)
353341 then {
354342 let oldBestResult = valueOrElse(getInteger(bestResultKey), 0)
355343 let scoreKey = keyScoreBoardByTour(lastId)
356344 let oldScoreBoard = valueOrElse(getString(scoreKey), "")
357345 let updated = if ((newBest > oldBestResult))
358346 then if (!(contains(oldScoreBoard, duckAssetId)))
359347 then throw(("scoreBoard does not contain " + duckAssetId))
360348 else {
361349 let parts = split_51C(oldScoreBoard, duckAssetId)
362350 ((((parts[0] + duckAssetId) + ":") + padL(newBest, 3)) + drop(parts[1], 4))
363351 }
364352 else oldScoreBoard
365353 $Tuple2([IntegerEntry(bestResultKey, max([oldBestResult, newBest])), StringEntry(scoreKey, updated)], 0)
366354 }
367355 else $Tuple2(nil, 0)
368356 }
369357
370358
371359
372360 @Callable(i)
373361 func finishTournament (tId) = {
374362 let caller = toString(i.caller)
375363 if (!(containsElement(adminsList, caller)))
376364 then throw("Permission denied")
377365 else {
378366 let tData = getTourData(this, tId)
379367 let dynamic = tData[idxDynamic]
380368 let status = dynamic[tDynamicStatus]
381369 if ((status == "ARCHIVED"))
382370 then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
383371 else {
384372 let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
385373 $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
386374 }
387375 }
388376 }
389377
390378

github/deemru/w8io/169f3d6 
62.78 ms