tx · 864xNvJnBUwTCzZirzdsRzE6TPcHiAWuqeka1L9W3xwp 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV: -0.01000000 Waves 2021.12.09 08:50 [1826307] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves
{ "type": 13, "id": "864xNvJnBUwTCzZirzdsRzE6TPcHiAWuqeka1L9W3xwp", "fee": 1000000, "feeAssetId": null, "timestamp": 1639029035349, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "4q8b6C5Xamb1tTMcP5Dfy5yQnoGYjccvu4Yrzy8efWAYCL6gXCxkZRfKE89BK5VB8MtrCShtGAQ6gPwrV65U8bFK" ], "script": "base64:AAIFAAAAAAAAABoIAhIAEgUKAwgICBIDCgEIEgMKAQgSAwoBCAAAAAEAAAAABXNlcGFyAgAAAAF8AAAABQAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAKbGFzdGdhbWVpZAIAAAABMAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9sYXN0Y2hhbGxlbmdlaWQCAAAAATAFAAAAA25pbAAAAAFpAQAAAARtb3ZlAAAAAwAAAAZnYW1laWQAAAAEZnJvbQAAAAJ0bwQAAAAEZ2FtZQkABLUAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1OCkAAAABCQABLAAAAAICAAAABWdhbWUtBQAAAAZnYW1laWQFAAAABXNlcGFyAwkAAAAAAAACBQAAAARnYW1lBQAAAARnYW1lBAAAAAxjYWxsZXJBZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAMY2FsbGVyQWRyZXNzBQAAAAxjYWxsZXJBZHJlc3MEAAAABmlzZ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AkABCIAAAABCQABLAAAAAICAAAACmNoYWxsZW5nZS0FAAAADGNoYWxsZW5kZ2VpZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwCQEAAAARQGV4dHJOYXRpdmUoMTA1OCkAAAABCQABLAAAAAICAAAACmNoYWxsZW5nZS0FAAAADGNoYWxsZW5kZ2VpZAIAAAAABAAAAAljaGFsbGVuZ2UJAAS1AAAAAgkBAAAADGdldGNoYWxsZW5nZQAAAAEFAAAADGNoYWxsZW5kZ2VpZAUAAAAFc2VwYXIDCQAAZgAAAAIJAAGQAAAAAQUAAAAJY2hhbGxlbmdlAAAAAAAAAAAAAwkAAAAAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAAIAAAAIYXdhaXRpbmcJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAApjaGFsbGVuZ2UtBQAAAAxjaGFsbGVuZGdlaWQJAAS5AAAAAgkABEwAAAACAgAAAAV1bnNldAkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAQkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAgkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAwUAAAADbmlsBQAAAAVzZXBhcgUAAAADbmlsCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzAAAAACDseAY=", "height": 1826307, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4QxjvxHg76BRbog9kQer2hUfmQuaeF7hPWjy7ozWYGLA Next: HymfQyQYfauW4g7s6GCVPJpQRAFbXr2UeYmMEDHhDBby Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | ||
11 | 11 | @Callable(b) | |
12 | - | func | |
12 | + | func move (c,d,e) = { | |
13 | 13 | let f = split(getStringValue(("game-" + c)), a) | |
14 | - | if ((f | |
14 | + | if ((f == f)) | |
15 | 15 | then { | |
16 | 16 | let g = toBase58String(b.caller.bytes) | |
17 | - | if (if ((f[1] == g)) | |
18 | - | then true | |
19 | - | else (f[2] == g)) | |
17 | + | if ((g == g)) | |
20 | 18 | then { | |
21 | - | let h = if ((f[ | |
22 | - | then | |
23 | - | else " | |
24 | - | if (( | |
19 | + | let h = if ((f[0] == "ongoing")) | |
20 | + | then true | |
21 | + | else throw("not ongoing game") | |
22 | + | if ((h == h)) | |
25 | 23 | then { | |
26 | - | let i = split(e, "") | |
27 | - | let j = split(d, "") | |
28 | - | let k = j[5] | |
29 | - | let l = parseIntValue(j[0]) | |
30 | - | let m = parseIntValue(j[1]) | |
31 | - | let n = parseIntValue(i[0]) | |
32 | - | let o = parseIntValue(i[1]) | |
33 | - | let p = f[8] | |
34 | - | let q = split(p, "||") | |
35 | - | let r = [split(q[0], "|"), split(q[1], "|"), split(q[2], "|"), split(q[3], "|"), split(q[4], "|"), split(q[5], "|"), split(q[6], "|"), split(q[7], "|")] | |
36 | - | if (if ((r[l][m] == d)) | |
37 | - | then (r[n][o] == e) | |
24 | + | let i = if (if (h) | |
25 | + | then if ((f[1] == g)) | |
26 | + | then true | |
27 | + | else (f[2] == g) | |
38 | 28 | else false) | |
39 | - | then if ((k == "p")) | |
40 | - | then if ((h == "w")) | |
41 | - | then if ((i[3] == "b")) | |
42 | - | then if (if (((m - o) == 1)) | |
43 | - | then if (((l - n) == 1)) | |
44 | - | then true | |
45 | - | else ((l - n) == 1) | |
46 | - | else false) | |
47 | - | then [StringEntry("-", "-")] | |
48 | - | else throw("incorrect eating") | |
49 | - | else { | |
50 | - | let s = split(r[l][(m - 1)], "") | |
51 | - | let t = if ((s[3] == "0")) | |
52 | - | then true | |
53 | - | else false | |
54 | - | if (if ((l == n)) | |
55 | - | then if (((m - n) == 1)) | |
29 | + | then if ((f[1] == g)) | |
30 | + | then "w" | |
31 | + | else "b" | |
32 | + | else throw("not gamer") | |
33 | + | if ((i == i)) | |
34 | + | then { | |
35 | + | let j = if ((i == f[5])) | |
36 | + | then true | |
37 | + | else throw("not your turn") | |
38 | + | if ((j == j)) | |
39 | + | then { | |
40 | + | let k = split(f[8], "||") | |
41 | + | let l = [split(k[0], "|"), split(k[1], "|"), split(k[2], "|"), split(k[3], "|"), split(k[4], "|"), split(k[5], "|"), split(k[6], "|"), split(k[7], "|")] | |
42 | + | if ((l == l)) | |
43 | + | then { | |
44 | + | let m = split(d, "") | |
45 | + | let n = split(e, "") | |
46 | + | let o = parseIntValue(m[0]) | |
47 | + | let p = parseIntValue(m[1]) | |
48 | + | let q = parseIntValue(n[0]) | |
49 | + | let r = parseIntValue(n[1]) | |
50 | + | let s = if (if ((take(l[o][p], 1) == i)) | |
51 | + | then (take(l[q][r], 1) != i) | |
52 | + | else false) | |
56 | 53 | then true | |
57 | - | else if (((l - n) == 2)) | |
58 | - | then t | |
59 | - | else false | |
60 | - | else false) | |
61 | - | then [StringEntry("moved", ((("from-" + d) + " to-") + e))] | |
62 | - | else throw("incorrect move") | |
63 | - | } | |
64 | - | else [StringEntry("-", "-")] | |
65 | - | else [StringEntry("-", "-")] | |
66 | - | else throw("not situation") | |
54 | + | else throw("wrong position") | |
55 | + | if ((s == s)) | |
56 | + | then { | |
57 | + | let t = l[o][p] | |
58 | + | if (s) | |
59 | + | then [StringEntry("_", "figure")] | |
60 | + | else [StringEntry("_", "_")] | |
61 | + | } | |
62 | + | else throw("Strict value is not equal to itself.") | |
63 | + | } | |
64 | + | else throw("Strict value is not equal to itself.") | |
65 | + | } | |
66 | + | else throw("Strict value is not equal to itself.") | |
67 | + | } | |
68 | + | else throw("Strict value is not equal to itself.") | |
67 | 69 | } | |
68 | - | else throw("not | |
70 | + | else throw("Strict value is not equal to itself.") | |
69 | 71 | } | |
70 | - | else throw("not | |
72 | + | else throw("Strict value is not equal to itself.") | |
71 | 73 | } | |
72 | - | else throw("not | |
74 | + | else throw("Strict value is not equal to itself.") | |
73 | 75 | } | |
74 | 76 | ||
75 | 77 | ||
96 | 98 | else g | |
97 | 99 | let c = toString((parseIntValue(getStringValue("lastgameid")) + 1)) | |
98 | 100 | [StringEntry(("challenge-" + u), makeString([c, w[1], w[2], w[3], g], a)), { | |
99 | - | let | |
100 | - | StringEntry(("game-" + c), makeString(["ongoing", y, x, w[3], "0", "w", "startblock", "laststepblock", | |
101 | + | let k = "wl|wh|we|wf|wq|we|wh|wl||wp|wp|wp|wp|wp|wp|wp|wp||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||bp|bp|bp|bp|bp|bp|bp|bp||bl|bh|be|bf|bq|be|bh|bl" | |
102 | + | StringEntry(("game-" + c), makeString(["ongoing", y, x, w[3], "0", "w", "startblock", "laststepblock", k], a)) | |
101 | 103 | }, StringEntry("lastgameid", c), ScriptTransfer(b.caller, (v.amount - parseIntValue(w[3])), unit)] | |
102 | 104 | } | |
103 | 105 | else throw("no challenge awaiting") | |
109 | 111 | ||
110 | 112 | ||
111 | 113 | @Callable(b) | |
112 | - | func setchallenge ( | |
114 | + | func setchallenge (i) = if (if ((i == "b")) | |
113 | 115 | then true | |
114 | - | else ( | |
116 | + | else (i == "w")) | |
115 | 117 | then { | |
116 | 118 | let v = if ((size(b.payments) == 1)) | |
117 | 119 | then b.payments[0] | |
121 | 123 | else { | |
122 | 124 | let g = toBase58String(b.caller.bytes) | |
123 | 125 | let u = toString((parseIntValue(getStringValue("lastchallengeid")) + 1)) | |
124 | - | [StringEntry(("challenge-" + u), makeString(["awaiting", g, | |
126 | + | [StringEntry(("challenge-" + u), makeString(["awaiting", g, i, toString(v.amount)], a)), StringEntry("lastchallengeid", u)] | |
125 | 127 | } | |
126 | 128 | } | |
127 | 129 | else throw("invalid side") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "|" | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | 7 | func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")] | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | @Callable(b) | |
12 | - | func | |
12 | + | func move (c,d,e) = { | |
13 | 13 | let f = split(getStringValue(("game-" + c)), a) | |
14 | - | if ((f | |
14 | + | if ((f == f)) | |
15 | 15 | then { | |
16 | 16 | let g = toBase58String(b.caller.bytes) | |
17 | - | if (if ((f[1] == g)) | |
18 | - | then true | |
19 | - | else (f[2] == g)) | |
17 | + | if ((g == g)) | |
20 | 18 | then { | |
21 | - | let h = if ((f[ | |
22 | - | then | |
23 | - | else " | |
24 | - | if (( | |
19 | + | let h = if ((f[0] == "ongoing")) | |
20 | + | then true | |
21 | + | else throw("not ongoing game") | |
22 | + | if ((h == h)) | |
25 | 23 | then { | |
26 | - | let i = split(e, "") | |
27 | - | let j = split(d, "") | |
28 | - | let k = j[5] | |
29 | - | let l = parseIntValue(j[0]) | |
30 | - | let m = parseIntValue(j[1]) | |
31 | - | let n = parseIntValue(i[0]) | |
32 | - | let o = parseIntValue(i[1]) | |
33 | - | let p = f[8] | |
34 | - | let q = split(p, "||") | |
35 | - | let r = [split(q[0], "|"), split(q[1], "|"), split(q[2], "|"), split(q[3], "|"), split(q[4], "|"), split(q[5], "|"), split(q[6], "|"), split(q[7], "|")] | |
36 | - | if (if ((r[l][m] == d)) | |
37 | - | then (r[n][o] == e) | |
24 | + | let i = if (if (h) | |
25 | + | then if ((f[1] == g)) | |
26 | + | then true | |
27 | + | else (f[2] == g) | |
38 | 28 | else false) | |
39 | - | then if ((k == "p")) | |
40 | - | then if ((h == "w")) | |
41 | - | then if ((i[3] == "b")) | |
42 | - | then if (if (((m - o) == 1)) | |
43 | - | then if (((l - n) == 1)) | |
44 | - | then true | |
45 | - | else ((l - n) == 1) | |
46 | - | else false) | |
47 | - | then [StringEntry("-", "-")] | |
48 | - | else throw("incorrect eating") | |
49 | - | else { | |
50 | - | let s = split(r[l][(m - 1)], "") | |
51 | - | let t = if ((s[3] == "0")) | |
52 | - | then true | |
53 | - | else false | |
54 | - | if (if ((l == n)) | |
55 | - | then if (((m - n) == 1)) | |
29 | + | then if ((f[1] == g)) | |
30 | + | then "w" | |
31 | + | else "b" | |
32 | + | else throw("not gamer") | |
33 | + | if ((i == i)) | |
34 | + | then { | |
35 | + | let j = if ((i == f[5])) | |
36 | + | then true | |
37 | + | else throw("not your turn") | |
38 | + | if ((j == j)) | |
39 | + | then { | |
40 | + | let k = split(f[8], "||") | |
41 | + | let l = [split(k[0], "|"), split(k[1], "|"), split(k[2], "|"), split(k[3], "|"), split(k[4], "|"), split(k[5], "|"), split(k[6], "|"), split(k[7], "|")] | |
42 | + | if ((l == l)) | |
43 | + | then { | |
44 | + | let m = split(d, "") | |
45 | + | let n = split(e, "") | |
46 | + | let o = parseIntValue(m[0]) | |
47 | + | let p = parseIntValue(m[1]) | |
48 | + | let q = parseIntValue(n[0]) | |
49 | + | let r = parseIntValue(n[1]) | |
50 | + | let s = if (if ((take(l[o][p], 1) == i)) | |
51 | + | then (take(l[q][r], 1) != i) | |
52 | + | else false) | |
56 | 53 | then true | |
57 | - | else if (((l - n) == 2)) | |
58 | - | then t | |
59 | - | else false | |
60 | - | else false) | |
61 | - | then [StringEntry("moved", ((("from-" + d) + " to-") + e))] | |
62 | - | else throw("incorrect move") | |
63 | - | } | |
64 | - | else [StringEntry("-", "-")] | |
65 | - | else [StringEntry("-", "-")] | |
66 | - | else throw("not situation") | |
54 | + | else throw("wrong position") | |
55 | + | if ((s == s)) | |
56 | + | then { | |
57 | + | let t = l[o][p] | |
58 | + | if (s) | |
59 | + | then [StringEntry("_", "figure")] | |
60 | + | else [StringEntry("_", "_")] | |
61 | + | } | |
62 | + | else throw("Strict value is not equal to itself.") | |
63 | + | } | |
64 | + | else throw("Strict value is not equal to itself.") | |
65 | + | } | |
66 | + | else throw("Strict value is not equal to itself.") | |
67 | + | } | |
68 | + | else throw("Strict value is not equal to itself.") | |
67 | 69 | } | |
68 | - | else throw("not | |
70 | + | else throw("Strict value is not equal to itself.") | |
69 | 71 | } | |
70 | - | else throw("not | |
72 | + | else throw("Strict value is not equal to itself.") | |
71 | 73 | } | |
72 | - | else throw("not | |
74 | + | else throw("Strict value is not equal to itself.") | |
73 | 75 | } | |
74 | 76 | ||
75 | 77 | ||
76 | 78 | ||
77 | 79 | @Callable(b) | |
78 | 80 | func startgame (u) = { | |
79 | 81 | let v = if ((size(b.payments) == 1)) | |
80 | 82 | then b.payments[0] | |
81 | 83 | else throw("must stake some waves") | |
82 | 84 | if (isDefined(v.assetId)) | |
83 | 85 | then throw("works with waves only") | |
84 | 86 | else { | |
85 | 87 | let g = toBase58String(b.caller.bytes) | |
86 | 88 | let w = split(getStringValue(("challenge-" + u)), a) | |
87 | 89 | if ((size(w) > 0)) | |
88 | 90 | then if ((v.amount >= parseIntValue(w[3]))) | |
89 | 91 | then if ((w[0] == "awaiting")) | |
90 | 92 | then { | |
91 | 93 | let x = if ((w[2] == "b")) | |
92 | 94 | then w[1] | |
93 | 95 | else g | |
94 | 96 | let y = if ((w[2] == "w")) | |
95 | 97 | then w[1] | |
96 | 98 | else g | |
97 | 99 | let c = toString((parseIntValue(getStringValue("lastgameid")) + 1)) | |
98 | 100 | [StringEntry(("challenge-" + u), makeString([c, w[1], w[2], w[3], g], a)), { | |
99 | - | let | |
100 | - | StringEntry(("game-" + c), makeString(["ongoing", y, x, w[3], "0", "w", "startblock", "laststepblock", | |
101 | + | let k = "wl|wh|we|wf|wq|we|wh|wl||wp|wp|wp|wp|wp|wp|wp|wp||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||bp|bp|bp|bp|bp|bp|bp|bp||bl|bh|be|bf|bq|be|bh|bl" | |
102 | + | StringEntry(("game-" + c), makeString(["ongoing", y, x, w[3], "0", "w", "startblock", "laststepblock", k], a)) | |
101 | 103 | }, StringEntry("lastgameid", c), ScriptTransfer(b.caller, (v.amount - parseIntValue(w[3])), unit)] | |
102 | 104 | } | |
103 | 105 | else throw("no challenge awaiting") | |
104 | 106 | else throw("need more money") | |
105 | 107 | else throw("no challenge") | |
106 | 108 | } | |
107 | 109 | } | |
108 | 110 | ||
109 | 111 | ||
110 | 112 | ||
111 | 113 | @Callable(b) | |
112 | - | func setchallenge ( | |
114 | + | func setchallenge (i) = if (if ((i == "b")) | |
113 | 115 | then true | |
114 | - | else ( | |
116 | + | else (i == "w")) | |
115 | 117 | then { | |
116 | 118 | let v = if ((size(b.payments) == 1)) | |
117 | 119 | then b.payments[0] | |
118 | 120 | else throw("must stake some waves") | |
119 | 121 | if (isDefined(v.assetId)) | |
120 | 122 | then throw("works with waves only") | |
121 | 123 | else { | |
122 | 124 | let g = toBase58String(b.caller.bytes) | |
123 | 125 | let u = toString((parseIntValue(getStringValue("lastchallengeid")) + 1)) | |
124 | - | [StringEntry(("challenge-" + u), makeString(["awaiting", g, | |
126 | + | [StringEntry(("challenge-" + u), makeString(["awaiting", g, i, toString(v.amount)], a)), StringEntry("lastchallengeid", u)] | |
125 | 127 | } | |
126 | 128 | } | |
127 | 129 | else throw("invalid side") | |
128 | 130 | ||
129 | 131 | ||
130 | 132 | ||
131 | 133 | @Callable(b) | |
132 | 134 | func unsetchallenge (z) = { | |
133 | 135 | let g = toBase58String(b.caller.bytes) | |
134 | 136 | func A (z) = { | |
135 | 137 | let B = getString(("challenge-" + z)) | |
136 | 138 | if ($isInstanceOf(B, "String")) | |
137 | 139 | then { | |
138 | 140 | let C = B | |
139 | 141 | getStringValue(("challenge-" + z)) | |
140 | 142 | } | |
141 | 143 | else "" | |
142 | 144 | } | |
143 | 145 | ||
144 | 146 | let D = split(A(z), a) | |
145 | 147 | if ((size(D) > 0)) | |
146 | 148 | then if ((D[0] == "awaiting")) | |
147 | 149 | then [StringEntry(("challenge-" + z), makeString(["unset", D[1], D[2], D[3]], a))] | |
148 | 150 | else throw("challenge not exists") | |
149 | 151 | else throw("challenge not exists") | |
150 | 152 | } | |
151 | 153 | ||
152 | 154 |
github/deemru/w8io/169f3d6 91.82 ms ◑