6 | | - | let kLastIterationLen = "lastIterationLen" |
---|
7 | | - | |
---|
8 | | - | let kIterationsCount = "iterationsCount" |
---|
9 | | - | |
---|
10 | | - | let kIncrementCounter = "incrementCounter" |
---|
11 | | - | |
---|
12 | | - | let kCurrentBalance = "currentBalance" |
---|
13 | | - | |
---|
14 | | - | let kIsActive = "isActive" |
---|
15 | | - | |
---|
16 | | - | let MAX_INCREMENT = 96 |
---|
17 | | - | |
---|
18 | | - | let currentLastIterationLen = valueOrErrorMessage(getInteger(this, kLastIterationLen), "Last iteration store read error") |
---|
19 | | - | |
---|
20 | | - | let currentIterationsCount = valueOrErrorMessage(getInteger(this, kIterationsCount), "Iteration store read error") |
---|
21 | | - | |
---|
22 | | - | let currentIncrementCounter = valueOrErrorMessage(getInteger(this, kIncrementCounter), "Increment store read error") |
---|
23 | | - | |
---|
24 | | - | let currentBalance = valueOrErrorMessage(getInteger(this, kCurrentBalance), "Balance store read error") |
---|
25 | | - | |
---|
26 | | - | let range = valueOrErrorMessage(getInteger(this, "usersCounter"), "Range store read error") |
---|
27 | | - | |
---|
28 | | - | let isActiveStatus = valueOrElse(getBoolean(this, kIsActive), false) |
---|
31 | | - | func enableMassIncrement (key) = if (isActiveStatus) |
---|
32 | | - | then throw("Function blocked") |
---|
33 | | - | else { |
---|
34 | | - | let iterationsCount = fraction(1, range, MAX_INCREMENT) |
---|
35 | | - | let lastIterationLen = (range % MAX_INCREMENT) |
---|
36 | | - | let currentBalanceBefore = getStringValue(this, ((key + separator) + toString((range - 1)))) |
---|
37 | | - | let valueArray = split(currentBalanceBefore, separator) |
---|
38 | | - | let currentBalanceInt = (parseIntValue(valueArray[1]) + 1) |
---|
39 | | - | [IntegerEntry(kLastIterationLen, lastIterationLen), IntegerEntry(kIterationsCount, iterationsCount), IntegerEntry(kIncrementCounter, 0), IntegerEntry(kCurrentBalance, currentBalanceInt)] |
---|
40 | | - | } |
---|
| 7 | + | func tokenIssuance () = { |
---|
| 8 | + | let name = "BebraToken" |
---|
| 9 | + | let lendescription = "Bebra by Kringe" |
---|
| 10 | + | let quantity = 10000000 |
---|
| 11 | + | let decimals = 0 |
---|
| 12 | + | let isReissuable = true |
---|
| 13 | + | let assetBebra = Issue(name, lendescription, quantity, decimals, isReissuable, unit, 0) |
---|
| 14 | + | let assetId = calculateAssetId(assetBebra) |
---|
| 15 | + | let knewToken = "Token" |
---|
| 16 | + | let newToken = valueOrErrorMessage(getString(this, knewToken), "BebraToken is not defined") |
---|
| 17 | + | let recipient = i.caller |
---|
| 18 | + | [assetBebra, StringEntry(knewToken, newToken), ScriptTransfer(recipient, 2000, assetId)] |
---|
| 19 | + | } |
---|
45 | | - | func massIncrement (key) = if ((currentIterationsCount != 0)) |
---|
46 | | - | then { |
---|
47 | | - | let res1 = reentrantInvoke(this, "incrementStore", [MAX_INCREMENT, key], nil) |
---|
48 | | - | if ((res1 == res1)) |
---|
49 | | - | then [IntegerEntry(kIncrementCounter, (currentIncrementCounter + MAX_INCREMENT)), IntegerEntry(kIterationsCount, (currentIterationsCount - 1)), BooleanEntry(kIsActive, true)] |
---|
50 | | - | else throw("Strict value is not equal to itself.") |
---|
51 | | - | } |
---|
52 | | - | else if (if ((currentIterationsCount == 0)) |
---|
53 | | - | then (currentLastIterationLen != 0) |
---|
54 | | - | else false) |
---|
55 | | - | then { |
---|
56 | | - | let res2 = reentrantInvoke(this, "incrementStore", [currentLastIterationLen, key], nil) |
---|
57 | | - | if ((res2 == res2)) |
---|
58 | | - | then [IntegerEntry(kIncrementCounter, (currentIncrementCounter + currentLastIterationLen)), IntegerEntry(kLastIterationLen, 0), BooleanEntry(kIsActive, false)] |
---|
59 | | - | else throw("Strict value is not equal to itself.") |
---|
60 | | - | } |
---|
61 | | - | else throw("Storage is incremented") |
---|
| 24 | + | func tokenTransfer (amount) = { |
---|
| 25 | + | let recipient = toBase58String(i.caller.bytes) |
---|
| 26 | + | nil |
---|
| 27 | + | } |
---|
64 | | - | |
---|
65 | | - | @Callable(i) |
---|
66 | | - | func incrementStore (range,key) = if ((range >= 0)) |
---|
67 | | - | then { |
---|
68 | | - | let storeValue = ((toString(i.originCaller) + separator) + toString(currentBalance)) |
---|
69 | | - | let res = invoke(this, "incrementStore", [(range - 1), key], nil) |
---|
70 | | - | if ((res == res)) |
---|
71 | | - | then [StringEntry(((key + separator) + toString((range + currentIncrementCounter))), storeValue)] |
---|
72 | | - | else throw("Strict value is not equal to itself.") |
---|
73 | | - | } |
---|
74 | | - | else nil |
---|
75 | | - | |
---|
| 30 | + | @Verifier(tx) |
---|
| 31 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|