2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | func a (b,c) = if ((c != "first_name")) |
---|
5 | | - | then throw("You cannot update this property") |
---|
6 | | - | else { |
---|
7 | | - | let d = value(indexOf(b, (("\"" + c) + "\":"))) |
---|
8 | | - | let e = drop(b, ((d + size(c)) + 3)) |
---|
9 | | - | e |
---|
10 | | - | } |
---|
11 | | - | |
---|
12 | | - | |
---|
13 | | - | func f (b,c) = if ((c != "first_name")) |
---|
14 | | - | then throw("You cannot update this property") |
---|
15 | | - | else { |
---|
16 | | - | let d = value(indexOf(b, (("\"" + c) + "\":"))) |
---|
17 | | - | let e = take(b, ((d + size(c)) + 3)) |
---|
18 | | - | e |
---|
19 | | - | } |
---|
20 | | - | |
---|
21 | | - | |
---|
22 | | - | func g (b,c,h) = if ((c != "first_name")) |
---|
23 | | - | then throw("You cannot update this property") |
---|
24 | | - | else { |
---|
25 | | - | let d = value(indexOf(b, (("\"" + c) + "\":"))) |
---|
26 | | - | let e = takeRight(b, (size(b) - ((((d + size(c)) + 3) + h) + 2))) |
---|
27 | | - | e |
---|
28 | | - | } |
---|
29 | | - | |
---|
30 | | - | |
---|
31 | | - | func i (b) = take(drop(b, 1), value(indexOf(drop(b, 1), "\""))) |
---|
32 | | - | |
---|
33 | | - | |
---|
34 | | - | @Callable(j) |
---|
35 | | - | func testUpdateJsonKeyValue (k,c,l) = { |
---|
36 | | - | let m = { |
---|
37 | | - | let n = getString(this, k) |
---|
38 | | - | if ($isInstanceOf(n, "String")) |
---|
39 | | - | then { |
---|
40 | | - | let o = n |
---|
41 | | - | o |
---|
42 | | - | } |
---|
43 | | - | else throw("The key doesn't exist") |
---|
44 | | - | } |
---|
45 | | - | let p = f(m, c) |
---|
46 | | - | let q = g(m, c, size(i(a(m, c)))) |
---|
47 | | - | let r = i(a(m, c)) |
---|
48 | | - | if ((r == l)) |
---|
49 | | - | then throw("same value so no changes") |
---|
50 | | - | else WriteSet([DataEntry(k, ((((p + "\"") + l) + "\"") + q))]) |
---|
51 | | - | } |
---|
52 | | - | |
---|
53 | | - | |
---|
| 2 | + | {-# CONTENT_TYPE EXPRESSION #-} |
---|
| 3 | + | match tx { |
---|
| 4 | + | case t: TransferTransaction => |
---|
| 5 | + | let passwordHash = "c788cd1aa394b03ef75a74ed724aa55656f67b73401b5e222fae361c9c16f70e" |
---|
| 6 | + | let passSecret = toBase16String(sha256(tx.proofs[1])) |
---|
| 7 | + | if (if ((passwordHash == passSecret)) |
---|
| 8 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
| 9 | + | else false) |
---|
| 10 | + | then true |
---|
| 11 | + | else throw(passSecret) |
---|
| 12 | + | case _ => |
---|
| 13 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
| 14 | + | } |
---|