tx · 3vwLZBXeXpbhppwPw7YWyWxpcZujg1Ssb4VhDAX628e2

3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H:  -0.00100000 Waves

2022.08.21 16:06 [2194260] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves

{ "type": 13, "id": "3vwLZBXeXpbhppwPw7YWyWxpcZujg1Ssb4VhDAX628e2", "fee": 100000, "feeAssetId": null, "timestamp": 1661087241231, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "3QhRkf4i4QRv3qZ3tLgqRZ8UnoGtcRCZZc5dweZgKatn4r8U8gaZMM2gxN4qntso1Zyyb96g4t3aSrYMYboJPAa5" ], "script": "base64:BgIGCAISABIABAAMa1VzZXJQYXltZW50AgdQYXltZW50AARrV29uAgNXb24BCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCGNvdW50aW5nAQVieXRlcwQFY291bnQJAQlyYW5kb21pemUCBQVieXRlcwAKAwkAZwIFBWNvdW50AAQJAQxCb29sZWFuRW50cnkCBQRrV29uBwkBDEJvb2xlYW5FbnRyeQIFBGtXb24GAgFpAQtwYXJzZVN0cnVjdAADCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAx3aW5uZXJTdHJ1Y3QJAQhjb3VudGluZwEIBQFpDXRyYW5zYWN0aW9uSWQJAMwIAgUMd2lubmVyU3RydWN0BQNuaWwBaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwMJAGYCBQZhbW91bnQAFAkAAgECG1lvdSBjYW5ub3QgYmV0IG1vcmUgdGhhbiAyMAQNbnVsbEluaXRTdG9yZQkA/AcEBQR0aGlzAgtwYXJzZVN0cnVjdAUDbmlsBQNuaWwDCQAAAgUNbnVsbEluaXRTdG9yZQUNbnVsbEluaXRTdG9yZQQDd29uCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJsIAgUEdGhpcwUEa1dvbgISU3RvcmFnZSByZWFkIGVycm9yAwUDd29uCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFBmFtb3VudAACBQR1bml0BQNuaWwFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgDDISRQ", "height": 2194260, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: He1ntbKUnrKrALKpgj6xSt5nPfnjJX5ra5dKz9NEMZrL Next: 6cVfMR5CzMZpHZJNrqFrMuh6t53wzkP7ho4pJCEs53QL Diff:
OldNewDifferences
44 let kUserPayment = "Payment"
55
66 let kWon = "Won"
7-
8-let separator = "/"
9-
10-let separatorSecond = "|"
117
128 func randomize (bytes,range) = {
139 let hash = sha256(bytes)
1612 }
1713
1814
19-func counting (bytes,caller) = {
15+func counting (bytes) = {
2016 let count = randomize(bytes, 10)
2117 if ((count >= 4))
22- then StringEntry(kWon, ((((toString(caller) + separator) + "false") + separatorSecond) + getStringValue(this, kWon)))
23- else StringEntry(kWon, ((((toString(caller) + separator) + "true") + separatorSecond) + getStringValue(this, kWon)))
18+ then BooleanEntry(kWon, false)
19+ else BooleanEntry(kWon, true)
2420 }
2521
2622
2723 @Callable(i)
28-func initStore () = [StringEntry(kWon, "0")]
29-
30-
31-
32-@Callable(i)
33-func parseStruct () = {
34- let nullInitStore = reentrantInvoke(this, "initStore", nil, nil)
35- if ((nullInitStore == nullInitStore))
36- then if ((i.caller != this))
37- then throw("Only owner")
38- else {
39- let winnerStruct = counting(i.transactionId, i.caller)
24+func parseStruct () = if ((i.caller != this))
25+ then throw("Only owner")
26+ else {
27+ let winnerStruct = counting(i.transactionId)
4028 [winnerStruct]
41- }
42- else throw("Strict value is not equal to itself.")
43- }
29+ }
4430
4531
4632
5238 else if ((amount > 20))
5339 then throw("You cannot bet more than 20")
5440 else {
55- let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error")
56- if (won)
57- then [ScriptTransfer(i.caller, (amount * 2), unit)]
58- else nil
41+ let nullInitStore = invoke(this, "parseStruct", nil, nil)
42+ if ((nullInitStore == nullInitStore))
43+ then {
44+ let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error")
45+ if (won)
46+ then [ScriptTransfer(i.caller, (amount * 2), unit)]
47+ else nil
48+ }
49+ else throw("Strict value is not equal to itself.")
5950 }
6051 }
6152
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let kUserPayment = "Payment"
55
66 let kWon = "Won"
7-
8-let separator = "/"
9-
10-let separatorSecond = "|"
117
128 func randomize (bytes,range) = {
139 let hash = sha256(bytes)
1410 let index = toInt(hash)
1511 (index % range)
1612 }
1713
1814
19-func counting (bytes,caller) = {
15+func counting (bytes) = {
2016 let count = randomize(bytes, 10)
2117 if ((count >= 4))
22- then StringEntry(kWon, ((((toString(caller) + separator) + "false") + separatorSecond) + getStringValue(this, kWon)))
23- else StringEntry(kWon, ((((toString(caller) + separator) + "true") + separatorSecond) + getStringValue(this, kWon)))
18+ then BooleanEntry(kWon, false)
19+ else BooleanEntry(kWon, true)
2420 }
2521
2622
2723 @Callable(i)
28-func initStore () = [StringEntry(kWon, "0")]
29-
30-
31-
32-@Callable(i)
33-func parseStruct () = {
34- let nullInitStore = reentrantInvoke(this, "initStore", nil, nil)
35- if ((nullInitStore == nullInitStore))
36- then if ((i.caller != this))
37- then throw("Only owner")
38- else {
39- let winnerStruct = counting(i.transactionId, i.caller)
24+func parseStruct () = if ((i.caller != this))
25+ then throw("Only owner")
26+ else {
27+ let winnerStruct = counting(i.transactionId)
4028 [winnerStruct]
41- }
42- else throw("Strict value is not equal to itself.")
43- }
29+ }
4430
4531
4632
4733 @Callable(i)
4834 func startGame () = {
4935 let amount = value(i.payments[0].amount)
5036 if ((i.payments[0].assetId != unit))
5137 then throw("Pay in waves")
5238 else if ((amount > 20))
5339 then throw("You cannot bet more than 20")
5440 else {
55- let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error")
56- if (won)
57- then [ScriptTransfer(i.caller, (amount * 2), unit)]
58- else nil
41+ let nullInitStore = invoke(this, "parseStruct", nil, nil)
42+ if ((nullInitStore == nullInitStore))
43+ then {
44+ let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error")
45+ if (won)
46+ then [ScriptTransfer(i.caller, (amount * 2), unit)]
47+ else nil
48+ }
49+ else throw("Strict value is not equal to itself.")
5950 }
6051 }
6152
6253

github/deemru/w8io/169f3d6 
62.36 ms