tx · 7QasE4mADpBBHPNcZpsSeh3sadpEwY52yF7zqZ5UQgLz

3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89:  -0.01400000 Waves

2019.08.21 12:39 [640714] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves

{ "type": 13, "id": "7QasE4mADpBBHPNcZpsSeh3sadpEwY52yF7zqZ5UQgLz", "fee": 1400000, "feeAssetId": null, "timestamp": 1566380365365, "version": 1, "sender": "3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89", "senderPublicKey": "FgbqvGasMMrXxbhwrsgEiCgJLjXPjgn8kHxsZiVmLrkb", "proofs": [ "4fWZhKjy8gTSbnzZnwTX9dezWew79FSiXB7HW41XTygD3XDEKumdWGPYFkcABbYKYxjemiB3KTVVdtbKjnBbnfGY" ], "script": "base64:AAIDAAAAAAAAAAAAAAArAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbGVtcjk1SjFqWlVzN2NKbXJtbWxONHpvN1lWc0JKekllSmRrOExERkdoVUtTSTZ5ZnMyMFp5SmUyMSs2R0p3Tm5LVVUxVXlvYzE3d1NXTUtrclowTU12WUUrWjVBaWlqdkJLNHNTSjNJZ0dqZFU4L05oSThDQkR1MEYreFJNOXEzVEIzTExiRHk1c0JkdWRZZkhmc1VPYytNVHZBRDY5bjI3ZGIyUmg4K3laUU10dWJrdVRRTnA4OXNwaEhRYUxHeVFGYU5sSy9OYTNsRng2b21xemFhMWdqb3BsVXI2cnZZS2dmQUlDVUIzelZtSlNoaUVpN3c3UjBoV2xOUkQzcWNaakNVT05TcEZvNFdiemtuR09henc4NEIrSU1JRm5JcFhXelFMOFJYMHZOY2ZzQnZMRGZNNmsyWmFjcXd5TUthTExxaWdkQmlHZEo3VyswbE9TdE9RSURBUUFCAAAAABNSQU5ET1JBQ0xF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WVEYXRhU3RyAAAABgUAAAAJU1RBVEVMT1NUBQAAAAxwbGF5ZXJDaG9pY2UFAAAADnBsYXllclB1YktleTU4BQAAAA1zdGFydGVkSGVpZ2h0BQAAAAZ3aW5BbXQFAAAAB3JhbmRTdHIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABmdhbWVJZAUAAAAObmV3R2FtZURhdGFTdHIJAARMAAAAAgUAAAARZGVjcmVhc2VkUmVzZXJ2ZXMFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA3R0eAUAAAAHJG1hdGNoMAkAAGcAAAACCQAAZQAAAAIJAQAAAAx3YXZlc0JhbGFuY2UAAAABBQAAAAR0aGlzCAUAAAADdHR4AAAABmFtb3VudAkBAAAAEkV4dHJhY3RSZXNlcnZlZEFtdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAANzdHgFAAAAByRtYXRjaDAGBweLZdEr", "chainId": 84, "height": 640714, "spentComplexity": 0 } View: original | compacted Prev: 8AxSmR2Z9mNtWDTiBxyVrgiuhWMgzRKE6qducZbTjJmx Next: FNCDvZLz3S2SZsQNmgrnsUYe57ghu2rWrYDtqYssaUxC Diff:
OldNewDifferences
6262 then {
6363 let rand = (toInt(sha256(rsaSign)) % 6)
6464 if ((0 > rand))
65- then (-1 * rand)
66- else rand
65+ then ((-1 * rand) + 1)
66+ else (rand + 1)
6767 }
6868 else throw("Invalid RSA signature")
6969 }
165165 }
166166
167167
168-func RandToStr (r) = if ((r == 0))
168+func RandToStr (r) = if ((r == 1))
169169 then "1"
170- else if ((r == 1))
170+ else if ((r == 2))
171171 then "2"
172- else if ((r == 2))
172+ else if ((r == 3))
173173 then "3"
174- else if ((r == 3))
174+ else if ((r == 4))
175175 then "4"
176- else if ((r == 4))
176+ else if ((r == 5))
177177 then "5"
178- else if ((r == 5))
178+ else if ((r == 6))
179179 then "6"
180- else throw(("Unsupported r parameter passed: expected=[0,...,5] actual=" + toString(r)))
180+ else throw(("Unsupported r parameter passed: expected=[1,...,6] actual=" + toString(r)))
181181
182182
183183 func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = {
253253
254254
255255 func IsPlayerWin (playerChoice,randStr) = {
256- let s = size(playerChoice)
257- if (if (if (if (if (if ((s >= 1))
258- then (take(drop(playerChoice, 0), 1) == randStr)
259- else false)
256+ let randInt = parseIntValue(randStr)
257+ let choiceArray = split(playerChoice, "")
258+ if ((choiceArray[(randInt - 1)] == "0"))
260259 then true
261- else if ((s >= 2))
262- then (take(drop(playerChoice, 1), 1) == randStr)
263- else false)
264- then true
265- else if ((s >= 3))
266- then (take(drop(playerChoice, 2), 1) == randStr)
267- else false)
268- then true
269- else if ((s >= 4))
270- then (take(drop(playerChoice, 3), 1) == randStr)
271- else false)
272- then true
273- else if ((s >= 5))
274- then (take(drop(playerChoice, 4), 1) == randStr)
275- else false)
276- then true
277- else if ((s >= 6))
278- then (take(drop(playerChoice, 5), 1) == randStr)
279- else false
260+ else false
280261 }
281262
282263
314295 else {
315296 let playerPubKey58 = toBase58String(i.callerPublicKey)
316297 let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "")
298+ let readableGameData = ((((((((STATESUBMITTED + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(height)) + "_") + toString(winAmt))
317299 let SERVER = addressFromPublicKey(i.callerPublicKey)
318300 let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)]
319- let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]
301+ let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]
320302 ScriptResult(WriteSet(betData), TransferSet(serverTransfer))
321303 }
322304 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlemr95J1jZUs7cJmrmmlN4zo7YVsBJzIeJdk8LDFGhUKSI6yfs20ZyJe21+6GJwNnKUU1Uyoc17wSWMKkrZ0MMvYE+Z5AiijvBK4sSJ3IgGjdU8/NhI8CBDu0F+xRM9q3TB3LLbDy5sBdudYfHfsUOc+MTvAD69n27db2Rh8+yZQMtubkuTQNp89sphHQaLGyQFaNlK/Na3lFx6omqzaa1gjoplUr6rvYKgfAICUB3zVmJShiEi7w7R0hWlNRD3qcZjCUONSpFo4WbzknGOazw84B+IMIFnIpXWzQL8RX0vNcfsBvLDfM6k2ZacqwyMKaLLqigdBiGdJ7W+0lOStOQIDAQAB")
55
66 let RANDORACLETIMEFRAME = 4320
77
88 let WAVELET = ((100 * 1000) * 1000)
99
1010 let COMMISSION = ((9 * WAVELET) / 1000)
1111
1212 let BET1 = (1 * WAVELET)
1313
1414 let BET2 = (2 * WAVELET)
1515
1616 let BET4 = (4 * WAVELET)
1717
1818 let BET8 = (8 * WAVELET)
1919
2020 let BET14 = (14 * WAVELET)
2121
2222 let RATEMULT = 10000
2323
2424 let RATE1 = 39655
2525
2626 let RATE2 = 24600
2727
2828 let RATE3 = 19000
2929
3030 let RATE4 = 14200
3131
3232 let RATE5 = 11400
3333
3434 let IdxGameState = 0
3535
3636 let IdxPlayerChoice = 1
3737
3838 let IdxPlayerPubKey58 = 2
3939
4040 let IdxStartedHeight = 3
4141
4242 let IdxWinAmt = 4
4343
4444 let IdxRandOrEmpty = 5
4545
4646 let GAMESCOUNTERKEY = "$GAME_NUM"
4747
4848 let RESERVATIONKEY = "$RESERVED_AMOUNT"
4949
5050 let STATESUBMITTED = "SUBMITTED"
5151
5252 let STATEWON = "WON"
5353
5454 let STATELOST = "LOST"
5555
5656 func getAnswer (playerChoice) = BET14
5757
5858
5959 func GenerateRandInt (gameId,rsaSign) = {
6060 let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
6161 if (rsaSigValid)
6262 then {
6363 let rand = (toInt(sha256(rsaSign)) % 6)
6464 if ((0 > rand))
65- then (-1 * rand)
66- else rand
65+ then ((-1 * rand) + 1)
66+ else (rand + 1)
6767 }
6868 else throw("Invalid RSA signature")
6969 }
7070
7171
7272 func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0))
7373 then drop(remaining, 1)
7474 else remaining
7575
7676
7777 func ParseNextAttribute (remaining) = {
7878 let s = size(remaining)
7979 if ((s > 0))
8080 then {
8181 let nn = parseIntValue(take(remaining, 2))
8282 let v = take(drop(remaining, 2), nn)
8383 let tmpRemaining = drop(remaining, (nn + 2))
8484 let remainingState = RemoveUnderscoreIfPresent(tmpRemaining)
8585 [v, remainingState]
8686 }
8787 else throw("Empty string was passed into parseNextAttribute func")
8888 }
8989
9090
9191 func ParseGameRawDataStr (rawStateStr) = {
9292 let gameState = ParseNextAttribute(rawStateStr)
9393 let playerChoice = ParseNextAttribute(gameState[1])
9494 let playerPubKey58 = ParseNextAttribute(playerChoice[1])
9595 let startedHeight = ParseNextAttribute(playerPubKey58[1])
9696 let winAmt = ParseNextAttribute(startedHeight[1])
9797 [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]]
9898 }
9999
100100
101101 func ExtractGameDataList (gameId) = {
102102 let rawDataStr = match getString(this, gameId) {
103103 case str: String =>
104104 str
105105 case _ =>
106106 throw(("Couldn't find game by " + gameId))
107107 }
108108 ParseGameRawDataStr(rawDataStr)
109109 }
110110
111111
112112 func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) {
113113 case a: Int =>
114114 a
115115 case _ =>
116116 0
117117 }
118118
119119
120120 func ValidateAndIncreaseReservedAmt (winAmt) = {
121121 let newReservedAmount = (ExtractReservedAmt() + winAmt)
122122 let balance = wavesBalance(this)
123123 if ((newReservedAmount > balance))
124124 then throw("Insufficient funds on Russian Roulette account. Transaction was rejected for your safety.")
125125 else newReservedAmount
126126 }
127127
128128
129129 func IncrementGameNum () = {
130130 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
131131 case num: Int =>
132132 num
133133 case _ =>
134134 0
135135 }
136136 (gameNum + 1)
137137 }
138138
139139
140140 func DecreaseReservedAmt (gameId,winAmt) = {
141141 let newReservedAmount = (ExtractReservedAmt() - winAmt)
142142 if ((0 > newReservedAmount))
143143 then throw("Invalid Russian Roulette account state - reserved amount is less than 0")
144144 else DataEntry(RESERVATIONKEY, newReservedAmount)
145145 }
146146
147147
148148 func FormatGameDataParam (p) = {
149149 let s = size(p)
150150 if ((s == 0))
151151 then throw("Parameter size must be greater then 0")
152152 else if ((s > 99))
153153 then throw("Parameter size must be less then 100")
154154 else if ((10 > s))
155155 then (("0" + toString(s)) + p)
156156 else (toString(s) + p)
157157 }
158158
159159
160160 func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = {
161161 let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt)))
162162 if ((randOrEmpty == ""))
163163 then fullStateStr
164164 else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty))
165165 }
166166
167167
168-func RandToStr (r) = if ((r == 0))
168+func RandToStr (r) = if ((r == 1))
169169 then "1"
170- else if ((r == 1))
170+ else if ((r == 2))
171171 then "2"
172- else if ((r == 2))
172+ else if ((r == 3))
173173 then "3"
174- else if ((r == 3))
174+ else if ((r == 4))
175175 then "4"
176- else if ((r == 4))
176+ else if ((r == 5))
177177 then "5"
178- else if ((r == 5))
178+ else if ((r == 6))
179179 then "6"
180- else throw(("Unsupported r parameter passed: expected=[0,...,5] actual=" + toString(r)))
180+ else throw(("Unsupported r parameter passed: expected=[1,...,6] actual=" + toString(r)))
181181
182182
183183 func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = {
184184 let betAmtValid = if (if (if (if (if ((betAmt == (BET1 + COMMISSION)))
185185 then true
186186 else (betAmt == (BET2 + COMMISSION)))
187187 then true
188188 else (betAmt == (BET4 + COMMISSION)))
189189 then true
190190 else (betAmt == (BET8 + COMMISSION)))
191191 then true
192192 else (betAmt == (BET14 + COMMISSION)))
193193 then true
194194 else false
195195 if (betAmtValid)
196196 then {
197197 let bulletsCount = size(playerChoice)
198198 let bet = (betAmt - COMMISSION)
199199 let b1 = parseIntValue(take(playerChoice, 1))
200200 let forB2 = drop(playerChoice, 1)
201201 let b2 = parseIntValue(take(forB2, 1))
202202 let forB3 = drop(playerChoice, 1)
203203 let b3 = parseIntValue(take(forB3, 1))
204204 let forB4 = drop(playerChoice, 1)
205205 let b4 = parseIntValue(take(forB4, 1))
206206 let forB5 = drop(playerChoice, 1)
207207 let b5 = parseIntValue(take(forB5, 1))
208208 let forB6 = drop(playerChoice, 1)
209209 let b6 = parseIntValue(take(forB6, 1))
210210 let activeBullets = (((((b1 + b2) + b3) + b4) + b5) + b6)
211211 if ((activeBullets == 5))
212212 then ((bet * RATE1) / RATEMULT)
213213 else if ((activeBullets == 4))
214214 then ((bet * RATE2) / RATEMULT)
215215 else if ((activeBullets == 3))
216216 then ((bet * RATE3) / RATEMULT)
217217 else if ((activeBullets == 2))
218218 then ((bet * RATE4) / RATEMULT)
219219 else if ((activeBullets == 1))
220220 then ((bet * RATE5) / RATEMULT)
221221 else throw("Invalid player's choice")
222222 }
223223 else throw("Bet amount is not in range")
224224 }
225225
226226
227227 func getWinStr (playerChoice) = {
228228 let b1 = parseIntValue(take(playerChoice, 1))
229229 let forB2 = drop(playerChoice, 1)
230230 let b2 = parseIntValue(take(forB2, 1))
231231 let forB3 = drop(playerChoice, 1)
232232 let b3 = parseIntValue(take(forB3, 1))
233233 let forB4 = drop(playerChoice, 1)
234234 let b4 = parseIntValue(take(forB4, 1))
235235 let forB5 = drop(playerChoice, 1)
236236 let b5 = parseIntValue(take(forB5, 1))
237237 let forB6 = drop(playerChoice, 1)
238238 let b6 = parseIntValue(take(forB6, 1))
239239 if ((b1 == 0))
240240 then "1"
241241 else if ((b2 == 0))
242242 then "2"
243243 else if ((b3 == 0))
244244 then "3"
245245 else if ((b4 == 0))
246246 then "4"
247247 else if ((b5 == 0))
248248 then "5"
249249 else if ((b6 == 0))
250250 then "6"
251251 else throw("Bet amount is not in range")
252252 }
253253
254254
255255 func IsPlayerWin (playerChoice,randStr) = {
256- let s = size(playerChoice)
257- if (if (if (if (if (if ((s >= 1))
258- then (take(drop(playerChoice, 0), 1) == randStr)
259- else false)
256+ let randInt = parseIntValue(randStr)
257+ let choiceArray = split(playerChoice, "")
258+ if ((choiceArray[(randInt - 1)] == "0"))
260259 then true
261- else if ((s >= 2))
262- then (take(drop(playerChoice, 1), 1) == randStr)
263- else false)
264- then true
265- else if ((s >= 3))
266- then (take(drop(playerChoice, 2), 1) == randStr)
267- else false)
268- then true
269- else if ((s >= 4))
270- then (take(drop(playerChoice, 3), 1) == randStr)
271- else false)
272- then true
273- else if ((s >= 5))
274- then (take(drop(playerChoice, 4), 1) == randStr)
275- else false)
276- then true
277- else if ((s >= 6))
278- then (take(drop(playerChoice, 5), 1) == randStr)
279- else false
260+ else false
280261 }
281262
282263
283264 func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = {
284265 let wSetCommonData = [decreasedReserves]
285266 let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)]
286267 if (winByTimeout)
287268 then {
288269 let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT"))
289270 let gameData = DataEntry(gameId, newGameDataStrAdjusted)
290271 ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
291272 }
292273 else {
293274 let gameData = DataEntry(gameId, newGameDataStr)
294275 ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
295276 }
296277 }
297278
298279
299280 @Callable(i)
300281 func bet (playerChoice) = {
301282 let newGameNum = IncrementGameNum()
302283 let gameId = toBase58String(i.transactionId)
303284 let pmt = extract(i.payment)
304285 let betNotInWaves = isDefined(pmt.assetId)
305286 let feeNotInWaves = isDefined(pmt.assetId)
306287 let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice)
307288 let txIdUsed = isDefined(getString(this, gameId))
308289 if (betNotInWaves)
309290 then throw("Bet amount must be in Waves")
310291 else if (feeNotInWaves)
311292 then throw("Transaction's fee must be in Waves")
312293 else if (txIdUsed)
313294 then throw("Passed txId had been used before. Game aborted.")
314295 else {
315296 let playerPubKey58 = toBase58String(i.callerPublicKey)
316297 let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "")
298+ let readableGameData = ((((((((STATESUBMITTED + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(height)) + "_") + toString(winAmt))
317299 let SERVER = addressFromPublicKey(i.callerPublicKey)
318300 let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)]
319- let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]
301+ let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]
320302 ScriptResult(WriteSet(betData), TransferSet(serverTransfer))
321303 }
322304 }
323305
324306
325307
326308 @Callable(i)
327309 func withdraw (gameId,rsaSign) = {
328310 let gameDataList = ExtractGameDataList(gameId)
329311 let gameState = gameDataList[IdxGameState]
330312 let playerChoice = gameDataList[IdxPlayerChoice]
331313 let startedHeight = parseIntValue(gameDataList[IdxStartedHeight])
332314 let winAmt = parseIntValue(gameDataList[IdxWinAmt])
333315 let playerPubKey58 = gameDataList[IdxPlayerPubKey58]
334316 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
335317 let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
336318 let decreasedReserves = DecreaseReservedAmt(gameId, winAmt)
337319 if ((gameState != STATESUBMITTED))
338320 then throw("Invalid game state for passed gameId")
339321 else if (winByTimeout)
340322 then {
341323 let randStr = getWinStr(playerChoice)
342324 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
343325 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
344326 }
345327 else {
346328 let randInt = GenerateRandInt(gameId, rsaSign)
347329 let randStr = RandToStr(randInt)
348330 if (IsPlayerWin(playerChoice, randStr))
349331 then {
350332 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
351333 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
352334 }
353335 else {
354336 let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
355337 WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves])
356338 }
357339 }
358340 }
359341
360342
361343 @Verifier(tx)
362344 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
363345 then match tx {
364346 case ttx: TransferTransaction =>
365347 ((wavesBalance(this) - ttx.amount) >= ExtractReservedAmt())
366348 case stx: SetScriptTransaction =>
367349 true
368350 case _ =>
369351 false
370352 }
371353 else false
372354

github/deemru/w8io/026f985 
64.13 ms