3 | | - | let betAmount = 100000000 |
---|
4 | | - | let dataTxFee = 10000000 |
---|
5 | | - | let payoutFee = 500000 |
---|
6 | | - | let player = tx.sender |
---|
7 | | - | let win = 2 |
---|
8 | | - | match tx { |
---|
9 | | - | case t: DataTransaction => |
---|
10 | | - | let tmpChoice = extract(getInteger(t.data, "Choice")) |
---|
11 | | - | let paymentTxId = extract(getString(t.data, "lastPayment")) |
---|
12 | | - | let paymentTx = transactionById(fromBase58String(paymentTxId)) |
---|
13 | | - | match paymentTx { |
---|
14 | | - | case paymentTx: TransferTransaction => |
---|
15 | | - | if (if (if (if (if (if (if (if (if ((3 >= tmpChoice)) |
---|
16 | | - | then (tmpChoice >= 1) |
---|
17 | | - | else false) |
---|
18 | | - | then !(isDefined(getString(player, paymentTxId))) |
---|
19 | | - | else false) |
---|
20 | | - | then (paymentTx.recipient == player) |
---|
21 | | - | else false) |
---|
22 | | - | then (paymentTx.amount >= (betAmount + dataTxFee)) |
---|
23 | | - | else false) |
---|
24 | | - | then !(isDefined(paymentTx.assetId)) |
---|
25 | | - | else false) |
---|
26 | | - | then (size(t.data) == 3) |
---|
27 | | - | else false) |
---|
28 | | - | then (height >= extract(getInteger(t.data, paymentTxId))) |
---|
29 | | - | else false) |
---|
30 | | - | then sigVerify(t.bodyBytes, t.proofs[0], paymentTx.senderPublicKey) |
---|
31 | | - | else false) |
---|
32 | | - | then (t.fee >= dataTxFee) |
---|
33 | | - | else false |
---|
34 | | - | case _ => |
---|
35 | | - | false |
---|
36 | | - | } |
---|
37 | | - | case payout: TransferTransaction => |
---|
38 | | - | let paymentTxId = extract(getString(player, "lastPayment")) |
---|
39 | | - | let paymentTx = transactionById(fromBase58String(paymentTxId)) |
---|
40 | | - | let heightChoice = extract(getInteger(player, paymentTxId)) |
---|
41 | | - | match paymentTx { |
---|
42 | | - | case paymentTx: TransferTransaction => |
---|
43 | | - | if (if (if ((extract(getInteger(player, "Choice")) == win)) |
---|
44 | | - | then (paymentTx.sender == payout.recipient) |
---|
45 | | - | else false) |
---|
46 | | - | then (payout.fee >= payoutFee) |
---|
47 | | - | else false) |
---|
48 | | - | then !(isDefined(payout.feeAssetId)) |
---|
49 | | - | else false |
---|
50 | | - | case _ => |
---|
51 | | - | false |
---|
52 | | - | } |
---|
53 | | - | case _ => |
---|
54 | | - | true |
---|
55 | | - | } |
---|
| 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) |
---|