3 | | - | let me = tx.sender |
---|
4 | | - | match tx { |
---|
5 | | - | case t: DataTransaction => |
---|
6 | | - | let mode = take(t.data[0].key, 3) |
---|
7 | | - | let mode2 = take(t.data[1].key, 3) |
---|
8 | | - | let num = take(drop(t.data[0].key, 3), 1) |
---|
9 | | - | let sessionId = drop(t.data[0].key, 4) |
---|
10 | | - | let isDef = isDefined(getString(me, t.data[0].key)) |
---|
11 | | - | let isDef2 = isDefined(getString(me, t.data[1].key)) |
---|
12 | | - | if (if (if (if (if ((size(t.data) == 2)) |
---|
13 | | - | then !(isDef) |
---|
14 | | - | else false) |
---|
15 | | - | then (mode == "pay") |
---|
16 | | - | else false) |
---|
17 | | - | then (mode2 == "ptx") |
---|
18 | | - | else false) |
---|
19 | | - | then !(isDef2) |
---|
20 | | - | else false) |
---|
21 | | - | then { |
---|
22 | | - | let ptx = drop(t.data[1].key, 3) |
---|
23 | | - | let ptxT1 = extract(getString(t.data, t.data[0].key)) |
---|
24 | | - | let payT1 = transactionById(fromBase58String(ptxT1)) |
---|
25 | | - | match payT1 { |
---|
26 | | - | case tt1: TransferTransaction => |
---|
27 | | - | if (if ((ptxT1 == ptx)) |
---|
28 | | - | then (tt1.amount == 100) |
---|
29 | | - | else false) |
---|
30 | | - | then (tt1.recipient == me) |
---|
31 | | - | else false |
---|
32 | | - | case _ => |
---|
33 | | - | false |
---|
34 | | - | } |
---|
35 | | - | } |
---|
36 | | - | else if (if (if ((size(t.data) == 2)) |
---|
37 | | - | then (mode == "app") |
---|
38 | | - | else false) |
---|
39 | | - | then (mode2 == "ses") |
---|
40 | | - | else false) |
---|
41 | | - | then { |
---|
42 | | - | let sessionIdK = drop(t.data[1].key, 3) |
---|
43 | | - | let addr = drop(t.data[0].key, 3) |
---|
44 | | - | let pay1Key = ("pay1" + sessionIdK) |
---|
45 | | - | let pay2Key = ("pay2" + sessionIdK) |
---|
46 | | - | let pay3Key = ("pay3" + sessionIdK) |
---|
47 | | - | let sender1 = match transactionById(fromBase58String(extract(getString(me, pay1Key)))) { |
---|
48 | | - | case ttt: TransferTransaction => |
---|
49 | | - | ttt.sender |
---|
50 | | - | case _ => |
---|
51 | | - | me |
---|
52 | | - | } |
---|
53 | | - | let sender2 = match transactionById(fromBase58String(extract(getString(me, pay2Key)))) { |
---|
54 | | - | case ttt: TransferTransaction => |
---|
55 | | - | ttt.sender |
---|
56 | | - | case _ => |
---|
57 | | - | me |
---|
58 | | - | } |
---|
59 | | - | let sender3 = match transactionById(fromBase58String(extract(getString(me, pay3Key)))) { |
---|
60 | | - | case ttt: TransferTransaction => |
---|
61 | | - | ttt.sender |
---|
62 | | - | case _ => |
---|
63 | | - | me |
---|
64 | | - | } |
---|
65 | | - | let app1 = if ((toBase58String(fromBase58String(extract(getString(sender1, ("win1" + sessionIdK))))) == addr)) |
---|
66 | | - | then 1 |
---|
67 | | - | else 0 |
---|
68 | | - | let app2 = if ((toBase58String(fromBase58String(extract(getString(sender2, ("win2" + sessionIdK))))) == addr)) |
---|
69 | | - | then 1 |
---|
70 | | - | else 0 |
---|
71 | | - | let app3 = if ((toBase58String(fromBase58String(extract(getString(sender3, ("win3" + sessionIdK))))) == addr)) |
---|
72 | | - | then 1 |
---|
73 | | - | else 0 |
---|
74 | | - | let lastAppO = getInteger(me, t.data[0].key) |
---|
75 | | - | let lastApp = if (isDefined(lastAppO)) |
---|
76 | | - | then extract(lastAppO) |
---|
77 | | - | else 0 |
---|
78 | | - | let isAdd300 = ((lastApp + 300) == getInteger(t.data, t.data[0].key)) |
---|
79 | | - | if (if (!(isDef2)) |
---|
80 | | - | then isAdd300 |
---|
81 | | - | else false) |
---|
82 | | - | then (((app1 + app2) + app3) >= 2) |
---|
83 | | - | else false |
---|
84 | | - | } |
---|
85 | | - | else if (if (if ((size(t.data) == 2)) |
---|
86 | | - | then (mode == "app") |
---|
87 | | - | else false) |
---|
88 | | - | then (mode2 == "trx") |
---|
89 | | - | else false) |
---|
90 | | - | then { |
---|
91 | | - | let addr = drop(t.data[0].key, 3) |
---|
92 | | - | let lastAppO = getInteger(me, t.data[0].key) |
---|
93 | | - | let lastApp = if (isDefined(lastAppO)) |
---|
94 | | - | then extract(lastAppO) |
---|
95 | | - | else 0 |
---|
96 | | - | let isSub300 = ((lastApp - 300) == getInteger(t.data, t.data[0].key)) |
---|
97 | | - | if (if (!(isDef2)) |
---|
98 | | - | then (extract(getInteger(t.data, t.data[0].key)) >= 0) |
---|
99 | | - | else false) |
---|
100 | | - | then isSub300 |
---|
101 | | - | else false |
---|
102 | | - | } |
---|
103 | | - | else false |
---|
104 | | - | case t: TransferTransaction => |
---|
105 | | - | let isDefTt = isDefined(getString(me, ("trx" + toBase58String(t.id)))) |
---|
106 | | - | if ((t.amount == 300)) |
---|
107 | | - | then isDefTt |
---|
108 | | - | else false |
---|
109 | | - | case t: SetScriptTransaction => |
---|
110 | | - | true |
---|
111 | | - | case _ => |
---|
112 | | - | false |
---|
113 | | - | } |
---|
| 3 | + | let PubKey1 = base58'854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa' |
---|
| 4 | + | let PubKey2 = base58'DKGFPozLrsiR8NM4NJzqQaBYC8NyGYjuw2hDYicQVjco' |
---|
| 5 | + | let sig1 = if (sigVerify(tx.bodyBytes, tx.proofs[0], PubKey1)) |
---|
| 6 | + | then 1 |
---|
| 7 | + | else 0 |
---|
| 8 | + | let sig2 = if (sigVerify(tx.bodyBytes, tx.proofs[1], PubKey2)) |
---|
| 9 | + | then 1 |
---|
| 10 | + | else 0 |
---|
| 11 | + | ((sig1 + sig2) > 0) |
---|