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