2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = "" |
---|
5 | | - | |
---|
6 | | - | let b = "EVALUATED" |
---|
7 | | - | |
---|
8 | | - | func c (d) = { |
---|
9 | | - | let e = getString(this, d) |
---|
10 | | - | if ($isInstanceOf(e, "String")) |
---|
11 | | - | then { |
---|
12 | | - | let f = e |
---|
13 | | - | f |
---|
14 | | - | } |
---|
15 | | - | else a |
---|
16 | | - | } |
---|
17 | | - | |
---|
18 | | - | |
---|
19 | | - | func g (h) = { |
---|
20 | | - | let i = c(h) |
---|
21 | | - | if ((i == a)) |
---|
22 | | - | then false |
---|
23 | | - | else true |
---|
24 | | - | } |
---|
25 | | - | |
---|
26 | | - | |
---|
27 | | - | func j (h) = { |
---|
28 | | - | let i = c(h) |
---|
29 | | - | if ((i != b)) |
---|
30 | | - | then true |
---|
31 | | - | else false |
---|
32 | | - | } |
---|
33 | | - | |
---|
34 | | - | |
---|
35 | | - | @Callable(k) |
---|
36 | | - | func addRisk (l,m) = { |
---|
37 | | - | let h = toBase58String(k.caller.bytes) |
---|
38 | | - | if (g(h)) |
---|
39 | | - | then WriteSet([DataEntry((toBase58String(k.transactionId) + "_name"), l), DataEntry((toBase58String(k.transactionId) + "_description"), m)]) |
---|
40 | | - | else throw("Sender not allowed to store risks!") |
---|
41 | | - | } |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | |
---|
45 | | - | @Callable(k) |
---|
46 | | - | func addConsolidatedRisk (l,m) = { |
---|
47 | | - | let h = toBase58String(k.caller.bytes) |
---|
48 | | - | if (g(h)) |
---|
49 | | - | then WriteSet([DataEntry((toBase58String(k.transactionId) + "_consolidated_name"), l), DataEntry((toBase58String(k.transactionId) + "_consolidated_description"), m)]) |
---|
50 | | - | else throw("Sender not allowed to consolidate risks!") |
---|
51 | | - | } |
---|
52 | | - | |
---|
53 | | - | |
---|
54 | | - | |
---|
55 | | - | @Callable(k) |
---|
56 | | - | func evaluateRisk (n,o,p) = { |
---|
57 | | - | let h = toBase58String(k.caller.bytes) |
---|
58 | | - | if (if (g(h)) |
---|
59 | | - | then j(h) |
---|
60 | | - | else false) |
---|
61 | | - | then WriteSet([DataEntry((((n + "_") + toBase58String(k.transactionId)) + "_probability"), o), DataEntry((((n + "_") + toBase58String(k.transactionId)) + "_impact"), p), DataEntry(h, b)]) |
---|
62 | | - | else throw("Sender not allowed to evaluate or evaluated already!") |
---|
63 | | - | } |
---|
64 | | - | |
---|
65 | | - | |
---|
66 | | - | @Verifier(q) |
---|
67 | | - | func r () = { |
---|
68 | | - | let e = q |
---|
69 | | - | true |
---|
70 | | - | } |
---|
71 | | - | |
---|
| 2 | + | {-# CONTENT_TYPE EXPRESSION #-} |
---|
| 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) |
---|