tx · Af8Ya79QSUcKfzfyqHyQrhjgdpXxCb1q9qWUkkmCCmvF

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.01000000 Waves

2023.08.06 16:41 [2698802] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "Af8Ya79QSUcKfzfyqHyQrhjgdpXxCb1q9qWUkkmCCmvF", "fee": 1000000, "feeAssetId": null, "timestamp": 1691329328022, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "6nJiWPcPPVtgUUqFxNJ4Rps4oHn86PXzopymukkhkPYmRuMD7u5DeHXa2Vqg6i7DuFjdTLhThNns4Syo1AewXZo" ], "script": "base64:BgIOCAISBgoEAQEBARIAEgAzAA9ERUZBVUxUTE9DQVRJT04CD0FmcmljYV9GX0FmcmljYQEUa2V5U3Rha2VkRHVja0J5T3duZXIBCW93bmVyQWRkcgkArAICAhJzdGFrZWREdWNrQnlPd25lcl8FCW93bmVyQWRkcgEPa2V5RHVja0xvY2F0aW9uAQtkdWNrQXNzZXRJZAkArAICAg1kdWNrTG9jYXRpb25fBQtkdWNrQXNzZXRJZAANbGFzdFRvdXJJZEtleQIOJXNfX2xhc3RUb3VySWQBFWtleVRvdXJTdGF0aWNEYXRhQnlJZAEDdElkCQCsAgICFiVzJWRfX3RvdXJTdGF0aWNEYXRhX18JAKQDAQUDdElkARZrZXlUb3VyRHluYW1pY0RhdGFCeUlkAQN0SWQJAKwCAgIXJXMlZF9fdG91ckR5bmFtaWNEYXRhX18JAKQDAQUDdElkARdrZXlBbGxSZWdpc3RyYW5kc0J5VG91cgEDdElkCQCsAgICFiVzJWRfX2FsbFJlZ2lzdHJhbmRzX18JAKQDAQUDdElkAAlpZHhTdGF0aWMAAAAKaWR4RHluYW1pYwABAQtnZ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hbWljRGF0YUJ5SWQBBQZsYXN0SWQFEnVwZGF0ZWREeW5hbWljRGF0YQUDbmlsCQDMCAIFDHByb2xvZ1Jlc3VsdAkAzAgCBQ1wYXllZEF0dGVtcHRzCQDMCAIFB3RvdXJMb2MFA25pbACYKx3f", "height": 2698802, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7w79SMLQzy6sU9UA4mqF75bPHBW8LhiMLn3htTSkKVLp Next: DpWnhQgmc4JDsXbFbEFTBPGTVvBJB8RyRA24QYBXRFLi Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let DEFAULTLOCATION = "Africa_F_Africa"
5+
46 func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr)
57
8+
9+func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId)
10+
11+
12+let lastTourIdKey = "%s__lastTourId"
613
714 func keyTourStaticDataById (tId) = ("%s%d__tourStaticData__" + toString(tId))
815
1118
1219
1320 func keyAllRegistrandsByTour (tId) = ("%s%d__allRegistrands__" + toString(tId))
21+
22+
23+let idxStatic = 0
24+
25+let idxDynamic = 1
26+
27+func getTourData (tourContract,tId) = {
28+ let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
29+ let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
30+[static, dynamic]
31+ }
1432
1533
1634 let tStaticRegisterCost = 2
2846 let tDynamicTotalRegCount = 4
2947
3048 let tDynamicTotalAttempts = 5
49+
50+let locIdxContinent = 0
51+
52+let locIdxType = 1
53+
54+let locIdxId = 2
3155
3256 let chain = take(drop(this.bytes, 1), 1)
3357
7397
7498 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
7599
100+func asString (v) = match v {
101+ case s: String =>
102+ s
103+ case _ =>
104+ throw("fail to cast into String")
105+}
106+
107+
76108 func asInt (v) = match v {
77109 case n: Int =>
78110 n
102134 else throw("Unknown chain")
103135 }]
104136
105-let lastTourIdKey = "%s__lastTourId"
106-
107137 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
108138
109139
110140 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], SEP)
141+
142+
143+func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], SEP)
144+
145+
146+func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], SEP)
111147
112148
113149 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)
117153
118154
119155 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
156+
157+
158+func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
120159
121160
122161 @Callable(i)
167206 else {
168207 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
169208 let now = lastBlock.timestamp
170- let static = split(valueOrErrorMessage(getString(keyTourStaticDataById(lastId)), (("Error reading tournament " + toString(lastId)) + " data")), SEP)
171- let dynamic = split(valueOrErrorMessage(getString(keyTourDynamicDataById(lastId)), (("Error reading tournament " + toString(lastId)) + " data")), SEP)
209+ let tData = getTourData(this, lastId)
210+ let static = tData[idxStatic]
211+ let dynamic = tData[idxDynamic]
172212 let status = dynamic[tDynamicStatus]
173213 if (!(if (if (if ((status == "CREATED"))
174214 then (now > parseIntValue(static[tStaticStart]))
185225 if ((wlgAmt != regCost))
186226 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
187227 else {
188- let addr = toString(i.originCaller)
189- let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(addr)), "You don't have a duck staked")
228+ let duckAssetId = duckByCaller(i.originCaller)
190229 let oldRegistrands = valueOrElse(getString(keyAllRegistrandsByTour(lastId)), "")
191230 let regList = if ((oldRegistrands == ""))
192231 then nil
206245 }
207246
208247
248+
249+@Callable(i)
250+func newAttempt () = {
251+ let prologResult = prolog()
252+ let duckAssetId = duckByCaller(i.originCaller)
253+ let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
254+ let now = lastBlock.timestamp
255+ let tData = getTourData(this, lastId)
256+ let static = tData[idxStatic]
257+ let dynamic = tData[idxDynamic]
258+ let status = dynamic[tDynamicStatus]
259+ if (!(if ((status == "INPROGRESS"))
260+ then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
261+ else false))
262+ then throw("Attempt is not possible")
263+ else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
264+ then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
265+ else {
266+ let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
267+ let lastAttempt = getInteger(attemptsIteratorKey)
268+ let $t065517184 = if (!(isDefined(lastAttempt)))
269+ then $Tuple2(0, 0)
270+ else if ((size(i.payments) != 1))
271+ then throw("exactly 1 payment must be attached")
272+ else {
273+ let pmt = i.payments[0]
274+ let wlgAmt = pmt.amount
275+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
276+ if ((pmtAssetId != wlgAssetId))
277+ then throw("WLGOLD payments only!")
278+ else {
279+ let attCost = parseIntValue(static[tStaticRegisterCost])
280+ if ((wlgAmt != attCost))
281+ then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
282+ else $Tuple2((value(lastAttempt) + 1), 1)
283+ }
284+ }
285+ let payedAttempts = $t065517184._1
286+ let increment = $t065517184._2
287+ let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
288+ let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
289+ let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
290+ let best = if (if ((curLocation[locIdxType] == "T"))
291+ then (parseIntValue(curLocation[locIdxContinent]) == lastId)
292+ else false)
293+ then {
294+ let bestResult = valueOrElse(getInteger(bestResultKey), 0)
295+ let curResult = parseIntValue(curLocation[locIdxId])
296+ max([bestResult, curResult])
297+ }
298+ else 0
299+ let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
300+ $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
301+ }
302+ }
303+
304+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let DEFAULTLOCATION = "Africa_F_Africa"
5+
46 func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr)
57
8+
9+func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId)
10+
11+
12+let lastTourIdKey = "%s__lastTourId"
613
714 func keyTourStaticDataById (tId) = ("%s%d__tourStaticData__" + toString(tId))
815
916
1017 func keyTourDynamicDataById (tId) = ("%s%d__tourDynamicData__" + toString(tId))
1118
1219
1320 func keyAllRegistrandsByTour (tId) = ("%s%d__allRegistrands__" + toString(tId))
21+
22+
23+let idxStatic = 0
24+
25+let idxDynamic = 1
26+
27+func getTourData (tourContract,tId) = {
28+ let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
29+ let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
30+[static, dynamic]
31+ }
1432
1533
1634 let tStaticRegisterCost = 2
1735
1836 let tStaticStart = 5
1937
2038 let tStaticEnd = 6
2139
2240 let tDynamicStatus = 1
2341
2442 let tDynamicWinDuck = 2
2543
2644 let tDynamicWinResult = 3
2745
2846 let tDynamicTotalRegCount = 4
2947
3048 let tDynamicTotalAttempts = 5
49+
50+let locIdxContinent = 0
51+
52+let locIdxType = 1
53+
54+let locIdxId = 2
3155
3256 let chain = take(drop(this.bytes, 1), 1)
3357
3458 let defaultRestAddressStr = match chain {
3559 case _ =>
3660 if ((base58'2W' == $match0))
3761 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
3862 else if ((base58'2T' == $match0))
3963 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
4064 else throw("Unknown chain")
4165 }
4266
4367 let SEP = "__"
4468
4569 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
4670
4771
4872 let IdxCfgStakingDapp = 1
4973
5074 let IdxCfgWlgDapp = 4
5175
5276 func keyRestCfg () = "%s__restConfig"
5377
5478
5579 func keyRestAddress () = "%s__restAddr"
5680
5781
5882 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
5983
6084
6185 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
6286
6387
6488 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
6589
6690 let restCfg = readRestCfgOrFail(restContract)
6791
6892 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
6993
7094 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
7195
7296 let wlgAssetIdKey = "wlg_assetId"
7397
7498 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
7599
100+func asString (v) = match v {
101+ case s: String =>
102+ s
103+ case _ =>
104+ throw("fail to cast into String")
105+}
106+
107+
76108 func asInt (v) = match v {
77109 case n: Int =>
78110 n
79111 case _ =>
80112 throw("fail to cast into Int")
81113 }
82114
83115
84116 func fixedPoint (val,decimals) = {
85117 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
86118 let lowPart = toString((val % tenPow))
87119 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
88120 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
89121 }
90122
91123
92124 let MAXTOURNAMENTLENGTH = 432000000
93125
94126 let HOUR = 3600000
95127
96128 let adminsList = [toString(this), match chain {
97129 case _ =>
98130 if ((base58'2W' == $match0))
99131 then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7"
100132 else if ((base58'2T' == $match0))
101133 then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY"
102134 else throw("Unknown chain")
103135 }]
104136
105-let lastTourIdKey = "%s__lastTourId"
106-
107137 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
108138
109139
110140 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], SEP)
141+
142+
143+func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], SEP)
144+
145+
146+func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], SEP)
111147
112148
113149 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)
114150
115151
116152 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
117153
118154
119155 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
156+
157+
158+func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
120159
121160
122161 @Callable(i)
123162 func createTournament (startTime,endTime,registerCost,attemptCost) = {
124163 let caller = toString(i.caller)
125164 if (!(containsElement(adminsList, caller)))
126165 then throw("Permission denied")
127166 else {
128167 let lastId = getInteger(lastTourIdKey)
129168 let tId = if (isDefined(lastId))
130169 then {
131170 let lastTourId = value(lastId)
132171 let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data"))
133172 let status = split(dynamic, SEP)[tDynamicStatus]
134173 if ((status != "ARCHIVED"))
135174 then throw(("Current tournement is not completed, status=" + status))
136175 else (lastTourId + 1)
137176 }
138177 else 1
139178 let now = lastBlock.timestamp
140179 if ((now > startTime))
141180 then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now)))
142181 else if ((startTime > endTime))
143182 then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime)))
144183 else if (((endTime - startTime) > MAXTOURNAMENTLENGTH))
145184 then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH)))
146185 else if (if ((0 >= registerCost))
147186 then true
148187 else (0 >= attemptCost))
149188 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
150189 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)
151190 }
152191 }
153192
154193
155194
156195 @Callable(i)
157196 func register () = {
158197 let prologResult = prolog()
159198 if ((size(i.payments) != 1))
160199 then throw("exactly 1 payment must be attached")
161200 else {
162201 let pmt = i.payments[0]
163202 let wlgAmt = pmt.amount
164203 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
165204 if ((pmtAssetId != wlgAssetId))
166205 then throw("WLGOLD payments only!")
167206 else {
168207 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
169208 let now = lastBlock.timestamp
170- let static = split(valueOrErrorMessage(getString(keyTourStaticDataById(lastId)), (("Error reading tournament " + toString(lastId)) + " data")), SEP)
171- let dynamic = split(valueOrErrorMessage(getString(keyTourDynamicDataById(lastId)), (("Error reading tournament " + toString(lastId)) + " data")), SEP)
209+ let tData = getTourData(this, lastId)
210+ let static = tData[idxStatic]
211+ let dynamic = tData[idxDynamic]
172212 let status = dynamic[tDynamicStatus]
173213 if (!(if (if (if ((status == "CREATED"))
174214 then (now > parseIntValue(static[tStaticStart]))
175215 else false)
176216 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
177217 else false)
178218 then true
179219 else if ((status == "INPROGRESS"))
180220 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
181221 else false))
182222 then throw("Cannot register now")
183223 else {
184224 let regCost = parseIntValue(static[tStaticRegisterCost])
185225 if ((wlgAmt != regCost))
186226 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
187227 else {
188- let addr = toString(i.originCaller)
189- let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(addr)), "You don't have a duck staked")
228+ let duckAssetId = duckByCaller(i.originCaller)
190229 let oldRegistrands = valueOrElse(getString(keyAllRegistrandsByTour(lastId)), "")
191230 let regList = if ((oldRegistrands == ""))
192231 then nil
193232 else split_51C(oldRegistrands, "_")
194233 if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))
195234 then true
196235 else containsElement(regList, duckAssetId))
197236 then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId)))
198237 else {
199238 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts]))
200239 $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyAllRegistrandsByTour(lastId), makeString_11C((regList :+ duckAssetId), "_")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult)
201240 }
202241 }
203242 }
204243 }
205244 }
206245 }
207246
208247
248+
249+@Callable(i)
250+func newAttempt () = {
251+ let prologResult = prolog()
252+ let duckAssetId = duckByCaller(i.originCaller)
253+ let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
254+ let now = lastBlock.timestamp
255+ let tData = getTourData(this, lastId)
256+ let static = tData[idxStatic]
257+ let dynamic = tData[idxDynamic]
258+ let status = dynamic[tDynamicStatus]
259+ if (!(if ((status == "INPROGRESS"))
260+ then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
261+ else false))
262+ then throw("Attempt is not possible")
263+ else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
264+ then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
265+ else {
266+ let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
267+ let lastAttempt = getInteger(attemptsIteratorKey)
268+ let $t065517184 = if (!(isDefined(lastAttempt)))
269+ then $Tuple2(0, 0)
270+ else if ((size(i.payments) != 1))
271+ then throw("exactly 1 payment must be attached")
272+ else {
273+ let pmt = i.payments[0]
274+ let wlgAmt = pmt.amount
275+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
276+ if ((pmtAssetId != wlgAssetId))
277+ then throw("WLGOLD payments only!")
278+ else {
279+ let attCost = parseIntValue(static[tStaticRegisterCost])
280+ if ((wlgAmt != attCost))
281+ then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
282+ else $Tuple2((value(lastAttempt) + 1), 1)
283+ }
284+ }
285+ let payedAttempts = $t065517184._1
286+ let increment = $t065517184._2
287+ let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
288+ let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
289+ let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
290+ let best = if (if ((curLocation[locIdxType] == "T"))
291+ then (parseIntValue(curLocation[locIdxContinent]) == lastId)
292+ else false)
293+ then {
294+ let bestResult = valueOrElse(getInteger(bestResultKey), 0)
295+ let curResult = parseIntValue(curLocation[locIdxId])
296+ max([bestResult, curResult])
297+ }
298+ else 0
299+ let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
300+ $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
301+ }
302+ }
303+
304+

github/deemru/w8io/169f3d6 
49.68 ms