tx · 2Cz1nVhJ7CuEHYvMiAwa7yGLbPqyUHYtcFgmR9wShtjX 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV: -0.01000000 Waves 2021.12.08 21:27 [1825631] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves
{ "type": 13, "id": "2Cz1nVhJ7CuEHYvMiAwa7yGLbPqyUHYtcFgmR9wShtjX", "fee": 1000000, "feeAssetId": null, "timestamp": 1638988150403, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "5g8kJL81vBWUjHfAqjqeoGzmkAAWNgR5vC2DRkJT8T7fxUL6ts4vmwbDEgH7kCRNsKaJi12L9ywXBSRMonmgq28c" ], "script": "base64:AAIFAAAAAAAAABoIAhIAEgUKAwgICBIDCgEIEgMKAQgSAwoBCAAAAAEAAAAABXNlcGFyAgAAAAF8AAAABQAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAKbGFzdGdhbWVpZAIAAAABMAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9sYXN0Y2hhbGxlbmdlaWQCAAAAATAFAAAAA25pbAAAAAFpAQAAAAVtb292ZQAAAAMAAAAGZ2FtZWlkAAAABGZyb20AAAACdG8EAAAABGdhbWUJAAS1AAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTgpAAAAAQkAASwAAAACAgAAAAVnYW1lLQUAAAAGZ2FtZWlkBQAAAAVzZXBhcgMJAAAAAAAAAgkAAZEAAAACBQAAAARnYW1lAAAAAAAAAAAAAgAAAAdvbmdvaW5nBAAAAAxjYWxsZXJBZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMDCQAAAAAAAAIJAAGRAAAAAgUAAA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uaWwFAAAABXNlcGFyBQAAAANuaWwJAAACAAAAAQIAAAAUY2hhbGxlbmdlIG5vdCBleGlzdHMJAAACAAAAAQIAAAAUY2hhbGxlbmdlIG5vdCBleGlzdHMAAAAAsN8Rlg==", "height": 1825631, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ds9KxLV24az8RMis5XerfUMDoT2cF1mVmccBTZTJmUDw Next: 61q2JQ1FDnGsgv6LaJVmhC2zLbs16BvisjTij3cTtnGA Diff:
Old | New | Differences | |
---|---|---|---|
90 | 90 | then if ((pmt.amount >= parseIntValue(conditions[3]))) | |
91 | 91 | then if ((conditions[0] == "awaiting")) | |
92 | 92 | then { | |
93 | - | let black = if ((conditions[2] == " | |
93 | + | let black = if ((conditions[2] == "b")) | |
94 | 94 | then conditions[1] | |
95 | 95 | else callerAdress | |
96 | - | let white = if ((conditions[2] == " | |
96 | + | let white = if ((conditions[2] == "w")) | |
97 | 97 | then conditions[1] | |
98 | 98 | else callerAdress | |
99 | 99 | let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1)) | |
100 | 100 | [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), { | |
101 | 101 | let situation = "00:w:l|10:w:h|20:w:e|30:w:f|40:w:q|50:w:e|60:w:h|70:w:l||01:w:p|11:w:p|21:w:p|31:w:p|41:w:p|51:w:p|61:w:p|71:w:p||02:0:0|12:0:0|22:0:0|32:0:0|42:0:0|52:0:0|62:0:0|72:0:0||03:0:0|13:0:0|23:0:0|33:0:0|43:0:0|53:0:0|63:0:0|73:0:0||04:0:0|14:0:0|24:0:0|34:0:0|44:0:0|54:0:0|64:0:0|74:0:0||05:0:0|15:0:0|25:0:0|35:0:0|45:0:0|55:0:0|65:0:0|75:0:0||06:b:p|16:w:p|26:w:p|36:w:p|46:w:p|56:w:p|66:w:p|76:w:p||07:b:l|17:b:h|27:b:e|37:b:f|47:b:q|57:b:e|67:b:h|77:b:l" | |
102 | - | StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", " | |
102 | + | StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ)) | |
103 | 103 | }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)] | |
104 | 104 | } | |
105 | 105 | else throw("no challenge awaiting") | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Callable(i) | |
114 | - | func setchallenge (side) = if (if ((side == " | |
114 | + | func setchallenge (side) = if (if ((side == "b")) | |
115 | 115 | then true | |
116 | - | else (side == " | |
116 | + | else (side == "w")) | |
117 | 117 | then { | |
118 | 118 | let pmt = if ((size(i.payments) == 1)) | |
119 | 119 | then i.payments[0] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separ = "|" | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")] | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | @Callable(i) | |
12 | 12 | func moove (gameid,from,to) = { | |
13 | 13 | let game = split(getStringValue(("game-" + gameid)), separ) | |
14 | 14 | if ((game[0] == "ongoing")) | |
15 | 15 | then { | |
16 | 16 | let callerAdress = toBase58String(i.caller.bytes) | |
17 | 17 | if (if ((game[1] == callerAdress)) | |
18 | 18 | then true | |
19 | 19 | else (game[2] == callerAdress)) | |
20 | 20 | then { | |
21 | 21 | let side = if ((game[1] == callerAdress)) | |
22 | 22 | then "w" | |
23 | 23 | else "b" | |
24 | 24 | if ((game[5] == side)) | |
25 | 25 | then { | |
26 | 26 | let situation = game[8] | |
27 | 27 | let tolist = split(to, "") | |
28 | 28 | if (if (contains(situation, from)) | |
29 | 29 | then (tolist[3] != side) | |
30 | 30 | else false) | |
31 | 31 | then { | |
32 | 32 | let fromlist = split(from, "") | |
33 | 33 | let figure = fromlist[5] | |
34 | 34 | let fromx = parseIntValue(fromlist[0]) | |
35 | 35 | let fromy = parseIntValue(fromlist[1]) | |
36 | 36 | let tox = parseIntValue(tolist[0]) | |
37 | 37 | let toy = parseIntValue(tolist[1]) | |
38 | 38 | let rows = split(situation, "||") | |
39 | 39 | let cell = [split(rows[0], "|"), split(rows[1], "|"), split(rows[2], "|"), split(rows[3], "|"), split(rows[4], "|"), split(rows[5], "|"), split(rows[6], "|"), split(rows[7], "|")] | |
40 | 40 | if ((figure == "p")) | |
41 | 41 | then if ((side == "w")) | |
42 | 42 | then if ((tolist[3] == "b")) | |
43 | 43 | then if (if (((fromy - toy) == 1)) | |
44 | 44 | then if (((fromx - tox) == 1)) | |
45 | 45 | then true | |
46 | 46 | else ((fromx - tox) == 1) | |
47 | 47 | else false) | |
48 | 48 | then [StringEntry("-", "-")] | |
49 | 49 | else throw("incorrect eating") | |
50 | 50 | else { | |
51 | 51 | let c = split(cell[fromx][(fromy - 1)], "") | |
52 | 52 | let freecell = if ((c[3] == "0")) | |
53 | 53 | then true | |
54 | 54 | else false | |
55 | 55 | if (if ((fromx == tox)) | |
56 | 56 | then if (((fromy - tox) == 1)) | |
57 | 57 | then true | |
58 | 58 | else if (((fromx - tox) == 2)) | |
59 | 59 | then freecell | |
60 | 60 | else false | |
61 | 61 | else false) | |
62 | 62 | then [StringEntry("moved", ((("from-" + from) + " to-") + to))] | |
63 | 63 | else throw("incorrect move") | |
64 | 64 | } | |
65 | 65 | else [StringEntry("-", "-")] | |
66 | 66 | else [StringEntry("-", "-")] | |
67 | 67 | } | |
68 | 68 | else throw("not siotuation") | |
69 | 69 | } | |
70 | 70 | else throw("not your turn") | |
71 | 71 | } | |
72 | 72 | else throw("not gamer") | |
73 | 73 | } | |
74 | 74 | else throw("not ongoing game") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | ||
79 | 79 | @Callable(i) | |
80 | 80 | func startgame (challengeid) = { | |
81 | 81 | let pmt = if ((size(i.payments) == 1)) | |
82 | 82 | then i.payments[0] | |
83 | 83 | else throw("must stake some waves") | |
84 | 84 | if (isDefined(pmt.assetId)) | |
85 | 85 | then throw("works with waves only") | |
86 | 86 | else { | |
87 | 87 | let callerAdress = toBase58String(i.caller.bytes) | |
88 | 88 | let conditions = split(getStringValue(("challenge-" + challengeid)), separ) | |
89 | 89 | if ((size(conditions) > 0)) | |
90 | 90 | then if ((pmt.amount >= parseIntValue(conditions[3]))) | |
91 | 91 | then if ((conditions[0] == "awaiting")) | |
92 | 92 | then { | |
93 | - | let black = if ((conditions[2] == " | |
93 | + | let black = if ((conditions[2] == "b")) | |
94 | 94 | then conditions[1] | |
95 | 95 | else callerAdress | |
96 | - | let white = if ((conditions[2] == " | |
96 | + | let white = if ((conditions[2] == "w")) | |
97 | 97 | then conditions[1] | |
98 | 98 | else callerAdress | |
99 | 99 | let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1)) | |
100 | 100 | [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), { | |
101 | 101 | let situation = "00:w:l|10:w:h|20:w:e|30:w:f|40:w:q|50:w:e|60:w:h|70:w:l||01:w:p|11:w:p|21:w:p|31:w:p|41:w:p|51:w:p|61:w:p|71:w:p||02:0:0|12:0:0|22:0:0|32:0:0|42:0:0|52:0:0|62:0:0|72:0:0||03:0:0|13:0:0|23:0:0|33:0:0|43:0:0|53:0:0|63:0:0|73:0:0||04:0:0|14:0:0|24:0:0|34:0:0|44:0:0|54:0:0|64:0:0|74:0:0||05:0:0|15:0:0|25:0:0|35:0:0|45:0:0|55:0:0|65:0:0|75:0:0||06:b:p|16:w:p|26:w:p|36:w:p|46:w:p|56:w:p|66:w:p|76:w:p||07:b:l|17:b:h|27:b:e|37:b:f|47:b:q|57:b:e|67:b:h|77:b:l" | |
102 | - | StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", " | |
102 | + | StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ)) | |
103 | 103 | }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)] | |
104 | 104 | } | |
105 | 105 | else throw("no challenge awaiting") | |
106 | 106 | else throw("need more money") | |
107 | 107 | else throw("no challenge") | |
108 | 108 | } | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Callable(i) | |
114 | - | func setchallenge (side) = if (if ((side == " | |
114 | + | func setchallenge (side) = if (if ((side == "b")) | |
115 | 115 | then true | |
116 | - | else (side == " | |
116 | + | else (side == "w")) | |
117 | 117 | then { | |
118 | 118 | let pmt = if ((size(i.payments) == 1)) | |
119 | 119 | then i.payments[0] | |
120 | 120 | else throw("must stake some waves") | |
121 | 121 | if (isDefined(pmt.assetId)) | |
122 | 122 | then throw("works with waves only") | |
123 | 123 | else { | |
124 | 124 | let callerAdress = toBase58String(i.caller.bytes) | |
125 | 125 | let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1)) | |
126 | 126 | [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)] | |
127 | 127 | } | |
128 | 128 | } | |
129 | 129 | else throw("invalid side") | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | 134 | func unsetchallenge (challendgeid) = { | |
135 | 135 | let callerAdress = toBase58String(i.caller.bytes) | |
136 | 136 | func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) { | |
137 | 137 | case a: String => | |
138 | 138 | getStringValue(("challenge-" + challendgeid)) | |
139 | 139 | case _ => | |
140 | 140 | "" | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | let challenge = split(getchallenge(challendgeid), separ) | |
144 | 144 | if ((size(challenge) > 0)) | |
145 | 145 | then if ((challenge[0] == "awaiting")) | |
146 | 146 | then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))] | |
147 | 147 | else throw("challenge not exists") | |
148 | 148 | else throw("challenge not exists") | |
149 | 149 | } | |
150 | 150 | ||
151 | 151 |
github/deemru/w8io/026f985 34.15 ms ◑