tx · BpwggBsf9GEQKpMzQB1whtsEtB7eTJ3BrcwxhpwFAkyx 3N3sTCdtMzKzVBr7C6fvhvrRuUAC8UUTZZB: -0.01000000 Waves 2019.02.06 18:28 [483374] smart account 3N3sTCdtMzKzVBr7C6fvhvrRuUAC8UUTZZB > SELF 0.00000000 Waves
{ "type": 13, "id": "BpwggBsf9GEQKpMzQB1whtsEtB7eTJ3BrcwxhpwFAkyx", "fee": 1000000, "feeAssetId": null, "timestamp": 1549466894625, "version": 1, "sender": "3N3sTCdtMzKzVBr7C6fvhvrRuUAC8UUTZZB", "senderPublicKey": "EvwJf8qNHnPRjyNTcrT1MH6WnLpSzysFDGoZcQrDinqg", "proofs": [ "4amZfthQjtreomn48kDiWA7XUN8KqPc8YB7P8Q35kcY8yDRzBFCwn9pwT64yJE7s2YhtkxVwzssJvUFMyboPQRbv" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAADnNlcnZpY2VBZGRyZXNzCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTjdvRjVKNW05QndCRkNtVkpaV3IzQUVIM3U0YzZDTG9COQQAAAAJaGVpZ2h0S2V5AgAAAAZoZWlnaHQEAAAACnBsYXllcjJLZXkCAAAACnBsYXllcjJLZXkEAAAADXBsYXllcjFLZXlLZXkCAAAACnBsYXllcjFLZXkEAAAADXAxTW92ZUhhc2hLZXkCAAAACnAxTW92ZUhhc2gEAAAAC21hdGNoS2V5S2V5AgAAAAhtYXRjaEtleQQAAAAKcGF5bWVudEtleQIAAAAHcGF5bWVudAQAAAAGc3RhZ2UxAgAAAApwMk1vdmVIYXNoBAAAAAZzdGFnZTICAAAABnAyTW92ZQQAAAAGc3RhZ2UzAgAAAAZwMU1vdmUEAAAABHdhdmUAAAAAAAX14QAEAAAAB2dhbWVCZXQJAABoAAAAAgAAAAAAAAAAAQUAAAAEd2F2ZQQAAAARc2VydmljZUNvbW1pc3Npb24JAABpAAAAAgUAAAAHZ2F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hbGlkBwf5NOr4", "chainId": 84, "height": 483374, "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 player2Key = "player2Key" | |
7 | + | let player1KeyKey = "player1Key" | |
8 | + | let p1MoveHashKey = "p1MoveHash" | |
9 | + | let matchKeyKey = "matchKey" | |
10 | + | let paymentKey = "payment" | |
11 | + | let stage1 = "p2MoveHash" | |
12 | + | let stage2 = "p2Move" | |
13 | + | let stage3 = "p1Move" | |
14 | + | let wave = 100000000 | |
15 | + | let gameBet = (1 * wave) | |
16 | + | let serviceCommission = (gameBet / 200) | |
17 | + | let rock = base58'1' | |
18 | + | let paper = base58'2' | |
19 | + | let scissors = base58'3' | |
20 | + | let player2ReservationTimeout = 3 | |
21 | + | let player1RevealTimeout = 4 | |
22 | + | let p1MoveHash = extract(getBinary(me, p1MoveHashKey)) | |
23 | + | let matchKey = extract(getBinary(me, matchKeyKey)) | |
24 | + | let player1Key = extract(getBinary(me, player1KeyKey)) | |
25 | + | match tx { | |
26 | + | case dataTx: DataTransaction => | |
27 | + | let feeValid = (dataTx.fee == 500000) | |
28 | + | let payloadValid = if (isDefined(getBinary(dataTx.data, stage1))) | |
29 | + | then { | |
30 | + | let h = extract(getInteger(dataTx.data, heightKey)) | |
31 | + | let hasValidReservation = if (isDefined(getInteger(me, heightKey))) | |
32 | + | then (player2ReservationTimeout >= (height - extract(getInteger(me, heightKey)))) | |
33 | + | else false | |
34 | + | let hasPlayer2MoveRevealed = isDefined(getBinary(me, stage2)) | |
35 | + | let heightValid = if (((height + 1) >= h)) | |
36 | + | then (h >= (height - 1)) | |
37 | + | else false | |
38 | + | let isPlayer2KeyDefined = isDefined(getBinary(dataTx.data, player2Key)) | |
39 | + | let sizeValid = (size(dataTx.data) == 3) | |
40 | + | if (if (if (if (!(hasValidReservation)) | |
41 | + | then !(hasPlayer2MoveRevealed) | |
42 | + | else false) | |
43 | + | then heightValid | |
44 | + | else false) | |
45 | + | then isPlayer2KeyDefined | |
46 | + | else false) | |
47 | + | then sizeValid | |
48 | + | else false | |
49 | + | } | |
50 | + | else if (isDefined(getBinary(dataTx.data, stage2))) | |
51 | + | then { | |
52 | + | let p2MoveHash = extract(getBinary(me, stage1)) | |
53 | + | let player2RevealedMoves = isDefined(getBinary(me, stage2)) | |
54 | + | let sizeValid = (size(dataTx.data) == 2) | |
55 | + | let hashValid = (sha256(extract(getBinary(dataTx.data, stage2))) == p2MoveHash) | |
56 | + | let paymentValid = match transactionById(extract(getBinary(dataTx.data, paymentKey))) { | |
57 | + | case p2payment: TransferTransaction => | |
58 | + | if (if (if (if (if (if ((sha256(p2payment.attachment) == p2MoveHash)) | |
59 | + | then (p2payment.amount == (1 * wave)) | |
60 | + | else false) | |
61 | + | then (p2payment.recipient == me) | |
62 | + | else false) | |
63 | + | then (p2payment.senderPublicKey == extract(getBinary(me, player2Key))) | |
64 | + | else false) | |
65 | + | then (p2payment.senderPublicKey != player1Key) | |
66 | + | else false) | |
67 | + | then !(isDefined(p2payment.assetId)) | |
68 | + | else false) | |
69 | + | then sigVerify(p2payment.bodyBytes, p2payment.proofs[0], p2payment.senderPublicKey) | |
70 | + | else false | |
71 | + | case _ => | |
72 | + | false | |
73 | + | } | |
74 | + | if (if (if (!(player2RevealedMoves)) | |
75 | + | then hashValid | |
76 | + | else false) | |
77 | + | then sizeValid | |
78 | + | else false) | |
79 | + | then paymentValid | |
80 | + | else false | |
81 | + | } | |
82 | + | else if (isDefined(getBinary(dataTx.data, stage3))) | |
83 | + | then { | |
84 | + | let player1RevealedMoves = isDefined(getBinary(me, stage3)) | |
85 | + | let sizeValid = (size(dataTx.data) == 1) | |
86 | + | let proofValid = (size(extract(getBinary(dataTx.data, stage3))) == 32) | |
87 | + | let hashValid = (sha256(extract(getBinary(dataTx.data, stage3))) == extract(getBinary(me, p1MoveHashKey))) | |
88 | + | if (if (if (!(player1RevealedMoves)) | |
89 | + | then sizeValid | |
90 | + | else false) | |
91 | + | then proofValid | |
92 | + | else false) | |
93 | + | then hashValid | |
94 | + | else false | |
95 | + | } | |
96 | + | else false | |
97 | + | if (feeValid) | |
98 | + | then payloadValid | |
99 | + | else false | |
100 | + | case payout: MassTransferTransaction => | |
101 | + | let isCommissionIncluded = if ((payout.transfers[0].recipient == serviceAddress)) | |
102 | + | then (payout.transfers[0].amount == serviceCommission) | |
103 | + | else false | |
104 | + | let feeValid = if (if ((payout.transferCount == 2)) | |
105 | + | then (600000 >= payout.fee) | |
106 | + | else false) | |
107 | + | then true | |
108 | + | else if ((payout.transferCount == 3)) | |
109 | + | then (700000 >= payout.fee) | |
110 | + | else false | |
111 | + | let player1RevealedMoves = isDefined(getBinary(me, stage3)) | |
112 | + | let waitingTooLongForPlayer1 = if (((height - extract(getInteger(me, heightKey))) > player1RevealTimeout)) | |
113 | + | then !(player1RevealedMoves) | |
114 | + | else false | |
115 | + | let p1moves = take(extract(getBinary(me, stage3)), 3) | |
116 | + | let p2moves = take(extract(getBinary(me, stage2)), 3) | |
117 | + | let p1m1 = take(p1moves, 1) | |
118 | + | let p2m1 = take(p2moves, 1) | |
119 | + | let p1m2 = takeRightBytes(take(p1moves, 2), 1) | |
120 | + | let p2m2 = takeRightBytes(take(p2moves, 2), 1) | |
121 | + | let p1m3 = takeRightBytes(p1moves, 1) | |
122 | + | let p2m3 = takeRightBytes(p2moves, 1) | |
123 | + | let round1 = if (if (if (if ((p1m1 == rock)) | |
124 | + | then (p2m1 == scissors) | |
125 | + | else false) | |
126 | + | then true | |
127 | + | else if ((p1m1 == paper)) | |
128 | + | then (p2m1 == rock) | |
129 | + | else false) | |
130 | + | then true | |
131 | + | else if ((p1m1 == scissors)) | |
132 | + | then (p2m1 == paper) | |
133 | + | else false) | |
134 | + | then 1 | |
135 | + | else if ((p1m1 == p2m1)) | |
136 | + | then 0 | |
137 | + | else -1 | |
138 | + | let round2 = if (if (if (if ((p1m2 == rock)) | |
139 | + | then (p2m2 == scissors) | |
140 | + | else false) | |
141 | + | then true | |
142 | + | else if ((p1m2 == paper)) | |
143 | + | then (p2m2 == rock) | |
144 | + | else false) | |
145 | + | then true | |
146 | + | else if ((p1m2 == scissors)) | |
147 | + | then (p2m2 == paper) | |
148 | + | else false) | |
149 | + | then 1 | |
150 | + | else if ((p1m2 == p2m2)) | |
151 | + | then 0 | |
152 | + | else -1 | |
153 | + | let round3 = if (if (if (if ((p1m3 == rock)) | |
154 | + | then (p2m3 == scissors) | |
155 | + | else false) | |
156 | + | then true | |
157 | + | else if ((p1m3 == paper)) | |
158 | + | then (p2m3 == rock) | |
159 | + | else false) | |
160 | + | then true | |
161 | + | else if ((p1m3 == scissors)) | |
162 | + | then (p2m3 == paper) | |
163 | + | else false) | |
164 | + | then 1 | |
165 | + | else if ((p1m3 == p2m3)) | |
166 | + | then 0 | |
167 | + | else -1 | |
168 | + | let score = ((round1 + round2) + round3) | |
169 | + | let p1 = addressFromPublicKey(player1Key) | |
170 | + | let p2 = addressFromPublicKey(extract(getBinary(me, player2Key))) | |
171 | + | let payoutValid = if (if (waitingTooLongForPlayer1) | |
172 | + | then (payout.transfers[1].recipient == p2) | |
173 | + | else false) | |
174 | + | then true | |
175 | + | else if ((score == 0)) | |
176 | + | then if (if (if ((size(payout.transfers) == 3)) | |
177 | + | then (payout.transfers[1].amount == payout.transfers[2].amount) | |
178 | + | else false) | |
179 | + | then (payout.transfers[1].recipient == p1) | |
180 | + | else false) | |
181 | + | then (payout.transfers[2].recipient == p2) | |
182 | + | else false | |
183 | + | else if ((size(payout.transfers) == 2)) | |
184 | + | then (payout.transfers[1].recipient == (if ((score > 0)) | |
185 | + | then p1 | |
186 | + | else p2)) | |
187 | + | else false | |
188 | + | if (if (feeValid) | |
189 | + | then isCommissionIncluded | |
190 | + | else false) | |
191 | + | then payoutValid | |
192 | + | else false | |
193 | + | case _ => | |
194 | + | false | |
195 | + | } |
github/deemru/w8io/026f985 25.06 ms ◑