tx · AKNzSqygHYjX9zBJsMiKx4rhfKjy2iAURKw66JCiyTJd 3MwR2FzFtbHeds3NzvkbiaYMVNhbtqcfRPU: -0.01000000 Waves 2019.02.10 18:43 [489234] smart account 3MwR2FzFtbHeds3NzvkbiaYMVNhbtqcfRPU > SELF 0.00000000 Waves
{ "type": 13, "id": "AKNzSqygHYjX9zBJsMiKx4rhfKjy2iAURKw66JCiyTJd", "fee": 1000000, "feeAssetId": null, "timestamp": 1549813446701, "version": 1, "sender": "3MwR2FzFtbHeds3NzvkbiaYMVNhbtqcfRPU", "senderPublicKey": "H5rtwGVnkSHDfz6msD7itGURoKMXvvDwPoup1VESxfjJ", "proofs": [ "5QWf986kQWRpnQz2CVhmKGag7xeHTk3G5ZmmkJ5qrfMsXZ2PqUe8X9C2avtrGNSwqF397qaQ3fNR3QBUBBr2o81p" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABm9yYWNsZQkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkN6YVlUTkRHdFI4emY5eWZjcWVQRmpDcUZ4OVM1emhzNAQAAAAObWluV2l0aGRyYXdGZWUAAAAAAAAGGoAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAp3aXRoZHJhd1R4BQAAAAckbWF0Y2gwBAAAAAR0eElkCQEAAAAHZXh0cmFjdAAAAAEJAAQdAAAAAgUAAAACbWUJAAJYAAAAAQkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAABBAAAAAckbWF0Y2gxCQAD6AAAAAEJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQMJAAABAAAAAgUAAAAHJG1hdGNoMQIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAAJcGF5bWVudFR4BQAAAAckbWF0Y2gxB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3VtAAAAAAAAAAAABAAAAApzdW1CZXRzTmV3CQEAAAAHZXh0cmFjdAAAAAEJAAQQAAAAAggFAAAAA2R0eAAAAARkYXRhCQABLAAAAAIFAAAADHBheW1lbnRSb3VuZAIAAAAIX2JldHNTdW0EAAAAGWlzUGF5bWVudEFscmVhZHlNZW50aW9uZWQJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAAAm1lBQAAAA5wYXltZW50VHhJZFN0cgQAAAAJcGF5bWVudFR4CQAD6AAAAAEJAAJZAAAAAQUAAAAOcGF5bWVudFR4SWRTdHIEAAAAByRtYXRjaDEFAAAACXBheW1lbnRUeAMJAAABAAAAAgUAAAAHJG1hdGNoMQIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAAJcGF5bWVudFR4BQAAAAckbWF0Y2gxBAAAABJpc0R0eFNpZ25lZEJ5UGF5ZXIJAAH0AAAAAwgFAAAAA2R0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAA2R0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAlwYXltZW50VHgAAAAPc2VuZGVyUHVibGljS2V5AwkBAAAAASEAAAABBQAAABlpc1BheW1lbnRBbHJlYWR5TWVudGlvbmVkCQAAAAAAAAIFAAAACnN1bUJldHNOZXcJAABlAAAAAgkAAGQAAAACBQAAAApzdW1CZXRzT2xkCAUAAAAJcGF5bWVudFR4AAAABmFtb3VudAgFAAAAA2R0eAAAAANmZWUHBwcJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5aHEG7w==", "chainId": 84, "height": 489234, "spentComplexity": 0 } View: original | compacted Prev: none Next: AMhwRMpgD9V1PF7acEWr3Tr7zufPXy359ofEwagv1sYf Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 1 #-} | |
2 | + | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | + | let me = tx.sender | |
4 | + | let oracle = extract(addressFromString("3NCzaYTNDGtR8zf9yfcqePFjCqFx9S5zhs4")) | |
5 | + | let minWithdrawFee = 400000 | |
6 | + | match tx { | |
7 | + | case withdrawTx: TransferTransaction => | |
8 | + | let txId = extract(getString(me, toBase58String(tx.proofs[1]))) | |
9 | + | match transactionById(tx.proofs[1]) { | |
10 | + | case paymentTx: TransferTransaction => | |
11 | + | let isPaymentTookPlace = if ((txId == toBase58String(tx.id))) | |
12 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey) | |
13 | + | else false | |
14 | + | let feesKey = (toBase58String(tx.proofs[1]) + "_fees") | |
15 | + | let dataTxsFees = extract(getInteger(me, feesKey)) | |
16 | + | let guess = extract(getBinary(me, toBase58String(tx.proofs[1]))) | |
17 | + | let type = take(guess, 1) | |
18 | + | let val = drop(guess, 1) | |
19 | + | let key = extract(getString(me, (toBase58String(tx.proofs[1]) + "_round"))) | |
20 | + | let valComplex = extract(getBinary(oracle, key)) | |
21 | + | let koeff = if ((type == drop(toBytes(0), 7))) | |
22 | + | then 35 | |
23 | + | else if ((type == drop(toBytes(1), 7))) | |
24 | + | then 2 | |
25 | + | else if ((type == drop(toBytes(2), 7))) | |
26 | + | then 2 | |
27 | + | else if ((type == drop(toBytes(3), 7))) | |
28 | + | then 2 | |
29 | + | else if ((type == drop(toBytes(4), 7))) | |
30 | + | then 3 | |
31 | + | else if ((type == drop(toBytes(5), 7))) | |
32 | + | then 3 | |
33 | + | else 0 | |
34 | + | let correctAmount = (((paymentTx.amount * koeff) - dataTxsFees) - withdrawTx.fee) | |
35 | + | let isAmountOk = (withdrawTx.amount == correctAmount) | |
36 | + | let isInWaves = if (!(isDefined(withdrawTx.feeAssetId))) | |
37 | + | then !(isDefined(withdrawTx.assetId)) | |
38 | + | else false | |
39 | + | if (if (isPaymentTookPlace) | |
40 | + | then isAmountOk | |
41 | + | else false) | |
42 | + | then isInWaves | |
43 | + | else false | |
44 | + | case _ => | |
45 | + | false | |
46 | + | } | |
47 | + | case dtx: DataTransaction => | |
48 | + | if ((size(dtx.data) == 2)) | |
49 | + | then { | |
50 | + | let isDataCountOk = (size(dtx.data) == 2) | |
51 | + | let paymentTxIdStr = dropRight(extract(dtx.data[0].key), 9) | |
52 | + | let feesKey = (paymentTxIdStr + "_fees") | |
53 | + | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
54 | + | let newFees = extract(getInteger(dtx.data, feesKey)) | |
55 | + | let oldFees = if (isDefined(getInteger(me, feesKey))) | |
56 | + | then extract(getInteger(me, feesKey)) | |
57 | + | else 0 | |
58 | + | let isFeeCorrect = (newFees == (oldFees + dtx.fee)) | |
59 | + | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
60 | + | let withdrawTransactionId = fromBase58String(extract(getString(me, paymentTxIdStr))) | |
61 | + | let isWithdrawExist = isDefined(transactionById(withdrawTransactionId)) | |
62 | + | match paymentTx { | |
63 | + | case paymentTx: TransferTransaction => | |
64 | + | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
65 | + | if (if (if (if (if (!(isPaymentAlreadyMentioned)) | |
66 | + | then true | |
67 | + | else !(isWithdrawExist)) | |
68 | + | then isDtxSignedByPayer | |
69 | + | else false) | |
70 | + | then isFeeCorrect | |
71 | + | else false) | |
72 | + | then isDataCountOk | |
73 | + | else false) | |
74 | + | then { | |
75 | + | let att = paymentTx.attachment | |
76 | + | let type = dropRightBytes(takeRightBytes(att, 2), 1) | |
77 | + | let val = takeRightBytes(att, 1) | |
78 | + | let key = dropRightBytes(att, 2) | |
79 | + | let heightRes = extract(getInteger(oracle, (toBase58String(key) + "height"))) | |
80 | + | let isCheater = (extract(transactionHeightById(paymentTx.id)) >= heightRes) | |
81 | + | let valComplex = extract(getBinary(oracle, toBase58String(key))) | |
82 | + | let koeff = if ((type == drop(toBytes(0), 7))) | |
83 | + | then 35 | |
84 | + | else if ((type == drop(toBytes(1), 7))) | |
85 | + | then 2 | |
86 | + | else if ((type == drop(toBytes(2), 7))) | |
87 | + | then 2 | |
88 | + | else if ((type == drop(toBytes(3), 7))) | |
89 | + | then 2 | |
90 | + | else if ((type == drop(toBytes(4), 7))) | |
91 | + | then 3 | |
92 | + | else if ((type == drop(toBytes(5), 7))) | |
93 | + | then 3 | |
94 | + | else 0 | |
95 | + | let ver = take(valComplex, 1) | |
96 | + | let valReal = if ((type == drop(toBytes(0), 7))) | |
97 | + | then drop(take(valComplex, 2), 1) | |
98 | + | else if ((type == drop(toBytes(1), 7))) | |
99 | + | then drop(take(valComplex, 3), 2) | |
100 | + | else if ((type == drop(toBytes(2), 7))) | |
101 | + | then drop(take(valComplex, 4), 3) | |
102 | + | else if ((type == drop(toBytes(3), 7))) | |
103 | + | then drop(take(valComplex, 5), 4) | |
104 | + | else if ((type == drop(toBytes(4), 7))) | |
105 | + | then drop(take(valComplex, 6), 5) | |
106 | + | else if ((type == drop(toBytes(5), 7))) | |
107 | + | then drop(take(valComplex, 7), 6) | |
108 | + | else toBytes(38) | |
109 | + | let isWin = if ((val == valReal)) | |
110 | + | then (val != toBytes(38)) | |
111 | + | else false | |
112 | + | let isMoneyStillEnough = (((paymentTx.amount * koeff) + minWithdrawFee) > newFees) | |
113 | + | if (if (isWin) | |
114 | + | then !(isCheater) | |
115 | + | else false) | |
116 | + | then isMoneyStillEnough | |
117 | + | else false | |
118 | + | } | |
119 | + | else false | |
120 | + | case _ => | |
121 | + | false | |
122 | + | } | |
123 | + | } | |
124 | + | else if ((size(dtx.data) == 3)) | |
125 | + | then { | |
126 | + | let paymentTxIdStr = extract(dtx.data[0].key) | |
127 | + | let guessStr = extract(getString(dtx.data, paymentTxIdStr)) | |
128 | + | let paymentRoundKey = (paymentTxIdStr + "_round") | |
129 | + | let paymentRound = extract(getString(dtx.data, paymentRoundKey)) | |
130 | + | let sumBetsOld = if (isDefined(getInteger(me, (paymentRound + "_betsSum")))) | |
131 | + | then extract(getInteger(me, (paymentRound + "_betsSum"))) | |
132 | + | else 0 | |
133 | + | let sumBetsNew = extract(getInteger(dtx.data, (paymentRound + "_betsSum"))) | |
134 | + | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
135 | + | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
136 | + | match paymentTx { | |
137 | + | case paymentTx: TransferTransaction => | |
138 | + | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
139 | + | if (!(isPaymentAlreadyMentioned)) | |
140 | + | then (sumBetsNew == ((sumBetsOld + paymentTx.amount) - dtx.fee)) | |
141 | + | else false | |
142 | + | case _ => | |
143 | + | false | |
144 | + | } | |
145 | + | } | |
146 | + | else false | |
147 | + | case _ => | |
148 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
149 | + | } |
github/deemru/w8io/026f985 31.48 ms ◑