tx · DnzsKDR7JTKdK27udNFYRT6hTKbePmDGdxMrUAj7bUKG 3NBDJSsPQQLr1UFm6FKAKdvCX36WQLcBD5n: -0.01000000 Waves 2019.01.21 15:14 [459857] smart account 3NBDJSsPQQLr1UFm6FKAKdvCX36WQLcBD5n > SELF 0.00000000 Waves
{ "type": 13, "id": "DnzsKDR7JTKdK27udNFYRT6hTKbePmDGdxMrUAj7bUKG", "fee": 1000000, "feeAssetId": null, "timestamp": 1548072873966, "version": 1, "sender": "3NBDJSsPQQLr1UFm6FKAKdvCX36WQLcBD5n", "senderPublicKey": "EG6osmuHZBzhk6vWjDY9fZjqMAi5mpjQyWqt3KyLrEm4", "proofs": [ "8H2Z3rjC4cKzbCukWkapMRxtvy9VftxyDPgNithau9o7KqiUVw12fmy9HWKDc8r8CGrnz9cGCWD7q92cUyEmiKz" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAADnNlcnZpY2VBZGRyZXNzCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTjdvRjVKNW05QndCRkNtVkpaV3IzQUVIM3U0YzZDTG9COQQAAAAJaGVpZ2h0S2V5AgAAAAZoZWlnaHQEAAAABnN0YWdlMQIAAAAKcDJNb3ZlSGFzaAQAAAAGc3RhZ2UyAgAAAAZwMk1vdmUEAAAABnN0YWdlMwIAAAAGcDFNb3ZlBAAAAAR3YXZlAAAAAAAF9eEABAAAAAdnYW1lQmV0CQAAaAAAAAIAAAAAAAAAAAEFAAAABHdhdmUEAAAAEXNlcnZpY2VDb21taXNzaW9uAAAAAAAAAADIBAAAAARyb2NrAQAAAAEABAAAAAVwYXBlcgEAAAABAQQAAAAIc2Npc3NvcnMBAAAAAQIEAAAAG21hdGNoUmVzZXJ2YXRpb25CbG9ja3NDb3VudAAAAAAAAAAAAwQAAAAYY3JlYXRvclJldmVhbEJsb2Nrc0NvdW50AAAAAAAAAAAEBAAAAAdtYXhsb25nAH//////////BAAAAAhtYXRjaE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AACCAkAAZEAAAACCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAQAAAAlyZWNpcGllbnQFAAAAAnAyBwYDCQAAAAAAAAIFAAAABXNjb3JlAAAAAAAAAAAAAwMDCQAAAAAAAAIJAAGQAAAAAQgFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAMJAAAAAAAAAggJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAEAAAAGYW1vdW50CAkAAZEAAAACCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAgAAAAZhbW91bnQHCQAAAAAAAAIICQABkQAAAAIIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAABAAAACXJlY2lwaWVudAUAAAACcDEHCQAAAAAAAAIICQABkQAAAAIIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAACAAAACXJlY2lwaWVudAUAAAACcDIHBAAAAAZ3aW5uZXIDCQAAZgAAAAIFAAAABXNjb3JlAAAAAAAAAAAABQAAAAJwMQUAAAACcDIDCQAAAAAAAAIJAAGQAAAAAQgFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAIJAAAAAAAAAggJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAEAAAAJcmVjaXBpZW50BQAAAAZ3aW5uZXIHAwMFAAAAEGlzRmVlSXNOb3RBYnVzZWQFAAAAFGlzQ29tbWlzc2lvbkluY2x1ZGVkBwUAAAANaXNQYXlvdXRWYWxpZAcHPhUf5Q==", "chainId": 84, "height": 459857, "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 (isAttSizeOk) | |
55 | + | then isAttHashOk | |
56 | + | else false) | |
57 | + | then (p2payment.amount == (1 * wave)) | |
58 | + | else false) | |
59 | + | then (p2payment.recipient == me) | |
60 | + | else false) | |
61 | + | then (p2payment.senderPublicKey == extract(getBinary(me, "player2Key"))) | |
62 | + | else false) | |
63 | + | then sigVerify(p2payment.bodyBytes, p2payment.proofs[0], p2payment.senderPublicKey) | |
64 | + | else false | |
65 | + | case _ => | |
66 | + | false | |
67 | + | } | |
68 | + | if (if (if (isNotDefined) | |
69 | + | then isSizeOk | |
70 | + | else false) | |
71 | + | then isHashShaOk | |
72 | + | else false) | |
73 | + | then isPaymentOk | |
74 | + | else false | |
75 | + | } | |
76 | + | else if (isDefined(getBinary(dataTx.data, stage3))) | |
77 | + | then { | |
78 | + | let isP1NotYetRevealed = !(isDefined(getBinary(me, stage3))) | |
79 | + | let isSizeValid = (size(dataTx.data) == 1) | |
80 | + | let isProofValid = (size(extract(getBinary(dataTx.data, stage3))) == 32) | |
81 | + | let isShaValid = (sha256(extract(getBinary(dataTx.data, stage3))) == extract(getBinary(me, "p1MoveHash"))) | |
82 | + | if (if (if (isP1NotYetRevealed) | |
83 | + | then isSizeValid | |
84 | + | else false) | |
85 | + | then isProofValid | |
86 | + | else false) | |
87 | + | then isShaValid | |
88 | + | else false | |
89 | + | } | |
90 | + | else false | |
91 | + | if (dataTxFeeIsOk) | |
92 | + | then dataTxDataIsOk | |
93 | + | else false | |
94 | + | case payout: MassTransferTransaction => | |
95 | + | let waitingTooLongForMatchCreatorToReveal = (-(matchReservationBlocksCount) > (extract(getInteger(me, heightKey)) - height)) | |
96 | + | let p1moves = take(extract(getBinary(me, stage3)), 3) | |
97 | + | let p2moves = take(extract(getBinary(me, stage2)), 3) | |
98 | + | let p1m1 = take(p1moves, 1) | |
99 | + | let p2m1 = take(p2moves, 1) | |
100 | + | let p1m2 = takeRightBytes(take(p1moves, 2), 1) | |
101 | + | let p2m2 = takeRightBytes(take(p2moves, 2), 1) | |
102 | + | let p1m3 = takeRightBytes(p1moves, 1) | |
103 | + | let p2m3 = takeRightBytes(p2moves, 1) | |
104 | + | let round1 = if (if (if (if ((p1m1 == rock)) | |
105 | + | then (p2m1 == scissors) | |
106 | + | else false) | |
107 | + | then true | |
108 | + | else if ((p1m1 == paper)) | |
109 | + | then (p2m1 == rock) | |
110 | + | else false) | |
111 | + | then true | |
112 | + | else if ((p1m1 == scissors)) | |
113 | + | then (p2m1 == paper) | |
114 | + | else false) | |
115 | + | then 1 | |
116 | + | else if ((p1m1 == p2m1)) | |
117 | + | then 0 | |
118 | + | else -1 | |
119 | + | let round2 = if (if (if (if ((p1m2 == rock)) | |
120 | + | then (p2m2 == scissors) | |
121 | + | else false) | |
122 | + | then true | |
123 | + | else if ((p1m2 == paper)) | |
124 | + | then (p2m2 == rock) | |
125 | + | else false) | |
126 | + | then true | |
127 | + | else if ((p1m2 == scissors)) | |
128 | + | then (p2m2 == paper) | |
129 | + | else false) | |
130 | + | then 1 | |
131 | + | else if ((p1m2 == p2m2)) | |
132 | + | then 0 | |
133 | + | else -1 | |
134 | + | let round3 = if (if (if (if ((p1m3 == rock)) | |
135 | + | then (p2m3 == scissors) | |
136 | + | else false) | |
137 | + | then true | |
138 | + | else if ((p1m3 == paper)) | |
139 | + | then (p2m3 == rock) | |
140 | + | else false) | |
141 | + | then true | |
142 | + | else if ((p1m3 == scissors)) | |
143 | + | then (p2m3 == paper) | |
144 | + | else false) | |
145 | + | then 1 | |
146 | + | else if ((p1m3 == p2m3)) | |
147 | + | then 0 | |
148 | + | else -1 | |
149 | + | let score = ((round1 + round2) + round3) | |
150 | + | let p1 = addressFromPublicKey(player1Key) | |
151 | + | let p2 = addressFromPublicKey(extract(getBinary(me, "player2Key"))) | |
152 | + | let isCommissionIncluded = if ((payout.transfers[0].recipient == serviceAddress)) | |
153 | + | then (payout.transfers[0].amount == (gameBet / serviceCommission)) | |
154 | + | else false | |
155 | + | let isFeeIsNotAbused = if (if ((payout.transferCount == 2)) | |
156 | + | then (600000 >= payout.fee) | |
157 | + | else false) | |
158 | + | then true | |
159 | + | else if ((payout.transferCount == 3)) | |
160 | + | then (700000 >= payout.fee) | |
161 | + | else false | |
162 | + | let isPayoutValid = if (if (waitingTooLongForMatchCreatorToReveal) | |
163 | + | then (payout.transfers[1].recipient == p2) | |
164 | + | else false) | |
165 | + | then true | |
166 | + | else if ((score == 0)) | |
167 | + | then if (if (if ((size(payout.transfers) == 3)) | |
168 | + | then (payout.transfers[1].amount == payout.transfers[2].amount) | |
169 | + | else false) | |
170 | + | then (payout.transfers[1].recipient == p1) | |
171 | + | else false) | |
172 | + | then (payout.transfers[2].recipient == p2) | |
173 | + | else false | |
174 | + | else { | |
175 | + | let winner = if ((score > 0)) | |
176 | + | then p1 | |
177 | + | else p2 | |
178 | + | if ((size(payout.transfers) == 2)) | |
179 | + | then (payout.transfers[1].recipient == winner) | |
180 | + | else false | |
181 | + | } | |
182 | + | if (if (isFeeIsNotAbused) | |
183 | + | then isCommissionIncluded | |
184 | + | else false) | |
185 | + | then isPayoutValid | |
186 | + | else false | |
187 | + | case _ => | |
188 | + | false | |
189 | + | } |
github/deemru/w8io/026f985 16.90 ms ◑