tx · DQ4QHApfJAsdefLPNzudLuvaTjCvJPDbENJrtK5FqCWm 3N4Z7j4oSNfJVUtP4kmMKbhZD5n4xPFpPAu: -0.01400000 Waves 2019.02.02 01:20 [476512] smart account 3N4Z7j4oSNfJVUtP4kmMKbhZD5n4xPFpPAu > SELF 0.00000000 Waves
{ "type": 13, "id": "DQ4QHApfJAsdefLPNzudLuvaTjCvJPDbENJrtK5FqCWm", "fee": 1400000, "feeAssetId": null, "timestamp": 1549059640106, "version": 1, "sender": "3N4Z7j4oSNfJVUtP4kmMKbhZD5n4xPFpPAu", "senderPublicKey": "F3DbYSfYZz6arcD6Mst8HdWScxTeWvTvatC7jp4DGryX", "proofs": [ "5Dkz9hpT9faHtmY5asHSq4ShBX35Zxzeywi3khETF2r9FGWK1yK7ue8in1WBoHZh1FPfeE2ntovtpTfHA68PRTYa" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABm9yYWNsZQkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkN6YVlUTkRHdFI4emY5eWZjcWVQRmpDcUZ4OVM1emhzNAQAAAAJZGF0YVR4RmVlAAAAAAAAD0JABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAAKd2l0aGRyYXdUeAUAAAAHJG1hdGNoMAQAAAAEdHhJZAkBAAAAB2V4dHJhY3QAAAABCQAEHQAAAAIFAAAAAm1lCQACWAAAAAEJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQQAAAAHJG1hdGNoMQkAA+gAAAABCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEDCQAAAQAAAAIFAAAAByRtYXRjaDECAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAACXBheW1lbnRUeAUAAAAHJG1hdGNoMQQA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AAAAPc2VuZGVyUHVibGljS2V5cKkLJg==", "chainId": 84, "height": 476512, "spentComplexity": 0 } View: original | compacted Prev: CrMbxbC5ZF3uB87eZAM4dZai2P98PLPZFqm7oUUxGRgh Next: 2UYZfMmuvrT9jit8XetQaUtxzKZvkdosZmSt5F1ZGba2 Diff:
Old | New | Differences | |
---|---|---|---|
12 | 12 | then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey) | |
13 | 13 | else false | |
14 | 14 | let att = paymentTx.attachment | |
15 | + | let feesKey = (txId + "_fees") | |
16 | + | let dataTxsFees = extract(getInteger(me, feesKey)) | |
15 | 17 | let type = dropRightBytes(takeRightBytes(att, 2), 1) | |
16 | 18 | let val = takeRightBytes(att, 1) | |
17 | 19 | let key = dropRightBytes(att, 2) | |
29 | 31 | else if ((type == drop(toBytes(5), 7))) | |
30 | 32 | then 2 | |
31 | 33 | else 0 | |
32 | - | let isAmountOk = (withdrawTx.amount == (((paymentTx.amount * koeff) - | |
34 | + | let isAmountOk = (withdrawTx.amount == (((paymentTx.amount * koeff) - dataTxsFees) - withdrawTx.fee)) | |
33 | 35 | let isInWaves = if (!(isDefined(withdrawTx.feeAssetId))) | |
34 | 36 | then !(isDefined(withdrawTx.assetId)) | |
35 | 37 | else false |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 1 #-} | |
2 | 2 | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | 3 | let me = tx.sender | |
4 | 4 | let oracle = extract(addressFromString("3NCzaYTNDGtR8zf9yfcqePFjCqFx9S5zhs4")) | |
5 | 5 | let dataTxFee = 1000000 | |
6 | 6 | match tx { | |
7 | 7 | case withdrawTx: TransferTransaction => | |
8 | 8 | let txId = extract(getString(me, toBase58String(tx.proofs[1]))) | |
9 | 9 | match transactionById(tx.proofs[1]) { | |
10 | 10 | case paymentTx: TransferTransaction => | |
11 | 11 | let isPaymentTookPlace = if ((txId == toBase58String(tx.id))) | |
12 | 12 | then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey) | |
13 | 13 | else false | |
14 | 14 | let att = paymentTx.attachment | |
15 | + | let feesKey = (txId + "_fees") | |
16 | + | let dataTxsFees = extract(getInteger(me, feesKey)) | |
15 | 17 | let type = dropRightBytes(takeRightBytes(att, 2), 1) | |
16 | 18 | let val = takeRightBytes(att, 1) | |
17 | 19 | let key = dropRightBytes(att, 2) | |
18 | 20 | let valComplex = extract(getBinary(oracle, toBase58String(key))) | |
19 | 21 | let koeff = if ((type == drop(toBytes(0), 7))) | |
20 | 22 | then 35 | |
21 | 23 | else if ((type == drop(toBytes(1), 7))) | |
22 | 24 | then 1 | |
23 | 25 | else if ((type == drop(toBytes(2), 7))) | |
24 | 26 | then 1 | |
25 | 27 | else if ((type == drop(toBytes(3), 7))) | |
26 | 28 | then 1 | |
27 | 29 | else if ((type == drop(toBytes(4), 7))) | |
28 | 30 | then 2 | |
29 | 31 | else if ((type == drop(toBytes(5), 7))) | |
30 | 32 | then 2 | |
31 | 33 | else 0 | |
32 | - | let isAmountOk = (withdrawTx.amount == (((paymentTx.amount * koeff) - | |
34 | + | let isAmountOk = (withdrawTx.amount == (((paymentTx.amount * koeff) - dataTxsFees) - withdrawTx.fee)) | |
33 | 35 | let isInWaves = if (!(isDefined(withdrawTx.feeAssetId))) | |
34 | 36 | then !(isDefined(withdrawTx.assetId)) | |
35 | 37 | else false | |
36 | 38 | if (if (isPaymentTookPlace) | |
37 | 39 | then isAmountOk | |
38 | 40 | else false) | |
39 | 41 | then isInWaves | |
40 | 42 | else false | |
41 | 43 | case _ => | |
42 | 44 | false | |
43 | 45 | } | |
44 | 46 | case dtx: DataTransaction => | |
45 | 47 | let paymentTxIdStr = extract(dtx.data[0].key) | |
46 | 48 | let feesKey = (paymentTxIdStr + "_fees") | |
47 | 49 | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
48 | 50 | let newFees = extract(getInteger(dtx.data, feesKey)) | |
49 | 51 | let oldFees = if (isDefined(getInteger(me, feesKey))) | |
50 | 52 | then extract(getInteger(me, feesKey)) | |
51 | 53 | else 0 | |
52 | 54 | let isFeeCorrect = (newFees == (oldFees + dtx.fee)) | |
53 | 55 | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
54 | 56 | let withdrawTransactionId = fromBase58String(extract(getString(me, paymentTxIdStr))) | |
55 | 57 | let isWithdrawExist = isDefined(transactionById(withdrawTransactionId)) | |
56 | 58 | match paymentTx { | |
57 | 59 | case paymentTx: TransferTransaction => | |
58 | 60 | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
59 | 61 | if (if (if (if (!(isPaymentAlreadyMentioned)) | |
60 | 62 | then true | |
61 | 63 | else !(isWithdrawExist)) | |
62 | 64 | then isDtxSignedByPayer | |
63 | 65 | else false) | |
64 | 66 | then isFeeCorrect | |
65 | 67 | else false) | |
66 | 68 | then { | |
67 | 69 | let att = paymentTx.attachment | |
68 | 70 | let type = dropRightBytes(takeRightBytes(att, 2), 1) | |
69 | 71 | let val = takeRightBytes(att, 1) | |
70 | 72 | let key = dropRightBytes(att, 2) | |
71 | 73 | let heightRes = extract(getInteger(oracle, (toBase58String(key) + "height"))) | |
72 | 74 | let isCheater = (extract(transactionHeightById(paymentTx.id)) >= heightRes) | |
73 | 75 | let valComplex = extract(getBinary(oracle, toBase58String(key))) | |
74 | 76 | let koeff = if ((type == drop(toBytes(0), 7))) | |
75 | 77 | then 35 | |
76 | 78 | else if ((type == drop(toBytes(1), 7))) | |
77 | 79 | then 1 | |
78 | 80 | else if ((type == drop(toBytes(2), 7))) | |
79 | 81 | then 1 | |
80 | 82 | else if ((type == drop(toBytes(3), 7))) | |
81 | 83 | then 1 | |
82 | 84 | else if ((type == drop(toBytes(4), 7))) | |
83 | 85 | then 2 | |
84 | 86 | else if ((type == drop(toBytes(5), 7))) | |
85 | 87 | then 2 | |
86 | 88 | else 0 | |
87 | 89 | let ver = take(valComplex, 1) | |
88 | 90 | let valReal = if ((type == drop(toBytes(0), 7))) | |
89 | 91 | then drop(take(valComplex, 2), 1) | |
90 | 92 | else if ((type == drop(toBytes(1), 7))) | |
91 | 93 | then drop(take(valComplex, 3), 2) | |
92 | 94 | else if ((type == drop(toBytes(2), 7))) | |
93 | 95 | then drop(take(valComplex, 4), 3) | |
94 | 96 | else if ((type == drop(toBytes(3), 7))) | |
95 | 97 | then drop(take(valComplex, 5), 4) | |
96 | 98 | else if ((type == drop(toBytes(4), 7))) | |
97 | 99 | then drop(take(valComplex, 6), 5) | |
98 | 100 | else if ((type == drop(toBytes(5), 7))) | |
99 | 101 | then drop(take(valComplex, 7), 5) | |
100 | 102 | else toBytes(38) | |
101 | 103 | let isWin = if ((val == valReal)) | |
102 | 104 | then (val != toBytes(38)) | |
103 | 105 | else false | |
104 | 106 | isWin | |
105 | 107 | } | |
106 | 108 | else false | |
107 | 109 | case _ => | |
108 | 110 | false | |
109 | 111 | } | |
110 | 112 | case _ => | |
111 | 113 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
112 | 114 | } |
github/deemru/w8io/169f3d6 24.08 ms ◑