tx · 4ZuZ1dmL2RHnh8YDxcCmMkhop3CSHc6nzXDDuQtvRzXi

3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f:  -0.01400000 Waves

2018.09.29 18:38 [353490] smart account 3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f > SELF 0.00000000 Waves

{ "type": 13, "id": "4ZuZ1dmL2RHnh8YDxcCmMkhop3CSHc6nzXDDuQtvRzXi", "fee": 1400000, "feeAssetId": null, "timestamp": 1538235582104, "version": 1, "sender": "3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f", "senderPublicKey": "4BRdUi95rN89kRWamqTcb9Dj9pLpAQbjLt17MPxcgGhG", "proofs": [ "5XfdnoyHTLcEfyuKAWCn2cMqd9QbgbHawXv8kv9JBJNKLW3k7E5YWpUxCoSs2CCs5j8T7wFJjDCtHUqBE8BzVdzZ" ], "script": "base64:AQQAAAAJcmVkUHViS2V5AQAAACCcvkAYXSO2dto8Bjx/Z65U0bGrFY5cIkLHdfY5mFVSDwQAAAALZ3JlZW5QdWJLZXkBAAAAIPlfPeSXGejVVO8XgpF607z8UJ46ZmmLUq4Rq0R8IFM8BAAAAApibHVlUHViS2V5AQAAACA97ajD767lxQiKGSbQ60FmHM7Nfb7azWSBD/TaFp3/QAQAAAAHcmVkQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVGfSoosyZxu2GPr01RED4+I9rSQ9LlF8XgQAAAAJZ3JlZW5BZGRyCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUeYFF8qf7pD+lzgJaCmi860XRkyZFP24HBAAAAAhibHVlQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVEG1BP9MronfM5Ad2fldCE7DdHowHHByOQQAAAAIY29udHJhY3QIBQAAAAJ0eAAAAAZzZW5kZXIEAAAACXJlZFNpZ25lZAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAA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QHCQAAAAAAAAIFAAAACGRhdGFTaXplAAAAAAAAAAADBwYJAAAAAAAAAgUAAAAIZGF0YVNpemUAAAAAAAAAAAwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA250eAUAAAAHJG1hdGNoMAYGXkP5IQ==", "chainId": 84, "height": 353490, "spentComplexity": 0 } View: original | compacted Prev: 2XUAgax8HLwV4yTWjcrvTsJ4rPdmLGXGq3Q95SYnuqXe Next: J3SKyYF6i668SV9Y7bwfD15J62koiVS2sRycio1FHgaX Diff:
OldNewDifferences
9393 let turnFromKey = ("turn_" + fromKey)
9494 let turnFromValue = extract(getInteger(contract, turnFromKey))
9595 let turnAllowed = (turnFromValue == 0)
96+ let oldTurnToKey = ("turn_" + toKey)
97+ let oldTurnToValue = extract(getInteger(contract, oldTurnToKey))
9698 let locked = if ((("turn_" + toKey) == turnToKey))
9799 then (turnToValue == 1)
100+ else false
101+ let lockNotChanged = if ((("turn_" + toKey) == turnToKey))
102+ then (turnToValue == oldTurnToValue)
98103 else false
99104 let fromUnits = extract(getInteger(contract, fromKey))
100105 let toUnits = extract(getInteger(contract, toKey))
118123 else if ((blueAttackers > 0))
119124 then blueSigned
120125 else false
121- let multiAttackers = (fromUnits / attackers)
122- let multiDefenders = (toUnits / defenders)
123- let win = if (if (if (if (if (if (king)
126+ let multiAttackers = if ((attackers > 0))
127+ then (fromUnits / attackers)
128+ else 0
129+ let multiDefenders = if ((defenders > 0))
130+ then (toUnits / defenders)
131+ else 0
132+ let win = if (if (if (if (if (king)
124133 then (multiAttackers != multiDefenders)
125134 else false)
126135 then (attackers > defenders)
130139 then (newToUnits == ((attackers - defenders) * multiAttackers))
131140 else false)
132141 then locked
133- else false)
134- then (dataSize == 3)
135142 else false
136143 let lost = if (if (if (if (if (king)
137144 then (multiAttackers != multiDefenders)
142149 else false)
143150 then (newToUnits == ((defenders - attackers) * multiDefenders))
144151 else false)
145- then (dataSize == 2)
152+ then lockNotChanged
146153 else false
147154 let draw = if (if (if (if (if (king)
148155 then (multiAttackers != multiDefenders)
153160 else false)
154161 then (newToUnits == (((defenders + 1) - attackers) * multiDefenders))
155162 else false)
156- then (dataSize == 2)
163+ then lockNotChanged
157164 else false
158- let move = if (if (if (if (if (if (king)
165+ let move = if (if (if (if (if (king)
159166 then (multiAttackers == multiDefenders)
160167 else false)
161168 then (newFromUnits == 0)
165172 then (newToUnits == ((attackers + defenders) * multiAttackers))
166173 else false)
167174 then locked
168- else false)
169- then (dataSize == 3)
170175 else false
171- if (if (if (if (if (win)
176+ if (if (if (if (if (if (win)
172177 then true
173178 else lost)
174179 then true
176181 then true
177182 else move)
178183 then turnAllowed
184+ else false)
185+ then (dataSize == 3)
179186 else false)
180187 then true
181188 else (dataSize == 12)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 1 #-}
22 {-# CONTENT_TYPE EXPRESSION #-}
33 let redPubKey = base58'BYrrqVpD5uuz7cndnPwuUxuYFUK6Bovu6yfoV8seY6Px'
44 let greenPubKey = base58'HnSkSntD7ihFgZpLNmHgdVnVmCYxJLC96eNbubTXsWju'
55 let bluePubKey = base58'5Ak4HQK3cnkwe6XVUXwpCYeSAARwruKyAmsmegePUPvo'
66 let redAddr = Address(base58'3MyP3hrK8SBvtXtggNWdsry8KuGdrv1sFrV')
77 let greenAddr = Address(base58'3MzzYQCC8Ks86exHaWV2VpaANbNLPRDunNJ')
88 let blueAddr = Address(base58'3MuuWYr3DyjEkncbNU1tUeFbyvcyZng9gz4')
99 let contract = tx.sender
1010 let redSigned = sigVerify(tx.bodyBytes, tx.proofs[0], redPubKey)
1111 let greenSigned = sigVerify(tx.bodyBytes, tx.proofs[0], greenPubKey)
1212 let blueSigned = sigVerify(tx.bodyBytes, tx.proofs[0], bluePubKey)
1313 match tx {
1414 case ttx: DataTransaction =>
1515 let dataSize = size(ttx.data)
1616 let fromKey = ttx.data[0].key
1717 let toKey = ttx.data[1].key
1818 let turnToKey = ttx.data[2].key
1919 let newFromUnits = ttx.data[0].value
2020 let newToUnits = ttx.data[1].value
2121 let turnToValue = ttx.data[2].value
2222 let turnCorrect = if (if (if (if (if (if (if (if (if (if (if (if ((fromKey == "country1"))
2323 then (toKey == "country2")
2424 else false)
2525 then true
2626 else if ((fromKey == "country2"))
2727 then if ((toKey == "country1"))
2828 then true
2929 else (toKey == "country3")
3030 else false)
3131 then true
3232 else if ((fromKey == "country3"))
3333 then if (if ((toKey == "country2"))
3434 then true
3535 else (toKey == "country4"))
3636 then true
3737 else (toKey == "country5")
3838 else false)
3939 then true
4040 else if ((fromKey == "country4"))
4141 then if ((toKey == "country3"))
4242 then true
4343 else (toKey == "country8")
4444 else false)
4545 then true
4646 else if ((fromKey == "country5"))
4747 then if ((toKey == "country3"))
4848 then true
4949 else (toKey == "country10")
5050 else false)
5151 then true
5252 else if ((fromKey == "country6"))
5353 then (toKey == "country7")
5454 else false)
5555 then true
5656 else if ((fromKey == "country7"))
5757 then if ((toKey == "country6"))
5858 then true
5959 else (toKey == "country8")
6060 else false)
6161 then true
6262 else if ((fromKey == "country8"))
6363 then if (if ((toKey == "country4"))
6464 then true
6565 else (toKey == "country7"))
6666 then true
6767 else (toKey == "country9")
6868 else false)
6969 then true
7070 else if ((fromKey == "country9"))
7171 then if ((toKey == "country8"))
7272 then true
7373 else (toKey == "country10")
7474 else false)
7575 then true
7676 else if ((fromKey == "country10"))
7777 then if (if ((toKey == "country5"))
7878 then true
7979 else (toKey == "country10"))
8080 then true
8181 else (toKey == "country11")
8282 else false)
8383 then true
8484 else if ((fromKey == "country11"))
8585 then if ((toKey == "country10"))
8686 then true
8787 else (toKey == "country12")
8888 else false)
8989 then true
9090 else if ((fromKey == "country12"))
9191 then (toKey == "country11")
9292 else false
9393 let turnFromKey = ("turn_" + fromKey)
9494 let turnFromValue = extract(getInteger(contract, turnFromKey))
9595 let turnAllowed = (turnFromValue == 0)
96+ let oldTurnToKey = ("turn_" + toKey)
97+ let oldTurnToValue = extract(getInteger(contract, oldTurnToKey))
9698 let locked = if ((("turn_" + toKey) == turnToKey))
9799 then (turnToValue == 1)
100+ else false
101+ let lockNotChanged = if ((("turn_" + toKey) == turnToKey))
102+ then (turnToValue == oldTurnToValue)
98103 else false
99104 let fromUnits = extract(getInteger(contract, fromKey))
100105 let toUnits = extract(getInteger(contract, toKey))
101106 let redAttackers = (fromUnits % 100)
102107 let greenAttackers = (((fromUnits - redAttackers) % 10000) / 100)
103108 let blueAttackers = (((fromUnits - (greenAttackers * 100)) - redAttackers) / 10000)
104109 let redDefenders = (toUnits % 100)
105110 let greenDefenders = (((toUnits - redDefenders) % 10000) / 100)
106111 let blueDefenders = ((((toUnits - (greenDefenders * 100)) - redDefenders) % 1000000) / 10000)
107112 let whiteDefenders = ((((toUnits - (blueDefenders * 10000)) - (greenDefenders * 100)) - redDefenders) / 1000000)
108113 let attackers = ((redAttackers + greenAttackers) + blueAttackers)
109114 let defenders = ((redDefenders + greenDefenders) + blueDefenders)
110115 let king = if (if (if ((redAttackers > 0))
111116 then redSigned
112117 else false)
113118 then true
114119 else if ((greenAttackers > 0))
115120 then greenSigned
116121 else false)
117122 then true
118123 else if ((blueAttackers > 0))
119124 then blueSigned
120125 else false
121- let multiAttackers = (fromUnits / attackers)
122- let multiDefenders = (toUnits / defenders)
123- let win = if (if (if (if (if (if (king)
126+ let multiAttackers = if ((attackers > 0))
127+ then (fromUnits / attackers)
128+ else 0
129+ let multiDefenders = if ((defenders > 0))
130+ then (toUnits / defenders)
131+ else 0
132+ let win = if (if (if (if (if (king)
124133 then (multiAttackers != multiDefenders)
125134 else false)
126135 then (attackers > defenders)
127136 else false)
128137 then (newFromUnits == 0)
129138 else false)
130139 then (newToUnits == ((attackers - defenders) * multiAttackers))
131140 else false)
132141 then locked
133- else false)
134- then (dataSize == 3)
135142 else false
136143 let lost = if (if (if (if (if (king)
137144 then (multiAttackers != multiDefenders)
138145 else false)
139146 then (defenders > attackers)
140147 else false)
141148 then (newFromUnits == 0)
142149 else false)
143150 then (newToUnits == ((defenders - attackers) * multiDefenders))
144151 else false)
145- then (dataSize == 2)
152+ then lockNotChanged
146153 else false
147154 let draw = if (if (if (if (if (king)
148155 then (multiAttackers != multiDefenders)
149156 else false)
150157 then (attackers == defenders)
151158 else false)
152159 then (newFromUnits == 0)
153160 else false)
154161 then (newToUnits == (((defenders + 1) - attackers) * multiDefenders))
155162 else false)
156- then (dataSize == 2)
163+ then lockNotChanged
157164 else false
158- let move = if (if (if (if (if (if (king)
165+ let move = if (if (if (if (if (king)
159166 then (multiAttackers == multiDefenders)
160167 else false)
161168 then (newFromUnits == 0)
162169 else false)
163170 then (10 >= (attackers + defenders))
164171 else false)
165172 then (newToUnits == ((attackers + defenders) * multiAttackers))
166173 else false)
167174 then locked
168- else false)
169- then (dataSize == 3)
170175 else false
171- if (if (if (if (if (win)
176+ if (if (if (if (if (if (win)
172177 then true
173178 else lost)
174179 then true
175180 else draw)
176181 then true
177182 else move)
178183 then turnAllowed
184+ else false)
185+ then (dataSize == 3)
179186 else false)
180187 then true
181188 else (dataSize == 12)
182189 case ntx: TransferTransaction =>
183190 true
184191 case _ =>
185192 true
186193 }

github/deemru/w8io/169f3d6 
44.60 ms