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