tx · FgmELiD9KD7JgNjQNkfjA4S77Ng9obN8tRKcmgywuVpy 3N2u2njp9aqxBqJPtEYDfmoW7vu5vtjqn9A: -0.01500000 Waves 2019.07.11 12:05 [580828] smart account 3N2u2njp9aqxBqJPtEYDfmoW7vu5vtjqn9A > SELF 0.00000000 Waves
{ "type": 13, "id": "FgmELiD9KD7JgNjQNkfjA4S77Ng9obN8tRKcmgywuVpy", "fee": 1500000, "feeAssetId": null, "timestamp": 1562835995898, "version": 1, "sender": "3N2u2njp9aqxBqJPtEYDfmoW7vu5vtjqn9A", "senderPublicKey": "9PgwurhsEwWCkXp5Seqm2HwWBGaSL3Dj1HJvXqWx6MYg", "proofs": [ "4qprHtooJME5h3Su9Cc2i6qcZ9KRUSfhez75DfHUFQW3nocYpaAXfyuVG6nrWVo3GvaV5syDsEPjDzGDcty4oz4t" ], "script": "base64:AAIDAAAAAAAAAAAAAAAvAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFxbEFpQU5TbUJwREhZS1A5c0tnZU4vbDFiQWIyOGcvdEdsZ0Rrd1Q1RmlNTjRYM3B3ZHZkeEU3bXZTUjgvNDFkVTlyeDRqRys2dFpwYjFVTFZEUHM0MzF0UjJJUmFUWHc1Q2orQWMydmhMKzVKYW1DZXJHRDFVVytiaC9FR1F0eG84VzNZTERyb2ZYQjVRSEp4NFBrejJLZ2Yrb1MvQzhoSHVCL1U0a3JPNzZVMDUwN0dUalpQUDlrUlEwdUxTTWVxUVh0OHdYUytuTXA1d2FqcXhQcERMTWFTUkVnc0t3di9BRWtQ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AAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwAwkAAAAAAAACCQEAAAAISXNEQXBwVXAAAAAABwkAAAAAAAACCQEAAAASRXh0cmFjdFJlc2VydmVkQW10AAAAAAAAAAAAAAAAAAcHByraX3Q=", "chainId": 84, "height": 580828, "spentComplexity": 0 } View: original | compacted Prev: EBCWccZKYwchPyws5Z1Z9Kp2H2CUaduw9nA4VZ6XW9Vq 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 MAXBALANCEDIFF = (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 MAXBALANCEDIFF = (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 > MAXBALANCEDIFF)) | |
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/026f985 50.00 ms ◑