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