1 | | - | {-# STDLIB_VERSION 1 #-} |
---|
2 | | - | {-# CONTENT_TYPE EXPRESSION #-} |
---|
3 | | - | let vecroPublicKey = tx.senderPublicKey |
---|
4 | | - | let triggerMinCost = 500000 |
---|
5 | | - | let triggerMaxCost = 100000000 |
---|
6 | | - | let aliasInit = Alias("init@samplevecro") |
---|
7 | | - | let aliasRandom = Alias("random@samplevecro") |
---|
8 | | - | let assetInit = base58'CtGcw1rZxdCjVpFUexfPo4ERKD72f7LuHN44RvamMwiD' |
---|
9 | | - | let assetRandom = base58'G9e4BkCnpbHFSPo7T9CfnYqdakZ9WRm4Z7j65GM3f9tA' |
---|
10 | | - | let codeR = toBytes("R") |
---|
11 | | - | let codeS = toBytes("S") |
---|
12 | | - | let codeSize = 45 |
---|
13 | | - | let iSig = 0 |
---|
14 | | - | let iRaw = 1 |
---|
15 | | - | let iTrig = 2 |
---|
16 | | - | let iInit = 3 |
---|
17 | | - | match tx { |
---|
18 | | - | case thisTx: TransferTransaction => |
---|
19 | | - | match transactionById(thisTx.proofs[iTrig]) { |
---|
20 | | - | case triggerTx: TransferTransaction => |
---|
21 | | - | if ((triggerTx.recipient == aliasInit)) |
---|
22 | | - | then { |
---|
23 | | - | let initTx = thisTx |
---|
24 | | - | let triggerInitTx = triggerTx |
---|
25 | | - | let initTxbodyBytes = (initTx.bodyBytes + initTx.proofs[iTrig]) |
---|
26 | | - | let R = initTx.proofs[iRaw] |
---|
27 | | - | if (if (if (if (if (if (if (if (if (!(isDefined(triggerInitTx.assetId))) |
---|
28 | | - | then (triggerInitTx.amount >= triggerMinCost) |
---|
29 | | - | else false) |
---|
30 | | - | then (triggerInitTx.sender == initTx.recipient) |
---|
31 | | - | else false) |
---|
32 | | - | then !(isDefined(initTx.feeAssetId)) |
---|
33 | | - | else false) |
---|
34 | | - | then if ((initTx.fee == triggerMaxCost)) |
---|
35 | | - | then true |
---|
36 | | - | else (initTx.fee == triggerInitTx.amount) |
---|
37 | | - | else false) |
---|
38 | | - | then (initTx.assetId == assetInit) |
---|
39 | | - | else false) |
---|
40 | | - | then (initTx.amount == 1) |
---|
41 | | - | else false) |
---|
42 | | - | then (size(initTx.attachment) == codeSize) |
---|
43 | | - | else false) |
---|
44 | | - | then (initTx.attachment == toBytes(toBase58String((codeR + R)))) |
---|
45 | | - | else false) |
---|
46 | | - | then sigVerify(initTxbodyBytes, initTx.proofs[iSig], vecroPublicKey) |
---|
47 | | - | else false |
---|
48 | | - | } |
---|
49 | | - | else if ((triggerTx.recipient == aliasRandom)) |
---|
50 | | - | then match transactionById(thisTx.proofs[iInit]) { |
---|
51 | | - | case initTx: TransferTransaction => |
---|
52 | | - | match transactionById(initTx.proofs[iTrig]) { |
---|
53 | | - | case triggerInitTx: TransferTransaction => |
---|
54 | | - | if ((triggerInitTx.recipient == aliasInit)) |
---|
55 | | - | then { |
---|
56 | | - | let randomTx = thisTx |
---|
57 | | - | let triggerRandomTx = triggerTx |
---|
58 | | - | let initTxbodyBytes = (initTx.bodyBytes + initTx.proofs[iTrig]) |
---|
59 | | - | let randomTxbodyBytes = ((randomTx.bodyBytes + randomTx.proofs[iTrig]) + randomTx.proofs[iInit]) |
---|
60 | | - | let R = initTx.proofs[iRaw] |
---|
61 | | - | let S = thisTx.proofs[iRaw] |
---|
62 | | - | let sig = (R + S) |
---|
63 | | - | let msg = triggerRandomTx.attachment |
---|
64 | | - | if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((triggerRandomTx.sender == triggerInitTx.sender)) |
---|
65 | | - | then (take(msg, codeSize) == initTx.attachment) |
---|
66 | | - | else false) |
---|
67 | | - | then sigVerify(msg, sig, vecroPublicKey) |
---|
68 | | - | else false) |
---|
69 | | - | then !(isDefined(triggerRandomTx.assetId)) |
---|
70 | | - | else false) |
---|
71 | | - | then (triggerRandomTx.amount >= triggerMinCost) |
---|
72 | | - | else false) |
---|
73 | | - | then (triggerRandomTx.sender == randomTx.recipient) |
---|
74 | | - | else false) |
---|
75 | | - | then !(isDefined(randomTx.feeAssetId)) |
---|
76 | | - | else false) |
---|
77 | | - | then if ((randomTx.fee == triggerMaxCost)) |
---|
78 | | - | then true |
---|
79 | | - | else (randomTx.fee == triggerRandomTx.amount) |
---|
80 | | - | else false) |
---|
81 | | - | then (randomTx.assetId == assetRandom) |
---|
82 | | - | else false) |
---|
83 | | - | then (randomTx.amount == 1) |
---|
84 | | - | else false) |
---|
85 | | - | then (size(randomTx.attachment) == codeSize) |
---|
86 | | - | else false) |
---|
87 | | - | then (randomTx.attachment == toBytes(toBase58String((codeS + S)))) |
---|
88 | | - | else false) |
---|
89 | | - | then sigVerify(randomTxbodyBytes, randomTx.proofs[iSig], vecroPublicKey) |
---|
90 | | - | else false) |
---|
91 | | - | then !(isDefined(triggerInitTx.assetId)) |
---|
92 | | - | else false) |
---|
93 | | - | then (triggerInitTx.amount >= triggerMinCost) |
---|
94 | | - | else false) |
---|
95 | | - | then (triggerInitTx.sender == initTx.recipient) |
---|
96 | | - | else false) |
---|
97 | | - | then !(isDefined(initTx.feeAssetId)) |
---|
98 | | - | else false) |
---|
99 | | - | then if ((initTx.fee == triggerMaxCost)) |
---|
100 | | - | then true |
---|
101 | | - | else (initTx.fee == triggerInitTx.amount) |
---|
102 | | - | else false) |
---|
103 | | - | then (initTx.assetId == assetInit) |
---|
104 | | - | else false) |
---|
105 | | - | then (initTx.amount == 1) |
---|
106 | | - | else false) |
---|
107 | | - | then (size(initTx.attachment) == codeSize) |
---|
108 | | - | else false) |
---|
109 | | - | then (initTx.attachment == toBytes(toBase58String((codeR + R)))) |
---|
110 | | - | else false) |
---|
111 | | - | then sigVerify(initTxbodyBytes, initTx.proofs[iSig], vecroPublicKey) |
---|
112 | | - | else false |
---|
113 | | - | } |
---|
114 | | - | else false |
---|
115 | | - | case _ => |
---|
116 | | - | false |
---|
117 | | - | } |
---|
118 | | - | case _ => |
---|
119 | | - | false |
---|
120 | | - | } |
---|
121 | | - | else false |
---|
122 | | - | case _ => |
---|
123 | | - | false |
---|
124 | | - | } |
---|
125 | | - | case _ => |
---|
126 | | - | sigVerify(tx.bodyBytes, tx.proofs[iSig], vecroPublicKey) |
---|
127 | | - | } |
---|
| 1 | + | # no script |
---|