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:BgIfCAISBgoEAQEBARIAEgASBAoCCAESBAoCCAESAwoBATQAD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhARRrZXlTdGFrZWREdWNrQnlPd25lcgEJb3duZXJBZGRyCQCsAgICEnN0YWtlZER1Y2tCeU93bmVyXwUJb3duZXJBZGRyAQ9rZXlEdWNrTG9jYXRpb24BC2R1Y2tBc3NldElkCQCsAgICDWR1Y2tMb2NhdGlvbl8FC2R1Y2tBc3NldElkAA1sYXN0VG91cklkS2V5Ag4lc19fbGFzdFRvdXJJZAEVa2V5VG91clN0YXRpY0RhdGFCeUlkAQN0SWQJAKwCAgIWJXMlZF9fdG91clN0YXRpY0RhdGFfXwkApAMBBQN0SWQBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBA3RJZAkArAICAhclcyVkX190b3VyRHluYW1pY0RhdGFfXwkApAMBBQN0SWQBF2tleUFsbFJlZ2lzdHJhbnRzQnlUb3VyAQN0SWQJAKwCAgIWJXMlZF9fYWxsUmVnaXN0cmFudHNfXwkApAMBBQN0SWQACWlkeFN0YXRpYwAAA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AQxJbnRlZ2VyRW50cnkCBQ1iZXN0UmVzdWx0S2V5CQCWAwEJAMwIAgUNb2xkQmVzdFJlc3VsdAkAzAgCBQduZXdCZXN0BQNuaWwFA25pbAAACQCUCgIFA25pbAAAAWkBEGZpbmlzaFRvdXJuYW1lbnQBA3RJZAQGY2FsbGVyCQClCAEIBQFpBmNhbGxlcgMJAQEhAQkBD2NvbnRhaW5zRWxlbWVudAIFCmFkbWluc0xpc3QFBmNhbGxlcgkAAgECEVBlcm1pc3Npb24gZGVuaWVkBAV0RGF0YQkBC2dldFRvdXJEYXRhAgUEdGhpcwUDdElkBAdkeW5hbWljCQCRAwIFBXREYXRhBQppZHhEeW5hbWljBAZzdGF0dXMJAJEDAgUHZHluYW1pYwUOdER5bmFtaWNTdGF0dXMDCQAAAgUGc3RhdHVzAghBUkNISVZFRAkAAgEJAKwCAgkArAICAgtUb3VybmFtZW50IAkApAMBBQN0SWQCFCBpcyBhbHJlYWR5IEFSQ0hJVkVEBBJ1cGRhdGVkRHluYW1pY0RhdGEJAQtkeW5hbWljRGF0YQUCCEFSQ0hJVkVECQCRAwIFB2R5bmFtaWMFD3REeW5hbWljV2luRHVjawkBDXBhcnNlSW50VmFsdWUBCQCRAwIFB2R5bmFtaWMFEXREeW5hbWljV2luUmVzdWx0CQENcGFyc2VJbnRWYWx1ZQEJAJEDAgUHZHluYW1pYwUVdER5bmFtaWNUb3RhbFJlZ0NvdW50CQENcGFyc2VJbnRWYWx1ZQEJAJEDAgUHZHluYW1pYwUVdER5bmFtaWNUb3RhbEF0dGVtcHRzCQCUCgIJAMwIAgkBC1N0cmluZ0VudHJ5AgkBFmtleVRvdXJEeW5hbWljRGF0YUJ5SWQBBQN0SWQFEnVwZGF0ZWREeW5hbWljRGF0YQUDbmlsAAAA093VGQ==", "height": 2732104, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FTM676SsWURMh2DGwLBgsGcUQZ9iReZdyqhHzSh5hYtR Next: Ard2KekPMgzREu9fkdMxuL8atrT6Sn8u33oYpCRjYiE8 Diff:
OldNewDifferences
328328
329329
330330 @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)
331357 func finishTournament (tId) = {
332358 let caller = toString(i.caller)
333359 if (!(containsElement(adminsList, caller)))
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 keyAllRegistrantsByTour (tId) = ("%s%d__allRegistrants__" + toString(tId))
2121
2222
2323 let idxStatic = 0
2424
2525 let idxDynamic = 1
2626
2727 func getTourData (tourContract,tId) = {
2828 let static = split(valueOrErrorMessage(getString(tourContract, keyTourStaticDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
2929 let dynamic = split(valueOrErrorMessage(getString(tourContract, keyTourDynamicDataById(tId)), (("Error reading tournament " + toString(tId)) + " data")), "__")
3030 [static, dynamic]
3131 }
3232
3333
3434 let tStaticRegisterCost = 2
3535
3636 let tStaticAttemptCost = 3
3737
3838 let tStaticStart = 5
3939
4040 let tStaticEnd = 6
4141
4242 let tDynamicStatus = 1
4343
4444 let tDynamicWinDuck = 2
4545
4646 let tDynamicWinResult = 3
4747
4848 let tDynamicTotalRegCount = 4
4949
5050 let tDynamicTotalAttempts = 5
5151
5252 let locIdxContinent = 0
5353
5454 let locIdxType = 1
5555
5656 let locIdxId = 2
5757
5858 func keyLastRegisteredTourByDuck (duckAssetId) = ("%s%s__lastRegisteredTourByDuck__" + duckAssetId)
5959
6060
6161 func keyIsRegisteredByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__isRegisteredByTourAndDuck", toString(tId), duckAssetId], "__")
6262
6363
6464 func keyLastAttemptByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__lastAttemptByTourAndDuck", toString(tId), duckAssetId], "__")
6565
6666
6767 func keyBestResultByTourAndDuck (tId,duckAssetId) = makeString(["%s%d%s__bestResultByTourAndDuck", toString(tId), duckAssetId], "__")
6868
6969
7070 let chain = take(drop(this.bytes, 1), 1)
7171
7272 let defaultRestAddressStr = match chain {
7373 case _ =>
7474 if ((base58'2W' == $match0))
7575 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
7676 else if ((base58'2T' == $match0))
7777 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
7878 else throw("Unknown chain")
7979 }
8080
8181 let SEP = "__"
8282
8383 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
8484
8585
8686 let IdxCfgStakingDapp = 1
8787
8888 let IdxCfgWlgDapp = 4
8989
9090 func keyRestCfg () = "%s__restConfig"
9191
9292
9393 func keyRestAddress () = "%s__restAddr"
9494
9595
9696 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
9797
9898
9999 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
100100
101101
102102 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
103103
104104 let restCfg = readRestCfgOrFail(restContract)
105105
106106 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
107107
108108 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
109109
110110 let wlgAssetIdKey = "wlg_assetId"
111111
112112 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
113113
114114 func asString (v) = match v {
115115 case s: String =>
116116 s
117117 case _ =>
118118 throw("fail to cast into String")
119119 }
120120
121121
122122 func asInt (v) = match v {
123123 case n: Int =>
124124 n
125125 case _ =>
126126 throw("fail to cast into Int")
127127 }
128128
129129
130130 func fixedPoint (val,decimals) = {
131131 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
132132 let lowPart = toString((val % tenPow))
133133 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
134134 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
135135 }
136136
137137
138138 let MAXTOURNAMENTLENGTH = 432000000
139139
140140 let HOUR = 3600000
141141
142142 let adminsList = [toString(this), match chain {
143143 case _ =>
144144 if ((base58'2W' == $match0))
145145 then "3PEe2RELUHCFCBsmSCNcBJ8N3URLVQende7"
146146 else if ((base58'2T' == $match0))
147147 then "3MtBgJTaLxPB3C7UJD1UE8qjkHthfKvFQYY"
148148 else throw("Unknown chain")
149149 }]
150150
151151 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)
152152
153153
154154 func dynamicData (status,winDuck,winResult,totalRegs,totalAttempts) = makeString(["%s%s%d%d%d", status, winDuck, toString(winResult), toString(totalRegs), toString(totalAttempts)], SEP)
155155
156156
157157 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
158158
159159
160160 func duckByCaller (caller) = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(caller))), "You don't have a duck staked")
161161
162162
163163 @Callable(i)
164164 func createTournament (startTime,endTime,registerCost,attemptCost) = {
165165 let caller = toString(i.caller)
166166 if (!(containsElement(adminsList, caller)))
167167 then throw("Permission denied")
168168 else {
169169 let lastId = getInteger(lastTourIdKey)
170170 let tId = if (isDefined(lastId))
171171 then {
172172 let lastTourId = value(lastId)
173173 let dynamic = valueOrErrorMessage(getString(keyTourDynamicDataById(lastTourId)), (("Error reading tournament " + toString(lastTourId)) + " data"))
174174 let status = split(dynamic, SEP)[tDynamicStatus]
175175 if ((status != "ARCHIVED"))
176176 then throw(("Current tournement is not completed, status=" + status))
177177 else (lastTourId + 1)
178178 }
179179 else 1
180180 let now = lastBlock.timestamp
181181 if ((now > startTime))
182182 then throw(((("startTime=" + toString(startTime)) + " < creationTime=") + toString(now)))
183183 else if ((startTime > endTime))
184184 then throw(((("endTime=" + toString(endTime)) + " < startTime=") + toString(startTime)))
185185 else if (((endTime - startTime) > MAXTOURNAMENTLENGTH))
186186 then throw(((("Tournament period exceeds max: " + toString((endTime - startTime))) + " > ") + toString(MAXTOURNAMENTLENGTH)))
187187 else if (if ((0 >= registerCost))
188188 then true
189189 else (0 >= attemptCost))
190190 then throw(((("Cost should be positive, but passed " + toString(registerCost)) + " and ") + toString(attemptCost)))
191191 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)
192192 }
193193 }
194194
195195
196196
197197 @Callable(i)
198198 func register () = {
199199 let prologResult = prolog()
200200 if ((size(i.payments) != 1))
201201 then throw("exactly 1 payment must be attached")
202202 else {
203203 let pmt = i.payments[0]
204204 let wlgAmt = pmt.amount
205205 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
206206 if ((pmtAssetId != wlgAssetId))
207207 then throw("WLGOLD payments only!")
208208 else {
209209 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
210210 let now = lastBlock.timestamp
211211 let tData = getTourData(this, lastId)
212212 let static = tData[idxStatic]
213213 let dynamic = tData[idxDynamic]
214214 let status = dynamic[tDynamicStatus]
215215 if (!(if (if (if ((status == "CREATED"))
216216 then (now > parseIntValue(static[tStaticStart]))
217217 else false)
218218 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
219219 else false)
220220 then true
221221 else if ((status == "INPROGRESS"))
222222 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
223223 else false))
224224 then throw("Cannot register now")
225225 else {
226226 let regCost = parseIntValue(static[tStaticRegisterCost])
227227 if ((wlgAmt != regCost))
228228 then throw((("Need payment of " + fixedPoint(regCost, 8)) + " WLGOLD"))
229229 else {
230230 let duckAssetId = duckByCaller(i.originCaller)
231231 let oldRegistrants = valueOrElse(getString(keyAllRegistrantsByTour(lastId)), "")
232232 let regList = if ((oldRegistrants == ""))
233233 then nil
234234 else split_51C(oldRegistrants, "_")
235235 if (if (valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false))
236236 then true
237237 else containsElement(regList, duckAssetId))
238238 then throw(((("Your duck " + duckAssetId) + " is already registered at tournament ") + toString(lastId)))
239239 else {
240240 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), (parseIntValue(dynamic[tDynamicTotalRegCount]) + 1), parseIntValue(dynamic[tDynamicTotalAttempts]))
241241 $Tuple2([IntegerEntry(keyLastRegisteredTourByDuck(duckAssetId), lastId), BooleanEntry(keyIsRegisteredByTourAndDuck(lastId, duckAssetId), true), StringEntry(keyAllRegistrantsByTour(lastId), makeString_11C((regList :+ duckAssetId), "_")), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], prologResult)
242242 }
243243 }
244244 }
245245 }
246246 }
247247 }
248248
249249
250250
251251 @Callable(i)
252252 func newAttempt () = {
253253 let prologResult = prolog()
254254 let duckAssetId = duckByCaller(i.originCaller)
255255 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
256256 let now = lastBlock.timestamp
257257 let tData = getTourData(this, lastId)
258258 let static = tData[idxStatic]
259259 let dynamic = tData[idxDynamic]
260260 let status = dynamic[tDynamicStatus]
261261 if (!(if ((status == "INPROGRESS"))
262262 then ((parseIntValue(static[tStaticEnd]) - HOUR) > now)
263263 else false))
264264 then throw("Attempt is not possible")
265265 else if (!(valueOrElse(getBoolean(keyIsRegisteredByTourAndDuck(lastId, duckAssetId)), false)))
266266 then throw(((("Your duck " + duckAssetId) + " is not registered at tournament ") + toString(lastId)))
267267 else {
268268 let attemptsIteratorKey = keyLastAttemptByTourAndDuck(lastId, duckAssetId)
269269 let lastAttempt = getInteger(attemptsIteratorKey)
270270 let $t059656597 = if (!(isDefined(lastAttempt)))
271271 then $Tuple2(0, 0)
272272 else if ((size(i.payments) != 1))
273273 then throw("exactly 1 payment must be attached")
274274 else {
275275 let pmt = i.payments[0]
276276 let wlgAmt = pmt.amount
277277 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
278278 if ((pmtAssetId != wlgAssetId))
279279 then throw("WLGOLD payments only!")
280280 else {
281281 let attCost = parseIntValue(static[tStaticAttemptCost])
282282 if ((wlgAmt != attCost))
283283 then throw((("Need payment of " + fixedPoint(attCost, 8)) + " WLGOLD"))
284284 else $Tuple2((value(lastAttempt) + 1), 1)
285285 }
286286 }
287287 let payedAttempts = $t059656597._1
288288 let increment = $t059656597._2
289289 let updatedDynamicData = dynamicData("INPROGRESS", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), (parseIntValue(dynamic[tDynamicTotalAttempts]) + increment))
290290 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
291291 let bestResultKey = keyBestResultByTourAndDuck(lastId, duckAssetId)
292292 let best = if (if ((curLocation[locIdxType] == "T"))
293293 then (parseIntValue(curLocation[locIdxContinent]) == lastId)
294294 else false)
295295 then {
296296 let bestResult = valueOrElse(getInteger(bestResultKey), 0)
297297 let curResult = parseIntValue(curLocation[locIdxId])
298298 max([bestResult, curResult])
299299 }
300300 else 0
301301 let tourLoc = asString(invoke(stakingContract, "initDuckTourAttempt", [duckAssetId], nil))
302302 $Tuple2([IntegerEntry(bestResultKey, best), IntegerEntry(attemptsIteratorKey, payedAttempts), StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], [prologResult, payedAttempts, tourLoc])
303303 }
304304 }
305305
306306
307307
308308 @Callable(i)
309309 func updateDynamicData (duckAssetId,newBest) = if ((i.caller != stakingContract))
310310 then throw("Access denied")
311311 else {
312312 let lastId = valueOrErrorMessage(getInteger(lastTourIdKey), "No active tournaments")
313313 let tData = getTourData(this, lastId)
314314 let static = tData[idxStatic]
315315 let dynamic = tData[idxDynamic]
316316 if (if (if ((parseIntValue(dynamic[tDynamicWinResult]) >= newBest))
317317 then true
318318 else (dynamic[tDynamicStatus] != "INPROGRESS"))
319319 then true
320320 else (lastBlock.timestamp > parseIntValue(static[tStaticEnd])))
321321 then $Tuple2(nil, 0)
322322 else {
323323 let updatedDynamicData = dynamicData("INPROGRESS", duckAssetId, newBest, parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
324324 $Tuple2([StringEntry(keyTourDynamicDataById(lastId), updatedDynamicData)], 0)
325325 }
326326 }
327327
328328
329329
330330 @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)
331357 func finishTournament (tId) = {
332358 let caller = toString(i.caller)
333359 if (!(containsElement(adminsList, caller)))
334360 then throw("Permission denied")
335361 else {
336362 let tData = getTourData(this, tId)
337363 let dynamic = tData[idxDynamic]
338364 let status = dynamic[tDynamicStatus]
339365 if ((status == "ARCHIVED"))
340366 then throw((("Tournament " + toString(tId)) + " is already ARCHIVED"))
341367 else {
342368 let updatedDynamicData = dynamicData("ARCHIVED", dynamic[tDynamicWinDuck], parseIntValue(dynamic[tDynamicWinResult]), parseIntValue(dynamic[tDynamicTotalRegCount]), parseIntValue(dynamic[tDynamicTotalAttempts]))
343369 $Tuple2([StringEntry(keyTourDynamicDataById(tId), updatedDynamicData)], 0)
344370 }
345371 }
346372 }
347373
348374

github/deemru/w8io/169f3d6 
54.66 ms