3 | | - | let dealer = base58'BrpLMJrt3XATLKfqc24Vf95caJgpz781uz58riLeJAQj' |
---|
4 | | - | let dealerAddress = addressFromPublicKey(base58'BrpLMJrt3XATLKfqc24Vf95caJgpz781uz58riLeJAQj') |
---|
5 | | - | let player = base58'Bi48U6i3749BU35R1ANiZSNvQTHwoGcM2GcMGSp3trdR' |
---|
6 | | - | let playerAddress = addressFromPublicKey(base58'Bi48U6i3749BU35R1ANiZSNvQTHwoGcM2GcMGSp3trdR') |
---|
7 | | - | let multiSigAddress = addressFromPublicKey(base58'GcumKP6hHJxy1VtAHxgLCPAmpDVRKyJMxoaAVAeFAPjZ') |
---|
8 | | - | match tx { |
---|
9 | | - | case tx: DataTransaction => |
---|
10 | | - | let dealerSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], dealer)) |
---|
11 | | - | then 1 |
---|
12 | | - | else 0 |
---|
13 | | - | let playerSigned = if (sigVerify(tx.bodyBytes, tx.proofs[1], player)) |
---|
14 | | - | then 1 |
---|
15 | | - | else 0 |
---|
16 | | - | let block = extract(getInteger(multiSigAddress, "block")) |
---|
17 | | - | if ((block > 0)) |
---|
18 | | - | then { |
---|
19 | | - | let method = extract(getString(tx.data, "method")) |
---|
20 | | - | if ((method == "game")) |
---|
21 | | - | then { |
---|
22 | | - | let lastBlock = extract(getInteger(multiSigAddress, "lastBlock")) |
---|
23 | | - | let newLastBlock = extract(getInteger(tx.data, "lastBlock")) |
---|
24 | | - | if ((newLastBlock > lastBlock)) |
---|
25 | | - | then ((dealerSigned + playerSigned) == 2) |
---|
26 | | - | else false |
---|
27 | | - | } |
---|
28 | | - | else if ((method == "getSaltDealer")) |
---|
29 | | - | then (playerSigned == 1) |
---|
30 | | - | else if ((method == "getSaltPlayer")) |
---|
31 | | - | then (dealerSigned == 1) |
---|
32 | | - | else if ((method == "setSaltPlayer")) |
---|
33 | | - | then { |
---|
34 | | - | let hashLastGame = extract(getString(multiSigAddress, "hashLastGame")) |
---|
35 | | - | let hashLastBlock = extract(getString(multiSigAddress, "hashLastBlock")) |
---|
36 | | - | let saltPlayer = extract(getString(tx.data, "saltPlayer")) |
---|
37 | | - | if ((sha256(toBytes((saltPlayer + hashLastBlock))) == toBytes(hashLastBlock))) |
---|
38 | | - | then (playerSigned == 1) |
---|
39 | | - | else false |
---|
40 | | - | } |
---|
41 | | - | else if ((method == "setSaltDealer")) |
---|
42 | | - | then { |
---|
43 | | - | let hashLastGame = extract(getString(multiSigAddress, "hashLastGame")) |
---|
44 | | - | let hashLastBlock = extract(getString(multiSigAddress, "hashLastBlock")) |
---|
45 | | - | let saltDealer = extract(getString(tx.data, "saltDealer")) |
---|
46 | | - | if ((sha256(toBytes((saltDealer + hashLastGame))) == toBytes(hashLastBlock))) |
---|
47 | | - | then (dealerSigned == 1) |
---|
48 | | - | else false |
---|
49 | | - | } |
---|
50 | | - | else false |
---|
51 | | - | } |
---|
52 | | - | else { |
---|
53 | | - | let newBlock = extract(getInteger(tx.data, "block")) |
---|
54 | | - | (newBlock > 0) |
---|
55 | | - | } |
---|
56 | | - | case tt: TransferTransaction => |
---|
57 | | - | let failurePayOut = extract(getBoolean(multiSigAddress, "failurePayOut")) |
---|
58 | | - | let lastBlock = extract(getInteger(multiSigAddress, "lastBlock")) |
---|
59 | | - | if ((tt.recipient == multiSigAddress)) |
---|
60 | | - | then if ((dealerAddress == tt.sender)) |
---|
61 | | - | then (tt.amount != 0) |
---|
62 | | - | else (tt.amount != 0) |
---|
63 | | - | else if (if ((failurePayOut == true)) |
---|
64 | | - | then (height > lastBlock) |
---|
65 | | - | else false) |
---|
66 | | - | then true |
---|
67 | | - | else false |
---|
68 | | - | case mtx: MassTransferTransaction => |
---|
69 | | - | if ((mtx.sender == multiSigAddress)) |
---|
70 | | - | then { |
---|
71 | | - | let block = extract(getInteger(multiSigAddress, "block")) |
---|
72 | | - | if ((height > block)) |
---|
73 | | - | then true |
---|
74 | | - | else { |
---|
75 | | - | let failurePayOut = extract(getBoolean(multiSigAddress, "failurePayOut")) |
---|
76 | | - | let lastBlock = extract(getInteger(multiSigAddress, "lastBlock")) |
---|
77 | | - | if (((lastBlock + 3) > height)) |
---|
78 | | - | then if ((failurePayOut == false)) |
---|
79 | | - | then { |
---|
80 | | - | let dealerSigned = if (sigVerify(mtx.bodyBytes, mtx.proofs[0], dealer)) |
---|
81 | | - | then 1 |
---|
82 | | - | else 0 |
---|
83 | | - | let playerSigned = if (sigVerify(mtx.bodyBytes, mtx.proofs[1], player)) |
---|
84 | | - | then 1 |
---|
85 | | - | else 0 |
---|
86 | | - | ((dealerSigned + playerSigned) == 2) |
---|
87 | | - | } |
---|
88 | | - | else false |
---|
89 | | - | else false |
---|
90 | | - | } |
---|
91 | | - | } |
---|
92 | | - | else false |
---|
93 | | - | case ta: SetScriptTransaction => |
---|
94 | | - | true |
---|
95 | | - | case _ => |
---|
96 | | - | false |
---|
97 | | - | } |
---|
| 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) |
---|