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