tx · FHPVvmewUmrBzp43sA9LoBCAVr6sCF7fE8UUxyum8qS3 3NBWVfQbLU9yqYFNpGUMtmURyrH7bYq1XHz: -0.01500000 Waves 2019.07.11 11:59 [580823] smart account 3NBWVfQbLU9yqYFNpGUMtmURyrH7bYq1XHz > SELF 0.00000000 Waves
{ "type": 13, "id": "FHPVvmewUmrBzp43sA9LoBCAVr6sCF7fE8UUxyum8qS3", "fee": 1500000, "feeAssetId": null, "timestamp": 1562835590097, "version": 1, "sender": "3NBWVfQbLU9yqYFNpGUMtmURyrH7bYq1XHz", "senderPublicKey": "4Fo9f1CzjjVp3zkua3g1NBYdWmSEdxLKTkoC663PvJYG", "proofs": [ "3LZP1YBWCd5FfJ4KKqiWFXsxaM5yRD5G4dusT9RupNio8R7ENh2P9HpcZZdpaUXmMitCCQTit6hEeDiF84EVSuF4" ], "script": "base64:AAIDAAAAAAAAAAAAAAAvAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFxbEFpQU5TbUJwREhZS1A5c0tnZU4vbDFiQWIyOGcvdEdsZ0Rrd1Q1RmlNTjRYM3B3ZHZkeEU3bXZTUjgvNDFkVTlyeDRqRys2dFpwYjFVTFZEUHM0MzF0UjJJUmFUWHc1Q2orQWMydmhMKzVKYW1DZXJHRDFVVytiaC9FR1F0eG84VzNZTERyb2ZYQjVRSEp4NFBrejJLZ2Yrb1MvQzhoSHVCL1U0a3JPNzZVMDUwN0dUalpQUDlrUlEwdUxTTWVxUVh0OHdYUytuTXA1d2FqcXhQcERMTWFTUkVnc0t3di9BRWtQN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AAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAMJAAAAAAAAAgkBAAAACElzREFwcFVwAAAAAAcJAAAAAAAAAgkBAAAAEkV4dHJhY3RSZXNlcnZlZEFtdAAAAAAAAAAAAAAAAAAHBwe/r0gf", "chainId": 84, "height": 580823, "spentComplexity": 0 } View: original | compacted Prev: 93d1rQxcimJXjBmYkdDV9RGXBpBBDiTkiR57WgjnzrHM Next: none Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j") | |
11 | 11 | ||
12 | - | let RANDORACLETIMEFRAME = | |
12 | + | let RANDORACLETIMEFRAME = 2880 | |
13 | 13 | ||
14 | 14 | let MAXDIFF = (70 * WAVELET) | |
15 | 15 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WAVELET = ((100 * 1000) * 1000) | |
5 | 5 | ||
6 | 6 | let COMMISSION = ((5 * WAVELET) / 1000) | |
7 | 7 | ||
8 | 8 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlAiANSmBpDHYKP9sKgeN/l1bAb28g/tGlgDkwT5FiMN4X3pwdvdxE7mvSR8/41dU9rx4jG+6tZpb1ULVDPs431tR2IRaTXw5Cj+Ac2vhL+5JamCerGD1UW+bh/EGQtxo8W3YLDrofXB5QHJx4Pkz2Kgf+oS/C8hHuB/U4krO76U0507GTjZPP9kRQ0uLSMeqQXt8wXS+nMp5wajqxPpDLMaSREgsKwv/AEkP4dzpTYbikLBYl4qtdJsD84HLFSkiwd3BhcOrPjoIYmLxQuBD5TIMKTKD3sdZgaY9rsyqx3A00innyxD6zp3b4gFpUOX8JxKZdEC2myEqleNgg7GzwIDAQAB") | |
9 | 9 | ||
10 | 10 | let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j") | |
11 | 11 | ||
12 | - | let RANDORACLETIMEFRAME = | |
12 | + | let RANDORACLETIMEFRAME = 2880 | |
13 | 13 | ||
14 | 14 | let MAXDIFF = (70 * WAVELET) | |
15 | 15 | ||
16 | 16 | let BET1 = (1 * WAVELET) | |
17 | 17 | ||
18 | 18 | let BET2 = (2 * WAVELET) | |
19 | 19 | ||
20 | 20 | let BET4 = (4 * WAVELET) | |
21 | 21 | ||
22 | 22 | let BET8 = (8 * WAVELET) | |
23 | 23 | ||
24 | 24 | let BET14 = (14 * WAVELET) | |
25 | 25 | ||
26 | 26 | let RATEMULT = 10000 | |
27 | 27 | ||
28 | 28 | let RATE1 = 39655 | |
29 | 29 | ||
30 | 30 | let RATE2 = 24600 | |
31 | 31 | ||
32 | 32 | let RATE3 = 19000 | |
33 | 33 | ||
34 | 34 | let RATE4 = 14200 | |
35 | 35 | ||
36 | 36 | let RATE5 = 11400 | |
37 | 37 | ||
38 | 38 | let IdxGameState = 0 | |
39 | 39 | ||
40 | 40 | let IdxPlayerChoice = 1 | |
41 | 41 | ||
42 | 42 | let IdxPlayerPubKey58 = 2 | |
43 | 43 | ||
44 | 44 | let IdxStartedHeight = 3 | |
45 | 45 | ||
46 | 46 | let IdxWinAmt = 4 | |
47 | 47 | ||
48 | 48 | let IdxRandOrEmpty = 5 | |
49 | 49 | ||
50 | 50 | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
51 | 51 | ||
52 | 52 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
53 | 53 | ||
54 | 54 | let DAPPUPKEY = "$DAPP_UP" | |
55 | 55 | ||
56 | 56 | let MAXBALANCEKEY = "$MAX_BALANCE" | |
57 | 57 | ||
58 | 58 | let STATESUBMITTED = "SUBMITTED" | |
59 | 59 | ||
60 | 60 | let STATEWON = "WON" | |
61 | 61 | ||
62 | 62 | let STATELOST = "LOST" | |
63 | 63 | ||
64 | 64 | func IncrementGameNum () = { | |
65 | 65 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
66 | 66 | case num: Int => | |
67 | 67 | num | |
68 | 68 | case _ => | |
69 | 69 | 0 | |
70 | 70 | } | |
71 | 71 | (gameNum + 1) | |
72 | 72 | } | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
76 | 76 | case a: Int => | |
77 | 77 | a | |
78 | 78 | case _ => | |
79 | 79 | 0 | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
84 | 84 | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
85 | 85 | let balance = wavesBalance(this) | |
86 | 86 | if ((newReservedAmount > balance)) | |
87 | 87 | then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.") | |
88 | 88 | else newReservedAmount | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func DecreaseReservedAmt (gameId,winAmt) = { | |
93 | 93 | let newReservedAmount = (ExtractReservedAmt() - winAmt) | |
94 | 94 | if ((0 > newReservedAmount)) | |
95 | 95 | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
96 | 96 | else DataEntry(RESERVATIONKEY, newReservedAmount) | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = { | |
101 | 101 | let betAmtValid = if (if (if (if ((betAmt == (BET1 + COMMISSION))) | |
102 | 102 | then true | |
103 | 103 | else (betAmt == (BET2 + COMMISSION))) | |
104 | 104 | then true | |
105 | 105 | else (betAmt == (BET4 + COMMISSION))) | |
106 | 106 | then true | |
107 | 107 | else (betAmt == (BET8 + COMMISSION))) | |
108 | 108 | then true | |
109 | 109 | else (betAmt == (BET14 + COMMISSION)) | |
110 | 110 | if (betAmtValid) | |
111 | 111 | then { | |
112 | 112 | let dicesCount = size(playerChoice) | |
113 | 113 | let bet = (betAmt - COMMISSION) | |
114 | 114 | if ((dicesCount == 1)) | |
115 | 115 | then ((bet * RATE1) / RATEMULT) | |
116 | 116 | else if ((dicesCount == 2)) | |
117 | 117 | then ((bet * RATE2) / RATEMULT) | |
118 | 118 | else if ((dicesCount == 3)) | |
119 | 119 | then ((bet * RATE3) / RATEMULT) | |
120 | 120 | else if ((dicesCount == 4)) | |
121 | 121 | then ((bet * RATE4) / RATEMULT) | |
122 | 122 | else if ((dicesCount == 5)) | |
123 | 123 | then ((bet * RATE5) / RATEMULT) | |
124 | 124 | else throw("Invalid dices count in player's choice") | |
125 | 125 | } | |
126 | 126 | else throw("Bet amount is not in range") | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func RandToStr (r) = if ((r == 0)) | |
131 | 131 | then "1" | |
132 | 132 | else if ((r == 1)) | |
133 | 133 | then "2" | |
134 | 134 | else if ((r == 2)) | |
135 | 135 | then "3" | |
136 | 136 | else if ((r == 3)) | |
137 | 137 | then "4" | |
138 | 138 | else if ((r == 4)) | |
139 | 139 | then "5" | |
140 | 140 | else if ((r == 5)) | |
141 | 141 | then "6" | |
142 | 142 | else throw(("Unsupported r parameter passed: expected=[0,...,5] actual=" + toString(r))) | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func GenerateRandInt (gameId,rsaSign) = { | |
146 | 146 | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
147 | 147 | if (rsaSigValid) | |
148 | 148 | then { | |
149 | 149 | let rand = (toInt(sha256(rsaSign)) % 6) | |
150 | 150 | if ((0 > rand)) | |
151 | 151 | then (-1 * rand) | |
152 | 152 | else rand | |
153 | 153 | } | |
154 | 154 | else throw("Invalid RSA signature") | |
155 | 155 | } | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func IsPlayerWin (playerChoice,randStr) = { | |
159 | 159 | let s = size(playerChoice) | |
160 | 160 | if (if (if (if (if ((s >= 1)) | |
161 | 161 | then (take(drop(playerChoice, 0), 1) == randStr) | |
162 | 162 | else false) | |
163 | 163 | then true | |
164 | 164 | else if ((s >= 2)) | |
165 | 165 | then (take(drop(playerChoice, 1), 1) == randStr) | |
166 | 166 | else false) | |
167 | 167 | then true | |
168 | 168 | else if ((s >= 3)) | |
169 | 169 | then (take(drop(playerChoice, 2), 1) == randStr) | |
170 | 170 | else false) | |
171 | 171 | then true | |
172 | 172 | else if ((s >= 4)) | |
173 | 173 | then (take(drop(playerChoice, 3), 1) == randStr) | |
174 | 174 | else false) | |
175 | 175 | then true | |
176 | 176 | else if ((s == 5)) | |
177 | 177 | then (take(drop(playerChoice, 4), 1) == randStr) | |
178 | 178 | else false | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | func FormatGameDataParam (p) = { | |
183 | 183 | let s = size(p) | |
184 | 184 | if ((s == 0)) | |
185 | 185 | then throw("Parameter size must be greater then 0") | |
186 | 186 | else if ((s > 99)) | |
187 | 187 | then throw("Parameter size must be less then 100") | |
188 | 188 | else if ((10 > s)) | |
189 | 189 | then (("0" + toString(s)) + p) | |
190 | 190 | else (toString(s) + p) | |
191 | 191 | } | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = { | |
195 | 195 | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt))) | |
196 | 196 | if ((randOrEmpty == "")) | |
197 | 197 | then fullStateStr | |
198 | 198 | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
199 | 199 | } | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
203 | 203 | then drop(remaining, 1) | |
204 | 204 | else remaining | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func ParseNextAttribute (remaining) = { | |
208 | 208 | let s = size(remaining) | |
209 | 209 | if ((s > 0)) | |
210 | 210 | then { | |
211 | 211 | let nn = parseIntValue(take(remaining, 2)) | |
212 | 212 | let v = take(drop(remaining, 2), nn) | |
213 | 213 | let tmpRemaining = drop(remaining, (nn + 2)) | |
214 | 214 | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
215 | 215 | [v, remainingState] | |
216 | 216 | } | |
217 | 217 | else throw("Empty string was passed into parseNextAttribute func") | |
218 | 218 | } | |
219 | 219 | ||
220 | 220 | ||
221 | 221 | func ParseGameRawDataStr (rawStateStr) = { | |
222 | 222 | let gameState = ParseNextAttribute(rawStateStr) | |
223 | 223 | let playerChoice = ParseNextAttribute(gameState[1]) | |
224 | 224 | let playerPubKey58 = ParseNextAttribute(playerChoice[1]) | |
225 | 225 | let startedHeight = ParseNextAttribute(playerPubKey58[1]) | |
226 | 226 | let winAmt = ParseNextAttribute(startedHeight[1]) | |
227 | 227 | [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]] | |
228 | 228 | } | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | func ExtractGameDataList (gameId) = { | |
232 | 232 | let rawDataStr = match getString(this, gameId) { | |
233 | 233 | case str: String => | |
234 | 234 | str | |
235 | 235 | case _ => | |
236 | 236 | throw(("Couldn't find game by " + gameId)) | |
237 | 237 | } | |
238 | 238 | ParseGameRawDataStr(rawDataStr) | |
239 | 239 | } | |
240 | 240 | ||
241 | 241 | ||
242 | 242 | func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = { | |
243 | 243 | let wSetCommonData = [decreasedReserves] | |
244 | 244 | let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)] | |
245 | 245 | if (winByTimeout) | |
246 | 246 | then { | |
247 | 247 | let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT")) | |
248 | 248 | let gameData = DataEntry(gameId, newGameDataStrAdjusted) | |
249 | 249 | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
250 | 250 | } | |
251 | 251 | else { | |
252 | 252 | let gameData = DataEntry(gameId, newGameDataStr) | |
253 | 253 | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
254 | 254 | } | |
255 | 255 | } | |
256 | 256 | ||
257 | 257 | ||
258 | 258 | func IsDAppUp () = { | |
259 | 259 | let dAppUpOpt = getBoolean(this, DAPPUPKEY) | |
260 | 260 | if (isDefined(dAppUpOpt)) | |
261 | 261 | then extract(dAppUpOpt) | |
262 | 262 | else false | |
263 | 263 | } | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | func monitorMaxBalance () = { | |
267 | 267 | let maxBalanceOpt = getInteger(this, MAXBALANCEKEY) | |
268 | 268 | let maxBalance = if (isDefined(maxBalanceOpt)) | |
269 | 269 | then extract(maxBalanceOpt) | |
270 | 270 | else 0 | |
271 | 271 | let currBalance = wavesBalance(this) | |
272 | 272 | if ((currBalance > maxBalance)) | |
273 | 273 | then currBalance | |
274 | 274 | else { | |
275 | 275 | let diff = (maxBalance - currBalance) | |
276 | 276 | if ((diff > MAXDIFF)) | |
277 | 277 | then throw("dApp is temporary disabled") | |
278 | 278 | else maxBalance | |
279 | 279 | } | |
280 | 280 | } | |
281 | 281 | ||
282 | 282 | ||
283 | 283 | @Callable(i) | |
284 | 284 | func dAppUp (dAppUp) = if ((i.caller != SERVER)) | |
285 | 285 | then throw("Only Server can manage dAppUp attribute") | |
286 | 286 | else if ((IsDAppUp() == dAppUp)) | |
287 | 287 | then throw("dAppUp must be different with actual value") | |
288 | 288 | else WriteSet([DataEntry(DAPPUPKEY, dAppUp)]) | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | ||
292 | 292 | @Callable(i) | |
293 | 293 | func bet (playerChoice) = { | |
294 | 294 | let newGameNum = IncrementGameNum() | |
295 | 295 | let gameId = toBase58String(i.transactionId) | |
296 | 296 | let pmt = extract(i.payment) | |
297 | 297 | let betNotInWaves = isDefined(pmt.assetId) | |
298 | 298 | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
299 | 299 | let txIdUsed = isDefined(getString(this, gameId)) | |
300 | 300 | if (!(IsDAppUp())) | |
301 | 301 | then throw("DApp is under maintenance") | |
302 | 302 | else if (betNotInWaves) | |
303 | 303 | then throw("Bet amount must be in Waves") | |
304 | 304 | else if (txIdUsed) | |
305 | 305 | then throw("Passed txId had been used before. Game aborted.") | |
306 | 306 | else { | |
307 | 307 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
308 | 308 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
309 | 309 | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(MAXBALANCEKEY, monitorMaxBalance()), DataEntry(gameId, gameDataStr)]), TransferSet([ScriptTransfer(SERVER, COMMISSION, unit)])) | |
310 | 310 | } | |
311 | 311 | } | |
312 | 312 | ||
313 | 313 | ||
314 | 314 | ||
315 | 315 | @Callable(i) | |
316 | 316 | func withdraw (gameId,rsaSign) = { | |
317 | 317 | let gameDataList = ExtractGameDataList(gameId) | |
318 | 318 | let gameState = gameDataList[IdxGameState] | |
319 | 319 | let playerChoice = gameDataList[IdxPlayerChoice] | |
320 | 320 | let startedHeight = parseIntValue(gameDataList[IdxStartedHeight]) | |
321 | 321 | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
322 | 322 | let playerPubKey58 = gameDataList[IdxPlayerPubKey58] | |
323 | 323 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
324 | 324 | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
325 | 325 | let decreasedReserves = DecreaseReservedAmt(gameId, winAmt) | |
326 | 326 | if ((gameState != STATESUBMITTED)) | |
327 | 327 | then throw("Invalid game state for passed gameId") | |
328 | 328 | else if (winByTimeout) | |
329 | 329 | then { | |
330 | 330 | let randStr = take(playerChoice, 1) | |
331 | 331 | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
332 | 332 | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
333 | 333 | } | |
334 | 334 | else { | |
335 | 335 | let randStr = RandToStr(GenerateRandInt(gameId, rsaSign)) | |
336 | 336 | if ((i.caller != SERVER)) | |
337 | 337 | then throw("Regular withdraw can be done by server only") | |
338 | 338 | else if (IsPlayerWin(playerChoice, randStr)) | |
339 | 339 | then { | |
340 | 340 | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
341 | 341 | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
342 | 342 | } | |
343 | 343 | else { | |
344 | 344 | let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
345 | 345 | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
346 | 346 | } | |
347 | 347 | } | |
348 | 348 | } | |
349 | 349 | ||
350 | 350 | ||
351 | 351 | @Verifier(tx) | |
352 | 352 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
353 | 353 | then match tx { | |
354 | 354 | case ttx: TransferTransaction => | |
355 | 355 | ((wavesBalance(this) - ttx.amount) >= ExtractReservedAmt()) | |
356 | 356 | case stx: SetScriptTransaction => | |
357 | 357 | if ((IsDAppUp() == false)) | |
358 | 358 | then (ExtractReservedAmt() == 0) | |
359 | 359 | else false | |
360 | 360 | case _ => | |
361 | 361 | false | |
362 | 362 | } | |
363 | 363 | else false | |
364 | 364 |
github/deemru/w8io/fabc49c 42.97 ms ◑