tx · B7XboCLWGEZEALiaT6tJSMqQy6j6UZoD7dN3oQxJrdCT 3MwR2FzFtbHeds3NzvkbiaYMVNhbtqcfRPU: -0.01400000 Waves 2019.02.12 10:08 [491595] smart account 3MwR2FzFtbHeds3NzvkbiaYMVNhbtqcfRPU > SELF 0.00000000 Waves
{ "type": 13, "id": "B7XboCLWGEZEALiaT6tJSMqQy6j6UZoD7dN3oQxJrdCT", "fee": 1400000, "feeAssetId": null, "timestamp": 1549955293104, "version": 1, "sender": "3MwR2FzFtbHeds3NzvkbiaYMVNhbtqcfRPU", "senderPublicKey": "H5rtwGVnkSHDfz6msD7itGURoKMXvvDwPoup1VESxfjJ", "proofs": [ "5TX9Eqiy5ncfm3RjQvaJw3GVrXcUyevgvUDSai1xGrzjsbWtXtz1Dk22M6uHx1a11givXaxkhYEarESMjKMs4AtQ" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABm9yYWNsZQkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkN6YVlUTkRHdFI4emY5eWZjcWVQRmpDcUZ4OVM1emhzNAQAAAAObWluV2l0aGRyYXdGZWUAAAAAAAAHoSAEAAAAEHJlZ2lzdGVyQmV0VHhGZWUAAAAAAAAHoSAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAp3aXRoZHJhd1R4BQAAAAckbWF0Y2gwBAAAAAR0eElkCQEAAAAHZXh0cmFjdAAAAAEJAAQdAAAAAgUAAAACbWUJAAEsAAAAAgkAAlgAAAABCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAECAAAACV93aXRoZHJhdwQAAAAHJG1hdGNoMQkAA+gAAAABCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEDCQAAAQAAAAIFAAAAByRtY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AAAAAAQUAAAAHdmFsUmVhbAQAAAASaXNNb25leVN0aWxsRW5vdWdoCQAAZgAAAAIJAABkAAAAAgkAAGgAAAACCQAAZQAAAAIIBQAAAAlwYXltZW50VHgAAAAGYW1vdW50BQAAABByZWdpc3RlckJldFR4RmVlBQAAAAVrb2VmZgUAAAAObWluV2l0aGRyYXdGZWUFAAAAB25ld0ZlZXMDBQAAAAVpc1dpbgUAAAASaXNNb25leVN0aWxsRW5vdWdoBwcHBwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkUW+xy", "chainId": 84, "height": 491595, "spentComplexity": 0 } View: original | compacted Prev: BDFs5ipHmHPQhEhdLEJr4PSWWBPtwsWJXK3nnXW59LZC Next: J2DYAoL1eR7apYBCpC5fMi3WoJzpg2MwKz8q6hJcFQ66 Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | false | |
54 | 54 | } | |
55 | 55 | case dtx: DataTransaction => | |
56 | - | if ((size(dtx.data) == | |
56 | + | if ((size(dtx.data) == 3)) | |
57 | 57 | then { | |
58 | - | let isDataCountOk = (size(dtx.data) == 2) | |
59 | - | let paymentTxIdStr = dropRight(extract(dtx.data[0].key), 9) | |
60 | - | let feesKey = (paymentTxIdStr + "_withdraw_fees") | |
58 | + | let minBet = 50000000 | |
59 | + | let maxSumBet = 1000000000 | |
60 | + | let paymentTxIdStr = extract(dtx.data[0].key) | |
61 | + | let guessStr = extract(getString(dtx.data, paymentTxIdStr)) | |
62 | + | let paymentRoundKey = (paymentTxIdStr + "_round") | |
63 | + | let paymentRound = extract(getString(dtx.data, paymentRoundKey)) | |
64 | + | let sumBetsOld = if (isDefined(getInteger(me, (paymentRound + "_betsSum")))) | |
65 | + | then extract(getInteger(me, (paymentRound + "_betsSum"))) | |
66 | + | else 0 | |
67 | + | let sumBetsNew = extract(getInteger(dtx.data, (paymentRound + "_betsSum"))) | |
68 | + | let itsTooLate = isDefined(getString(me, (paymentRound + "_stop"))) | |
69 | + | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
61 | 70 | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
62 | - | let newFees = extract(getInteger(dtx.data, feesKey)) | |
63 | - | let oldFeesUnit = getInteger(me, feesKey) | |
64 | - | let oldFees = if (isDefined(oldFeesUnit)) | |
65 | - | then extract(oldFeesUnit) | |
66 | - | else 0 | |
67 | - | let isFeeCorrect = (newFees == (oldFees + dtx.fee)) | |
68 | - | let withdrawTxIdUnit = getString(me, paymentTxIdStr) | |
69 | - | let isPaymentAlreadyMentioned = isDefined(withdrawTxIdUnit) | |
70 | - | let withdrawTransactionId = fromBase58String(extract(withdrawTxIdUnit)) | |
71 | 71 | match paymentTx { | |
72 | 72 | case paymentTx: TransferTransaction => | |
73 | 73 | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
74 | - | if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
74 | + | let correctSumBets = ((sumBetsOld + paymentTx.amount) - dtx.fee) | |
75 | + | if (if (if (if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
76 | + | then true | |
77 | + | else throw("Incorrect recipient of the payment")) | |
75 | 78 | then if (!(isPaymentAlreadyMentioned)) | |
76 | 79 | then true | |
77 | - | else | |
80 | + | else throw("This transfer is already used as a bet") | |
78 | 81 | else false) | |
79 | - | then isDtxSignedByPayer | |
82 | + | then if ((sumBetsNew == correctSumBets)) | |
83 | + | then true | |
84 | + | else throw(("Wrong value for Sum of Bets. Must be " + toString(correctSumBets))) | |
80 | 85 | else false) | |
81 | - | then isFeeCorrect | |
86 | + | then if ((maxSumBet > sumBetsNew)) | |
87 | + | then true | |
88 | + | else throw(((("Maximum amount of bets for round " + toString(maxSumBet)) + ". With your bet it's ") + toString(sumBetsNew))) | |
82 | 89 | else false) | |
83 | - | then isDataCountOk | |
90 | + | then if ((dtx.fee == registerBetTxFee)) | |
91 | + | then true | |
92 | + | else throw(("Fee of bet registration data transaction must be " + toString(registerBetTxFee))) | |
84 | 93 | else false) | |
85 | - | then { | |
86 | - | let guess = extract(getBinary(me, paymentTxIdStr)) | |
87 | - | let type = take(guess, 1) | |
88 | - | let key = extract(getString(me, (paymentTxIdStr + "_round"))) | |
89 | - | let itsTooLate = isDefined(getString(me, (key + "_stop"))) | |
90 | - | let valComplex = extract(getBinary(oracle, key)) | |
91 | - | let koeff = if ((type == drop(toBytes(0), 7))) | |
92 | - | then 35 | |
93 | - | else if ((type == drop(toBytes(1), 7))) | |
94 | - | then 2 | |
95 | - | else if ((type == drop(toBytes(2), 7))) | |
96 | - | then 2 | |
97 | - | else if ((type == drop(toBytes(3), 7))) | |
98 | - | then 2 | |
99 | - | else if ((type == drop(toBytes(4), 7))) | |
100 | - | then 3 | |
101 | - | else if ((type == drop(toBytes(5), 7))) | |
102 | - | then 3 | |
103 | - | else 0 | |
104 | - | let valReal = if ((type == drop(toBytes(0), 7))) | |
105 | - | then drop(take(valComplex, 2), 1) | |
106 | - | else if ((type == drop(toBytes(1), 7))) | |
107 | - | then drop(take(valComplex, 3), 2) | |
108 | - | else if ((type == drop(toBytes(2), 7))) | |
109 | - | then drop(take(valComplex, 4), 3) | |
110 | - | else if ((type == drop(toBytes(3), 7))) | |
111 | - | then drop(take(valComplex, 5), 4) | |
112 | - | else if ((type == drop(toBytes(4), 7))) | |
113 | - | then drop(take(valComplex, 6), 5) | |
114 | - | else if ((type == drop(toBytes(5), 7))) | |
115 | - | then drop(take(valComplex, 7), 6) | |
116 | - | else throw("Incorrect type of guess provided") | |
117 | - | let isWin = (drop(guess, 1) == valReal) | |
118 | - | let isMoneyStillEnough = ((((paymentTx.amount - registerBetTxFee) * koeff) + minWithdrawFee) > newFees) | |
119 | - | if (if (isWin) | |
120 | - | then isMoneyStillEnough | |
121 | - | else false) | |
122 | - | then !(itsTooLate) | |
123 | - | else false | |
124 | - | } | |
94 | + | then if ((paymentTx.amount >= minBet)) | |
95 | + | then true | |
96 | + | else throw(("Your Bet amount is less then minimal bet " + toString(minBet))) | |
97 | + | else false) | |
98 | + | then if (!(isDefined(paymentTx.feeAssetId))) | |
99 | + | then true | |
100 | + | else throw("Paymnet must be in WAVES") | |
101 | + | else false) | |
102 | + | then if (!(itsTooLate)) | |
103 | + | then true | |
104 | + | else throw("It's too late to play this round. Try next one") | |
125 | 105 | else false | |
126 | 106 | case _ => | |
127 | 107 | false | |
128 | 108 | } | |
129 | 109 | } | |
130 | - | else if ((size(dtx.data) == | |
110 | + | else if ((size(dtx.data) == 2)) | |
131 | 111 | then { | |
132 | - | let | |
133 | - | let | |
134 | - | let | |
135 | - | let | |
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | then extract( | |
112 | + | let isDataCountOk = (size(dtx.data) == 2) | |
113 | + | let paymentTxIdStr = dropRight(extract(dtx.data[0].key), 9) | |
114 | + | let feesKey = (paymentTxIdStr + "_withdraw_fees") | |
115 | + | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
116 | + | let newFees = extract(getInteger(dtx.data, feesKey)) | |
117 | + | let oldFeesUnit = getInteger(me, feesKey) | |
118 | + | let oldFees = if (isDefined(oldFeesUnit)) | |
119 | + | then extract(oldFeesUnit) | |
140 | 120 | else 0 | |
141 | - | let sumBetsNew = extract(getInteger(dtx.data, (paymentRound + "_betsSum"))) | |
142 | - | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
143 | - | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
121 | + | let isFeeCorrect = (newFees == (oldFees + dtx.fee)) | |
122 | + | let withdrawTxIdUnit = getString(me, paymentTxIdStr) | |
123 | + | let isPaymentAlreadyMentioned = isDefined(withdrawTxIdUnit) | |
124 | + | let withdrawTransactionId = fromBase58String(extract(withdrawTxIdUnit)) | |
144 | 125 | match paymentTx { | |
145 | 126 | case paymentTx: TransferTransaction => | |
146 | 127 | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
147 | - | let correctSumBets = ((sumBetsOld + paymentTx.amount) - dtx.fee) | |
148 | - | if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
149 | - | then !(isPaymentAlreadyMentioned) | |
128 | + | if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
129 | + | then if (!(isPaymentAlreadyMentioned)) | |
130 | + | then true | |
131 | + | else !(isDefined(transactionById(withdrawTransactionId))) | |
150 | 132 | else false) | |
151 | - | then if ((sumBetsNew == correctSumBets)) | |
152 | - | then true | |
153 | - | else throw(("Wrong value for Sum of Bets. Must be " + toString(correctSumBets))) | |
133 | + | then isDtxSignedByPayer | |
154 | 134 | else false) | |
155 | - | then if ((maxSumBet > sumBetsNew)) | |
156 | - | then true | |
157 | - | else throw(((("Maximum amount of bets for round " + toString(maxSumBet)) + ". With your bet it's ") + toString(sumBetsNew))) | |
135 | + | then isFeeCorrect | |
158 | 136 | else false) | |
159 | - | then if ((dtx.fee == registerBetTxFee)) | |
160 | - | then true | |
161 | - | else throw(("Fee of bet registration data transaction must be " + toString(registerBetTxFee))) | |
137 | + | then isDataCountOk | |
138 | + | else false) | |
139 | + | then { | |
140 | + | let guess = extract(getBinary(me, paymentTxIdStr)) | |
141 | + | let type = take(guess, 1) | |
142 | + | let key = extract(getString(me, (paymentTxIdStr + "_round"))) | |
143 | + | let valComplex = extract(getBinary(oracle, key)) | |
144 | + | let koeff = if ((type == drop(toBytes(0), 7))) | |
145 | + | then 35 | |
146 | + | else if ((type == drop(toBytes(1), 7))) | |
147 | + | then 2 | |
148 | + | else if ((type == drop(toBytes(2), 7))) | |
149 | + | then 2 | |
150 | + | else if ((type == drop(toBytes(3), 7))) | |
151 | + | then 2 | |
152 | + | else if ((type == drop(toBytes(4), 7))) | |
153 | + | then 3 | |
154 | + | else if ((type == drop(toBytes(5), 7))) | |
155 | + | then 3 | |
156 | + | else 0 | |
157 | + | let valReal = if ((type == drop(toBytes(0), 7))) | |
158 | + | then drop(take(valComplex, 2), 1) | |
159 | + | else if ((type == drop(toBytes(1), 7))) | |
160 | + | then drop(take(valComplex, 3), 2) | |
161 | + | else if ((type == drop(toBytes(2), 7))) | |
162 | + | then drop(take(valComplex, 4), 3) | |
163 | + | else if ((type == drop(toBytes(3), 7))) | |
164 | + | then drop(take(valComplex, 5), 4) | |
165 | + | else if ((type == drop(toBytes(4), 7))) | |
166 | + | then drop(take(valComplex, 6), 5) | |
167 | + | else if ((type == drop(toBytes(5), 7))) | |
168 | + | then drop(take(valComplex, 7), 6) | |
169 | + | else throw("Incorrect type of guess provided") | |
170 | + | let isWin = (drop(guess, 1) == valReal) | |
171 | + | let isMoneyStillEnough = ((((paymentTx.amount - registerBetTxFee) * koeff) + minWithdrawFee) > newFees) | |
172 | + | if (isWin) | |
173 | + | then isMoneyStillEnough | |
174 | + | else false | |
175 | + | } | |
162 | 176 | else false | |
163 | 177 | case _ => | |
164 | 178 | 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 minWithdrawFee = 500000 | |
6 | 6 | let registerBetTxFee = 500000 | |
7 | 7 | match tx { | |
8 | 8 | case withdrawTx: TransferTransaction => | |
9 | 9 | let txId = extract(getString(me, (toBase58String(tx.proofs[1]) + "_withdraw"))) | |
10 | 10 | match transactionById(tx.proofs[1]) { | |
11 | 11 | case paymentTx: TransferTransaction => | |
12 | 12 | let isPaymentTookPlace = if ((txId == toBase58String(tx.id))) | |
13 | 13 | then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey) | |
14 | 14 | else false | |
15 | 15 | let feesKey = (toBase58String(tx.proofs[1]) + "_withdraw_fees") | |
16 | 16 | let dataTxsFees = extract(getInteger(me, feesKey)) | |
17 | 17 | let guess = extract(getBinary(me, toBase58String(tx.proofs[1]))) | |
18 | 18 | let type = take(guess, 1) | |
19 | 19 | let val = drop(guess, 1) | |
20 | 20 | let key = extract(getString(me, (toBase58String(tx.proofs[1]) + "_round"))) | |
21 | 21 | let valComplex = extract(getBinary(oracle, key)) | |
22 | 22 | let koeff = if ((type == drop(toBytes(0), 7))) | |
23 | 23 | then 35 | |
24 | 24 | else if ((type == drop(toBytes(1), 7))) | |
25 | 25 | then 2 | |
26 | 26 | else if ((type == drop(toBytes(2), 7))) | |
27 | 27 | then 2 | |
28 | 28 | else if ((type == drop(toBytes(3), 7))) | |
29 | 29 | then 2 | |
30 | 30 | else if ((type == drop(toBytes(4), 7))) | |
31 | 31 | then 3 | |
32 | 32 | else if ((type == drop(toBytes(5), 7))) | |
33 | 33 | then 3 | |
34 | 34 | else 0 | |
35 | 35 | let correctAmount = ((((paymentTx.amount - registerBetTxFee) * koeff) - dataTxsFees) - withdrawTx.fee) | |
36 | 36 | let isInWaves = if (!(isDefined(withdrawTx.feeAssetId))) | |
37 | 37 | then !(isDefined(withdrawTx.assetId)) | |
38 | 38 | else false | |
39 | 39 | if (if (if (isPaymentTookPlace) | |
40 | 40 | then true | |
41 | 41 | else throw("There was no bet")) | |
42 | 42 | then if ((withdrawTx.amount == correctAmount)) | |
43 | 43 | then true | |
44 | 44 | else throw(("Amount is incorrect. Correct amount is " + toString(correctAmount))) | |
45 | 45 | else false) | |
46 | 46 | then if (if (!(isDefined(withdrawTx.feeAssetId))) | |
47 | 47 | then !(isDefined(withdrawTx.assetId)) | |
48 | 48 | else false) | |
49 | 49 | then true | |
50 | 50 | else throw("Withdraw and fee must be in WAVES") | |
51 | 51 | else false | |
52 | 52 | case _ => | |
53 | 53 | false | |
54 | 54 | } | |
55 | 55 | case dtx: DataTransaction => | |
56 | - | if ((size(dtx.data) == | |
56 | + | if ((size(dtx.data) == 3)) | |
57 | 57 | then { | |
58 | - | let isDataCountOk = (size(dtx.data) == 2) | |
59 | - | let paymentTxIdStr = dropRight(extract(dtx.data[0].key), 9) | |
60 | - | let feesKey = (paymentTxIdStr + "_withdraw_fees") | |
58 | + | let minBet = 50000000 | |
59 | + | let maxSumBet = 1000000000 | |
60 | + | let paymentTxIdStr = extract(dtx.data[0].key) | |
61 | + | let guessStr = extract(getString(dtx.data, paymentTxIdStr)) | |
62 | + | let paymentRoundKey = (paymentTxIdStr + "_round") | |
63 | + | let paymentRound = extract(getString(dtx.data, paymentRoundKey)) | |
64 | + | let sumBetsOld = if (isDefined(getInteger(me, (paymentRound + "_betsSum")))) | |
65 | + | then extract(getInteger(me, (paymentRound + "_betsSum"))) | |
66 | + | else 0 | |
67 | + | let sumBetsNew = extract(getInteger(dtx.data, (paymentRound + "_betsSum"))) | |
68 | + | let itsTooLate = isDefined(getString(me, (paymentRound + "_stop"))) | |
69 | + | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
61 | 70 | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
62 | - | let newFees = extract(getInteger(dtx.data, feesKey)) | |
63 | - | let oldFeesUnit = getInteger(me, feesKey) | |
64 | - | let oldFees = if (isDefined(oldFeesUnit)) | |
65 | - | then extract(oldFeesUnit) | |
66 | - | else 0 | |
67 | - | let isFeeCorrect = (newFees == (oldFees + dtx.fee)) | |
68 | - | let withdrawTxIdUnit = getString(me, paymentTxIdStr) | |
69 | - | let isPaymentAlreadyMentioned = isDefined(withdrawTxIdUnit) | |
70 | - | let withdrawTransactionId = fromBase58String(extract(withdrawTxIdUnit)) | |
71 | 71 | match paymentTx { | |
72 | 72 | case paymentTx: TransferTransaction => | |
73 | 73 | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
74 | - | if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
74 | + | let correctSumBets = ((sumBetsOld + paymentTx.amount) - dtx.fee) | |
75 | + | if (if (if (if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
76 | + | then true | |
77 | + | else throw("Incorrect recipient of the payment")) | |
75 | 78 | then if (!(isPaymentAlreadyMentioned)) | |
76 | 79 | then true | |
77 | - | else | |
80 | + | else throw("This transfer is already used as a bet") | |
78 | 81 | else false) | |
79 | - | then isDtxSignedByPayer | |
82 | + | then if ((sumBetsNew == correctSumBets)) | |
83 | + | then true | |
84 | + | else throw(("Wrong value for Sum of Bets. Must be " + toString(correctSumBets))) | |
80 | 85 | else false) | |
81 | - | then isFeeCorrect | |
86 | + | then if ((maxSumBet > sumBetsNew)) | |
87 | + | then true | |
88 | + | else throw(((("Maximum amount of bets for round " + toString(maxSumBet)) + ". With your bet it's ") + toString(sumBetsNew))) | |
82 | 89 | else false) | |
83 | - | then isDataCountOk | |
90 | + | then if ((dtx.fee == registerBetTxFee)) | |
91 | + | then true | |
92 | + | else throw(("Fee of bet registration data transaction must be " + toString(registerBetTxFee))) | |
84 | 93 | else false) | |
85 | - | then { | |
86 | - | let guess = extract(getBinary(me, paymentTxIdStr)) | |
87 | - | let type = take(guess, 1) | |
88 | - | let key = extract(getString(me, (paymentTxIdStr + "_round"))) | |
89 | - | let itsTooLate = isDefined(getString(me, (key + "_stop"))) | |
90 | - | let valComplex = extract(getBinary(oracle, key)) | |
91 | - | let koeff = if ((type == drop(toBytes(0), 7))) | |
92 | - | then 35 | |
93 | - | else if ((type == drop(toBytes(1), 7))) | |
94 | - | then 2 | |
95 | - | else if ((type == drop(toBytes(2), 7))) | |
96 | - | then 2 | |
97 | - | else if ((type == drop(toBytes(3), 7))) | |
98 | - | then 2 | |
99 | - | else if ((type == drop(toBytes(4), 7))) | |
100 | - | then 3 | |
101 | - | else if ((type == drop(toBytes(5), 7))) | |
102 | - | then 3 | |
103 | - | else 0 | |
104 | - | let valReal = if ((type == drop(toBytes(0), 7))) | |
105 | - | then drop(take(valComplex, 2), 1) | |
106 | - | else if ((type == drop(toBytes(1), 7))) | |
107 | - | then drop(take(valComplex, 3), 2) | |
108 | - | else if ((type == drop(toBytes(2), 7))) | |
109 | - | then drop(take(valComplex, 4), 3) | |
110 | - | else if ((type == drop(toBytes(3), 7))) | |
111 | - | then drop(take(valComplex, 5), 4) | |
112 | - | else if ((type == drop(toBytes(4), 7))) | |
113 | - | then drop(take(valComplex, 6), 5) | |
114 | - | else if ((type == drop(toBytes(5), 7))) | |
115 | - | then drop(take(valComplex, 7), 6) | |
116 | - | else throw("Incorrect type of guess provided") | |
117 | - | let isWin = (drop(guess, 1) == valReal) | |
118 | - | let isMoneyStillEnough = ((((paymentTx.amount - registerBetTxFee) * koeff) + minWithdrawFee) > newFees) | |
119 | - | if (if (isWin) | |
120 | - | then isMoneyStillEnough | |
121 | - | else false) | |
122 | - | then !(itsTooLate) | |
123 | - | else false | |
124 | - | } | |
94 | + | then if ((paymentTx.amount >= minBet)) | |
95 | + | then true | |
96 | + | else throw(("Your Bet amount is less then minimal bet " + toString(minBet))) | |
97 | + | else false) | |
98 | + | then if (!(isDefined(paymentTx.feeAssetId))) | |
99 | + | then true | |
100 | + | else throw("Paymnet must be in WAVES") | |
101 | + | else false) | |
102 | + | then if (!(itsTooLate)) | |
103 | + | then true | |
104 | + | else throw("It's too late to play this round. Try next one") | |
125 | 105 | else false | |
126 | 106 | case _ => | |
127 | 107 | false | |
128 | 108 | } | |
129 | 109 | } | |
130 | - | else if ((size(dtx.data) == | |
110 | + | else if ((size(dtx.data) == 2)) | |
131 | 111 | then { | |
132 | - | let | |
133 | - | let | |
134 | - | let | |
135 | - | let | |
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | then extract( | |
112 | + | let isDataCountOk = (size(dtx.data) == 2) | |
113 | + | let paymentTxIdStr = dropRight(extract(dtx.data[0].key), 9) | |
114 | + | let feesKey = (paymentTxIdStr + "_withdraw_fees") | |
115 | + | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
116 | + | let newFees = extract(getInteger(dtx.data, feesKey)) | |
117 | + | let oldFeesUnit = getInteger(me, feesKey) | |
118 | + | let oldFees = if (isDefined(oldFeesUnit)) | |
119 | + | then extract(oldFeesUnit) | |
140 | 120 | else 0 | |
141 | - | let sumBetsNew = extract(getInteger(dtx.data, (paymentRound + "_betsSum"))) | |
142 | - | let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr)) | |
143 | - | let paymentTx = transactionById(fromBase58String(paymentTxIdStr)) | |
121 | + | let isFeeCorrect = (newFees == (oldFees + dtx.fee)) | |
122 | + | let withdrawTxIdUnit = getString(me, paymentTxIdStr) | |
123 | + | let isPaymentAlreadyMentioned = isDefined(withdrawTxIdUnit) | |
124 | + | let withdrawTransactionId = fromBase58String(extract(withdrawTxIdUnit)) | |
144 | 125 | match paymentTx { | |
145 | 126 | case paymentTx: TransferTransaction => | |
146 | 127 | let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey) | |
147 | - | let correctSumBets = ((sumBetsOld + paymentTx.amount) - dtx.fee) | |
148 | - | if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
149 | - | then !(isPaymentAlreadyMentioned) | |
128 | + | if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me)) | |
129 | + | then if (!(isPaymentAlreadyMentioned)) | |
130 | + | then true | |
131 | + | else !(isDefined(transactionById(withdrawTransactionId))) | |
150 | 132 | else false) | |
151 | - | then if ((sumBetsNew == correctSumBets)) | |
152 | - | then true | |
153 | - | else throw(("Wrong value for Sum of Bets. Must be " + toString(correctSumBets))) | |
133 | + | then isDtxSignedByPayer | |
154 | 134 | else false) | |
155 | - | then if ((maxSumBet > sumBetsNew)) | |
156 | - | then true | |
157 | - | else throw(((("Maximum amount of bets for round " + toString(maxSumBet)) + ". With your bet it's ") + toString(sumBetsNew))) | |
135 | + | then isFeeCorrect | |
158 | 136 | else false) | |
159 | - | then if ((dtx.fee == registerBetTxFee)) | |
160 | - | then true | |
161 | - | else throw(("Fee of bet registration data transaction must be " + toString(registerBetTxFee))) | |
137 | + | then isDataCountOk | |
138 | + | else false) | |
139 | + | then { | |
140 | + | let guess = extract(getBinary(me, paymentTxIdStr)) | |
141 | + | let type = take(guess, 1) | |
142 | + | let key = extract(getString(me, (paymentTxIdStr + "_round"))) | |
143 | + | let valComplex = extract(getBinary(oracle, key)) | |
144 | + | let koeff = if ((type == drop(toBytes(0), 7))) | |
145 | + | then 35 | |
146 | + | else if ((type == drop(toBytes(1), 7))) | |
147 | + | then 2 | |
148 | + | else if ((type == drop(toBytes(2), 7))) | |
149 | + | then 2 | |
150 | + | else if ((type == drop(toBytes(3), 7))) | |
151 | + | then 2 | |
152 | + | else if ((type == drop(toBytes(4), 7))) | |
153 | + | then 3 | |
154 | + | else if ((type == drop(toBytes(5), 7))) | |
155 | + | then 3 | |
156 | + | else 0 | |
157 | + | let valReal = if ((type == drop(toBytes(0), 7))) | |
158 | + | then drop(take(valComplex, 2), 1) | |
159 | + | else if ((type == drop(toBytes(1), 7))) | |
160 | + | then drop(take(valComplex, 3), 2) | |
161 | + | else if ((type == drop(toBytes(2), 7))) | |
162 | + | then drop(take(valComplex, 4), 3) | |
163 | + | else if ((type == drop(toBytes(3), 7))) | |
164 | + | then drop(take(valComplex, 5), 4) | |
165 | + | else if ((type == drop(toBytes(4), 7))) | |
166 | + | then drop(take(valComplex, 6), 5) | |
167 | + | else if ((type == drop(toBytes(5), 7))) | |
168 | + | then drop(take(valComplex, 7), 6) | |
169 | + | else throw("Incorrect type of guess provided") | |
170 | + | let isWin = (drop(guess, 1) == valReal) | |
171 | + | let isMoneyStillEnough = ((((paymentTx.amount - registerBetTxFee) * koeff) + minWithdrawFee) > newFees) | |
172 | + | if (isWin) | |
173 | + | then isMoneyStillEnough | |
174 | + | else false | |
175 | + | } | |
162 | 176 | else false | |
163 | 177 | case _ => | |
164 | 178 | false | |
165 | 179 | } | |
166 | 180 | } | |
167 | 181 | else false | |
168 | 182 | case _ => | |
169 | 183 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
170 | 184 | } |
github/deemru/w8io/169f3d6 58.79 ms ◑