tx · DBwuZ3GPJMyvVncAu5sSmCcHrhP98xjbcs4GYniyFxHT

3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f:  -0.01400000 Waves

2018.09.29 18:05 [353453] smart account 3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f > SELF 0.00000000 Waves

{ "type": 13, "id": "DBwuZ3GPJMyvVncAu5sSmCcHrhP98xjbcs4GYniyFxHT", "fee": 1400000, "feeAssetId": null, "timestamp": 1538233547109, "version": 1, "sender": "3N9UZtJRvvoNgHCjQsWvDUtxiym7KFc7r6f", "senderPublicKey": "4BRdUi95rN89kRWamqTcb9Dj9pLpAQbjLt17MPxcgGhG", "proofs": [ "2N8SuSvZNDXB7ZyGMGCeAH855VAnt5d8UhUQ1RZPmCFiYEvbK1tQ3mfa3gbWSg7ZuCF5jbaA29ZaY15zbqAN6TKQ" ], "script": "base64:AQQAAAAJcmVkUHViS2V5AQAAACCcvkAYXSO2dto8Bjx/Z65U0bGrFY5cIkLHdfY5mFVSDwQAAAALZ3JlZW5QdWJLZXkBAAAAIPlfPeSXGejVVO8XgpF607z8UJ46ZmmLUq4Rq0R8IFM8BAAAAApibHVlUHViS2V5AQAAACA97ajD767lxQiKGSbQ60FmHM7Nfb7azWSBD/TaFp3/QAQAAAAHcmVkQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVGfSoosyZxu2GPr01RED4+I9rSQ9LlF8XgQAAAAJZ3JlZW5BZGRyCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUeYFF8qf7pD+lzgJaCmi860XRkyZFP24HBAAAAAhibHVlQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVEG1BP9MronfM5Ad2fldCE7DdHowHHByOQQAAAAIY29udHJhY3QIBQAAAAJ0eAAAAAZzZW5kZXIEAAAACXJlZFNpZ25lZAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAA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dWx0aURlZmVuZGVycwcJAAAAAAAAAgUAAAAJYXR0YWNrZXJzBQAAAAlkZWZlbmRlcnMHCQAAAAAAAAIFAAAADG5ld0Zyb21Vbml0cwAAAAAAAAAAAAcJAAAAAAAAAgUAAAAKbmV3VG9Vbml0cwkAAGgAAAACCQAAZQAAAAIJAABkAAAAAgUAAAAJZGVmZW5kZXJzAAAAAAAAAAABBQAAAAlhdHRhY2tlcnMFAAAADm11bHRpRGVmZW5kZXJzBwkAAAAAAAACBQAAAAhkYXRhU2l6ZQAAAAAAAAAAAgcEAAAABG1vdmUDAwMDAwMFAAAABGtpbmcJAAAAAAAAAgUAAAAObXVsdGlBdHRhY2tlcnMFAAAADm11bHRpRGVmZW5kZXJzBwkAAAAAAAACBQAAAAxuZXdGcm9tVW5pdHMAAAAAAAAAAAAHCQAAZwAAAAIAAAAAAAAAAAoJAABkAAAAAgUAAAAJYXR0YWNrZXJzBQAAAAlkZWZlbmRlcnMHCQAAAAAAAAIFAAAACm5ld1RvVW5pdHMJAABoAAAAAgkAAGQAAAACBQAAAAlhdHRhY2tlcnMFAAAACWRlZmVuZGVycwUAAAAObXVsdGlBdHRhY2tlcnMHBQAAAAZsb2NrZWQHCQAAAAAAAAIFAAAACGRhdGFTaXplAAAAAAAAAAADBwMDAwMDBQAAAAN3aW4GBQAAAARsb3N0BgUAAAAEZHJhdwYFAAAABG1vdmUFAAAAC3R1cm5BbGxvd2VkBwYJAAAAAAAAAgUAAAAIZGF0YVNpemUAAAAAAAAAAAwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA250eAUAAAAHJG1hdGNoMAYGYzEs+Q==", "chainId": 84, "height": 353453, "spentComplexity": 0 } View: original | compacted Prev: FFeuTxhcLforNgPx4hwX9MJQ1VHLeJ1odLagV1273QS2 Next: 5qLxbdzW9MmvR7qB6wWUK8DrCS3pLsaHJuPjcEZuHnaX Diff:
OldNewDifferences
1515 let dataSize = size(ttx.data)
1616 let fromKey = ttx.data[0].key
1717 let toKey = ttx.data[1].key
18+ let turnToKey = ttx.data[2].key
1819 let newFromUnits = ttx.data[0].value
1920 let newToUnits = ttx.data[1].value
21+ let turnToValue = ttx.data[2].value
2022 let turnCorrect = if (if (if (if (if (if (if (if (if (if (if (if ((fromKey == "country1"))
2123 then (toKey == "country2")
2224 else false)
8890 else if ((fromKey == "country12"))
8991 then (toKey == "country11")
9092 else false
93+ let turnFromKey = ("turn_" + fromKey)
94+ let turnFromValue = extract(getInteger(contract, turnFromKey))
95+ let turnAllowed = (turnFromValue == 0)
96+ let locked = if ((("turn_" + toKey) == turnToKey))
97+ then (turnToValue == 1)
98+ else false
9199 let fromUnits = extract(getInteger(contract, fromKey))
92100 let toUnits = extract(getInteger(contract, toKey))
93101 let redAttackers = (fromUnits % 100)
95103 let blueAttackers = (((fromUnits - (greenAttackers * 100)) - redAttackers) / 10000)
96104 let redDefenders = (toUnits % 100)
97105 let greenDefenders = (((toUnits - redDefenders) % 10000) / 100)
98- let blueDefenders = (((toUnits - (greenDefenders * 100)) - redDefenders) / 10000)
106+ let blueDefenders = ((((toUnits - (greenDefenders * 100)) - redDefenders) % 1000000) / 10000)
107+ let whiteDefenders = ((((toUnits - (blueDefenders * 10000)) - (greenDefenders * 100)) - redDefenders) / 1000000)
99108 let attackers = ((redAttackers + greenAttackers) + blueAttackers)
100109 let defenders = ((redDefenders + greenDefenders) + blueDefenders)
101110 let king = if (if (if ((redAttackers > 0))
111120 else false
112121 let multiAttackers = (fromUnits / attackers)
113122 let multiDefenders = (toUnits / defenders)
114- let win = if (if (if (if (king)
123+ let win = if (if (if (if (if (if (king)
115124 then (multiAttackers != multiDefenders)
116125 else false)
117126 then (attackers > defenders)
119128 then (newFromUnits == 0)
120129 else false)
121130 then (newToUnits == ((attackers - defenders) * multiAttackers))
131+ else false)
132+ then locked
133+ else false)
134+ then (dataSize == 3)
122135 else false
123- let lost = if (if (if (if (king)
136+ let lost = if (if (if (if (if (king)
124137 then (multiAttackers != multiDefenders)
125138 else false)
126139 then (defenders > attackers)
128141 then (newFromUnits == 0)
129142 else false)
130143 then (newToUnits == ((defenders - attackers) * multiDefenders))
144+ else false)
145+ then (dataSize == 2)
131146 else false
132- let draw = if (if (if (if (king)
147+ let draw = if (if (if (if (if (king)
133148 then (multiAttackers != multiDefenders)
134149 else false)
135150 then (attackers == defenders)
137152 then (newFromUnits == 0)
138153 else false)
139154 then (newToUnits == (((defenders + 1) - attackers) * multiDefenders))
155+ else false)
156+ then (dataSize == 2)
140157 else false
141- let move = if (if (if (if (king)
158+ let move = if (if (if (if (if (if (king)
142159 then (multiAttackers == multiDefenders)
143160 else false)
144161 then (newFromUnits == 0)
146163 then (10 >= (attackers + defenders))
147164 else false)
148165 then (newToUnits == ((attackers + defenders) * multiAttackers))
166+ else false)
167+ then locked
168+ else false)
169+ then (dataSize == 3)
149170 else false
150171 if (if (if (if (if (win)
151172 then true
154175 else draw)
155176 then true
156177 else move)
157- then (dataSize == 2)
178+ then turnAllowed
158179 else false)
159180 then true
160181 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
18+ let turnToKey = ttx.data[2].key
1819 let newFromUnits = ttx.data[0].value
1920 let newToUnits = ttx.data[1].value
21+ let turnToValue = ttx.data[2].value
2022 let turnCorrect = if (if (if (if (if (if (if (if (if (if (if (if ((fromKey == "country1"))
2123 then (toKey == "country2")
2224 else false)
2325 then true
2426 else if ((fromKey == "country2"))
2527 then if ((toKey == "country1"))
2628 then true
2729 else (toKey == "country3")
2830 else false)
2931 then true
3032 else if ((fromKey == "country3"))
3133 then if (if ((toKey == "country2"))
3234 then true
3335 else (toKey == "country4"))
3436 then true
3537 else (toKey == "country5")
3638 else false)
3739 then true
3840 else if ((fromKey == "country4"))
3941 then if ((toKey == "country3"))
4042 then true
4143 else (toKey == "country8")
4244 else false)
4345 then true
4446 else if ((fromKey == "country5"))
4547 then if ((toKey == "country3"))
4648 then true
4749 else (toKey == "country10")
4850 else false)
4951 then true
5052 else if ((fromKey == "country6"))
5153 then (toKey == "country7")
5254 else false)
5355 then true
5456 else if ((fromKey == "country7"))
5557 then if ((toKey == "country6"))
5658 then true
5759 else (toKey == "country8")
5860 else false)
5961 then true
6062 else if ((fromKey == "country8"))
6163 then if (if ((toKey == "country4"))
6264 then true
6365 else (toKey == "country7"))
6466 then true
6567 else (toKey == "country9")
6668 else false)
6769 then true
6870 else if ((fromKey == "country9"))
6971 then if ((toKey == "country8"))
7072 then true
7173 else (toKey == "country10")
7274 else false)
7375 then true
7476 else if ((fromKey == "country10"))
7577 then if (if ((toKey == "country5"))
7678 then true
7779 else (toKey == "country10"))
7880 then true
7981 else (toKey == "country11")
8082 else false)
8183 then true
8284 else if ((fromKey == "country11"))
8385 then if ((toKey == "country10"))
8486 then true
8587 else (toKey == "country12")
8688 else false)
8789 then true
8890 else if ((fromKey == "country12"))
8991 then (toKey == "country11")
9092 else false
93+ let turnFromKey = ("turn_" + fromKey)
94+ let turnFromValue = extract(getInteger(contract, turnFromKey))
95+ let turnAllowed = (turnFromValue == 0)
96+ let locked = if ((("turn_" + toKey) == turnToKey))
97+ then (turnToValue == 1)
98+ else false
9199 let fromUnits = extract(getInteger(contract, fromKey))
92100 let toUnits = extract(getInteger(contract, toKey))
93101 let redAttackers = (fromUnits % 100)
94102 let greenAttackers = (((fromUnits - redAttackers) % 10000) / 100)
95103 let blueAttackers = (((fromUnits - (greenAttackers * 100)) - redAttackers) / 10000)
96104 let redDefenders = (toUnits % 100)
97105 let greenDefenders = (((toUnits - redDefenders) % 10000) / 100)
98- let blueDefenders = (((toUnits - (greenDefenders * 100)) - redDefenders) / 10000)
106+ let blueDefenders = ((((toUnits - (greenDefenders * 100)) - redDefenders) % 1000000) / 10000)
107+ let whiteDefenders = ((((toUnits - (blueDefenders * 10000)) - (greenDefenders * 100)) - redDefenders) / 1000000)
99108 let attackers = ((redAttackers + greenAttackers) + blueAttackers)
100109 let defenders = ((redDefenders + greenDefenders) + blueDefenders)
101110 let king = if (if (if ((redAttackers > 0))
102111 then redSigned
103112 else false)
104113 then true
105114 else if ((greenAttackers > 0))
106115 then greenSigned
107116 else false)
108117 then true
109118 else if ((blueAttackers > 0))
110119 then blueSigned
111120 else false
112121 let multiAttackers = (fromUnits / attackers)
113122 let multiDefenders = (toUnits / defenders)
114- let win = if (if (if (if (king)
123+ let win = if (if (if (if (if (if (king)
115124 then (multiAttackers != multiDefenders)
116125 else false)
117126 then (attackers > defenders)
118127 else false)
119128 then (newFromUnits == 0)
120129 else false)
121130 then (newToUnits == ((attackers - defenders) * multiAttackers))
131+ else false)
132+ then locked
133+ else false)
134+ then (dataSize == 3)
122135 else false
123- let lost = if (if (if (if (king)
136+ let lost = if (if (if (if (if (king)
124137 then (multiAttackers != multiDefenders)
125138 else false)
126139 then (defenders > attackers)
127140 else false)
128141 then (newFromUnits == 0)
129142 else false)
130143 then (newToUnits == ((defenders - attackers) * multiDefenders))
144+ else false)
145+ then (dataSize == 2)
131146 else false
132- let draw = if (if (if (if (king)
147+ let draw = if (if (if (if (if (king)
133148 then (multiAttackers != multiDefenders)
134149 else false)
135150 then (attackers == defenders)
136151 else false)
137152 then (newFromUnits == 0)
138153 else false)
139154 then (newToUnits == (((defenders + 1) - attackers) * multiDefenders))
155+ else false)
156+ then (dataSize == 2)
140157 else false
141- let move = if (if (if (if (king)
158+ let move = if (if (if (if (if (if (king)
142159 then (multiAttackers == multiDefenders)
143160 else false)
144161 then (newFromUnits == 0)
145162 else false)
146163 then (10 >= (attackers + defenders))
147164 else false)
148165 then (newToUnits == ((attackers + defenders) * multiAttackers))
166+ else false)
167+ then locked
168+ else false)
169+ then (dataSize == 3)
149170 else false
150171 if (if (if (if (if (win)
151172 then true
152173 else lost)
153174 then true
154175 else draw)
155176 then true
156177 else move)
157- then (dataSize == 2)
178+ then turnAllowed
158179 else false)
159180 then true
160181 else (dataSize == 12)
161182 case ntx: TransferTransaction =>
162183 true
163184 case _ =>
164185 true
165186 }

github/deemru/w8io/026f985 
31.03 ms