tx · Hu629T9Fuxf3qJ5mYjdPMbmXNVLQoBGv6dm24spkbr26

3N6i9GuByxYceKLWnViaLiRRKhUSjGzxX3w:  -0.01400000 Waves

2019.02.09 17:47 [487718] smart account 3N6i9GuByxYceKLWnViaLiRRKhUSjGzxX3w > SELF 0.00000000 Waves

{ "type": 13, "id": "Hu629T9Fuxf3qJ5mYjdPMbmXNVLQoBGv6dm24spkbr26", "fee": 1400000, "feeAssetId": null, "timestamp": 1549723668161, "version": 1, "sender": "3N6i9GuByxYceKLWnViaLiRRKhUSjGzxX3w", "senderPublicKey": "H5qbKQJj24DNetPBaUed9etUGEPdzh5ef8bPyudKocwX", "proofs": [ "4TPn6BVFUVHqHvGHdheGkhXErw5LXfdbC7TVHdbPfbJZYrYJz4vWD51nbX25tSuUmfZcTJHZd6v2TBQHQqE3NrEj" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABm9yYWNsZQkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkN6YVlUTkRHdFI4emY5eWZjcWVQRmpDcUZ4OVM1emhzNAQAAAAObWluV2l0aGRyYXdGZWUAAAAAAAAGGoAEAAAABm1pbkJldAAAAAAAAvrwgAQAAAAGbWF4QmV0AAAAAAAdzWUABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAAKd2l0aGRyYXdUeAUAAAAHJG1hdGNoMAQAAAAEdHhJZAkBAAAAB2V4dHJhY3QAAAABCQAEHQAAAAIFAAAAAm1lCQACWAAAAAEJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQQAAAAHJG1hdGNoMQkAA+gAAAABCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEDCQAAAQAAAAIFAAAAByRtYXRjaDECAAAAE1RyYW5zZmVyVH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N0AAAAAQkABBoAAAACBQAAAAJtZQkAASwAAAACCQABLAAAAAIFAAAADHBheW1lbnRSb3VuZAIAAAABXwUAAAAIZ3Vlc3NTdHIAAAAAAAAAAAAEAAAACnN1bUJldHNOZXcJAQAAAAdleHRyYWN0AAAAAQkABBAAAAACCAUAAAADZHR4AAAABGRhdGEJAAEsAAAAAgkAASwAAAACBQAAAAxwYXltZW50Um91bmQCAAAAAV8FAAAACGd1ZXNzU3RyBAAAABlpc1BheW1lbnRBbHJlYWR5TWVudGlvbmVkCQEAAAAJaXNEZWZpbmVkAAAAAQkABB0AAAACBQAAAAJtZQUAAAAOcGF5bWVudFR4SWRTdHIEAAAACXBheW1lbnRUeAkAA+gAAAABCQACWQAAAAEFAAAADnBheW1lbnRUeElkU3RyBAAAAAckbWF0Y2gxBQAAAAlwYXltZW50VHgDCQAAAQAAAAIFAAAAByRtYXRjaDECAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAACXBheW1lbnRUeAUAAAAHJG1hdGNoMQQAAAASaXNEdHhTaWduZWRCeVBheWVyCQAB9AAAAAMIBQAAAANkdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAANkdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAAJcGF5bWVudFR4AAAAD3NlbmRlclB1YmxpY0tleQMJAQAAAAEhAAAAAQUAAAAZaXNQYXltZW50QWxyZWFkeU1lbnRpb25lZAkAAAAAAAACBQAAAApzdW1CZXRzTmV3CQAAZQAAAAIJAABkAAAAAgUAAAAKc3VtQmV0c09sZAgFAAAACXBheW1lbnRUeAAAAAZhbW91bnQIBQAAAANkdHgAAAADZmVlBwcHCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleRd6KuI=", "chainId": 84, "height": 487718, "spentComplexity": 0 } View: original | compacted Prev: 35KVwpmxDVBUjuabyihW7iVnAooAQ7kutaKszoDb5LeJ Next: none Diff:
OldNewDifferences
22 {-# CONTENT_TYPE EXPRESSION #-}
33 let me = tx.sender
44 let oracle = extract(addressFromString("3NCzaYTNDGtR8zf9yfcqePFjCqFx9S5zhs4"))
5+let minWithdrawFee = 400000
6+let minBet = 50000000
7+let maxBet = 500000000
58 match tx {
69 case withdrawTx: TransferTransaction =>
710 let txId = extract(getString(me, toBase58String(tx.proofs[1])))
1821 let key = dropRightBytes(att, 2)
1922 let valComplex = extract(getBinary(oracle, toBase58String(key)))
2023 let koeff = if ((type == drop(toBytes(0), 7)))
21- then 35
24+ then 36
2225 else if ((type == drop(toBytes(1), 7)))
23- then 1
26+ then 2
2427 else if ((type == drop(toBytes(2), 7)))
25- then 1
28+ then 2
2629 else if ((type == drop(toBytes(3), 7)))
27- then 1
30+ then 2
2831 else if ((type == drop(toBytes(4), 7)))
29- then 2
32+ then 3
3033 else if ((type == drop(toBytes(5), 7)))
31- then 2
34+ then 3
3235 else 0
33- 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)
3440 let isAmountOk = (withdrawTx.amount == correctAmount)
3541 let isInWaves = if (!(isDefined(withdrawTx.feeAssetId)))
3642 then !(isDefined(withdrawTx.assetId))
3743 else false
38- if (if (isPaymentTookPlace)
44+ if (if (if (isPaymentTookPlace)
3945 then isAmountOk
4046 else false)
4147 then isInWaves
48+ else false)
49+ then (paymentAmount >= minBet)
4250 else false
4351 case _ =>
4452 false
4553 }
4654 case dtx: DataTransaction =>
47- let paymentTxIdStr = extract(dtx.data[0].key)
48- let feesKey = (paymentTxIdStr + "_fees")
49- let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
50- let newFees = extract(getInteger(dtx.data, feesKey))
51- let oldFees = if (isDefined(getInteger(me, feesKey)))
52- then extract(getInteger(me, feesKey))
53- else 0
54- let isFeeCorrect = (newFees == (oldFees + dtx.fee))
55- let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
56- let withdrawTransactionId = fromBase58String(extract(getString(me, paymentTxIdStr)))
57- let isWithdrawExist = isDefined(transactionById(withdrawTransactionId))
58- match paymentTx {
59- case paymentTx: TransferTransaction =>
60- let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
61- if (if (if (if (!(isPaymentAlreadyMentioned))
62- then true
63- else !(isWithdrawExist))
64- then isDtxSignedByPayer
65- else false)
66- then isFeeCorrect
67- else false)
68- then {
69- let att = paymentTx.attachment
70- let type = dropRightBytes(takeRightBytes(att, 2), 1)
71- let val = takeRightBytes(att, 1)
72- let key = dropRightBytes(att, 2)
73- let heightRes = extract(getInteger(oracle, (toBase58String(key) + "height")))
74- let isCheater = (extract(transactionHeightById(paymentTx.id)) >= heightRes)
75- let valComplex = extract(getBinary(oracle, toBase58String(key)))
76- let koeff = if ((type == drop(toBytes(0), 7)))
77- then 35
78- else if ((type == drop(toBytes(1), 7)))
79- then 1
80- else if ((type == drop(toBytes(2), 7)))
81- then 1
82- else if ((type == drop(toBytes(3), 7)))
83- then 1
84- else if ((type == drop(toBytes(4), 7)))
55+ if ((size(dtx.data) == 2))
56+ then {
57+ let paymentTxIdStr = extract(dtx.data[0].key)
58+ let feesKey = (paymentTxIdStr + "_fees")
59+ let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
60+ let newFees = extract(getInteger(dtx.data, feesKey))
61+ let oldFees = if (isDefined(getInteger(me, feesKey)))
62+ then extract(getInteger(me, feesKey))
63+ else 0
64+ let isFeeCorrect = (newFees == (oldFees + dtx.fee))
65+ let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
66+ let withdrawTransactionId = fromBase58String(extract(getString(me, paymentTxIdStr)))
67+ let isWithdrawExist = isDefined(transactionById(withdrawTransactionId))
68+ match paymentTx {
69+ case paymentTx: TransferTransaction =>
70+ let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
71+ if (if (if (if (!(isPaymentAlreadyMentioned))
72+ then true
73+ else !(isWithdrawExist))
74+ then isDtxSignedByPayer
75+ else false)
76+ then isFeeCorrect
77+ else false)
78+ then {
79+ let att = paymentTx.attachment
80+ let type = dropRightBytes(takeRightBytes(att, 2), 1)
81+ let val = takeRightBytes(att, 1)
82+ let key = dropRightBytes(att, 2)
83+ let heightRes = extract(getInteger(oracle, (toBase58String(key) + "height")))
84+ let isCheater = (extract(transactionHeightById(paymentTx.id)) >= heightRes)
85+ let valComplex = extract(getBinary(oracle, toBase58String(key)))
86+ let koeff = if ((type == drop(toBytes(0), 7)))
87+ then 36
88+ else if ((type == drop(toBytes(1), 7)))
89+ then 2
90+ else if ((type == drop(toBytes(2), 7)))
8591 then 2
86- else if ((type == drop(toBytes(5), 7)))
92+ else if ((type == drop(toBytes(3), 7)))
8793 then 2
88- else 0
89- let ver = take(valComplex, 1)
90- let valReal = if ((type == drop(toBytes(0), 7)))
91- then drop(take(valComplex, 2), 1)
92- else if ((type == drop(toBytes(1), 7)))
93- then drop(take(valComplex, 3), 2)
94- else if ((type == drop(toBytes(2), 7)))
95- then drop(take(valComplex, 4), 3)
96- else if ((type == drop(toBytes(3), 7)))
97- then drop(take(valComplex, 5), 4)
98- else if ((type == drop(toBytes(4), 7)))
99- then drop(take(valComplex, 6), 5)
100- else if ((type == drop(toBytes(5), 7)))
101- then drop(take(valComplex, 7), 5)
102- else toBytes(38)
103- let isWin = if ((val == valReal))
104- then (val != toBytes(38))
94+ else if ((type == drop(toBytes(4), 7)))
95+ then 3
96+ else if ((type == drop(toBytes(5), 7)))
97+ then 3
98+ else 0
99+ let isMoneyStillEnough = (((paymentTx.amount * koeff) + minWithdrawFee) > newFees)
100+ let ver = take(valComplex, 1)
101+ let valReal = if ((type == drop(toBytes(0), 7)))
102+ then drop(take(valComplex, 2), 1)
103+ else if ((type == drop(toBytes(1), 7)))
104+ then drop(take(valComplex, 3), 2)
105+ else if ((type == drop(toBytes(2), 7)))
106+ then drop(take(valComplex, 4), 3)
107+ else if ((type == drop(toBytes(3), 7)))
108+ then drop(take(valComplex, 5), 4)
109+ else if ((type == drop(toBytes(4), 7)))
110+ then drop(take(valComplex, 6), 5)
111+ else if ((type == drop(toBytes(5), 7)))
112+ then drop(take(valComplex, 7), 6)
113+ else toBytes(38)
114+ let isWin = if ((val == valReal))
115+ then (val != toBytes(38))
116+ else false
117+ if (if (isWin)
118+ then !(isCheater)
119+ else false)
120+ then isMoneyStillEnough
121+ else false
122+ }
105123 else false
106- if (isWin)
107- then !(isCheater)
108- else false
109- }
110- else false
111- case _ =>
112- false
113- }
124+ case _ =>
125+ false
126+ }
127+ }
128+ else if ((size(dtx.data) == 3))
129+ then {
130+ let paymentTxIdStr = extract(dtx.data[0].key)
131+ let guessStr = extract(getString(dtx.data, paymentTxIdStr))
132+ let paymentRoundKey = (paymentTxIdStr + "_round")
133+ let paymentRound = extract(getString(dtx.data, paymentRoundKey))
134+ let sumBetsOld = if (isDefined(getInteger(me, ((paymentRound + "_") + guessStr))))
135+ then extract(getInteger(me, ((paymentRound + "_") + guessStr)))
136+ else 0
137+ let sumBetsNew = extract(getInteger(dtx.data, ((paymentRound + "_") + guessStr)))
138+ let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
139+ let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
140+ match paymentTx {
141+ case paymentTx: TransferTransaction =>
142+ let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
143+ if (!(isPaymentAlreadyMentioned))
144+ then (sumBetsNew == ((sumBetsOld + paymentTx.amount) - dtx.fee))
145+ else false
146+ case _ =>
147+ false
148+ }
149+ }
150+ else false
114151 case _ =>
115152 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
116153 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 1 #-}
22 {-# CONTENT_TYPE EXPRESSION #-}
33 let me = tx.sender
44 let oracle = extract(addressFromString("3NCzaYTNDGtR8zf9yfcqePFjCqFx9S5zhs4"))
5+let minWithdrawFee = 400000
6+let minBet = 50000000
7+let maxBet = 500000000
58 match tx {
69 case withdrawTx: TransferTransaction =>
710 let txId = extract(getString(me, toBase58String(tx.proofs[1])))
811 match transactionById(tx.proofs[1]) {
912 case paymentTx: TransferTransaction =>
1013 let isPaymentTookPlace = if ((txId == toBase58String(tx.id)))
1114 then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey)
1215 else false
1316 let att = paymentTx.attachment
1417 let feesKey = (toBase58String(tx.proofs[1]) + "_fees")
1518 let dataTxsFees = extract(getInteger(me, feesKey))
1619 let type = dropRightBytes(takeRightBytes(att, 2), 1)
1720 let val = takeRightBytes(att, 1)
1821 let key = dropRightBytes(att, 2)
1922 let valComplex = extract(getBinary(oracle, toBase58String(key)))
2023 let koeff = if ((type == drop(toBytes(0), 7)))
21- then 35
24+ then 36
2225 else if ((type == drop(toBytes(1), 7)))
23- then 1
26+ then 2
2427 else if ((type == drop(toBytes(2), 7)))
25- then 1
28+ then 2
2629 else if ((type == drop(toBytes(3), 7)))
27- then 1
30+ then 2
2831 else if ((type == drop(toBytes(4), 7)))
29- then 2
32+ then 3
3033 else if ((type == drop(toBytes(5), 7)))
31- then 2
34+ then 3
3235 else 0
33- 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)
3440 let isAmountOk = (withdrawTx.amount == correctAmount)
3541 let isInWaves = if (!(isDefined(withdrawTx.feeAssetId)))
3642 then !(isDefined(withdrawTx.assetId))
3743 else false
38- if (if (isPaymentTookPlace)
44+ if (if (if (isPaymentTookPlace)
3945 then isAmountOk
4046 else false)
4147 then isInWaves
48+ else false)
49+ then (paymentAmount >= minBet)
4250 else false
4351 case _ =>
4452 false
4553 }
4654 case dtx: DataTransaction =>
47- let paymentTxIdStr = extract(dtx.data[0].key)
48- let feesKey = (paymentTxIdStr + "_fees")
49- let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
50- let newFees = extract(getInteger(dtx.data, feesKey))
51- let oldFees = if (isDefined(getInteger(me, feesKey)))
52- then extract(getInteger(me, feesKey))
53- else 0
54- let isFeeCorrect = (newFees == (oldFees + dtx.fee))
55- let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
56- let withdrawTransactionId = fromBase58String(extract(getString(me, paymentTxIdStr)))
57- let isWithdrawExist = isDefined(transactionById(withdrawTransactionId))
58- match paymentTx {
59- case paymentTx: TransferTransaction =>
60- let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
61- if (if (if (if (!(isPaymentAlreadyMentioned))
62- then true
63- else !(isWithdrawExist))
64- then isDtxSignedByPayer
65- else false)
66- then isFeeCorrect
67- else false)
68- then {
69- let att = paymentTx.attachment
70- let type = dropRightBytes(takeRightBytes(att, 2), 1)
71- let val = takeRightBytes(att, 1)
72- let key = dropRightBytes(att, 2)
73- let heightRes = extract(getInteger(oracle, (toBase58String(key) + "height")))
74- let isCheater = (extract(transactionHeightById(paymentTx.id)) >= heightRes)
75- let valComplex = extract(getBinary(oracle, toBase58String(key)))
76- let koeff = if ((type == drop(toBytes(0), 7)))
77- then 35
78- else if ((type == drop(toBytes(1), 7)))
79- then 1
80- else if ((type == drop(toBytes(2), 7)))
81- then 1
82- else if ((type == drop(toBytes(3), 7)))
83- then 1
84- else if ((type == drop(toBytes(4), 7)))
55+ if ((size(dtx.data) == 2))
56+ then {
57+ let paymentTxIdStr = extract(dtx.data[0].key)
58+ let feesKey = (paymentTxIdStr + "_fees")
59+ let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
60+ let newFees = extract(getInteger(dtx.data, feesKey))
61+ let oldFees = if (isDefined(getInteger(me, feesKey)))
62+ then extract(getInteger(me, feesKey))
63+ else 0
64+ let isFeeCorrect = (newFees == (oldFees + dtx.fee))
65+ let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
66+ let withdrawTransactionId = fromBase58String(extract(getString(me, paymentTxIdStr)))
67+ let isWithdrawExist = isDefined(transactionById(withdrawTransactionId))
68+ match paymentTx {
69+ case paymentTx: TransferTransaction =>
70+ let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
71+ if (if (if (if (!(isPaymentAlreadyMentioned))
72+ then true
73+ else !(isWithdrawExist))
74+ then isDtxSignedByPayer
75+ else false)
76+ then isFeeCorrect
77+ else false)
78+ then {
79+ let att = paymentTx.attachment
80+ let type = dropRightBytes(takeRightBytes(att, 2), 1)
81+ let val = takeRightBytes(att, 1)
82+ let key = dropRightBytes(att, 2)
83+ let heightRes = extract(getInteger(oracle, (toBase58String(key) + "height")))
84+ let isCheater = (extract(transactionHeightById(paymentTx.id)) >= heightRes)
85+ let valComplex = extract(getBinary(oracle, toBase58String(key)))
86+ let koeff = if ((type == drop(toBytes(0), 7)))
87+ then 36
88+ else if ((type == drop(toBytes(1), 7)))
89+ then 2
90+ else if ((type == drop(toBytes(2), 7)))
8591 then 2
86- else if ((type == drop(toBytes(5), 7)))
92+ else if ((type == drop(toBytes(3), 7)))
8793 then 2
88- else 0
89- let ver = take(valComplex, 1)
90- let valReal = if ((type == drop(toBytes(0), 7)))
91- then drop(take(valComplex, 2), 1)
92- else if ((type == drop(toBytes(1), 7)))
93- then drop(take(valComplex, 3), 2)
94- else if ((type == drop(toBytes(2), 7)))
95- then drop(take(valComplex, 4), 3)
96- else if ((type == drop(toBytes(3), 7)))
97- then drop(take(valComplex, 5), 4)
98- else if ((type == drop(toBytes(4), 7)))
99- then drop(take(valComplex, 6), 5)
100- else if ((type == drop(toBytes(5), 7)))
101- then drop(take(valComplex, 7), 5)
102- else toBytes(38)
103- let isWin = if ((val == valReal))
104- then (val != toBytes(38))
94+ else if ((type == drop(toBytes(4), 7)))
95+ then 3
96+ else if ((type == drop(toBytes(5), 7)))
97+ then 3
98+ else 0
99+ let isMoneyStillEnough = (((paymentTx.amount * koeff) + minWithdrawFee) > newFees)
100+ let ver = take(valComplex, 1)
101+ let valReal = if ((type == drop(toBytes(0), 7)))
102+ then drop(take(valComplex, 2), 1)
103+ else if ((type == drop(toBytes(1), 7)))
104+ then drop(take(valComplex, 3), 2)
105+ else if ((type == drop(toBytes(2), 7)))
106+ then drop(take(valComplex, 4), 3)
107+ else if ((type == drop(toBytes(3), 7)))
108+ then drop(take(valComplex, 5), 4)
109+ else if ((type == drop(toBytes(4), 7)))
110+ then drop(take(valComplex, 6), 5)
111+ else if ((type == drop(toBytes(5), 7)))
112+ then drop(take(valComplex, 7), 6)
113+ else toBytes(38)
114+ let isWin = if ((val == valReal))
115+ then (val != toBytes(38))
116+ else false
117+ if (if (isWin)
118+ then !(isCheater)
119+ else false)
120+ then isMoneyStillEnough
121+ else false
122+ }
105123 else false
106- if (isWin)
107- then !(isCheater)
108- else false
109- }
110- else false
111- case _ =>
112- false
113- }
124+ case _ =>
125+ false
126+ }
127+ }
128+ else if ((size(dtx.data) == 3))
129+ then {
130+ let paymentTxIdStr = extract(dtx.data[0].key)
131+ let guessStr = extract(getString(dtx.data, paymentTxIdStr))
132+ let paymentRoundKey = (paymentTxIdStr + "_round")
133+ let paymentRound = extract(getString(dtx.data, paymentRoundKey))
134+ let sumBetsOld = if (isDefined(getInteger(me, ((paymentRound + "_") + guessStr))))
135+ then extract(getInteger(me, ((paymentRound + "_") + guessStr)))
136+ else 0
137+ let sumBetsNew = extract(getInteger(dtx.data, ((paymentRound + "_") + guessStr)))
138+ let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
139+ let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
140+ match paymentTx {
141+ case paymentTx: TransferTransaction =>
142+ let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
143+ if (!(isPaymentAlreadyMentioned))
144+ then (sumBetsNew == ((sumBetsOld + paymentTx.amount) - dtx.fee))
145+ else false
146+ case _ =>
147+ false
148+ }
149+ }
150+ else false
114151 case _ =>
115152 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
116153 }

github/deemru/w8io/169f3d6 
53.62 ms