tx · 7unPpKJsW5UzWeU7XXwKLviBQHp5hq4dGdGH5aJPWFuS 3MrTMXEvaz63AHA6K7U5hDgTY54gZZe3R4g: -0.01400000 Waves 2019.03.18 19:28 [541916] smart account 3MrTMXEvaz63AHA6K7U5hDgTY54gZZe3R4g > SELF 0.00000000 Waves
{ "type": 13, "id": "7unPpKJsW5UzWeU7XXwKLviBQHp5hq4dGdGH5aJPWFuS", "fee": 1400000, "feeAssetId": null, "timestamp": 1552926643457, "version": 1, "sender": "3MrTMXEvaz63AHA6K7U5hDgTY54gZZe3R4g", "senderPublicKey": "CEx6vd7D5Czxcfshd4vLpSw4LEmGULQw5avVZ7Vfrzgo", "proofs": [ "4ewsFieRowsmvwKLPTMP5eCqRAapCQvGyMD9LRNPvdC13grQNfwr1ic8kcjJvAc3ZN4WAGG2ApcWNvwdhoLgE7NM" ], "script": "base64:AgQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAACZHQFAAAAByRtYXRjaDADCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCQAEEwAAAAIIBQAAAAJkdAAAAARkYXRhAgAAAAR0eXBlCQAAAgAAAAECAAAAH2R0eCBmYWlsIC0gZHR4IHR5cGUgbm90IGRlZmluZWQDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCQAEEwAAAAIIBQAAAAJkdAAAAARkYXRhAgAAAAZnYW1lSWQJAAACAAAAAQIAAAAeZHR4IGZhaWwgLSBnYW1lIGlkIG5vdCBkZWZpbmVkBAAAAAR0eXBlCQEAAAAHZXh0cmFjdAAAAAEJAAQTAAAAAggFAAAAAmR0AAAABGRhdGECAAAABHR5cGUEAAAABmdhbWVJZAkBAAAAB2V4dHJhY3QAAAABCQAEEwAAAAIIBQAAAAJkdAAAAARkYXRhAgAAAAZnYW1lSWQEAAAADHNlcnZlclNpZ25lZAkAAfQAAAADCAUAAAACZHQAAA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AGRAAAAAggFAAAAAnN0AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQcsv9n6", "chainId": 84, "height": 541916, "spentComplexity": 0 } View: original | compacted Prev: 5CaLUa74ahREByy9m69v3S3i1gsJKHehqX56eLGxxwrE Next: CnWUJ27ptC1K6uyGhnPLCUBhhh2jX625rNz9sD9ZM2A2 Diff:
Old | New | Differences | |
---|---|---|---|
84 | 84 | } | |
85 | 85 | else if ((type == "payout")) | |
86 | 86 | then if (!(isDefined(getString(tx.sender, (gameId + "_winner"))))) | |
87 | - | then throw("dtx:payout fail - game winner not defined") | |
87 | + | then throw(("dtx:payout fail - game winner not defined " + toBase58String(tx.sender.bytes))) | |
88 | 88 | else { | |
89 | 89 | let winnerPk = extract(getString(tx.sender, (gameId + "_winner"))) | |
90 | 90 | let winnerSigned = sigVerify(dt.bodyBytes, dt.proofs[0], fromBase58String(winnerPk)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 2 #-} | |
2 | 2 | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | 3 | match tx { | |
4 | 4 | case dt: DataTransaction => | |
5 | 5 | if (!(isDefined(getString(dt.data, "type")))) | |
6 | 6 | then throw("dtx fail - dtx type not defined") | |
7 | 7 | else if (!(isDefined(getString(dt.data, "gameId")))) | |
8 | 8 | then throw("dtx fail - game id not defined") | |
9 | 9 | else { | |
10 | 10 | let type = extract(getString(dt.data, "type")) | |
11 | 11 | let gameId = extract(getString(dt.data, "gameId")) | |
12 | 12 | let serverSigned = sigVerify(dt.bodyBytes, dt.proofs[0], tx.senderPublicKey) | |
13 | 13 | if ((type == "start")) | |
14 | 14 | then { | |
15 | 15 | let betAmount = extract(getInteger(dt.data, (gameId + "_amount"))) | |
16 | 16 | let player1 = extract(getString(dt.data, (gameId + "_player1"))) | |
17 | 17 | let player1TxId = extract(getString(dt.data, (gameId + "_tx1"))) | |
18 | 18 | let player2 = extract(getString(dt.data, (gameId + "_player2"))) | |
19 | 19 | let player2TxId = extract(getString(dt.data, (gameId + "_tx2"))) | |
20 | 20 | let dtStartDataDefined = if (if (if (isDefined(getInteger(dt.data, (gameId + "_winAmount")))) | |
21 | 21 | then isDefined(getBinary(dt.data, (gameId + "_squadronHash"))) | |
22 | 22 | else false) | |
23 | 23 | then isDefined(getBoolean(dt.data, ("used_tx_" + player1TxId))) | |
24 | 24 | else false) | |
25 | 25 | then isDefined(getBoolean(dt.data, ("used_tx_" + player2TxId))) | |
26 | 26 | else false | |
27 | 27 | let player1Tx = transactionById(fromBase58String(player1TxId)) | |
28 | 28 | let player2Tx = transactionById(fromBase58String(player2TxId)) | |
29 | 29 | let tr1Ok = match player1Tx { | |
30 | 30 | case t: TransferTransaction => | |
31 | 31 | if (if (if (if ((t.amount == betAmount)) | |
32 | 32 | then !(isDefined(getString(tx.sender, ("used_tx_" + player1TxId)))) | |
33 | 33 | else false) | |
34 | 34 | then !(isDefined(t.assetId)) | |
35 | 35 | else false) | |
36 | 36 | then (extract(getString(dt.data, ("game_" + toBase58String(addressFromPublicKey(fromBase58String(player1)).bytes)))) == gameId) | |
37 | 37 | else false) | |
38 | 38 | then (t.recipient == tx.sender) | |
39 | 39 | else false | |
40 | 40 | case _ => | |
41 | 41 | false | |
42 | 42 | } | |
43 | 43 | let tr2Ok = match player2Tx { | |
44 | 44 | case t: TransferTransaction => | |
45 | 45 | if (if (if (if ((t.amount == betAmount)) | |
46 | 46 | then !(isDefined(getString(tx.sender, ("used_tx_" + player2TxId)))) | |
47 | 47 | else false) | |
48 | 48 | then !(isDefined(t.assetId)) | |
49 | 49 | else false) | |
50 | 50 | then (extract(getString(dt.data, ("game_" + toBase58String(addressFromPublicKey(fromBase58String(player2)).bytes)))) == gameId) | |
51 | 51 | else false) | |
52 | 52 | then (t.recipient == tx.sender) | |
53 | 53 | else false | |
54 | 54 | case _ => | |
55 | 55 | false | |
56 | 56 | } | |
57 | 57 | if (!(serverSigned)) | |
58 | 58 | then throw("dtx:start fail - server did not sign tx") | |
59 | 59 | else if (!(tr1Ok)) | |
60 | 60 | then throw("dtx:start fail - player 1 ttx is invalid") | |
61 | 61 | else if (!(tr2Ok)) | |
62 | 62 | then throw("dtx:start fail - player 2 ttx is invalid") | |
63 | 63 | else if (!(dtStartDataDefined)) | |
64 | 64 | then throw("dtx:start fail - start data is incomplete") | |
65 | 65 | else true | |
66 | 66 | } | |
67 | 67 | else if ((type == "finish")) | |
68 | 68 | then { | |
69 | 69 | let winner = extract(getString(dt.data, (gameId + "_winner"))) | |
70 | 70 | let correctWinner = if ((winner == extract(getString(tx.sender, (gameId + "_player1"))))) | |
71 | 71 | then true | |
72 | 72 | else (winner == extract(getString(tx.sender, (gameId + "_player2")))) | |
73 | 73 | let squadron1 = extract(getBinary(dt.data, (gameId + "_squadron1"))) | |
74 | 74 | let squadron2 = extract(getBinary(dt.data, (gameId + "_squadron2"))) | |
75 | 75 | let gameSalt = extract(getBinary(dt.data, (gameId + "_salt"))) | |
76 | 76 | let correctSquadrons = (sha256(((squadron1 + squadron2) + gameSalt)) == extract(getBinary(tx.sender, (gameId + "_squadronHash")))) | |
77 | 77 | if (!(serverSigned)) | |
78 | 78 | then throw("dtx:finish fail - server did not sign tx") | |
79 | 79 | else if (!(correctWinner)) | |
80 | 80 | then throw("dtx:finish fail - winner is incorrect") | |
81 | 81 | else if (!(correctSquadrons)) | |
82 | 82 | then throw("dtx:finish fail - squadrons are incorrect") | |
83 | 83 | else true | |
84 | 84 | } | |
85 | 85 | else if ((type == "payout")) | |
86 | 86 | then if (!(isDefined(getString(tx.sender, (gameId + "_winner"))))) | |
87 | - | then throw("dtx:payout fail - game winner not defined") | |
87 | + | then throw(("dtx:payout fail - game winner not defined " + toBase58String(tx.sender.bytes))) | |
88 | 88 | else { | |
89 | 89 | let winnerPk = extract(getString(tx.sender, (gameId + "_winner"))) | |
90 | 90 | let winnerSigned = sigVerify(dt.bodyBytes, dt.proofs[0], fromBase58String(winnerPk)) | |
91 | 91 | let hashPkNotInState = !(isDefined(getBoolean(tx.sender, ((gameId + "_") + winnerPk)))) | |
92 | 92 | let hashPkInData = isDefined(getBoolean(dt.data, ((gameId + "_") + winnerPk))) | |
93 | 93 | let ttxIdNotInState = !(isDefined(getBoolean(tx.sender, dt.data[3].key))) | |
94 | 94 | let data4 = (size(dt.data) == 4) | |
95 | 95 | if (!(winnerSigned)) | |
96 | 96 | then throw("dtx:payout fail - winner did not sign tx") | |
97 | 97 | else if (!(hashPkNotInState)) | |
98 | 98 | then throw("dtx:payout fail - payout dtx already sent") | |
99 | 99 | else if (!(hashPkInData)) | |
100 | 100 | then throw("dtx:payout fail - payout (gameId, winnerPk) pair is not set") | |
101 | 101 | else if (!(ttxIdNotInState)) | |
102 | 102 | then throw("dtx:payout fail - payout ttx id is not set") | |
103 | 103 | else if (!(data4)) | |
104 | 104 | then throw("dtx:payout fail - data size is invalid") | |
105 | 105 | else true | |
106 | 106 | } | |
107 | 107 | else throw(("dtx:type_unknown " + type)) | |
108 | 108 | } | |
109 | 109 | case tt: TransferTransaction => | |
110 | 110 | let serverSigned = sigVerify(tt.bodyBytes, tt.proofs[0], tx.senderPublicKey) | |
111 | 111 | if (serverSigned) | |
112 | 112 | then true | |
113 | 113 | else { | |
114 | 114 | let recipientAddr = toBase58String(addressFromRecipient(tt.recipient).bytes) | |
115 | 115 | let gameId = extract(getString(tx.sender, ("game_" + recipientAddr))) | |
116 | 116 | let winner = extract(getString(tx.sender, (gameId + "_winner"))) | |
117 | 117 | let winnerAddr = toBase58String(addressFromPublicKey(fromBase58String(winner)).bytes) | |
118 | 118 | let winAmount = extract(getInteger(tx.sender, (gameId + "_winAmount"))) | |
119 | 119 | if ((recipientAddr != winnerAddr)) | |
120 | 120 | then throw("ttx:fail - recipient is not winner") | |
121 | 121 | else if (!(isDefined(getBoolean(tx.sender, toBase58String(tt.id))))) | |
122 | 122 | then throw("ttx:fail - payout ttx not registered") | |
123 | 123 | else if (isDefined(tt.assetId)) | |
124 | 124 | then throw("ttx:fail - asset id is set (not waves)") | |
125 | 125 | else if ((tt.amount != winAmount)) | |
126 | 126 | then throw("ttx:fail - wrong payout amount") | |
127 | 127 | else true | |
128 | 128 | } | |
129 | 129 | case st: SetScriptTransaction => | |
130 | 130 | sigVerify(st.bodyBytes, st.proofs[0], tx.senderPublicKey) | |
131 | 131 | case _ => | |
132 | 132 | false | |
133 | 133 | } |
github/deemru/w8io/026f985 26.84 ms ◑