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