tx · GsizKh7j4ggip5T1gJgTWa6ZCXBZiJ7cAAwJrQvE8Qx8 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.00200000 Waves 2022.09.14 18:09 [2228935] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{ "type": 13, "id": "GsizKh7j4ggip5T1gJgTWa6ZCXBZiJ7cAAwJrQvE8Qx8", "fee": 200000, "feeAssetId": null, "timestamp": 1663168194011, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "4Kczgq1VYuGWx4PJyh1BGuLYv48wXWhAMt3VRykAkQMdsiiNxtJrtTgrJrJqBQZxtPyY9hXagE3z8fZ7ZvZcH7Ke" ], "script": "base64:BgIKCAISBAoCAggSAAQADGtVc2VyUGF5bWVudAIHUGF5bWVudAAEa1dvbgIDV29uAAlzZXBhcmF0b3ICAS8BCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UCAWkBCGNvdW50aW5nAgVieXRlcwZjYWxsZXIDCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAVjb3VudAkBCXJhbmRvbWl6ZQIJAMkBAgUFYnl0ZXMJAGkCCQDIAQEFBWJ5dGVzAAIACgMJAGcCBQVjb3VudAADCQDMCAIJAQxCb29sZWFuRW50cnkCCQCsAgIJAKwCAgUEa1dvbgUJc2VwYXJhdG9yBQZjYWxsZXIHBQNuaWwJAMwIAgkBDEJvb2xlYW5FbnRyeQIJAKwCAgkArAICBQRrV29uBQlzZXBhcmF0b3IFBmNhbGxlcgYFA25pbAFpAQlzdGFydEdhbWUABAZhbW91bnQJAQV2YWx1ZQEICQCRAwII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yaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAOplpGo=", "height": 2228935, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E1t2f8ivUBNzS5n4anzwnXF4M5X19xqNydmrgtkxfHFW Next: ATsU1m5FkF1XgRi25BpbYtVX5ExNu2Wz23Mgyja5zCwH Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let b = "Won" | |
7 | 7 | ||
8 | - | func c (d,e) = { | |
9 | - | let f = sha256(d) | |
10 | - | let g = toInt(f) | |
11 | - | (g % e) | |
8 | + | let c = "/" | |
9 | + | ||
10 | + | func d (e,f) = { | |
11 | + | let g = sha256(e) | |
12 | + | let h = toInt(g) | |
13 | + | (h % f) | |
12 | 14 | } | |
13 | 15 | ||
14 | 16 | ||
15 | - | func h (d) = { | |
16 | - | let i = c(d, 10) | |
17 | - | if ((i >= 4)) | |
18 | - | then BooleanEntry(b, false) | |
19 | - | else BooleanEntry(b, true) | |
20 | - | } | |
21 | - | ||
22 | - | ||
23 | - | @Callable(j) | |
24 | - | func parseStruct () = if ((j.caller != this)) | |
17 | + | @Callable(i) | |
18 | + | func counting (e,j) = if ((i.caller != this)) | |
25 | 19 | then throw("Only owner") | |
26 | 20 | else { | |
27 | - | let k = h(j.transactionId) | |
28 | - | [k] | |
21 | + | let k = d(take(e, (size(e) / 2)), 10) | |
22 | + | if ((k >= 3)) | |
23 | + | then [BooleanEntry(((b + c) + j), false)] | |
24 | + | else [BooleanEntry(((b + c) + j), true)] | |
29 | 25 | } | |
30 | 26 | ||
31 | 27 | ||
32 | 28 | ||
33 | - | @Callable( | |
29 | + | @Callable(i) | |
34 | 30 | func startGame () = { | |
35 | - | let l = value( | |
36 | - | if (( | |
31 | + | let l = value(i.payments[0].amount) | |
32 | + | if ((i.payments[0].assetId != unit)) | |
37 | 33 | then throw("Pay in waves") | |
38 | - | else { | |
39 | - | let m = invoke(this, "parseStruct", nil, nil) | |
40 | - | if ((m == m)) | |
41 | - | then { | |
42 | - | let n = valueOrErrorMessage(getBoolean(this, b), "Storage read error") | |
43 | - | if (n) | |
44 | - | then [ScriptTransfer(j.caller, (l * 2), unit)] | |
45 | - | else nil | |
46 | - | } | |
47 | - | else throw("Strict value is not equal to itself.") | |
48 | - | } | |
34 | + | else if ((l > 10)) | |
35 | + | then throw("Maximum bet 10 waves") | |
36 | + | else { | |
37 | + | let m = invoke(this, "counting", [i.transactionId, toString(i.caller)], nil) | |
38 | + | if ((m == m)) | |
39 | + | then { | |
40 | + | let n = valueOrErrorMessage(getBoolean(this, ((b + c) + toString(i.caller))), "Storage read error") | |
41 | + | if (n) | |
42 | + | then [ScriptTransfer(i.caller, (l * 2), unit), DeleteEntry(((b + c) + toString(i.caller))), BooleanEntry(((((b + c) + toString(i.caller)) + c) + toString(d(i.transactionId, 1000))), true)] | |
43 | + | else [DeleteEntry(((b + c) + toString(i.caller))), BooleanEntry(((((b + c) + toString(i.caller)) + c) + toString(d(i.transactionId, 1000))), false)] | |
44 | + | } | |
45 | + | else throw("Strict value is not equal to itself.") | |
46 | + | } | |
49 | 47 | } | |
50 | 48 | ||
51 | 49 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "Payment" | |
5 | 5 | ||
6 | 6 | let b = "Won" | |
7 | 7 | ||
8 | - | func c (d,e) = { | |
9 | - | let f = sha256(d) | |
10 | - | let g = toInt(f) | |
11 | - | (g % e) | |
8 | + | let c = "/" | |
9 | + | ||
10 | + | func d (e,f) = { | |
11 | + | let g = sha256(e) | |
12 | + | let h = toInt(g) | |
13 | + | (h % f) | |
12 | 14 | } | |
13 | 15 | ||
14 | 16 | ||
15 | - | func h (d) = { | |
16 | - | let i = c(d, 10) | |
17 | - | if ((i >= 4)) | |
18 | - | then BooleanEntry(b, false) | |
19 | - | else BooleanEntry(b, true) | |
20 | - | } | |
21 | - | ||
22 | - | ||
23 | - | @Callable(j) | |
24 | - | func parseStruct () = if ((j.caller != this)) | |
17 | + | @Callable(i) | |
18 | + | func counting (e,j) = if ((i.caller != this)) | |
25 | 19 | then throw("Only owner") | |
26 | 20 | else { | |
27 | - | let k = h(j.transactionId) | |
28 | - | [k] | |
21 | + | let k = d(take(e, (size(e) / 2)), 10) | |
22 | + | if ((k >= 3)) | |
23 | + | then [BooleanEntry(((b + c) + j), false)] | |
24 | + | else [BooleanEntry(((b + c) + j), true)] | |
29 | 25 | } | |
30 | 26 | ||
31 | 27 | ||
32 | 28 | ||
33 | - | @Callable( | |
29 | + | @Callable(i) | |
34 | 30 | func startGame () = { | |
35 | - | let l = value( | |
36 | - | if (( | |
31 | + | let l = value(i.payments[0].amount) | |
32 | + | if ((i.payments[0].assetId != unit)) | |
37 | 33 | then throw("Pay in waves") | |
38 | - | else { | |
39 | - | let m = invoke(this, "parseStruct", nil, nil) | |
40 | - | if ((m == m)) | |
41 | - | then { | |
42 | - | let n = valueOrErrorMessage(getBoolean(this, b), "Storage read error") | |
43 | - | if (n) | |
44 | - | then [ScriptTransfer(j.caller, (l * 2), unit)] | |
45 | - | else nil | |
46 | - | } | |
47 | - | else throw("Strict value is not equal to itself.") | |
48 | - | } | |
34 | + | else if ((l > 10)) | |
35 | + | then throw("Maximum bet 10 waves") | |
36 | + | else { | |
37 | + | let m = invoke(this, "counting", [i.transactionId, toString(i.caller)], nil) | |
38 | + | if ((m == m)) | |
39 | + | then { | |
40 | + | let n = valueOrErrorMessage(getBoolean(this, ((b + c) + toString(i.caller))), "Storage read error") | |
41 | + | if (n) | |
42 | + | then [ScriptTransfer(i.caller, (l * 2), unit), DeleteEntry(((b + c) + toString(i.caller))), BooleanEntry(((((b + c) + toString(i.caller)) + c) + toString(d(i.transactionId, 1000))), true)] | |
43 | + | else [DeleteEntry(((b + c) + toString(i.caller))), BooleanEntry(((((b + c) + toString(i.caller)) + c) + toString(d(i.transactionId, 1000))), false)] | |
44 | + | } | |
45 | + | else throw("Strict value is not equal to itself.") | |
46 | + | } | |
49 | 47 | } | |
50 | 48 | ||
51 | 49 |
github/deemru/w8io/169f3d6 42.09 ms ◑