tx · AxMDPkHgBdzmgiCCYWmeThMCSfWEDZjbTuZvcoJdv79x 3N7QY2cbv4qS5Kno3Nq27ZKmxbJsQ2crmBW: -0.01000000 Waves 2019.01.16 20:18 [452861] smart account 3N7QY2cbv4qS5Kno3Nq27ZKmxbJsQ2crmBW > SELF 0.00000000 Waves
{ "type": 13, "id": "AxMDPkHgBdzmgiCCYWmeThMCSfWEDZjbTuZvcoJdv79x", "fee": 1000000, "feeAssetId": null, "timestamp": 1547659101413, "version": 1, "sender": "3N7QY2cbv4qS5Kno3Nq27ZKmxbJsQ2crmBW", "senderPublicKey": "5RJHzVLEvgHi6AzxHLa1T4C2yWY4FpsctRLzX79GgSBA", "proofs": [ "2LUf7ePSiMFJk8s3nwH27za4FjE52SBLZNDhdFwRV6jSoyvrM2Nu2t7LesyCRe5ccH9zahkPpHwQoYLaJd4AY9r5" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAADnNlcnZpY2VBZGRyZXNzCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTjdvRjVKNW05QndCRkNtVkpaV3IzQUVIM3U0YzZDTG9COQQAAAAJaGVpZ2h0S2V5AgAAAAZoZWlnaHQEAAAABnN0YWdlMQIAAAAKcDJNb3ZlSGFzaAQAAAAGc3RhZ2UyAgAAAAZwMk1vdmUEAAAABnN0YWdlMwIAAAAGcDFNb3ZlBAAAAAR3YXZlAAAAAAAF9eEABAAAAAdnYW1lQmV0CQAAaAAAAAIAAAAAAAAAAAEFAAAABHdhdmUEAAAAEXNlcnZpY2VDb21taXNzaW9uAAAAAAAAAADIBAAAAARyb2NrAQAAAAEABAAAAAVwYXBlcgEAAAABAQQAAAAIc2Npc3NvcnMBAAAAAQIEAAAACG1hdGNoS2V5CQEAAAAHZXh0cmFjdAAAAAEJAAQcAAAAAgUAAAACbWUCAAAACG1hdGNoS2V5BAAAAApwbGF5ZXIxS2V5CQEAAAAHZXh0cmFjdAAAAAEJAAQcAA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5jbHVkZWQHBQAAAA1pc1BheW91dFZhbGlkBwdWRUDX", "chainId": 84, "height": 452861, "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 matchKey = extract(getBinary(me, "matchKey")) | |
16 | + | let player1Key = extract(getBinary(me, "player1Key")) | |
17 | + | match tx { | |
18 | + | case dataTx: DataTransaction => | |
19 | + | let dataTxFeeIsOk = (dataTx.fee == 500000) | |
20 | + | let dataTxDataIsOk = if (isDefined(getBinary(dataTx.data, stage1))) | |
21 | + | then { | |
22 | + | let oldHeight = if (isDefined(getInteger(me, heightKey))) | |
23 | + | then extract(getInteger(me, heightKey)) | |
24 | + | else 9223372036854775807 | |
25 | + | let canWriteP2Move = if (!(isDefined(getBinary(me, stage1)))) | |
26 | + | then true | |
27 | + | else (-3 > (oldHeight - height)) | |
28 | + | let isDataSizeValid = (size(dataTx.data) == 3) | |
29 | + | let isHeightFieldCorrect = if (if ((height == extract(getInteger(dataTx.data, heightKey)))) | |
30 | + | then true | |
31 | + | else ((height - 1) == extract(getInteger(dataTx.data, heightKey)))) | |
32 | + | then true | |
33 | + | else ((height + 1) == extract(getInteger(dataTx.data, heightKey))) | |
34 | + | if (if (canWriteP2Move) | |
35 | + | then isDataSizeValid | |
36 | + | else false) | |
37 | + | then isHeightFieldCorrect | |
38 | + | else false | |
39 | + | } | |
40 | + | else if (isDefined(getBinary(dataTx.data, stage2))) | |
41 | + | then { | |
42 | + | let isSizeOk = (size(dataTx.data) == 2) | |
43 | + | let isNotDefined = !(isDefined(getBinary(me, stage2))) | |
44 | + | let isHashShaOk = (sha256(extract(getBinary(dataTx.data, stage2))) == extract(getBinary(me, stage1))) | |
45 | + | let isPaymentOk = match transactionById(extract(getBinary(dataTx.data, "payment"))) { | |
46 | + | case p2payment: TransferTransaction => | |
47 | + | let isAttSizeOk = (size(p2payment.attachment) == 32) | |
48 | + | let isAttHashOk = (sha256(p2payment.attachment) == extract(getBinary(me, stage1))) | |
49 | + | if (if (if (if (if (isAttSizeOk) | |
50 | + | then isAttHashOk | |
51 | + | else false) | |
52 | + | then (p2payment.amount == (1 * wave)) | |
53 | + | else false) | |
54 | + | then (p2payment.recipient == me) | |
55 | + | else false) | |
56 | + | then (p2payment.senderPublicKey == extract(getBinary(me, "player2Key"))) | |
57 | + | else false) | |
58 | + | then sigVerify(p2payment.bodyBytes, p2payment.proofs[0], p2payment.senderPublicKey) | |
59 | + | else false | |
60 | + | case _ => | |
61 | + | false | |
62 | + | } | |
63 | + | if (if (if (isNotDefined) | |
64 | + | then isSizeOk | |
65 | + | else false) | |
66 | + | then isHashShaOk | |
67 | + | else false) | |
68 | + | then isPaymentOk | |
69 | + | else false | |
70 | + | } | |
71 | + | else if (isDefined(getBinary(dataTx.data, stage3))) | |
72 | + | then { | |
73 | + | let isP1NotYetRevealed = !(isDefined(getBinary(me, stage3))) | |
74 | + | let isSizeValid = (size(dataTx.data) == 1) | |
75 | + | let isProofValid = (size(extract(getBinary(dataTx.data, stage3))) == 32) | |
76 | + | let isShaValid = (sha256(extract(getBinary(dataTx.data, stage3))) == extract(getBinary(me, "p1MoveHash"))) | |
77 | + | if (if (if (isP1NotYetRevealed) | |
78 | + | then isSizeValid | |
79 | + | else false) | |
80 | + | then isProofValid | |
81 | + | else false) | |
82 | + | then isShaValid | |
83 | + | else false | |
84 | + | } | |
85 | + | else false | |
86 | + | if (dataTxFeeIsOk) | |
87 | + | then dataTxDataIsOk | |
88 | + | else false | |
89 | + | case payout: MassTransferTransaction => | |
90 | + | let p1moves = take(extract(getBinary(me, stage3)), 3) | |
91 | + | let p2moves = take(extract(getBinary(me, stage2)), 3) | |
92 | + | let p1m1 = take(p1moves, 1) | |
93 | + | let p2m1 = take(p2moves, 1) | |
94 | + | let p1m2 = takeRightBytes(take(p1moves, 2), 1) | |
95 | + | let p2m2 = takeRightBytes(take(p2moves, 2), 1) | |
96 | + | let p1m3 = takeRightBytes(p1moves, 1) | |
97 | + | let p2m3 = takeRightBytes(p2moves, 1) | |
98 | + | let round1 = if (if (if (if ((p1m1 == rock)) | |
99 | + | then (p2m1 == scissors) | |
100 | + | else false) | |
101 | + | then true | |
102 | + | else if ((p1m1 == paper)) | |
103 | + | then (p2m1 == rock) | |
104 | + | else false) | |
105 | + | then true | |
106 | + | else if ((p1m1 == scissors)) | |
107 | + | then (p2m1 == paper) | |
108 | + | else false) | |
109 | + | then 1 | |
110 | + | else if ((p1m1 == p2m1)) | |
111 | + | then 0 | |
112 | + | else -1 | |
113 | + | let round2 = if (if (if (if ((p1m2 == rock)) | |
114 | + | then (p2m2 == scissors) | |
115 | + | else false) | |
116 | + | then true | |
117 | + | else if ((p1m2 == paper)) | |
118 | + | then (p2m2 == rock) | |
119 | + | else false) | |
120 | + | then true | |
121 | + | else if ((p1m2 == scissors)) | |
122 | + | then (p2m2 == paper) | |
123 | + | else false) | |
124 | + | then 1 | |
125 | + | else if ((p1m2 == p2m2)) | |
126 | + | then 0 | |
127 | + | else -1 | |
128 | + | let round3 = if (if (if (if ((p1m3 == rock)) | |
129 | + | then (p2m3 == scissors) | |
130 | + | else false) | |
131 | + | then true | |
132 | + | else if ((p1m3 == paper)) | |
133 | + | then (p2m3 == rock) | |
134 | + | else false) | |
135 | + | then true | |
136 | + | else if ((p1m3 == scissors)) | |
137 | + | then (p2m3 == paper) | |
138 | + | else false) | |
139 | + | then 1 | |
140 | + | else if ((p1m3 == p2m3)) | |
141 | + | then 0 | |
142 | + | else -1 | |
143 | + | let score = ((round1 + round2) + round3) | |
144 | + | let p1 = addressFromPublicKey(player1Key) | |
145 | + | let p2 = addressFromPublicKey(extract(getBinary(me, "player2Key"))) | |
146 | + | let isCommissionIncluded = if ((payout.transfers[0].recipient == serviceAddress)) | |
147 | + | then (payout.transfers[0].amount == (gameBet / serviceCommission)) | |
148 | + | else false | |
149 | + | let protect = (600000 >= payout.fee) | |
150 | + | let isPayoutValid = if ((score == 0)) | |
151 | + | then if (if (if ((size(payout.transfers) == 3)) | |
152 | + | then (payout.transfers[1].amount == payout.transfers[2].amount) | |
153 | + | else false) | |
154 | + | then (payout.transfers[1].recipient == p1) | |
155 | + | else false) | |
156 | + | then (payout.transfers[2].recipient == p2) | |
157 | + | else false | |
158 | + | else { | |
159 | + | let winner = if ((score > 0)) | |
160 | + | then p1 | |
161 | + | else p2 | |
162 | + | if ((size(payout.transfers) == 2)) | |
163 | + | then (payout.transfers[1].recipient == winner) | |
164 | + | else false | |
165 | + | } | |
166 | + | if (if (protect) | |
167 | + | then isCommissionIncluded | |
168 | + | else false) | |
169 | + | then isPayoutValid | |
170 | + | else false | |
171 | + | case _ => | |
172 | + | false | |
173 | + | } |
github/deemru/w8io/169f3d6 16.91 ms ◑