tx · 7HpJcQs4pX16fsLJJD2njP9Tf5aJJwQgCEXTp4L3RmAf 3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1: -0.01000000 Waves 2024.01.09 12:11 [2923750] smart account 3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1 > SELF 0.00000000 Waves
{ "type": 13, "id": "7HpJcQs4pX16fsLJJD2njP9Tf5aJJwQgCEXTp4L3RmAf", "fee": 1000000, "feeAssetId": null, "timestamp": 1704791496676, "version": 2, "chainId": 84, "sender": "3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1", "senderPublicKey": "7c3qLtcJ7EaPS2JDjXv8MBbd4kpyc6R27wcn5GgvZhur", "proofs": [ "4Guq5Nk5H5Tv1YbryeNrsoTEayzki4byMzk9Kkw2W4HMa8YHoYa1yeJq7KW6jUZXwt4JYBrfUe4nqigfonKom7Zr" ], "script": "base64:BgIKCAISBgoECAEBAREADGNvbnRyYWN0RmlsZQIQdmVzdGluZ19uZW8ucmlkZQADU0VQAgJfXwAISURTX0xJU1QJAMwIAgAACQDMCAIAAQkAzAgCAAIJAMwIAgADCQDMCAIABAkAzAgCAAUJAMwIAgAGCQDMCAIABwkAzAgCAAgJAMwIAgAJCQDMCAIACgkAzAgCAAsJAMwIAgAMCQDMCAIADQkAzAgCAA4JAMwIAgAPCQDMCAIAEAkAzAgCABEJAMwIAgASCQDMCAIAEwkAzAgCABQJAMwIAgAVCQDMCAIAFgkAzAgCABcJAMwIAgAYCQDMCAIAGQkAzAgCABoJAMwIAgAbCQDMCAIAHAkAzAgCAB0JAMwIAgAeCQDMCAIAHwkAzAgCACAJAMwIAgAhCQDMCAIAIgkAzAgCACMJAMwIAgAkCQDMCAIAJQkAzAgCACYJAMwIAgAnCQDMCAIAKAkAzAgCACkJAMwIAgAqCQDMCAIAKwkAzAgCACwJAMwIAgAtCQDMCAIALgkAzAgCAC8JAMwIAgAwCQDMCAIAMQkAzAgCADIJAMwIAgAzCQDMCAIANAkAzAgC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MQAyADMANAA1ADYANwA4ADkAOgA7ADwAPQA+AD8AQABBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGAAYQBiAGMAZAQKYWxsQWN0aW9ucwgFCyR0MDM5Njc0MDMzAl8xBAJfYQgFCyR0MDM5Njc0MDMzAl8yBQphbGxBY3Rpb25zAQFpAQNmb28EC3VzZXJBZGRyZXNzDXZlc3RpbmdBbW91bnQKc3RhcnRCbG9jawpsb2NrTGVuZ3RoCQEUZ2V0TmV3VmVzdGluZ0FjdGlvbnMFBQt1c2VyQWRkcmVzcwABBQ12ZXN0aW5nQW1vdW50BQpzdGFydEJsb2NrBQpsb2NrTGVuZ3RoAPYcx8o=", "height": 2923750, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AaSXKSeAg5BP5dMGLuoXS3gF64A7wCybx1w9WoohCMNd Next: 7C2T8247Dv37CKQXWqSoG8i2PCrVkH2VSCPVxSe9PqRq Diff:
Old | New | Differences | |
---|---|---|---|
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(i) | |
141 | - | func foo (userAddress,vestingAmount,startBlock,lockLength) = getNewVestingActions(userAddress, | |
141 | + | func foo (userAddress,vestingAmount,startBlock,lockLength) = getNewVestingActions(userAddress, 1, vestingAmount, startBlock, lockLength) | |
142 | 142 | ||
143 | 143 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "vesting_neo.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let IDS_LIST = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99] | |
9 | 9 | ||
10 | 10 | let MAX_VESTING_COUNT = size(IDS_LIST) | |
11 | 11 | ||
12 | 12 | func throwErr (msg) = throw(((contractFile + ": ") + msg)) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | let keyAssetId = makeString(["%s", "assetId"], SEP) | |
16 | 16 | ||
17 | 17 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
18 | 18 | ||
19 | 19 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
20 | 20 | then unit | |
21 | 21 | else fromBase58String(assetIdString) | |
22 | 22 | ||
23 | 23 | func isValidAddressString (addressString) = match addressFromString(addressString) { | |
24 | 24 | case a: Address => | |
25 | 25 | true | |
26 | 26 | case _ => | |
27 | 27 | false | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func keyUserVesting (userAddress,id) = { | |
32 | 32 | let checks = [if (isValidAddressString(userAddress)) | |
33 | 33 | then true | |
34 | 34 | else throwErr(makeString(["address is not valid:", userAddress], " ")), if (if ((id >= 0)) | |
35 | 35 | then (MAX_VESTING_COUNT > id) | |
36 | 36 | else false) | |
37 | 37 | then true | |
38 | 38 | else throwErr(makeString(["id is invalid:", toString(id)], " "))] | |
39 | 39 | if ((checks == checks)) | |
40 | 40 | then makeString(["%s%d", userAddress, toString(id)], SEP) | |
41 | 41 | else throw("Strict value is not equal to itself.") | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func formatUserVesting (vestingAmount,startBlock,lockLength) = { | |
46 | 46 | let checks = [if ((vestingAmount >= 0)) | |
47 | 47 | then true | |
48 | 48 | else throwErr("vesting amount cannot be negative"), if ((startBlock >= 0)) | |
49 | 49 | then true | |
50 | 50 | else throwErr("start block cannot be negative"), if ((lockLength >= 0)) | |
51 | 51 | then true | |
52 | 52 | else throwErr("lock length cannot be negative")] | |
53 | 53 | if ((checks == checks)) | |
54 | 54 | then makeString(["%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength)], SEP) | |
55 | 55 | else throw("Strict value is not equal to itself.") | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func parseUserVesting (userAddress,id) = match getString(this, keyUserVesting(userAddress, id)) { | |
60 | 60 | case rawString: String => | |
61 | 61 | let splitString = split(rawString, SEP) | |
62 | 62 | let vestingAmount = parseIntValue(splitString[1]) | |
63 | 63 | let startBlock = parseIntValue(splitString[2]) | |
64 | 64 | let lockLength = parseIntValue(splitString[3]) | |
65 | 65 | $Tuple3(vestingAmount, startBlock, lockLength) | |
66 | 66 | case _ => | |
67 | 67 | $Tuple3(0, 0, 0) | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func calcUnlockedAmount (amount,startBlock,lockLength) = { | |
72 | 72 | let elapsedBlocks = (height - startBlock) | |
73 | 73 | let unlockedAmount = if (if ((lockLength != 0)) | |
74 | 74 | then (elapsedBlocks > 0) | |
75 | 75 | else false) | |
76 | 76 | then min([fraction(amount, elapsedBlocks, lockLength), amount]) | |
77 | 77 | else 0 | |
78 | 78 | $Tuple2(unlockedAmount, (amount - unlockedAmount)) | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getUserUnlockedAmount (userAddress,id) = { | |
83 | 83 | let $t026912770 = parseUserVesting(userAddress, id) | |
84 | 84 | let vestingAmount = $t026912770._1 | |
85 | 85 | let startBlock = $t026912770._2 | |
86 | 86 | let lockLength = $t026912770._3 | |
87 | 87 | let $t027732870 = calcUnlockedAmount(vestingAmount, startBlock, lockLength) | |
88 | 88 | let unlockedAmount = $t027732870._1 | |
89 | 89 | let remainingAmount = $t027732870._2 | |
90 | 90 | $Tuple2(unlockedAmount, remainingAmount) | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func getUserClaimActions (userAddress,id) = { | |
95 | 95 | let $t029733052 = parseUserVesting(userAddress, id) | |
96 | 96 | let vestingAmount = $t029733052._1 | |
97 | 97 | let startBlock = $t029733052._2 | |
98 | 98 | let lockLength = $t029733052._3 | |
99 | 99 | let $t030553133 = getUserUnlockedAmount(userAddress, id) | |
100 | 100 | let unlockedAmount = $t030553133._1 | |
101 | 101 | let remainingAmount = $t030553133._2 | |
102 | 102 | let remainingBlocks = max([((startBlock + lockLength) - height), 0]) | |
103 | 103 | if ((unlockedAmount != 0)) | |
104 | 104 | then [ScriptTransfer(addressFromStringValue(userAddress), unlockedAmount, assetIdBytes), StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks))] | |
105 | 105 | else nil | |
106 | 106 | } | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength))] | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func getAllUserClaimActions (userAddress) = { | |
113 | 113 | func actionsHelper (accum,a) = { | |
114 | 114 | let $t038383869 = accum | |
115 | 115 | let allActions = $t038383869._1 | |
116 | 116 | let index = $t038383869._2 | |
117 | 117 | $Tuple2((allActions ++ getUserClaimActions(userAddress, index)), (index + 1)) | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | let $t039674033 = { | |
121 | 121 | let $l = IDS_LIST | |
122 | 122 | let $s = size($l) | |
123 | 123 | let $acc0 = $Tuple2(nil, 0) | |
124 | 124 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
125 | 125 | then $a | |
126 | 126 | else actionsHelper($a, $l[$i]) | |
127 | 127 | ||
128 | 128 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
129 | 129 | then $a | |
130 | 130 | else throw("List size exceeds 100") | |
131 | 131 | ||
132 | 132 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
133 | 133 | } | |
134 | 134 | let allActions = $t039674033._1 | |
135 | 135 | let _a = $t039674033._2 | |
136 | 136 | allActions | |
137 | 137 | } | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(i) | |
141 | - | func foo (userAddress,vestingAmount,startBlock,lockLength) = getNewVestingActions(userAddress, | |
141 | + | func foo (userAddress,vestingAmount,startBlock,lockLength) = getNewVestingActions(userAddress, 1, vestingAmount, startBlock, lockLength) | |
142 | 142 | ||
143 | 143 |
github/deemru/w8io/169f3d6 42.05 ms ◑