tx · rAANp7VHboDjXr2KjWWr4gBd5sHdLAHwtvB4nmGFNjS 3NB5gpL8WoDWgiA4XTbT9iUGE8zQmABqyog: -0.01000000 Waves 2019.01.28 18:01 [470265] smart account 3NB5gpL8WoDWgiA4XTbT9iUGE8zQmABqyog > SELF 0.00000000 Waves
{ "type": 13, "id": "rAANp7VHboDjXr2KjWWr4gBd5sHdLAHwtvB4nmGFNjS", "fee": 1000000, "feeAssetId": null, "timestamp": 1548687745322, "version": 1, "sender": "3NB5gpL8WoDWgiA4XTbT9iUGE8zQmABqyog", "senderPublicKey": "4Q7LwhfPhchgNNsovHLKmfGConhd7CwPGYzPPd1Bd6mp", "proofs": [ "2sa7soy96dRqsY78KrT6dCzWpCWZPgFTj59Knn3yfyRq4VQvynPgC7exnCi3wBtca9fWsD8jUHxoLxTH6dx4vCAX" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAADnNlcnZpY2VBZGRyZXNzCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTjdvRjVKNW05QndCRkNtVkpaV3IzQUVIM3U0YzZDTG9COQQAAAAJaGVpZ2h0S2V5AgAAAAZoZWlnaHQEAAAABnN0YWdlMQIAAAAKcDJNb3ZlSGFzaAQAAAAGc3RhZ2UyAgAAAAZwMk1vdmUEAAAABnN0YWdlMwIAAAAGcDFNb3ZlBAAAAAR3YXZlAAAAAAAF9eEABAAAAAdnYW1lQmV0CQAAaAAAAAIAAAAAAAAAAAEFAAAABHdhdmUEAAAAEXNlcnZpY2VDb21taXNzaW9uAAAAAAAAAADIBAAAAARyb2NrAQAAAAEABAAAAAVwYXBlcgEAAAABAQQAAAAIc2Npc3NvcnMBAAAAAQIEAAAAG21hdGNoUmVzZXJ2YXRpb25CbG9ja3NDb3VudAAAAAAAAAAAAwQAAAAYY3JlYXRvclJldmVhbEJsb2Nrc0NvdW50AAAAAAAAAAAEBAAAAAdtYXhsb25nAH//////////BAAAAAhtYXRjaEtleQ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ZhbGlkAwMFAAAAJXdhaXRpbmdUb29Mb25nRm9yTWF0Y2hDcmVhdG9yVG9SZXZlYWwJAAAAAAAAAggJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAEAAAAJcmVjaXBpZW50BQAAAAJwMgcGAwkAAAAAAAACBQAAAAVzY29yZQAAAAAAAAAAAAMDAwkAAAAAAAACCQABkAAAAAEIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAADCQAAAAAAAAIICQABkQAAAAIIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAABAAAABmFtb3VudAgJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAIAAAAGYW1vdW50BwkAAAAAAAACCAkAAZEAAAACCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAQAAAAlyZWNpcGllbnQFAAAAAnAxBwkAAAAAAAACCAkAAZEAAAACCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAgAAAAlyZWNpcGllbnQFAAAAAnAyBwQAAAAGd2lubmVyAwkAAGYAAAACBQAAAAVzY29yZQAAAAAAAAAAAAUAAAACcDEFAAAAAnAyAwkAAAAAAAACCQABkAAAAAEIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAACCQAAAAAAAAIICQABkQAAAAIIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAABAAAACXJlY2lwaWVudAUAAAAGd2lubmVyBwMDBQAAABBpc0ZlZUlzTm90QWJ1c2VkBQAAABRpc0NvbW1pc3Npb25JbmNsdWRlZAcFAAAADWlzUGF5b3V0VmFsaWQHBzh+JVg=", "chainId": 84, "height": 470265, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 1 #-} | |
2 | + | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | + | let me = tx.sender | |
4 | + | let serviceAddress = addressFromString("3N7oF5J5m9BwBFCmVJZWr3AEH3u4c6CLoB9") | |
5 | + | let heightKey = "height" | |
6 | + | let stage1 = "p2MoveHash" | |
7 | + | let stage2 = "p2Move" | |
8 | + | let stage3 = "p1Move" | |
9 | + | let wave = 100000000 | |
10 | + | let gameBet = (1 * wave) | |
11 | + | let serviceCommission = 200 | |
12 | + | let rock = base58'1' | |
13 | + | let paper = base58'2' | |
14 | + | let scissors = base58'3' | |
15 | + | let matchReservationBlocksCount = 3 | |
16 | + | let creatorRevealBlocksCount = 4 | |
17 | + | let maxlong = 9223372036854775807 | |
18 | + | let matchKey = extract(getBinary(me, "matchKey")) | |
19 | + | let player1Key = extract(getBinary(me, "player1Key")) | |
20 | + | match tx { | |
21 | + | case dataTx: DataTransaction => | |
22 | + | let dataTxFeeIsOk = (dataTx.fee == 500000) | |
23 | + | let dataTxDataIsOk = if (isDefined(getBinary(dataTx.data, stage1))) | |
24 | + | then { | |
25 | + | let oldHeight = if (isDefined(getInteger(me, heightKey))) | |
26 | + | then extract(getInteger(me, heightKey)) | |
27 | + | else maxlong | |
28 | + | let canWriteP2Move = if (!(isDefined(getBinary(me, stage1)))) | |
29 | + | then true | |
30 | + | else if ((-(matchReservationBlocksCount) > (oldHeight - height))) | |
31 | + | then !(isDefined(getBinary(me, stage2))) | |
32 | + | else false | |
33 | + | let isDataSizeValid = (size(dataTx.data) == 3) | |
34 | + | let isHeightFieldCorrect = if (if ((height == extract(getInteger(dataTx.data, heightKey)))) | |
35 | + | then true | |
36 | + | else ((height - 1) == extract(getInteger(dataTx.data, heightKey)))) | |
37 | + | then true | |
38 | + | else ((height + 1) == extract(getInteger(dataTx.data, heightKey))) | |
39 | + | if (if (canWriteP2Move) | |
40 | + | then isDataSizeValid | |
41 | + | else false) | |
42 | + | then isHeightFieldCorrect | |
43 | + | else false | |
44 | + | } | |
45 | + | else if (isDefined(getBinary(dataTx.data, stage2))) | |
46 | + | then { | |
47 | + | let isSizeOk = (size(dataTx.data) == 2) | |
48 | + | let isNotDefined = !(isDefined(getBinary(me, stage2))) | |
49 | + | let isHashShaOk = (sha256(extract(getBinary(dataTx.data, stage2))) == extract(getBinary(me, stage1))) | |
50 | + | let isPaymentOk = match transactionById(extract(getBinary(dataTx.data, "payment"))) { | |
51 | + | case p2payment: TransferTransaction => | |
52 | + | let isAttSizeOk = (size(p2payment.attachment) == 32) | |
53 | + | let isAttHashOk = (sha256(p2payment.attachment) == extract(getBinary(me, stage1))) | |
54 | + | if (if (if (if (if (if (isAttSizeOk) | |
55 | + | then isAttHashOk | |
56 | + | else false) | |
57 | + | then (p2payment.amount == (1 * wave)) | |
58 | + | else false) | |
59 | + | then !(isDefined(p2payment.assetId)) | |
60 | + | else false) | |
61 | + | then (p2payment.recipient == me) | |
62 | + | else false) | |
63 | + | then (p2payment.senderPublicKey == extract(getBinary(me, "player2Key"))) | |
64 | + | else false) | |
65 | + | then sigVerify(p2payment.bodyBytes, p2payment.proofs[0], p2payment.senderPublicKey) | |
66 | + | else false | |
67 | + | case _ => | |
68 | + | false | |
69 | + | } | |
70 | + | if (if (if (isNotDefined) | |
71 | + | then isSizeOk | |
72 | + | else false) | |
73 | + | then isHashShaOk | |
74 | + | else false) | |
75 | + | then isPaymentOk | |
76 | + | else false | |
77 | + | } | |
78 | + | else if (isDefined(getBinary(dataTx.data, stage3))) | |
79 | + | then { | |
80 | + | let isP1NotYetRevealed = !(isDefined(getBinary(me, stage3))) | |
81 | + | let isSizeValid = (size(dataTx.data) == 1) | |
82 | + | let isProofValid = (size(extract(getBinary(dataTx.data, stage3))) == 32) | |
83 | + | let isShaValid = (sha256(extract(getBinary(dataTx.data, stage3))) == extract(getBinary(me, "p1MoveHash"))) | |
84 | + | if (if (if (isP1NotYetRevealed) | |
85 | + | then isSizeValid | |
86 | + | else false) | |
87 | + | then isProofValid | |
88 | + | else false) | |
89 | + | then isShaValid | |
90 | + | else false | |
91 | + | } | |
92 | + | else false | |
93 | + | if (dataTxFeeIsOk) | |
94 | + | then dataTxDataIsOk | |
95 | + | else false | |
96 | + | case payout: MassTransferTransaction => | |
97 | + | let waitingTooLongForMatchCreatorToReveal = (-(matchReservationBlocksCount) > (extract(getInteger(me, heightKey)) - height)) | |
98 | + | let p1moves = take(extract(getBinary(me, stage3)), 3) | |
99 | + | let p2moves = take(extract(getBinary(me, stage2)), 3) | |
100 | + | let p1m1 = take(p1moves, 1) | |
101 | + | let p2m1 = take(p2moves, 1) | |
102 | + | let p1m2 = takeRightBytes(take(p1moves, 2), 1) | |
103 | + | let p2m2 = takeRightBytes(take(p2moves, 2), 1) | |
104 | + | let p1m3 = takeRightBytes(p1moves, 1) | |
105 | + | let p2m3 = takeRightBytes(p2moves, 1) | |
106 | + | let round1 = if (if (if (if ((p1m1 == rock)) | |
107 | + | then (p2m1 == scissors) | |
108 | + | else false) | |
109 | + | then true | |
110 | + | else if ((p1m1 == paper)) | |
111 | + | then (p2m1 == rock) | |
112 | + | else false) | |
113 | + | then true | |
114 | + | else if ((p1m1 == scissors)) | |
115 | + | then (p2m1 == paper) | |
116 | + | else false) | |
117 | + | then 1 | |
118 | + | else if ((p1m1 == p2m1)) | |
119 | + | then 0 | |
120 | + | else -1 | |
121 | + | let round2 = if (if (if (if ((p1m2 == rock)) | |
122 | + | then (p2m2 == scissors) | |
123 | + | else false) | |
124 | + | then true | |
125 | + | else if ((p1m2 == paper)) | |
126 | + | then (p2m2 == rock) | |
127 | + | else false) | |
128 | + | then true | |
129 | + | else if ((p1m2 == scissors)) | |
130 | + | then (p2m2 == paper) | |
131 | + | else false) | |
132 | + | then 1 | |
133 | + | else if ((p1m2 == p2m2)) | |
134 | + | then 0 | |
135 | + | else -1 | |
136 | + | let round3 = if (if (if (if ((p1m3 == rock)) | |
137 | + | then (p2m3 == scissors) | |
138 | + | else false) | |
139 | + | then true | |
140 | + | else if ((p1m3 == paper)) | |
141 | + | then (p2m3 == rock) | |
142 | + | else false) | |
143 | + | then true | |
144 | + | else if ((p1m3 == scissors)) | |
145 | + | then (p2m3 == paper) | |
146 | + | else false) | |
147 | + | then 1 | |
148 | + | else if ((p1m3 == p2m3)) | |
149 | + | then 0 | |
150 | + | else -1 | |
151 | + | let score = ((round1 + round2) + round3) | |
152 | + | let p1 = addressFromPublicKey(player1Key) | |
153 | + | let p2 = addressFromPublicKey(extract(getBinary(me, "player2Key"))) | |
154 | + | let isCommissionIncluded = if ((payout.transfers[0].recipient == serviceAddress)) | |
155 | + | then (payout.transfers[0].amount == (gameBet / serviceCommission)) | |
156 | + | else false | |
157 | + | let isFeeIsNotAbused = if (if ((payout.transferCount == 2)) | |
158 | + | then (600000 >= payout.fee) | |
159 | + | else false) | |
160 | + | then true | |
161 | + | else if ((payout.transferCount == 3)) | |
162 | + | then (700000 >= payout.fee) | |
163 | + | else false | |
164 | + | let isPayoutValid = if (if (waitingTooLongForMatchCreatorToReveal) | |
165 | + | then (payout.transfers[1].recipient == p2) | |
166 | + | else false) | |
167 | + | then true | |
168 | + | else if ((score == 0)) | |
169 | + | then if (if (if ((size(payout.transfers) == 3)) | |
170 | + | then (payout.transfers[1].amount == payout.transfers[2].amount) | |
171 | + | else false) | |
172 | + | then (payout.transfers[1].recipient == p1) | |
173 | + | else false) | |
174 | + | then (payout.transfers[2].recipient == p2) | |
175 | + | else false | |
176 | + | else { | |
177 | + | let winner = if ((score > 0)) | |
178 | + | then p1 | |
179 | + | else p2 | |
180 | + | if ((size(payout.transfers) == 2)) | |
181 | + | then (payout.transfers[1].recipient == winner) | |
182 | + | else false | |
183 | + | } | |
184 | + | if (if (isFeeIsNotAbused) | |
185 | + | then isCommissionIncluded | |
186 | + | else false) | |
187 | + | then isPayoutValid | |
188 | + | else false | |
189 | + | case _ => | |
190 | + | false | |
191 | + | } |
github/deemru/w8io/026f985 18.44 ms ◑