3 | | - | let maxTimeToBet = 1549000217000 |
---|
4 | | - | let minTimeToTrading = 1549086617000 |
---|
5 | | - | let maxTimeToTrading = 1549086677000 |
---|
6 | | - | let fee = 10000000 |
---|
7 | | - | let decimals = 2 |
---|
8 | | - | let multiply = 100 |
---|
9 | | - | let totalMoney = if (isDefined(getInteger(tx.sender, "totalMoney"))) |
---|
10 | | - | then extract(getInteger(tx.sender, "totalMoney")) |
---|
| 3 | + | let PubKey1 = base58'854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa' |
---|
| 4 | + | let PubKey2 = base58'DKGFPozLrsiR8NM4NJzqQaBYC8NyGYjuw2hDYicQVjco' |
---|
| 5 | + | let sig1 = if (sigVerify(tx.bodyBytes, tx.proofs[0], PubKey1)) |
---|
| 6 | + | then 1 |
---|
12 | | - | match tx { |
---|
13 | | - | case dt: DataTransaction => |
---|
14 | | - | if (if ((maxTimeToBet >= tx.timestamp)) |
---|
15 | | - | then isDefined(getString(dt.data, "bet_s")) |
---|
16 | | - | else false) |
---|
17 | | - | then { |
---|
18 | | - | let paymentTxId = extract(getString(dt.data, "paymentTxId")) |
---|
19 | | - | let paymentTx = transactionById(fromBase58String(paymentTxId)) |
---|
20 | | - | let betGroup = extract(getString(dt.data, "bet_s")) |
---|
21 | | - | let dtBetSummary = extract(getInteger(dt.data, betGroup)) |
---|
22 | | - | let betSummary = if (isDefined(getInteger(tx.sender, betGroup))) |
---|
23 | | - | then extract(getInteger(tx.sender, betGroup)) |
---|
24 | | - | else 0 |
---|
25 | | - | let vBet = extract(getInteger(dt.data, "bet_v")) |
---|
26 | | - | let iBet = extract(getInteger(dt.data, "bet_i")) |
---|
27 | | - | let dBet = extract(getInteger(dt.data, "bet_d")) |
---|
28 | | - | let c = (decimals - size(toString(dBet))) |
---|
29 | | - | let tBet = (((toString(iBet) + ".") + (if ((c == 1)) |
---|
30 | | - | then "0" |
---|
31 | | - | else if ((c == 2)) |
---|
32 | | - | then "00" |
---|
33 | | - | else if ((c == 3)) |
---|
34 | | - | then "000" |
---|
35 | | - | else if ((c == 4)) |
---|
36 | | - | then "0000" |
---|
37 | | - | else if ((c == 5)) |
---|
38 | | - | then "00000" |
---|
39 | | - | else if ((c == 6)) |
---|
40 | | - | then "000000" |
---|
41 | | - | else if ((c == 7)) |
---|
42 | | - | then "0000000" |
---|
43 | | - | else "")) + toString(dBet)) |
---|
44 | | - | match paymentTx { |
---|
45 | | - | case payment: TransferTransaction => |
---|
46 | | - | if (if (if (if (if (!(isDefined(getString(tx.sender, paymentTxId)))) |
---|
47 | | - | then (payment.recipient == tx.sender) |
---|
48 | | - | else false) |
---|
49 | | - | then (payment.amount > fee) |
---|
50 | | - | else false) |
---|
51 | | - | then (extract(getInteger(dt.data, "totalMoney")) == (totalMoney + (payment.amount - fee))) |
---|
52 | | - | else false) |
---|
53 | | - | then (dtBetSummary == (betSummary + (payment.amount - fee))) |
---|
54 | | - | else false) |
---|
55 | | - | then (vBet == ((iBet * multiply) + dBet)) |
---|
56 | | - | else false |
---|
57 | | - | case _ => |
---|
58 | | - | false |
---|
59 | | - | } |
---|
60 | | - | } |
---|
61 | | - | else if (if ((tx.timestamp > maxTimeToTrading)) |
---|
62 | | - | then !(isDefined(getString(tx.sender, "tradingTxId"))) |
---|
63 | | - | else false) |
---|
64 | | - | then { |
---|
65 | | - | let tradingTxId = extract(getString(dt.data, "tradingTxId")) |
---|
66 | | - | let tradingTx = transactionById(fromBase58String(tradingTxId)) |
---|
67 | | - | let priceWin = extract(getInteger(dt.data, "priceWin")) |
---|
68 | | - | match tradingTx { |
---|
69 | | - | case exchange: ExchangeTransaction => |
---|
70 | | - | if (if ((priceWin == exchange.price)) |
---|
71 | | - | then (exchange.timestamp >= minTimeToTrading) |
---|
72 | | - | else false) |
---|
73 | | - | then (maxTimeToTrading >= exchange.timestamp) |
---|
74 | | - | else false |
---|
75 | | - | case _ => |
---|
76 | | - | false |
---|
77 | | - | } |
---|
78 | | - | } |
---|
79 | | - | else if (isDefined(getString(tx.sender, "tradingTxId"))) |
---|
80 | | - | then true |
---|
81 | | - | else false |
---|
82 | | - | case _ => |
---|
83 | | - | true |
---|
84 | | - | } |
---|
| 8 | + | let sig2 = if (sigVerify(tx.bodyBytes, tx.proofs[1], PubKey2)) |
---|
| 9 | + | then 1 |
---|
| 10 | + | else 0 |
---|
| 11 | + | ((sig1 + sig2) > 0) |
---|