tx · DYcdTPPjcFk4Kxi918ac5nauVEpjZvdgdjacGL5axKEa

3MwfGrdtsJfpPqy8woo9WXCKPAvEtoS9jg2:  -0.01000000 Waves

2019.01.16 17:50 [452706] smart account 3MwfGrdtsJfpPqy8woo9WXCKPAvEtoS9jg2 > SELF 0.00000000 Waves

{ "type": 13, "id": "DYcdTPPjcFk4Kxi918ac5nauVEpjZvdgdjacGL5axKEa", "fee": 1000000, "feeAssetId": null, "timestamp": 1547650228201, "version": 1, "sender": "3MwfGrdtsJfpPqy8woo9WXCKPAvEtoS9jg2", "senderPublicKey": "CHmBBdoGFqMVYbjLzeuYbgmQgz4PZkJqHZQCwChLAgdi", "proofs": [ "3ZmmUejkdANvdYNBdWoh1hdBtEuM1eFwyDG9FY5CrTDocRcfuFY9kfaDDMLjhYvxfacGqbpMCkta8b1jRnRki9qu" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAADnNlcnZpY2VBZGRyZXNzCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTjdvRjVKNW05QndCRkNtVkpaV3IzQUVIM3U0YzZDTG9COQQAAAAJaGVpZ2h0S2V5AgAAAAZoZWlnaHQEAAAABnN0YWdlMQIAAAAKcDJNb3ZlSGFzaAQAAAAGc3RhZ2UyAgAAAAZwMk1vdmUEAAAABnN0YWdlMwIAAAAGcDFNb3ZlBAAAAAR3YXZlAAAAAAAF9eEABAAAAAdnYW1lQmV0CQAAaAAAAAIAAAAAAAAAAAEFAAAABHdhdmUEAAAAEXNlcnZpY2VDb21taXNzaW9uAAAAAAAAAADIBAAAAARyb2NrAQAAAAEABAAAAAVwYXBlcgEAAAABAQQAAAAIc2Npc3NvcnMBAAAAAQIEAAAACG1hdGNoS2V5CQEAAAAHZXh0cmFjdAAAAAEJAAQcAAAAAgUAAAACbWUCAAAACG1hdGNoS2V5BAAAAApwbGF5ZXIxS2V5CQEAAAAHZXh0cmFjdAAAAAEJAAQcAAAAAgUAAA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AOc2VydmljZUFkZHJlc3MJAAAAAAAAAggJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAAAAAAGYW1vdW50CQAAaQAAAAIFAAAAB2dhbWVCZXQFAAAAEXNlcnZpY2VDb21taXNzaW9uBwQAAAAHcHJvdGVjdAkAAGcAAAACAAAAAAAACSfACAUAAAAGcGF5b3V0AAAAA2ZlZQQAAAANaXNQYXlvdXRWYWxpZAMJAAAAAAAAAgUAAAAFc2NvcmUAAAAAAAAAAAADAwMJAAAAAAAAAgkAAZAAAAABCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAwkAAAAAAAACCAkAAZEAAAACCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAQAAAAZhbW91bnQICQABkQAAAAIIBQAAAAZwYXlvdXQAAAAJdHJhbnNmZXJzAAAAAAAAAAACAAAABmFtb3VudAcJAAAAAAAAAggJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAEAAAAJcmVjaXBpZW50BQAAAAJwMQcJAAAAAAAAAggJAAGRAAAAAggFAAAABnBheW91dAAAAAl0cmFuc2ZlcnMAAAAAAAAAAAIAAAAJcmVjaXBpZW50BQAAAAJwMgcEAAAABndpbm5lcgMJAABmAAAAAgUAAAAFc2NvcmUAAAAAAAAAAAAFAAAAAnAxBQAAAAJwMgMJAAAAAAAAAgkAAZAAAAABCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAgkAAAAAAAACCAkAAZEAAAACCAUAAAAGcGF5b3V0AAAACXRyYW5zZmVycwAAAAAAAAAAAQAAAAlyZWNpcGllbnQFAAAABndpbm5lcgcDAwUAAAAHcHJvdGVjdAUAAAAUaXNDb21taXNzaW9uSW5jbHVkZWQHBQAAAA1pc1BheW91dFZhbGlkBwd3fKEh", "chainId": 84, "height": 452706, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
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 isDataTxSignatureValid = sigVerify(dataTx.bodyBytes, dataTx.proofs[0], extract(getBinary(dataTx.data, "player2Key")))
30+ let isHeightFieldCorrect = if (if ((height == extract(getInteger(dataTx.data, heightKey))))
31+ then true
32+ else ((height - 1) == extract(getInteger(dataTx.data, heightKey))))
33+ then true
34+ else ((height + 1) == extract(getInteger(dataTx.data, heightKey)))
35+ if (if (if (canWriteP2Move)
36+ then isDataSizeValid
37+ else false)
38+ then isDataTxSignatureValid
39+ else false)
40+ then isHeightFieldCorrect
41+ else false
42+ }
43+ else if (isDefined(getBinary(dataTx.data, stage2)))
44+ then if (if (if (if (!(isDefined(getBinary(me, stage2))))
45+ then (size(dataTx.data) == 2)
46+ else false)
47+ then (size(extract(getBinary(dataTx.data, stage2))) == 32)
48+ else false)
49+ then (sha256(extract(getBinary(dataTx.data, stage2))) == extract(getBinary(me, stage1)))
50+ else false)
51+ then match transactionById(extract(getBinary(dataTx.data, "payment"))) {
52+ case p2payment: TransferTransaction =>
53+ if (if (if ((p2payment.amount == (1 * wave)))
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+ else false
64+ else if (isDefined(getBinary(dataTx.data, stage3)))
65+ then {
66+ let isP1NotYetRevealed = !(isDefined(getBinary(me, stage3)))
67+ let isSizeValid = (size(dataTx.data) == 1)
68+ let isProofValid = (size(extract(getBinary(dataTx.data, stage3))) == 32)
69+ let isShaValid = (sha256(extract(getBinary(dataTx.data, stage3))) == extract(getBinary(me, "p1MoveHash")))
70+ if (if (if (isP1NotYetRevealed)
71+ then isSizeValid
72+ else false)
73+ then isProofValid
74+ else false)
75+ then isShaValid
76+ else false
77+ }
78+ else false
79+ if (dataTxFeeIsOk)
80+ then dataTxDataIsOk
81+ else false
82+ case payout: MassTransferTransaction =>
83+ let p1moves = take(extract(getBinary(me, stage3)), 3)
84+ let p2moves = take(extract(getBinary(me, stage2)), 3)
85+ let p1m1 = take(p1moves, 1)
86+ let p2m1 = take(p2moves, 1)
87+ let p1m2 = takeRightBytes(take(p1moves, 2), 1)
88+ let p2m2 = takeRightBytes(take(p2moves, 2), 1)
89+ let p1m3 = takeRightBytes(p1moves, 1)
90+ let p2m3 = takeRightBytes(p2moves, 1)
91+ let round1 = if (if (if (if ((p1m1 == rock))
92+ then (p2m1 == scissors)
93+ else false)
94+ then true
95+ else if ((p1m1 == paper))
96+ then (p2m1 == rock)
97+ else false)
98+ then true
99+ else if ((p1m1 == scissors))
100+ then (p2m1 == paper)
101+ else false)
102+ then 1
103+ else if ((p1m1 == p2m1))
104+ then 0
105+ else -1
106+ let round2 = if (if (if (if ((p1m2 == rock))
107+ then (p2m2 == scissors)
108+ else false)
109+ then true
110+ else if ((p1m2 == paper))
111+ then (p2m2 == rock)
112+ else false)
113+ then true
114+ else if ((p1m2 == scissors))
115+ then (p2m2 == paper)
116+ else false)
117+ then 1
118+ else if ((p1m2 == p2m2))
119+ then 0
120+ else -1
121+ let round3 = if (if (if (if ((p1m3 == rock))
122+ then (p2m3 == scissors)
123+ else false)
124+ then true
125+ else if ((p1m3 == paper))
126+ then (p2m3 == rock)
127+ else false)
128+ then true
129+ else if ((p1m3 == scissors))
130+ then (p2m3 == paper)
131+ else false)
132+ then 1
133+ else if ((p1m3 == p2m3))
134+ then 0
135+ else -1
136+ let score = ((round1 + round2) + round3)
137+ let p1 = addressFromPublicKey(player1Key)
138+ let p2 = addressFromPublicKey(extract(getBinary(me, "player2Key")))
139+ let isCommissionIncluded = if ((payout.transfers[0].recipient == serviceAddress))
140+ then (payout.transfers[0].amount == (gameBet / serviceCommission))
141+ else false
142+ let protect = (600000 >= payout.fee)
143+ let isPayoutValid = if ((score == 0))
144+ then if (if (if ((size(payout.transfers) == 3))
145+ then (payout.transfers[1].amount == payout.transfers[2].amount)
146+ else false)
147+ then (payout.transfers[1].recipient == p1)
148+ else false)
149+ then (payout.transfers[2].recipient == p2)
150+ else false
151+ else {
152+ let winner = if ((score > 0))
153+ then p1
154+ else p2
155+ if ((size(payout.transfers) == 2))
156+ then (payout.transfers[1].recipient == winner)
157+ else false
158+ }
159+ if (if (protect)
160+ then isCommissionIncluded
161+ else false)
162+ then isPayoutValid
163+ else false
164+ case _ =>
165+ false
166+}

github/deemru/w8io/026f985 
15.77 ms