tx · BQWHHgZYQNjvRUCxxz6GLeAh6uRD4Sdssdf9WrAYu3EV

3Mungn3ygy3DzpbDUKPbJQaeNKfQHu9fkK8:  -0.01500000 Waves

2022.11.11 12:34 [2312305] smart account 3Mungn3ygy3DzpbDUKPbJQaeNKfQHu9fkK8 > SELF 0.00000000 Waves

{ "type": 13, "id": "BQWHHgZYQNjvRUCxxz6GLeAh6uRD4Sdssdf9WrAYu3EV", "fee": 1500000, "feeAssetId": null, "timestamp": 1668159300167, "version": 2, "chainId": 84, "sender": "3Mungn3ygy3DzpbDUKPbJQaeNKfQHu9fkK8", "senderPublicKey": "6L7iBerXuPa5E74WCM6fLSB2VM1bMG9jgASH8tu9orHN", "proofs": [ "V18QbmBRNV2caPpnThCZ6CRtHGVr2p4tqDoNj3yHJz8QQWEMQp3jwKVrgzmRjvyycqasravgtpur87CDAdaDDtT" ], "script": "base64:BgIoCAISBwoFAQgBAQgSBgoEAQEICBIDCgEBEgQKAgEIEgQKAhEYEgASACsAD0dBTUVfVFlQRV9HUk9VUAIFR3JvdXAAEUdBTUVfVFlQRV9QTEFUT0ZGAghQbGF5LW9mZgAKR0FNRV9UWVBFUwkAzAgCBQ9HQU1FX1RZUEVfR1JPVVAJAMwIAgURR0FNRV9UWVBFX1BMQVRPRkYFA25pbAAEVVNEVAEgbySjyqsw3FIpmOgsYVruWn8jTcItdbvpnapU4NLQB8EAB01JTl9CRVQAwIQ9AAhPTkVfSE9VUgkAaAIJAGgCAAUAPADoBwARTU9ORVlfQk9YX0FERFJFRVMJAQdBZGRyZXNzAQEaAVSxYgy7BRV2F+zuKtUZtXyHmoiep9yqU84AB0JFVF9GRUUA9AMACUZFRV9TQ0FMRQCQTgAHa0FjdGl2ZQIGYWN0aXZlAAtrQWN0aXZlR2xvYgIUYWN0aXZlX2FsbF9jb250cmFjdHMABmtDYXVzZQIOc2h1dGRvd25fY2F1c2UADWtHYW1lU3RyYVRpbWUCDl9zdGFydEdhbWVUaW1lAAlrR2FtZVR5cGU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kCBQtrTGFzdEdhbWVJZAUHbmV3TEdJZAFpAQhzaHV0ZG93bgADCQEBIQEFBmFjdGl2ZQkAAgEJAKwCAgIiREFwcCBpcyBhbHJlYWR5IHN1c3BlbmRlZC4gQ2F1c2U6IAkBC3ZhbHVlT3JFbHNlAgkAnQgCBQR0aGlzBQZrQ2F1c2UCGnRoZSBjYXVzZSB3YXNuJ3Qgc3BlY2lmaWVkAwkBASEBCQEPY29udGFpbnNFbGVtZW50AgkAzAgCBQxhZG1pblB1YktleTEJAMwIAgUMYWRtaW5QdWJLZXkyCQDMCAIFDGFkbWluUHViS2V5MwUDbmlsCAUBaQ9jYWxsZXJQdWJsaWNLZXkJAAIBAiFPbmx5IGFkbWluIGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24JAQdzdXNwZW5kAQIPUGF1c2VkIGJ5IGFkbWluAWkBCGFjdGl2YXRlAAMFBmFjdGl2ZQkAAgECFkRBcHAgaXMgYWxyZWFkeSBhY3RpdmUDCQEBIQEJAQ9jb250YWluc0VsZW1lbnQCCQDMCAIFDGFkbWluUHViS2V5MQkAzAgCBQxhZG1pblB1YktleTIJAMwIAgUMYWRtaW5QdWJLZXkzBQNuaWwIBQFpD2NhbGxlclB1YmxpY0tleQkAAgECIU9ubHkgYWRtaW4gY2FuIGNhbGwgdGhpcyBmdW5jdGlvbgkAzAgCCQEMQm9vbGVhbkVudHJ5AgUHa0FjdGl2ZQYJAMwIAgkBC0RlbGV0ZUVudHJ5AQUGa0NhdXNlBQNuaWwAvg7aqg==", "height": 2312305, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3dwwLKhoSMJmjsXhKrPU93xySYpTPEh79PBm6b1PJTkH Next: BtX8vUPS2krFinnzfzyeqVxCR5BdoJYfBqWNiDbGGF8J Diff:
OldNewDifferences
195195 let totalWinValueMax = ((G1 + (G2 * 3)) + (G3 * 2))
196196 let D1 = if ((G1 == 0))
197197 then 0
198- else fraction((G1 + fraction((G2 * B), 3, totalWinValueMax)), UB2, G1)
198+ else fraction((G1 + fraction((G2 * B), 3, totalWinValueMax)), UB1, G1)
199199 let D2 = if ((G2 == 0))
200200 then 0
201201 else fraction((G2 + fraction((G2 * B), 3, totalWinValueMax)), UB2, G2)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let GAME_TYPE_GROUP = "Group"
55
66 let GAME_TYPE_PLATOFF = "Play-off"
77
88 let GAME_TYPES = [GAME_TYPE_GROUP, GAME_TYPE_PLATOFF]
99
1010 let USDT = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS'
1111
1212 let MIN_BET = 1000000
1313
1414 let ONE_HOUR = ((5 * 60) * 1000)
1515
1616 let MONEY_BOX_ADDREES = Address(base58'3N65zqVKchaFdW4gS7FxCRibjfkVgJvo7PT')
1717
1818 let BET_FEE = 500
1919
2020 let FEE_SCALE = 10000
2121
2222 let kActive = "active"
2323
2424 let kActiveGlob = "active_all_contracts"
2525
2626 let kCause = "shutdown_cause"
2727
2828 let kGameStraTime = "_startGameTime"
2929
3030 let kGameType = "_GameType"
3131
3232 let kLastGameId = "last_game_id"
3333
3434 let kTotalBets = "_totalBets"
3535
3636 let kToWinA = "_toWinA"
3737
3838 let kToWinB = "_toWinB"
3939
4040 let kOnDraw = "_onDraw"
4141
4242 let kGameResult = "_result"
4343
4444 let kBank = "_bank"
4545
4646 let kFinalTime = "_finalTimeā€"
4747
4848 let kTotalBetsForType = "_totalBetsForType"
4949
5050 let kUserBet = "_userBet"
5151
5252 let kUserRefId = "_refId"
5353
5454 let kUserClaimed = "_claimed"
5555
5656 let kAdminPubKey1 = "admin_pub_1"
5757
5858 let kAdminPubKey2 = "admin_pub_2"
5959
6060 let kAdminPubKey3 = "admin_pub_3"
6161
6262 let oracle = Address(base58'3PEbqViERCoKnmcSULh6n2aiMvUdSQdCsom')
6363
6464 func getBase58FromOracle (key) = match getString(oracle, key) {
6565 case string: String =>
6666 fromBase58String(string)
6767 case nothing =>
6868 throw((key + "is empty"))
6969 }
7070
7171
7272 let adminPubKey1 = getBase58FromOracle(kAdminPubKey1)
7373
7474 let adminPubKey2 = getBase58FromOracle(kAdminPubKey2)
7575
7676 let adminPubKey3 = getBase58FromOracle(kAdminPubKey3)
7777
7878 let active = valueOrElse(getBoolean(this, kActive), true)
7979
8080 let activeGlob = valueOrElse(getBoolean(oracle, kActiveGlob), true)
8181
8282 func isActive () = if (if (active)
8383 then activeGlob
8484 else false)
8585 then unit
8686 else throw("DApp is inactive at this moment")
8787
8888
8989 func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))
9090 then unit
9191 else throw("Only admin can call this function")
9292
9393
9494 func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
9595
9696
9797 func getUserBetKey (user,gameId,type,result) = (((((((user + "_") + toString(gameId)) + "_") + toString(type)) + "_") + result) + kUserBet)
9898
9999
100100 func getTotalBetsForTypeKey (gameId,type,result) = (((((toString(gameId) + "_") + toString(type)) + "_") + result) + kTotalBetsForType)
101101
102102
103103 func validateBet (gameType,type,result) = if ((type == 1))
104104 then if ((size(result) != 1))
105105 then throw("Game result must contain only one letter: A,B,D")
106106 else if (!(contains("ABD", result)))
107107 then throw("Game result must contain only one letter: A,B,D")
108108 else if (if ((gameType == GAME_TYPE_PLATOFF))
109109 then !(contains("AB", result))
110110 else false)
111111 then throw("Game result must contain only one letter: A,B")
112112 else true
113113 else if ((type == 2))
114114 then {
115115 let splited = split(result, "_")
116116 if ((size(splited) != 2))
117117 then throw("Inncorrect game result")
118118 else {
119119 let ballsA = valueOrErrorMessage(parseInt(splited[0]), "Inncorrect game result")
120120 let ballsB = valueOrErrorMessage(parseInt(splited[1]), "Inncorrect game result")
121121 if ((ballsA == ballsB))
122122 then throw("Inncorrect game result. A and B cannot be equal")
123123 else true
124124 }
125125 }
126126 else if ((type == 3))
127127 then {
128128 let splited = split(result, "_")
129129 if ((size(splited) != 2))
130130 then throw("Inncorrect game result")
131131 else {
132132 let team = splited[0]
133133 let ballsAmount = valueOrErrorMessage(parseInt(splited[1]), "Inncorrect game result")
134134 if ((0 >= ballsAmount))
135135 then throw("Inncorrect game result, balls amount must be greater then 0")
136136 else if (if ((size(team) != 1))
137137 then true
138138 else !(contains("AB", team)))
139139 then throw("Game result must contain only one letter: A,B")
140140 else true
141141 }
142142 }
143143 else false
144144
145145
146146 func calcClaim (gameId,userAddress,result,type,amount) = {
147147 let spldRes = split(result, "_")
148148 let $t039694495 = if ((type == 1))
149149 then if ((result == "A"))
150150 then $Tuple3("1_0", 1, 0)
151151 else if ((result == "B"))
152152 then $Tuple3("0_1", 0, 1)
153153 else $Tuple3("1_1", 1, 1)
154154 else if ((type == 2))
155155 then $Tuple3(result, parseIntValue(spldRes[0]), parseIntValue(spldRes[1]))
156156 else if ((type == 3))
157157 then if ((spldRes[0] == "A"))
158158 then $Tuple3((spldRes[1] + "_0"), parseIntValue(spldRes[1]), 0)
159159 else $Tuple3(("0_" + spldRes[1]), 0, parseIntValue(spldRes[1]))
160160 else $Tuple3(result, parseIntValue(spldRes[0]), parseIntValue(spldRes[1]))
161161 let gameResult = $t039694495._1
162162 let ballsA = $t039694495._2
163163 let ballsB = $t039694495._3
164164 let diff = if ((ballsA > ballsB))
165165 then (ballsA - ballsB)
166166 else (ballsB - ballsA)
167167 let winner = if ((ballsA > ballsB))
168168 then "A"
169169 else if ((ballsB > ballsA))
170170 then "B"
171171 else "D"
172172 let G1 = (valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 1, winner)), 0) + (if ((type == 1))
173173 then amount
174174 else 0))
175175 let G2 = (valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 2, gameResult)), 0) + (if ((type == 2))
176176 then amount
177177 else 0))
178178 let G3 = (valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 3, ((winner + "_") + toString(diff)))), 0) + (if ((type == 3))
179179 then amount
180180 else 0))
181181 let totalWinValue = ((G1 + G2) + G3)
182182 let totalBets = (valueOrElse(getInteger(this, (toString(gameId) + kTotalBets)), 0) + amount)
183183 let bankWithFee = (totalBets - totalWinValue)
184184 let fee = fraction(bankWithFee, BET_FEE, FEE_SCALE)
185185 let B = (bankWithFee - fee)
186186 let UB1 = (valueOrElse(getInteger(this, getUserBetKey(userAddress, gameId, 1, winner)), 0) + (if ((type == 1))
187187 then amount
188188 else 0))
189189 let UB2 = (valueOrElse(getInteger(this, getUserBetKey(userAddress, gameId, 2, gameResult)), 0) + (if ((type == 2))
190190 then amount
191191 else 0))
192192 let UB3 = (valueOrElse(getInteger(this, getUserBetKey(userAddress, gameId, 3, ((winner + "_") + toString(diff)))), 0) + (if ((type == 3))
193193 then amount
194194 else 0))
195195 let totalWinValueMax = ((G1 + (G2 * 3)) + (G3 * 2))
196196 let D1 = if ((G1 == 0))
197197 then 0
198- else fraction((G1 + fraction((G2 * B), 3, totalWinValueMax)), UB2, G1)
198+ else fraction((G1 + fraction((G2 * B), 3, totalWinValueMax)), UB1, G1)
199199 let D2 = if ((G2 == 0))
200200 then 0
201201 else fraction((G2 + fraction((G2 * B), 3, totalWinValueMax)), UB2, G2)
202202 let D3 = if ((G3 == 0))
203203 then 0
204204 else fraction((G3 + fraction((G3 * B), 3, totalWinValueMax)), UB3, G3)
205205 let claimAmount = ((D1 + D2) + D3)
206206 claimAmount
207207 }
208208
209209
210210 @Callable(i)
211211 func potentialWinnings (gameId,userAddress,amount,type,result) = {
212212 let claimAmount = calcClaim(gameId, userAddress, result, type, amount)
213213 $Tuple2(nil, claimAmount)
214214 }
215215
216216
217217
218218 @Callable(i)
219219 func bet (gameId,type,result,refId) = valueOrElse(isActive(), {
220220 let user = toString(i.caller)
221221 let gIdStr = toString(gameId)
222222 let $t064816556 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
223223 let pmtAmount = $t064816556._1
224224 let pmtAssetId = $t064816556._2
225225 let gameStartTime = valueOrElse(getInteger(this, (toString(gameId) + kGameStraTime)), 0)
226226 let gameType = getStringValue(this, (toString(gameId) + kGameType))
227227 if ((pmtAssetId != USDT))
228228 then throw("Pamyment must be In USDT asset")
229229 else if ((MIN_BET > pmtAmount))
230230 then throw((("Min bet " + toString((MIN_BET / 1000000))) + "USDT"))
231231 else if ((gameStartTime == 0))
232232 then throw(("There is no game with id" + toString(gameId)))
233233 else if (((lastBlock.timestamp + ONE_HOUR) >= gameStartTime))
234234 then throw("Bets on this game are no longer accepted")
235235 else if (!(validateBet(gameType, type, result)))
236236 then throw("Incorrect bet type")
237237 else {
238238 let spldRes = split(result, "_")
239239 let userBetKey = getUserBetKey(user, gameId, type, result)
240240 let totalBetsForTypeBetKey = getTotalBetsForTypeKey(gameId, type, result)
241241 let userBet = (valueOrElse(getInteger(this, userBetKey), 0) + pmtAmount)
242242 let totalBetsForTypeBet = (valueOrElse(getInteger(this, totalBetsForTypeBetKey), 0) + pmtAmount)
243243 let totalBets = (valueOrElse(getInteger(this, (gIdStr + kTotalBets)), 0) + pmtAmount)
244244 let toWinA = (valueOrElse(getInteger(this, (gIdStr + kToWinA)), 0) + (if (if ((type == 1))
245245 then (result == "A")
246246 else false)
247247 then pmtAmount
248248 else if (if ((type == 2))
249249 then (parseIntValue(spldRes[0]) > parseIntValue(spldRes[1]))
250250 else false)
251251 then pmtAmount
252252 else if (if ((type == 3))
253253 then (spldRes[0] == "A")
254254 else false)
255255 then pmtAmount
256256 else 0))
257257 let toWinB = (valueOrElse(getInteger(this, (gIdStr + kToWinB)), 0) + (if (if ((type == 1))
258258 then (result == "B")
259259 else false)
260260 then pmtAmount
261261 else if (if ((type == 2))
262262 then (parseIntValue(spldRes[1]) > parseIntValue(spldRes[0]))
263263 else false)
264264 then pmtAmount
265265 else if (if ((type == 3))
266266 then (spldRes[0] == "B")
267267 else false)
268268 then pmtAmount
269269 else 0))
270270 let onDraw = (valueOrElse(getInteger(this, (gIdStr + kOnDraw)), 0) + (if (if ((type == 1))
271271 then (result == "D")
272272 else false)
273273 then pmtAmount
274274 else 0))
275275 ([IntegerEntry(userBetKey, userBet), IntegerEntry(totalBetsForTypeBetKey, totalBetsForTypeBet), IntegerEntry((gIdStr + kTotalBets), totalBets), IntegerEntry((gIdStr + kToWinA), toWinA), IntegerEntry((gIdStr + kToWinB), toWinB), IntegerEntry((gIdStr + kOnDraw), onDraw)] ++ (if (!(isDefined(getString(this, (user + kUserRefId)))))
276276 then [StringEntry((user + kUserRefId), refId)]
277277 else nil))
278278 }
279279 })
280280
281281
282282
283283 @Callable(i)
284284 func claim (gameId) = valueOrElse(isActive(), {
285285 let user = toString(i.caller)
286286 let gIdStr = toString(gameId)
287287 let finalTime = valueOrErrorMessage(getInteger(this, (gIdStr + kFinalTime)), "You can claim only after game finish")
288288 if ((lastBlock.timestamp > (finalTime + ONE_HOUR)))
289289 then throw("You can claim only after one hour pass after final time")
290290 else if (isDefined(getBoolean(this, (((user + "_") + gIdStr) + kUserClaimed))))
291291 then throw("You are alredy claimed")
292292 else {
293293 let gameResult = getStringValue(this, (gIdStr + kGameResult))
294294 let claimAmount = calcClaim(gameId, user, gameResult, 0, 0)
295295 if ((claimAmount == 0))
296296 then throw("Nothing to claim")
297297 else $Tuple2([BooleanEntry((((user + "_") + gIdStr) + kUserClaimed), true), ScriptTransfer(i.caller, claimAmount, USDT)], claimAmount)
298298 }
299299 })
300300
301301
302302
303303 @Callable(i)
304304 func gameSummary (gameId,result) = {
305305 let gIdStr = toString(gameId)
306306 let gameStartTime = valueOrElse(getInteger(this, (toString(gameId) + kGameStraTime)), 0)
307307 if ((gameStartTime == 0))
308308 then throw(("There is no game with id" + toString(gameId)))
309309 else {
310310 let spldRes = split(result, "_")
311311 let ballsA = valueOrErrorMessage(parseInt(spldRes[0]), "Inncorrect game result")
312312 let ballsB = valueOrErrorMessage(parseInt(spldRes[1]), "Inncorrect game result")
313313 let diff = if ((ballsA > ballsB))
314314 then (ballsA - ballsB)
315315 else (ballsB - ballsA)
316316 let winner = if ((ballsA > ballsB))
317317 then "A"
318318 else if ((ballsB > ballsA))
319319 then "B"
320320 else "D"
321321 let totalWinType1 = valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 1, winner)), 0)
322322 let totalWinType2 = valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 2, result)), 0)
323323 let totalWinType3 = valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 3, ((winner + "_") + toString(diff)))), 0)
324324 let totalWinValue = ((totalWinType1 + totalWinType2) + totalWinType3)
325325 let totalBets = valueOrElse(getInteger(this, (toString(gameId) + kTotalBets)), 0)
326326 let bankWithFee = (totalBets - totalWinValue)
327327 let $t01061810776 = if ((totalWinValue == 0))
328328 then $Tuple2(bankWithFee, 0)
329329 else {
330330 let f = fraction(bankWithFee, BET_FEE, FEE_SCALE)
331331 $Tuple2(f, (bankWithFee - f))
332332 }
333333 let fee = $t01061810776._1
334334 let bank = $t01061810776._2
335335 [StringEntry((gIdStr + kGameResult), result), IntegerEntry((gIdStr + kBank), bank), IntegerEntry((gIdStr + kFinalTime), lastBlock.timestamp), ScriptTransfer(MONEY_BOX_ADDREES, fee, USDT)]
336336 }
337337 }
338338
339339
340340
341341 @Callable(i)
342342 func initGames (startGameTimes,types) = {
343343 func initGame (acc,startGameTime) = {
344344 let $t01116011194 = acc
345345 let entries = $t01116011194._1
346346 let lastGameId = $t01116011194._2
347347 let j = $t01116011194._3
348348 let newGameId = (lastGameId + 1)
349349 if ((lastBlock.timestamp > startGameTime))
350350 then throw("startGameTime must be in the future")
351351 else if (!(containsElement(GAME_TYPES, types[j])))
352352 then throw(("type must contain one of values: " + makeString(GAME_TYPES, ",")))
353353 else {
354354 let gameEntries = [IntegerEntry((toString(newGameId) + kGameStraTime), startGameTime), StringEntry((toString(newGameId) + kGameType), types[j])]
355355 $Tuple3((entries ++ gameEntries), newGameId, (j + 1))
356356 }
357357 }
358358
359359 let lastGameId = valueOrElse(getInteger(this, kLastGameId), 0)
360360 let $t01173711822 = {
361361 let $l = startGameTimes
362362 let $s = size($l)
363363 let $acc0 = $Tuple3(nil, lastGameId, 0)
364364 func $f0_1 ($a,$i) = if (($i >= $s))
365365 then $a
366366 else initGame($a, $l[$i])
367367
368368 func $f0_2 ($a,$i) = if (($i >= $s))
369369 then $a
370370 else throw("List size exceeds 50")
371371
372372 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50)
373373 }
374374 let gamesEntries = $t01173711822._1
375375 let newLGId = $t01173711822._2
376376 (gamesEntries :+ IntegerEntry(kLastGameId, newLGId))
377377 }
378378
379379
380380
381381 @Callable(i)
382382 func shutdown () = if (!(active))
383383 then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
384384 else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
385385 then throw("Only admin can call this function")
386386 else suspend("Paused by admin")
387387
388388
389389
390390 @Callable(i)
391391 func activate () = if (active)
392392 then throw("DApp is already active")
393393 else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
394394 then throw("Only admin can call this function")
395395 else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
396396
397397

github/deemru/w8io/026f985 
46.73 ms