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