3 | | - | let sender = tx.sender |
---|
4 | | - | let asset = base58'4qu3P9iPuWSLjFtTNACiTMj2iPeH59eyEpwmHKnGrxQb' |
---|
5 | | - | let N = extract(getInteger(sender, "N")) |
---|
6 | | - | let lastUpdateHeight = extract(getInteger(sender, "lastUpdateHeight")) |
---|
7 | | - | let lastUpdateBalance = extract(getInteger(sender, "lastUpdateBalance")) |
---|
8 | | - | let currentBalance = assetBalance(sender, asset) |
---|
9 | | - | let validityPeriod = 100 |
---|
10 | | - | let transferAmount = 10 |
---|
11 | | - | let miningRate = 10000 |
---|
12 | | - | let minN = 1 |
---|
13 | | - | let maxN = 32 |
---|
14 | | - | match tx { |
---|
15 | | - | case tx: TransferTransaction => |
---|
16 | | - | let firstBytes = toBase58String(take(tx.id, N)) |
---|
17 | | - | if (if (if (if (if ((validityPeriod > (height - lastUpdateHeight))) |
---|
18 | | - | then isDefined(getBoolean(sender, firstBytes)) |
---|
19 | | - | else false) |
---|
20 | | - | then (tx.amount == transferAmount) |
---|
21 | | - | else false) |
---|
22 | | - | then (tx.assetId == asset) |
---|
23 | | - | else false) |
---|
24 | | - | then (tx.fee == 500000) |
---|
25 | | - | else false) |
---|
26 | | - | then !(isDefined(tx.feeAssetId)) |
---|
27 | | - | else false |
---|
28 | | - | case tx: DataTransaction => |
---|
29 | | - | let deltaN = (((lastUpdateBalance - currentBalance) / miningRate) - 1) |
---|
30 | | - | let newN = if ((minN > (N + deltaN))) |
---|
31 | | - | then minN |
---|
32 | | - | else if (((N + deltaN) > maxN)) |
---|
33 | | - | then maxN |
---|
34 | | - | else (N + deltaN) |
---|
35 | | - | if (if (if (if (if (((height - lastUpdateHeight) >= validityPeriod)) |
---|
36 | | - | then (size(tx.data) == 3) |
---|
37 | | - | else false) |
---|
38 | | - | then (extract(getInteger(tx.data, "N")) == newN) |
---|
39 | | - | else false) |
---|
40 | | - | then (extract(getInteger(tx.data, "lastUpdateHeight")) == height) |
---|
41 | | - | else false) |
---|
42 | | - | then (extract(getInteger(tx.data, "lastUpdateBalance")) == currentBalance) |
---|
43 | | - | else false) |
---|
44 | | - | then (tx.fee == 500000) |
---|
45 | | - | else false |
---|
46 | | - | case _ => |
---|
47 | | - | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
48 | | - | } |
---|
| 3 | + | true |
---|