tx · 8Us9u4b7JhFQisT7Tp9hon4BBVGL8fLqhN9bft7MRGsf 3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f: -0.01400000 Waves 2018.10.12 11:40 [372159] smart account 3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f > SELF 0.00000000 Waves
{ "type": 13, "id": "8Us9u4b7JhFQisT7Tp9hon4BBVGL8fLqhN9bft7MRGsf", "fee": 1400000, "feeAssetId": null, "timestamp": 1539333674892, "version": 1, "sender": "3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f", "senderPublicKey": "4BRdUi95rN89kRWamqTcb9Dj9pLpAQbjLt17MPxcgGhG", "proofs": [ "38Gm1CVSusuALuNUEScgVWu7yAGjmQh1zWgKkh5PkM1YKqBg28YU1GrnmVgm9iscBMJS2BVZRVXKYHqkhMzkzdQ4" ], "script": "base64:AQQAAAAJcmVkUHViS2V5AQAAACCcvkAYXSO2dto8Bjx/Z65U0bGrFY5cIkLHdfY5mFVSDwQAAAALZ3JlZW5QdWJLZXkBAAAAIPlfPeSXGejVVO8XgpF607z8UJ46ZmmLUq4Rq0R8IFM8BAAAAApibHVlUHViS2V5AQAAACA97ajD767lxQiKGSbQ60FmHM7Nfb7azWSBD/TaFp3/QAQAAAAHcmVkQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVGfSoosyZxu2GPr01RED4+I9rSQ9LlF8XgQAAAAJZ3JlZW5BZGRyCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUeYFF8qf7pD+lzgJaCmi860XRkyZFP24HBAAAAAhibHVlQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVEG1BP9MronfM5Ad2fldCE7DdHowHHByOQQAAAAIY29udHJhY3QIBQAAAAJ0eAAAAAZzZW5kZXIEAAAACXJlZFNpZ25lZAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAA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gUAAAAEbW92ZQUAAAALdHVybkFsbG93ZWQHCQAAAAAAAAIFAAAACGRhdGFTaXplAAAAAAAAAAAEBwYJAAAAAAAAAgUAAAAIZGF0YVNpemUAAAAAAAAAAAwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA250eAUAAAAHJG1hdGNoMAYGvKW4yw==", "chainId": 84, "height": 372159, "spentComplexity": 0 } View: original | compacted Prev: 4JgYXnTj52Ak97j1jYyAR6QfwjGqVT1Af96jaEsrx2kw Next: 5MCAxSy4yfSHsyo9GTtatJruGL2FkCPH5su5HFhHwhLe Diff:
Old | New | Differences | |
---|---|---|---|
107 | 107 | let lockNotChanged = if ((("turn_" + toKey) == turnToKey)) | |
108 | 108 | then (turnToValue == oldTurnToValue) | |
109 | 109 | else false | |
110 | - | let fromUnits = | |
110 | + | let fromUnits = extract(getInteger(contract, fromKey)) | |
111 | 111 | let toUnits = extract(getInteger(contract, toKey)) | |
112 | 112 | let redAttackers = (fromUnits % 100) | |
113 | 113 | let greenAttackers = (((fromUnits - redAttackers) % 10000) / 100) | |
124 | 124 | else (((redDefenders + greenDefenders) + blueDefenders) + (height - oldTurnToValue)) | |
125 | 125 | let attackers = if ((unlimitedAttackers >= 9)) | |
126 | 126 | then 9 | |
127 | - | else unlimitedAttackers | |
128 | - | let defenders = if ((unlimitedDefenders >= | |
129 | - | then | |
127 | + | else (unlimitedAttackers - 1) | |
128 | + | let defenders = if ((unlimitedDefenders >= 10)) | |
129 | + | then 10 | |
130 | 130 | else unlimitedDefenders | |
131 | 131 | let king = if (if (if ((redAttackers > 0)) | |
132 | 132 | then redSigned |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 1 #-} | |
2 | 2 | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | 3 | let redPubKey = base58'BYrrqVpD5uuz7cndnPwuUxuYFUK6Bovu6yfoV8seY6Px' | |
4 | 4 | let greenPubKey = base58'HnSkSntD7ihFgZpLNmHgdVnVmCYxJLC96eNbubTXsWju' | |
5 | 5 | let bluePubKey = base58'5Ak4HQK3cnkwe6XVUXwpCYeSAARwruKyAmsmegePUPvo' | |
6 | 6 | let redAddr = Address(base58'3MyP3hrK8SBvtXtggNWdsry8KuGdrv1sFrV') | |
7 | 7 | let greenAddr = Address(base58'3MzzYQCC8Ks86exHaWV2VpaANbNLPRDunNJ') | |
8 | 8 | let blueAddr = Address(base58'3MuuWYr3DyjEkncbNU1tUeFbyvcyZng9gz4') | |
9 | 9 | let contract = tx.sender | |
10 | 10 | let redSigned = sigVerify(tx.bodyBytes, tx.proofs[0], redPubKey) | |
11 | 11 | let greenSigned = sigVerify(tx.bodyBytes, tx.proofs[0], greenPubKey) | |
12 | 12 | let blueSigned = sigVerify(tx.bodyBytes, tx.proofs[0], bluePubKey) | |
13 | 13 | match tx { | |
14 | 14 | case ttx: DataTransaction => | |
15 | 15 | let dataSize = size(ttx.data) | |
16 | 16 | let fromKey = ttx.data[0].key | |
17 | 17 | let toKey = ttx.data[1].key | |
18 | 18 | let newTurnFromKey = ttx.data[2].key | |
19 | 19 | let turnToKey = ttx.data[3].key | |
20 | 20 | let newFromUnits = ttx.data[0].value | |
21 | 21 | let newToUnits = ttx.data[1].value | |
22 | 22 | let newTurnFromValue = ttx.data[2].value | |
23 | 23 | let turnToValue = ttx.data[3].value | |
24 | 24 | let turnCorrect = if (if (if (if (if (if (if (if (if (if (if (if ((fromKey == "country1")) | |
25 | 25 | then (toKey == "country2") | |
26 | 26 | else false) | |
27 | 27 | then true | |
28 | 28 | else if ((fromKey == "country2")) | |
29 | 29 | then if ((toKey == "country1")) | |
30 | 30 | then true | |
31 | 31 | else (toKey == "country3") | |
32 | 32 | else false) | |
33 | 33 | then true | |
34 | 34 | else if ((fromKey == "country3")) | |
35 | 35 | then if (if ((toKey == "country2")) | |
36 | 36 | then true | |
37 | 37 | else (toKey == "country4")) | |
38 | 38 | then true | |
39 | 39 | else (toKey == "country5") | |
40 | 40 | else false) | |
41 | 41 | then true | |
42 | 42 | else if ((fromKey == "country4")) | |
43 | 43 | then if ((toKey == "country3")) | |
44 | 44 | then true | |
45 | 45 | else (toKey == "country8") | |
46 | 46 | else false) | |
47 | 47 | then true | |
48 | 48 | else if ((fromKey == "country5")) | |
49 | 49 | then if ((toKey == "country3")) | |
50 | 50 | then true | |
51 | 51 | else (toKey == "country10") | |
52 | 52 | else false) | |
53 | 53 | then true | |
54 | 54 | else if ((fromKey == "country6")) | |
55 | 55 | then (toKey == "country7") | |
56 | 56 | else false) | |
57 | 57 | then true | |
58 | 58 | else if ((fromKey == "country7")) | |
59 | 59 | then if ((toKey == "country6")) | |
60 | 60 | then true | |
61 | 61 | else (toKey == "country8") | |
62 | 62 | else false) | |
63 | 63 | then true | |
64 | 64 | else if ((fromKey == "country8")) | |
65 | 65 | then if (if ((toKey == "country4")) | |
66 | 66 | then true | |
67 | 67 | else (toKey == "country7")) | |
68 | 68 | then true | |
69 | 69 | else (toKey == "country9") | |
70 | 70 | else false) | |
71 | 71 | then true | |
72 | 72 | else if ((fromKey == "country9")) | |
73 | 73 | then if ((toKey == "country8")) | |
74 | 74 | then true | |
75 | 75 | else (toKey == "country10") | |
76 | 76 | else false) | |
77 | 77 | then true | |
78 | 78 | else if ((fromKey == "country10")) | |
79 | 79 | then if (if ((toKey == "country5")) | |
80 | 80 | then true | |
81 | 81 | else (toKey == "country10")) | |
82 | 82 | then true | |
83 | 83 | else (toKey == "country11") | |
84 | 84 | else false) | |
85 | 85 | then true | |
86 | 86 | else if ((fromKey == "country11")) | |
87 | 87 | then if ((toKey == "country10")) | |
88 | 88 | then true | |
89 | 89 | else (toKey == "country12") | |
90 | 90 | else false) | |
91 | 91 | then true | |
92 | 92 | else if ((fromKey == "country12")) | |
93 | 93 | then (toKey == "country11") | |
94 | 94 | else false | |
95 | 95 | let turnFromKey = ("turn_" + fromKey) | |
96 | 96 | let turnFromValue = extract(getInteger(contract, turnFromKey)) | |
97 | 97 | let turnAllowed = if (if (((height - 2) > turnFromValue)) | |
98 | 98 | then (turnFromKey == newTurnFromKey) | |
99 | 99 | else false) | |
100 | 100 | then (newTurnFromValue == height) | |
101 | 101 | else false | |
102 | 102 | let oldTurnToKey = ("turn_" + toKey) | |
103 | 103 | let oldTurnToValue = extract(getInteger(contract, oldTurnToKey)) | |
104 | 104 | let locked = if ((("turn_" + toKey) == turnToKey)) | |
105 | 105 | then (turnToValue == height) | |
106 | 106 | else false | |
107 | 107 | let lockNotChanged = if ((("turn_" + toKey) == turnToKey)) | |
108 | 108 | then (turnToValue == oldTurnToValue) | |
109 | 109 | else false | |
110 | - | let fromUnits = | |
110 | + | let fromUnits = extract(getInteger(contract, fromKey)) | |
111 | 111 | let toUnits = extract(getInteger(contract, toKey)) | |
112 | 112 | let redAttackers = (fromUnits % 100) | |
113 | 113 | let greenAttackers = (((fromUnits - redAttackers) % 10000) / 100) | |
114 | 114 | let blueAttackers = (((fromUnits - (greenAttackers * 100)) - redAttackers) / 10000) | |
115 | 115 | let redDefenders = (toUnits % 100) | |
116 | 116 | let greenDefenders = (((toUnits - redDefenders) % 10000) / 100) | |
117 | 117 | let blueDefenders = ((((toUnits - (greenDefenders * 100)) - redDefenders) % 1000000) / 10000) | |
118 | 118 | let whiteDefenders = ((((toUnits - (blueDefenders * 10000)) - (greenDefenders * 100)) - redDefenders) / 1000000) | |
119 | 119 | let countryAttackers = ((redAttackers + greenAttackers) + blueAttackers) | |
120 | 120 | let countryDefenders = ((redDefenders + greenDefenders) + blueDefenders) | |
121 | 121 | let unlimitedAttackers = (((redAttackers + greenAttackers) + blueAttackers) + (height - turnFromValue)) | |
122 | 122 | let unlimitedDefenders = if ((whiteDefenders > 0)) | |
123 | 123 | then whiteDefenders | |
124 | 124 | else (((redDefenders + greenDefenders) + blueDefenders) + (height - oldTurnToValue)) | |
125 | 125 | let attackers = if ((unlimitedAttackers >= 9)) | |
126 | 126 | then 9 | |
127 | - | else unlimitedAttackers | |
128 | - | let defenders = if ((unlimitedDefenders >= | |
129 | - | then | |
127 | + | else (unlimitedAttackers - 1) | |
128 | + | let defenders = if ((unlimitedDefenders >= 10)) | |
129 | + | then 10 | |
130 | 130 | else unlimitedDefenders | |
131 | 131 | let king = if (if (if ((redAttackers > 0)) | |
132 | 132 | then redSigned | |
133 | 133 | else false) | |
134 | 134 | then true | |
135 | 135 | else if ((greenAttackers > 0)) | |
136 | 136 | then greenSigned | |
137 | 137 | else false) | |
138 | 138 | then true | |
139 | 139 | else if ((blueAttackers > 0)) | |
140 | 140 | then blueSigned | |
141 | 141 | else false | |
142 | 142 | let multiAttackers = if ((countryAttackers > 0)) | |
143 | 143 | then (fromUnits / countryAttackers) | |
144 | 144 | else 0 | |
145 | 145 | let multiDefenders = if ((countryDefenders > 0)) | |
146 | 146 | then (toUnits / countryDefenders) | |
147 | 147 | else 0 | |
148 | 148 | let win = if (if (if (if (if (king) | |
149 | 149 | then (multiAttackers != multiDefenders) | |
150 | 150 | else false) | |
151 | 151 | then (attackers > defenders) | |
152 | 152 | else false) | |
153 | 153 | then (newFromUnits == multiAttackers) | |
154 | 154 | else false) | |
155 | 155 | then (newToUnits == ((attackers - defenders) * multiAttackers)) | |
156 | 156 | else false) | |
157 | 157 | then locked | |
158 | 158 | else false | |
159 | 159 | let lost = if (if (if (if (if (king) | |
160 | 160 | then (multiAttackers != multiDefenders) | |
161 | 161 | else false) | |
162 | 162 | then (defenders > attackers) | |
163 | 163 | else false) | |
164 | 164 | then (newFromUnits == multiAttackers) | |
165 | 165 | else false) | |
166 | 166 | then (newToUnits == ((defenders - attackers) * multiDefenders)) | |
167 | 167 | else false) | |
168 | 168 | then lockNotChanged | |
169 | 169 | else false | |
170 | 170 | let draw = if (if (if (if (if (king) | |
171 | 171 | then (multiAttackers != multiDefenders) | |
172 | 172 | else false) | |
173 | 173 | then (attackers == defenders) | |
174 | 174 | else false) | |
175 | 175 | then (newFromUnits == multiAttackers) | |
176 | 176 | else false) | |
177 | 177 | then (newToUnits == (((defenders + 1) - attackers) * multiDefenders)) | |
178 | 178 | else false) | |
179 | 179 | then lockNotChanged | |
180 | 180 | else false | |
181 | 181 | let move = if (if (if (if (if (king) | |
182 | 182 | then (multiAttackers == multiDefenders) | |
183 | 183 | else false) | |
184 | 184 | then (newFromUnits == multiAttackers) | |
185 | 185 | else false) | |
186 | 186 | then (10 >= (attackers + defenders)) | |
187 | 187 | else false) | |
188 | 188 | then (newToUnits == ((attackers + defenders) * multiAttackers)) | |
189 | 189 | else false) | |
190 | 190 | then locked | |
191 | 191 | else false | |
192 | 192 | if (if (if (if (if (if (win) | |
193 | 193 | then true | |
194 | 194 | else lost) | |
195 | 195 | then true | |
196 | 196 | else draw) | |
197 | 197 | then true | |
198 | 198 | else move) | |
199 | 199 | then turnAllowed | |
200 | 200 | else false) | |
201 | 201 | then (dataSize == 4) | |
202 | 202 | else false) | |
203 | 203 | then true | |
204 | 204 | else (dataSize == 12) | |
205 | 205 | case ntx: TransferTransaction => | |
206 | 206 | true | |
207 | 207 | case _ => | |
208 | 208 | true | |
209 | 209 | } |
github/deemru/w8io/169f3d6 45.57 ms ◑