2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | func a (b,c) = if (isDefined(b.assetId)) |
---|
5 | | - | then throw("can hodl waves only at the moment") |
---|
6 | | - | else { |
---|
7 | | - | let d = toBase58String(c.bytes) |
---|
8 | | - | let e = { |
---|
9 | | - | let f = getInteger(this, d) |
---|
10 | | - | if ($isInstanceOf(f, "Int")) |
---|
11 | | - | then { |
---|
12 | | - | let g = f |
---|
13 | | - | g |
---|
14 | | - | } |
---|
15 | | - | else 0 |
---|
16 | | - | } |
---|
17 | | - | let h = (e + b.amount) |
---|
18 | | - | WriteSet([DataEntry(d, h)]) |
---|
19 | | - | } |
---|
20 | | - | |
---|
21 | | - | |
---|
22 | | - | @Callable(i) |
---|
23 | | - | func default () = a(extract(i.payment), i.caller) |
---|
24 | | - | |
---|
25 | | - | |
---|
26 | | - | |
---|
27 | | - | @Callable(i) |
---|
28 | | - | func deposit () = a(extract(i.payment), i.caller) |
---|
29 | | - | |
---|
30 | | - | |
---|
31 | | - | |
---|
32 | | - | @Callable(i) |
---|
33 | | - | func withdraw (j,k,l,m) = { |
---|
34 | | - | let n = toBytes("Hello, Ride4DApp!") |
---|
35 | | - | let o = extract(addressFromString("3N4sxBoGovhPyScZ8DyXaXL9tWKtG6kBvSj")) |
---|
36 | | - | let p = if (k) |
---|
37 | | - | then (2 * j) |
---|
38 | | - | else j |
---|
39 | | - | let d = toBase58String(i.caller.bytes) |
---|
40 | | - | let e = { |
---|
41 | | - | let f = getInteger(this, d) |
---|
42 | | - | if ($isInstanceOf(f, "Int")) |
---|
43 | | - | then { |
---|
44 | | - | let g = f |
---|
45 | | - | g |
---|
46 | | - | } |
---|
47 | | - | else 0 |
---|
48 | | - | } |
---|
49 | | - | let h = (e - p) |
---|
50 | | - | if ((0 > p)) |
---|
51 | | - | then throw("Can't withdraw negative amount") |
---|
52 | | - | else if ((0 > h)) |
---|
53 | | - | then throw("Not enough balance") |
---|
54 | | - | else if ((n != m)) |
---|
55 | | - | then throw("vec parameter doesn't match expected value") |
---|
56 | | - | else ScriptResult(WriteSet([DataEntry(d, h), DataEntry((l + " Total"), p), DataEntry((l + " Donation"), j)]), TransferSet([ScriptTransfer(i.caller, j, unit), ScriptTransfer(o, j, unit)])) |
---|
57 | | - | } |
---|
58 | | - | |
---|
59 | | - | |
---|
60 | | - | @Verifier(q) |
---|
61 | | - | func r () = true |
---|
62 | | - | |
---|
| 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) |
---|