tx · FZs5VPGcTnyv84LpHrPYQaKe9kY136SgpvE4rAZqP7xZ 3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1: -0.01700000 Waves 2024.01.31 12:25 [2955583] smart account 3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1 > SELF 0.00000000 Waves
{ "type": 13, "id": "FZs5VPGcTnyv84LpHrPYQaKe9kY136SgpvE4rAZqP7xZ", "fee": 1700000, "feeAssetId": null, "timestamp": 1706693100388, "version": 1, "sender": "3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1", "senderPublicKey": "7c3qLtcJ7EaPS2JDjXv8MBbd4kpyc6R27wcn5GgvZhur", "proofs": [ "5mFMej3pd3kX5DybTj2eFRktW4JuzDVtduTzF5n31RNjw6DEYawxKQK63Xg1quoXqsfkFSEWDa1kTj8PfZDsbj3x" ], "script": "base64:BgIbCAISBgoECAEBARIDCgEIEgMKAQgSABIDCgEIIQAMY29udHJhY3RGaWxlAhB2ZXN0aW5nX25lby5yaWRlAANTRVACAl9fAAhJRFNfTElTVAkAzAgCAAAJAMwIAgABCQDMCAIAAgkAzAgCAAMJAMwIAgAECQDMCAIABQkAzAgCAAYJAMwIAgAHCQDMCAIACAkAzAgCAAkJAMwIAgAKCQDMCAIACwkAzAgCAAwJAMwIAgANCQDMCAIADgkAzAgCAA8JAMwIAgAQCQDMCAIAEQkAzAgCABIJAMwIAgATCQDMCAIAFAkAzAgCABUJAMwIAgAWCQDMCAIAFwkAzAgCABgJAMwIAgAZCQDMCAIAGgkAzAgCABsJAMwIAgAcCQDMCAIAHQUDbmlsABFNQVhfVkVTVElOR19DT1VOVAkAkAMBBQhJRFNfTElTVAEIdGhyb3dFcnIBA21zZwkAAgEJAKwCAgkArAICBQxjb250cmFjdEZpbGUCAjogBQNtc2cBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEWa2V5TWFuYWdlclZhdWx0QWRkcmVzcwACFyVzX19tYW5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wkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleZQggMQ=", "chainId": 84, "height": 2955583, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6ufmP5RMMxW3rVNkZsrigp22Mnx2QtAE6Mzr6XPNJWkU Next: 4m7Y4Bh8V7RPdeN2bnQfjioA2RMSkGeVtSyvEAEXRAso Diff:
Old | New | Differences | |
---|---|---|---|
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | - | func formatUserVesting (vestingAmount,startBlock,lockLength) = { | |
100 | + | func formatUserVesting (vestingAmount,startBlock,lockLength,totalClaimed) = { | |
101 | 101 | let checks = [if ((vestingAmount >= 0)) | |
102 | 102 | then true | |
103 | 103 | else throwErr("vesting amount cannot be negative"), if ((startBlock >= 0)) | |
104 | 104 | then true | |
105 | 105 | else throwErr("start block cannot be negative"), if ((lockLength >= 0)) | |
106 | 106 | then true | |
107 | - | else throwErr("lock length cannot be negative")] | |
107 | + | else throwErr("lock length cannot be negative"), if ((totalClaimed >= 0)) | |
108 | + | then true | |
109 | + | else throwErr("total claimed cannot be negative")] | |
108 | 110 | if ((checks == checks)) | |
109 | - | then makeString(["%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength)], SEP) | |
111 | + | then makeString(["%d%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength), toString(totalClaimed)], SEP) | |
110 | 112 | else throw("Strict value is not equal to itself.") | |
111 | 113 | } | |
112 | 114 | ||
117 | 119 | let vestingAmount = parseIntValue(splitString[1]) | |
118 | 120 | let startBlock = parseIntValue(splitString[2]) | |
119 | 121 | let lockLength = parseIntValue(splitString[3]) | |
120 | - | $Tuple3(vestingAmount, startBlock, lockLength) | |
122 | + | let totalClaimed = if ((5 > size(splitString))) | |
123 | + | then 0 | |
124 | + | else parseIntValue(splitString[4]) | |
125 | + | $Tuple4(vestingAmount, startBlock, lockLength, totalClaimed) | |
121 | 126 | case _ => | |
122 | - | $ | |
127 | + | $Tuple4(0, 0, 0, 0) | |
123 | 128 | } | |
124 | 129 | ||
125 | 130 | ||
138 | 143 | ||
139 | 144 | ||
140 | 145 | func getUserUnlockedAmount (userAddress,id) = { | |
141 | - | let $t037793858 = parseUserVesting(userAddress, id) | |
142 | - | let vestingAmount = $t037793858._1 | |
143 | - | let startBlock = $t037793858._2 | |
144 | - | let lockLength = $t037793858._3 | |
145 | - | let $t038613958 = calcUnlockedAmount(vestingAmount, startBlock, lockLength) | |
146 | - | let unlockedAmount = $t038613958._1 | |
147 | - | let remainingAmount = $t038613958._2 | |
146 | + | let $t040564149 = parseUserVesting(userAddress, id) | |
147 | + | let vestingAmount = $t040564149._1 | |
148 | + | let startBlock = $t040564149._2 | |
149 | + | let lockLength = $t040564149._3 | |
150 | + | let totalClaimed = $t040564149._4 | |
151 | + | let $t041524249 = calcUnlockedAmount(vestingAmount, startBlock, lockLength) | |
152 | + | let unlockedAmount = $t041524249._1 | |
153 | + | let remainingAmount = $t041524249._2 | |
148 | 154 | $Tuple2(unlockedAmount, remainingAmount) | |
149 | 155 | } | |
150 | 156 | ||
151 | 157 | ||
152 | 158 | func getUpdateVestingActions (userAddress,id) = { | |
153 | - | let $t040654144 = parseUserVesting(userAddress, id) | |
154 | - | let vestingAmount = $t040654144._1 | |
155 | - | let startBlock = $t040654144._2 | |
156 | - | let lockLength = $t040654144._3 | |
157 | - | let $t041474225 = getUserUnlockedAmount(userAddress, id) | |
158 | - | let unlockedAmount = $t041474225._1 | |
159 | - | let remainingAmount = $t041474225._2 | |
159 | + | let $t043564449 = parseUserVesting(userAddress, id) | |
160 | + | let vestingAmount = $t043564449._1 | |
161 | + | let startBlock = $t043564449._2 | |
162 | + | let lockLength = $t043564449._3 | |
163 | + | let totalClaimed = $t043564449._4 | |
164 | + | let $t044524530 = getUserUnlockedAmount(userAddress, id) | |
165 | + | let unlockedAmount = $t044524530._1 | |
166 | + | let remainingAmount = $t044524530._2 | |
160 | 167 | let remainingBlocks = max([((startBlock + lockLength) - height), 0]) | |
168 | + | let newTotalClaimed = (totalClaimed + unlockedAmount) | |
161 | 169 | let updateVestingActions = if ((unlockedAmount != 0)) | |
162 | 170 | then if ((remainingBlocks != 0)) | |
163 | - | then [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks))] | |
171 | + | then [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks, newTotalClaimed))] | |
164 | 172 | else [DeleteEntry(keyUserVesting(userAddress, id))] | |
165 | 173 | else nil | |
166 | 174 | $Tuple2(updateVestingActions, unlockedAmount) | |
168 | 176 | ||
169 | 177 | ||
170 | 178 | func getUserClaimActions (userAddress,id) = { | |
171 | - | let $ | |
172 | - | let updateVestingActions = $ | |
173 | - | let unlockedAmount = $ | |
179 | + | let $t050655150 = getUpdateVestingActions(userAddress, id) | |
180 | + | let updateVestingActions = $t050655150._1 | |
181 | + | let unlockedAmount = $t050655150._2 | |
174 | 182 | let transferActions = if ((unlockedAmount != 0)) | |
175 | 183 | then [ScriptTransfer(addressFromStringValue(userAddress), unlockedAmount, assetIdBytes)] | |
176 | 184 | else nil | |
180 | 188 | ||
181 | 189 | func getAllUserClaimActions (userAddress) = { | |
182 | 190 | func actionsHelper (acc,id) = { | |
183 | - | let $ | |
184 | - | let allVestingsClaimActions = $ | |
185 | - | let sum = $ | |
186 | - | let $ | |
187 | - | let vestingClaimActions = $ | |
188 | - | let claimAmount = $ | |
191 | + | let $t055245564 = acc | |
192 | + | let allVestingsClaimActions = $t055245564._1 | |
193 | + | let sum = $t055245564._2 | |
194 | + | let $t055695646 = getUserClaimActions(userAddress, id) | |
195 | + | let vestingClaimActions = $t055695646._1 | |
196 | + | let claimAmount = $t055695646._2 | |
189 | 197 | $Tuple2((allVestingsClaimActions ++ vestingClaimActions), (sum + claimAmount)) | |
190 | 198 | } | |
191 | 199 | ||
206 | 214 | ||
207 | 215 | func getMoveAllUnlockedToAccumulatorActions (userAddress) = { | |
208 | 216 | func actionsHelper (acc,id) = { | |
209 | - | let $ | |
210 | - | let updateAllVestingsActions = $ | |
211 | - | let sum = $ | |
212 | - | let $ | |
213 | - | let updateVestingActions = $ | |
214 | - | let unlockedAmount = $ | |
217 | + | let $t059395980 = acc | |
218 | + | let updateAllVestingsActions = $t059395980._1 | |
219 | + | let sum = $t059395980._2 | |
220 | + | let $t059856070 = getUpdateVestingActions(userAddress, id) | |
221 | + | let updateVestingActions = $t059856070._1 | |
222 | + | let unlockedAmount = $t059856070._2 | |
215 | 223 | $Tuple2((updateAllVestingsActions ++ updateVestingActions), (sum + unlockedAmount)) | |
216 | 224 | } | |
217 | 225 | ||
218 | - | let $ | |
226 | + | let $t061566244 = { | |
219 | 227 | let $l = IDS_LIST | |
220 | 228 | let $s = size($l) | |
221 | 229 | let $acc0 = $Tuple2(nil, 0) | |
229 | 237 | ||
230 | 238 | $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($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) | |
231 | 239 | } | |
232 | - | let updateAllVestingsActions = $ | |
233 | - | let unlockedSum = $ | |
240 | + | let updateAllVestingsActions = $t061566244._1 | |
241 | + | let unlockedSum = $t061566244._2 | |
234 | 242 | let oldAccumulated = valueOrElse(getInteger(this, keyUserAccumulated(userAddress)), 0) | |
235 | 243 | let updateAccumulatedActions = if ((unlockedSum != 0)) | |
236 | 244 | then [IntegerEntry(keyUserAccumulated(userAddress), (oldAccumulated + unlockedSum))] | |
248 | 256 | ||
249 | 257 | ||
250 | 258 | func getClaimAllActions (userAddress) = { | |
251 | - | let $ | |
259 | + | let $t070127145 = if (!(containsElement(banList, userAddress))) | |
252 | 260 | then getAllUserClaimActions(userAddress) | |
253 | 261 | else $Tuple2(nil, 0) | |
254 | - | let claimActions = $ | |
255 | - | let unlockedAmount = $ | |
256 | - | let $ | |
257 | - | let claimAccumulatedActions = $ | |
258 | - | let accumulatedAmount = $ | |
262 | + | let claimActions = $t070127145._1 | |
263 | + | let unlockedAmount = $t070127145._2 | |
264 | + | let $t071487238 = getClaimAccumulatedActions(userAddress) | |
265 | + | let claimAccumulatedActions = $t071487238._1 | |
266 | + | let accumulatedAmount = $t071487238._2 | |
259 | 267 | let totalAmount = (unlockedAmount + accumulatedAmount) | |
260 | 268 | $Tuple2((claimActions ++ claimAccumulatedActions), totalAmount) | |
261 | 269 | } | |
263 | 271 | ||
264 | 272 | func getVestingUserInfo (userAddress) = { | |
265 | 273 | func helper (acc,id) = { | |
266 | - | let $t070767155 = parseUserVesting(userAddress, id) | |
267 | - | let vestingAmount = $t070767155._1 | |
268 | - | let startBlock = $t070767155._2 | |
269 | - | let lockLength = $t070767155._3 | |
270 | - | let $t071607238 = getUserUnlockedAmount(userAddress, id) | |
271 | - | let unlockedAmount = $t071607238._1 | |
272 | - | let remainingAmount = $t071607238._2 | |
274 | + | let $t074527545 = parseUserVesting(userAddress, id) | |
275 | + | let vestingAmount = $t074527545._1 | |
276 | + | let startBlock = $t074527545._2 | |
277 | + | let lockLength = $t074527545._3 | |
278 | + | let totalClaimed = $t074527545._4 | |
279 | + | let $t075507628 = getUserUnlockedAmount(userAddress, id) | |
280 | + | let unlockedAmount = $t075507628._1 | |
281 | + | let remainingAmount = $t075507628._2 | |
273 | 282 | if (if ((vestingAmount == 0)) | |
274 | 283 | then true | |
275 | 284 | else containsElement(banList, userAddress)) | |
276 | 285 | then acc | |
277 | - | else (acc :+ [vestingAmount, (startBlock + lockLength), unlockedAmount, remainingAmount]) | |
286 | + | else (acc :+ [vestingAmount, (startBlock + lockLength), unlockedAmount, remainingAmount, totalClaimed]) | |
278 | 287 | } | |
279 | 288 | ||
280 | 289 | let $l = IDS_LIST | |
294 | 303 | ||
295 | 304 | func getAvailableVestingId (userAddress) = { | |
296 | 305 | func helper (availableId,id) = { | |
297 | - | let $t075627641 = parseUserVesting(userAddress, id) | |
298 | - | let vestingAmount = $t075627641._1 | |
299 | - | let startBlock = $t075627641._2 | |
300 | - | let lockLength = $t075627641._3 | |
306 | + | let $t079668059 = parseUserVesting(userAddress, id) | |
307 | + | let vestingAmount = $t079668059._1 | |
308 | + | let startBlock = $t079668059._2 | |
309 | + | let lockLength = $t079668059._3 | |
310 | + | let totalClaimed = $t079668059._4 | |
301 | 311 | if ((vestingAmount > 0)) | |
302 | 312 | then availableId | |
303 | 313 | else if ((availableId == -1)) | |
325 | 335 | } | |
326 | 336 | ||
327 | 337 | ||
328 | - | func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength))] | |
338 | + | func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength, 0))] | |
329 | 339 | ||
330 | 340 | ||
331 | 341 | @Callable(i) | |
363 | 373 | else throwErr(makeString(["user already in a ban list:", userAddress], " "))] | |
364 | 374 | if ((checks == checks)) | |
365 | 375 | then { | |
366 | - | let $ | |
367 | - | let moveToAccumulatedActions = $ | |
368 | - | let _a = $ | |
376 | + | let $t0992410012 = getMoveAllUnlockedToAccumulatorActions(userAddress) | |
377 | + | let moveToAccumulatedActions = $t0992410012._1 | |
378 | + | let _a = $t0992410012._2 | |
369 | 379 | let addToBanListActions = [StringEntry(keyBanList, makeString_11C((banList :+ userAddress), "__"))] | |
370 | 380 | (moveToAccumulatedActions ++ addToBanListActions) | |
371 | 381 | } | |
403 | 413 | @Callable(i) | |
404 | 414 | func claimAll () = { | |
405 | 415 | let userAddress = toString(i.caller) | |
406 | - | let $ | |
407 | - | let claimActions = $ | |
408 | - | let totalAmount = $ | |
416 | + | let $t01090510970 = getClaimAllActions(userAddress) | |
417 | + | let claimActions = $t01090510970._1 | |
418 | + | let totalAmount = $t01090510970._2 | |
409 | 419 | let historyActions = [StringEntry(keyVestingHistory("claimed", userAddress, toBase58String(i.transactionId)), toString(totalAmount))] | |
410 | 420 | if ((totalAmount > 0)) | |
411 | 421 | then (claimActions ++ historyActions) | |
416 | 426 | ||
417 | 427 | @Callable(i) | |
418 | 428 | func userInfoREADONLY (userAddress) = { | |
419 | - | let $ | |
420 | - | let _a = $ | |
421 | - | let totalAmount = $ | |
429 | + | let $t01157111626 = getClaimAllActions(userAddress) | |
430 | + | let _a = $t01157111626._1 | |
431 | + | let totalAmount = $t01157111626._2 | |
422 | 432 | let accumulatedAmount = valueOrElse(getInteger(this, keyUserAccumulated(userAddress)), 0) | |
423 | 433 | $Tuple2(nil, $Tuple3(totalAmount, accumulatedAmount, getVestingUserInfo(userAddress))) | |
424 | - | } | |
425 | - | ||
426 | - | ||
427 | - | ||
428 | - | @Callable(i) | |
429 | - | func foo () = { | |
430 | - | let ch = throw("err") | |
431 | - | if ((ch == ch)) | |
432 | - | then nil | |
433 | - | else throw("Strict value is not equal to itself.") | |
434 | 434 | } | |
435 | 435 | ||
436 | 436 |
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] | |
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 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
22 | 22 | case s: String => | |
23 | 23 | addressFromStringValue(s) | |
24 | 24 | case _ => | |
25 | 25 | this | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func managerPublicKeyOrUnit () = { | |
30 | 30 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
31 | 31 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
32 | 32 | case s: String => | |
33 | 33 | fromBase58String(s) | |
34 | 34 | case _: Unit => | |
35 | 35 | unit | |
36 | 36 | case _ => | |
37 | 37 | throw("Match error") | |
38 | 38 | } | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | let keyAssetId = makeString(["%s", "assetId"], SEP) | |
43 | 43 | ||
44 | 44 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
45 | 45 | ||
46 | 46 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
47 | 47 | then unit | |
48 | 48 | else fromBase58String(assetIdString) | |
49 | 49 | ||
50 | 50 | let keyAdminList = makeString(["%s", "adminAddressList"], SEP) | |
51 | 51 | ||
52 | 52 | let keyBanList = makeString(["%s", "banList"], SEP) | |
53 | 53 | ||
54 | 54 | let adminList = match getString(this, keyAdminList) { | |
55 | 55 | case s: String => | |
56 | 56 | split(s, SEP) | |
57 | 57 | case _ => | |
58 | 58 | nil | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | let banList = { | |
62 | 62 | let banListRaw = valueOrElse(getString(this, keyBanList), "") | |
63 | 63 | if ((banListRaw == "")) | |
64 | 64 | then nil | |
65 | 65 | else split_51C(banListRaw, SEP) | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | func isValidAddressString (addressString) = match addressFromString(addressString) { | |
69 | 69 | case a: Address => | |
70 | 70 | true | |
71 | 71 | case _ => | |
72 | 72 | false | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func keyUserVesting (userAddress,id) = { | |
77 | 77 | let checks = [if (isValidAddressString(userAddress)) | |
78 | 78 | then true | |
79 | 79 | else throwErr(makeString(["address is not valid:", userAddress], " ")), if (if ((id >= 0)) | |
80 | 80 | then (MAX_VESTING_COUNT > id) | |
81 | 81 | else false) | |
82 | 82 | then true | |
83 | 83 | else throwErr(makeString(["id should be less than", toString(MAX_VESTING_COUNT), "got:", toString(id)], " "))] | |
84 | 84 | if ((checks == checks)) | |
85 | 85 | then makeString(["%s%s%d", "vesting", userAddress, toString(id)], SEP) | |
86 | 86 | else throw("Strict value is not equal to itself.") | |
87 | 87 | } | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func keyUserAccumulated (userAddress) = { | |
91 | 91 | let checks = [if (isValidAddressString(userAddress)) | |
92 | 92 | then true | |
93 | 93 | else throwErr(makeString(["address is not valid:", userAddress], " "))] | |
94 | 94 | if ((checks == checks)) | |
95 | 95 | then makeString(["%s%s", "accumulated", userAddress], SEP) | |
96 | 96 | else throw("Strict value is not equal to itself.") | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | - | func formatUserVesting (vestingAmount,startBlock,lockLength) = { | |
100 | + | func formatUserVesting (vestingAmount,startBlock,lockLength,totalClaimed) = { | |
101 | 101 | let checks = [if ((vestingAmount >= 0)) | |
102 | 102 | then true | |
103 | 103 | else throwErr("vesting amount cannot be negative"), if ((startBlock >= 0)) | |
104 | 104 | then true | |
105 | 105 | else throwErr("start block cannot be negative"), if ((lockLength >= 0)) | |
106 | 106 | then true | |
107 | - | else throwErr("lock length cannot be negative")] | |
107 | + | else throwErr("lock length cannot be negative"), if ((totalClaimed >= 0)) | |
108 | + | then true | |
109 | + | else throwErr("total claimed cannot be negative")] | |
108 | 110 | if ((checks == checks)) | |
109 | - | then makeString(["%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength)], SEP) | |
111 | + | then makeString(["%d%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength), toString(totalClaimed)], SEP) | |
110 | 112 | else throw("Strict value is not equal to itself.") | |
111 | 113 | } | |
112 | 114 | ||
113 | 115 | ||
114 | 116 | func parseUserVesting (userAddress,id) = match getString(this, keyUserVesting(userAddress, id)) { | |
115 | 117 | case rawString: String => | |
116 | 118 | let splitString = split(rawString, SEP) | |
117 | 119 | let vestingAmount = parseIntValue(splitString[1]) | |
118 | 120 | let startBlock = parseIntValue(splitString[2]) | |
119 | 121 | let lockLength = parseIntValue(splitString[3]) | |
120 | - | $Tuple3(vestingAmount, startBlock, lockLength) | |
122 | + | let totalClaimed = if ((5 > size(splitString))) | |
123 | + | then 0 | |
124 | + | else parseIntValue(splitString[4]) | |
125 | + | $Tuple4(vestingAmount, startBlock, lockLength, totalClaimed) | |
121 | 126 | case _ => | |
122 | - | $ | |
127 | + | $Tuple4(0, 0, 0, 0) | |
123 | 128 | } | |
124 | 129 | ||
125 | 130 | ||
126 | 131 | func keyVestingHistory (action,userAddress,txId) = makeString(["%s%s%s%s", "history", userAddress, action, txId], SEP) | |
127 | 132 | ||
128 | 133 | ||
129 | 134 | func calcUnlockedAmount (amount,startBlock,lockLength) = { | |
130 | 135 | let elapsedBlocks = (height - startBlock) | |
131 | 136 | let unlockedAmount = if (if ((lockLength != 0)) | |
132 | 137 | then (elapsedBlocks > 0) | |
133 | 138 | else false) | |
134 | 139 | then min([fraction(amount, elapsedBlocks, lockLength), amount]) | |
135 | 140 | else 0 | |
136 | 141 | $Tuple2(unlockedAmount, (amount - unlockedAmount)) | |
137 | 142 | } | |
138 | 143 | ||
139 | 144 | ||
140 | 145 | func getUserUnlockedAmount (userAddress,id) = { | |
141 | - | let $t037793858 = parseUserVesting(userAddress, id) | |
142 | - | let vestingAmount = $t037793858._1 | |
143 | - | let startBlock = $t037793858._2 | |
144 | - | let lockLength = $t037793858._3 | |
145 | - | let $t038613958 = calcUnlockedAmount(vestingAmount, startBlock, lockLength) | |
146 | - | let unlockedAmount = $t038613958._1 | |
147 | - | let remainingAmount = $t038613958._2 | |
146 | + | let $t040564149 = parseUserVesting(userAddress, id) | |
147 | + | let vestingAmount = $t040564149._1 | |
148 | + | let startBlock = $t040564149._2 | |
149 | + | let lockLength = $t040564149._3 | |
150 | + | let totalClaimed = $t040564149._4 | |
151 | + | let $t041524249 = calcUnlockedAmount(vestingAmount, startBlock, lockLength) | |
152 | + | let unlockedAmount = $t041524249._1 | |
153 | + | let remainingAmount = $t041524249._2 | |
148 | 154 | $Tuple2(unlockedAmount, remainingAmount) | |
149 | 155 | } | |
150 | 156 | ||
151 | 157 | ||
152 | 158 | func getUpdateVestingActions (userAddress,id) = { | |
153 | - | let $t040654144 = parseUserVesting(userAddress, id) | |
154 | - | let vestingAmount = $t040654144._1 | |
155 | - | let startBlock = $t040654144._2 | |
156 | - | let lockLength = $t040654144._3 | |
157 | - | let $t041474225 = getUserUnlockedAmount(userAddress, id) | |
158 | - | let unlockedAmount = $t041474225._1 | |
159 | - | let remainingAmount = $t041474225._2 | |
159 | + | let $t043564449 = parseUserVesting(userAddress, id) | |
160 | + | let vestingAmount = $t043564449._1 | |
161 | + | let startBlock = $t043564449._2 | |
162 | + | let lockLength = $t043564449._3 | |
163 | + | let totalClaimed = $t043564449._4 | |
164 | + | let $t044524530 = getUserUnlockedAmount(userAddress, id) | |
165 | + | let unlockedAmount = $t044524530._1 | |
166 | + | let remainingAmount = $t044524530._2 | |
160 | 167 | let remainingBlocks = max([((startBlock + lockLength) - height), 0]) | |
168 | + | let newTotalClaimed = (totalClaimed + unlockedAmount) | |
161 | 169 | let updateVestingActions = if ((unlockedAmount != 0)) | |
162 | 170 | then if ((remainingBlocks != 0)) | |
163 | - | then [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks))] | |
171 | + | then [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks, newTotalClaimed))] | |
164 | 172 | else [DeleteEntry(keyUserVesting(userAddress, id))] | |
165 | 173 | else nil | |
166 | 174 | $Tuple2(updateVestingActions, unlockedAmount) | |
167 | 175 | } | |
168 | 176 | ||
169 | 177 | ||
170 | 178 | func getUserClaimActions (userAddress,id) = { | |
171 | - | let $ | |
172 | - | let updateVestingActions = $ | |
173 | - | let unlockedAmount = $ | |
179 | + | let $t050655150 = getUpdateVestingActions(userAddress, id) | |
180 | + | let updateVestingActions = $t050655150._1 | |
181 | + | let unlockedAmount = $t050655150._2 | |
174 | 182 | let transferActions = if ((unlockedAmount != 0)) | |
175 | 183 | then [ScriptTransfer(addressFromStringValue(userAddress), unlockedAmount, assetIdBytes)] | |
176 | 184 | else nil | |
177 | 185 | $Tuple2((updateVestingActions ++ transferActions), unlockedAmount) | |
178 | 186 | } | |
179 | 187 | ||
180 | 188 | ||
181 | 189 | func getAllUserClaimActions (userAddress) = { | |
182 | 190 | func actionsHelper (acc,id) = { | |
183 | - | let $ | |
184 | - | let allVestingsClaimActions = $ | |
185 | - | let sum = $ | |
186 | - | let $ | |
187 | - | let vestingClaimActions = $ | |
188 | - | let claimAmount = $ | |
191 | + | let $t055245564 = acc | |
192 | + | let allVestingsClaimActions = $t055245564._1 | |
193 | + | let sum = $t055245564._2 | |
194 | + | let $t055695646 = getUserClaimActions(userAddress, id) | |
195 | + | let vestingClaimActions = $t055695646._1 | |
196 | + | let claimAmount = $t055695646._2 | |
189 | 197 | $Tuple2((allVestingsClaimActions ++ vestingClaimActions), (sum + claimAmount)) | |
190 | 198 | } | |
191 | 199 | ||
192 | 200 | let $l = IDS_LIST | |
193 | 201 | let $s = size($l) | |
194 | 202 | let $acc0 = $Tuple2(nil, 0) | |
195 | 203 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
196 | 204 | then $a | |
197 | 205 | else actionsHelper($a, $l[$i]) | |
198 | 206 | ||
199 | 207 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
200 | 208 | then $a | |
201 | 209 | else throw("List size exceeds 30") | |
202 | 210 | ||
203 | 211 | $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($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) | |
204 | 212 | } | |
205 | 213 | ||
206 | 214 | ||
207 | 215 | func getMoveAllUnlockedToAccumulatorActions (userAddress) = { | |
208 | 216 | func actionsHelper (acc,id) = { | |
209 | - | let $ | |
210 | - | let updateAllVestingsActions = $ | |
211 | - | let sum = $ | |
212 | - | let $ | |
213 | - | let updateVestingActions = $ | |
214 | - | let unlockedAmount = $ | |
217 | + | let $t059395980 = acc | |
218 | + | let updateAllVestingsActions = $t059395980._1 | |
219 | + | let sum = $t059395980._2 | |
220 | + | let $t059856070 = getUpdateVestingActions(userAddress, id) | |
221 | + | let updateVestingActions = $t059856070._1 | |
222 | + | let unlockedAmount = $t059856070._2 | |
215 | 223 | $Tuple2((updateAllVestingsActions ++ updateVestingActions), (sum + unlockedAmount)) | |
216 | 224 | } | |
217 | 225 | ||
218 | - | let $ | |
226 | + | let $t061566244 = { | |
219 | 227 | let $l = IDS_LIST | |
220 | 228 | let $s = size($l) | |
221 | 229 | let $acc0 = $Tuple2(nil, 0) | |
222 | 230 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
223 | 231 | then $a | |
224 | 232 | else actionsHelper($a, $l[$i]) | |
225 | 233 | ||
226 | 234 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
227 | 235 | then $a | |
228 | 236 | else throw("List size exceeds 30") | |
229 | 237 | ||
230 | 238 | $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($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) | |
231 | 239 | } | |
232 | - | let updateAllVestingsActions = $ | |
233 | - | let unlockedSum = $ | |
240 | + | let updateAllVestingsActions = $t061566244._1 | |
241 | + | let unlockedSum = $t061566244._2 | |
234 | 242 | let oldAccumulated = valueOrElse(getInteger(this, keyUserAccumulated(userAddress)), 0) | |
235 | 243 | let updateAccumulatedActions = if ((unlockedSum != 0)) | |
236 | 244 | then [IntegerEntry(keyUserAccumulated(userAddress), (oldAccumulated + unlockedSum))] | |
237 | 245 | else nil | |
238 | 246 | $Tuple2((updateAllVestingsActions ++ updateAccumulatedActions), unlockedSum) | |
239 | 247 | } | |
240 | 248 | ||
241 | 249 | ||
242 | 250 | func getClaimAccumulatedActions (userAddress) = { | |
243 | 251 | let oldAccumulated = valueOrElse(getInteger(this, keyUserAccumulated(userAddress)), 0) | |
244 | 252 | if ((oldAccumulated != 0)) | |
245 | 253 | then $Tuple2([ScriptTransfer(addressFromStringValue(userAddress), oldAccumulated, assetIdBytes), DeleteEntry(keyUserAccumulated(userAddress))], oldAccumulated) | |
246 | 254 | else $Tuple2(nil, 0) | |
247 | 255 | } | |
248 | 256 | ||
249 | 257 | ||
250 | 258 | func getClaimAllActions (userAddress) = { | |
251 | - | let $ | |
259 | + | let $t070127145 = if (!(containsElement(banList, userAddress))) | |
252 | 260 | then getAllUserClaimActions(userAddress) | |
253 | 261 | else $Tuple2(nil, 0) | |
254 | - | let claimActions = $ | |
255 | - | let unlockedAmount = $ | |
256 | - | let $ | |
257 | - | let claimAccumulatedActions = $ | |
258 | - | let accumulatedAmount = $ | |
262 | + | let claimActions = $t070127145._1 | |
263 | + | let unlockedAmount = $t070127145._2 | |
264 | + | let $t071487238 = getClaimAccumulatedActions(userAddress) | |
265 | + | let claimAccumulatedActions = $t071487238._1 | |
266 | + | let accumulatedAmount = $t071487238._2 | |
259 | 267 | let totalAmount = (unlockedAmount + accumulatedAmount) | |
260 | 268 | $Tuple2((claimActions ++ claimAccumulatedActions), totalAmount) | |
261 | 269 | } | |
262 | 270 | ||
263 | 271 | ||
264 | 272 | func getVestingUserInfo (userAddress) = { | |
265 | 273 | func helper (acc,id) = { | |
266 | - | let $t070767155 = parseUserVesting(userAddress, id) | |
267 | - | let vestingAmount = $t070767155._1 | |
268 | - | let startBlock = $t070767155._2 | |
269 | - | let lockLength = $t070767155._3 | |
270 | - | let $t071607238 = getUserUnlockedAmount(userAddress, id) | |
271 | - | let unlockedAmount = $t071607238._1 | |
272 | - | let remainingAmount = $t071607238._2 | |
274 | + | let $t074527545 = parseUserVesting(userAddress, id) | |
275 | + | let vestingAmount = $t074527545._1 | |
276 | + | let startBlock = $t074527545._2 | |
277 | + | let lockLength = $t074527545._3 | |
278 | + | let totalClaimed = $t074527545._4 | |
279 | + | let $t075507628 = getUserUnlockedAmount(userAddress, id) | |
280 | + | let unlockedAmount = $t075507628._1 | |
281 | + | let remainingAmount = $t075507628._2 | |
273 | 282 | if (if ((vestingAmount == 0)) | |
274 | 283 | then true | |
275 | 284 | else containsElement(banList, userAddress)) | |
276 | 285 | then acc | |
277 | - | else (acc :+ [vestingAmount, (startBlock + lockLength), unlockedAmount, remainingAmount]) | |
286 | + | else (acc :+ [vestingAmount, (startBlock + lockLength), unlockedAmount, remainingAmount, totalClaimed]) | |
278 | 287 | } | |
279 | 288 | ||
280 | 289 | let $l = IDS_LIST | |
281 | 290 | let $s = size($l) | |
282 | 291 | let $acc0 = nil | |
283 | 292 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
284 | 293 | then $a | |
285 | 294 | else helper($a, $l[$i]) | |
286 | 295 | ||
287 | 296 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
288 | 297 | then $a | |
289 | 298 | else throw("List size exceeds 30") | |
290 | 299 | ||
291 | 300 | $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($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) | |
292 | 301 | } | |
293 | 302 | ||
294 | 303 | ||
295 | 304 | func getAvailableVestingId (userAddress) = { | |
296 | 305 | func helper (availableId,id) = { | |
297 | - | let $t075627641 = parseUserVesting(userAddress, id) | |
298 | - | let vestingAmount = $t075627641._1 | |
299 | - | let startBlock = $t075627641._2 | |
300 | - | let lockLength = $t075627641._3 | |
306 | + | let $t079668059 = parseUserVesting(userAddress, id) | |
307 | + | let vestingAmount = $t079668059._1 | |
308 | + | let startBlock = $t079668059._2 | |
309 | + | let lockLength = $t079668059._3 | |
310 | + | let totalClaimed = $t079668059._4 | |
301 | 311 | if ((vestingAmount > 0)) | |
302 | 312 | then availableId | |
303 | 313 | else if ((availableId == -1)) | |
304 | 314 | then id | |
305 | 315 | else min([availableId, id]) | |
306 | 316 | } | |
307 | 317 | ||
308 | 318 | let availableId = { | |
309 | 319 | let $l = IDS_LIST | |
310 | 320 | let $s = size($l) | |
311 | 321 | let $acc0 = -1 | |
312 | 322 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
313 | 323 | then $a | |
314 | 324 | else helper($a, $l[$i]) | |
315 | 325 | ||
316 | 326 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
317 | 327 | then $a | |
318 | 328 | else throw("List size exceeds 30") | |
319 | 329 | ||
320 | 330 | $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($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) | |
321 | 331 | } | |
322 | 332 | if ((availableId == -1)) | |
323 | 333 | then throwErr(makeString(["user exceeded max active vesting count: ", userAddress], " ")) | |
324 | 334 | else availableId | |
325 | 335 | } | |
326 | 336 | ||
327 | 337 | ||
328 | - | func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength))] | |
338 | + | func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength, 0))] | |
329 | 339 | ||
330 | 340 | ||
331 | 341 | @Callable(i) | |
332 | 342 | func vestingForUser (userAddress,vestingAmount,startBlock,lockLength) = { | |
333 | 343 | let check = [if ((size(i.payments) == 1)) | |
334 | 344 | then true | |
335 | 345 | else throwErr("should be with exactly 1 payment"), if ((i.payments[0].assetId == assetIdBytes)) | |
336 | 346 | then true | |
337 | 347 | else throwErr(makeString(["payment assetId should be: ", assetIdString], " ")), if ((i.payments[0].amount == vestingAmount)) | |
338 | 348 | then true | |
339 | 349 | else throwErr("payment amount should be equal to vestingAmount"), if (if ((adminList == nil)) | |
340 | 350 | then true | |
341 | 351 | else containsElement(adminList, toString(i.caller))) | |
342 | 352 | then true | |
343 | 353 | else throwErr("you must be admin")] | |
344 | 354 | if ((check == check)) | |
345 | 355 | then { | |
346 | 356 | let id = getAvailableVestingId(userAddress) | |
347 | 357 | let historyActions = [StringEntry(keyVestingHistory("vested", userAddress, toBase58String(i.transactionId)), makeString([toString(vestingAmount), toString(startBlock), toString(lockLength)], SEP))] | |
348 | 358 | (getNewVestingActions(userAddress, id, vestingAmount, startBlock, lockLength) ++ historyActions) | |
349 | 359 | } | |
350 | 360 | else throw("Strict value is not equal to itself.") | |
351 | 361 | } | |
352 | 362 | ||
353 | 363 | ||
354 | 364 | ||
355 | 365 | @Callable(i) | |
356 | 366 | func ban (userAddress) = { | |
357 | 367 | let checks = [if (if ((adminList == nil)) | |
358 | 368 | then true | |
359 | 369 | else containsElement(adminList, toString(i.caller))) | |
360 | 370 | then true | |
361 | 371 | else throwErr("you must be admin"), if (!(containsElement(banList, userAddress))) | |
362 | 372 | then true | |
363 | 373 | else throwErr(makeString(["user already in a ban list:", userAddress], " "))] | |
364 | 374 | if ((checks == checks)) | |
365 | 375 | then { | |
366 | - | let $ | |
367 | - | let moveToAccumulatedActions = $ | |
368 | - | let _a = $ | |
376 | + | let $t0992410012 = getMoveAllUnlockedToAccumulatorActions(userAddress) | |
377 | + | let moveToAccumulatedActions = $t0992410012._1 | |
378 | + | let _a = $t0992410012._2 | |
369 | 379 | let addToBanListActions = [StringEntry(keyBanList, makeString_11C((banList :+ userAddress), "__"))] | |
370 | 380 | (moveToAccumulatedActions ++ addToBanListActions) | |
371 | 381 | } | |
372 | 382 | else throw("Strict value is not equal to itself.") | |
373 | 383 | } | |
374 | 384 | ||
375 | 385 | ||
376 | 386 | ||
377 | 387 | @Callable(i) | |
378 | 388 | func unban (userAddress) = { | |
379 | 389 | let checks = [if (if ((adminList == nil)) | |
380 | 390 | then true | |
381 | 391 | else containsElement(adminList, toString(i.caller))) | |
382 | 392 | then true | |
383 | 393 | else throwErr("you must be admin"), if (containsElement(banList, userAddress)) | |
384 | 394 | then true | |
385 | 395 | else throwErr(makeString(["user not in a ban list:", userAddress], " "))] | |
386 | 396 | if ((checks == checks)) | |
387 | 397 | then { | |
388 | 398 | let newBanList = match indexOf(banList, userAddress) { | |
389 | 399 | case ind: Int => | |
390 | 400 | removeByIndex(banList, ind) | |
391 | 401 | case _ => | |
392 | 402 | throwErr("user address index in ban list is not found") | |
393 | 403 | } | |
394 | 404 | if ((newBanList == nil)) | |
395 | 405 | then [DeleteEntry(keyBanList)] | |
396 | 406 | else [StringEntry(keyBanList, makeString_11C(newBanList, "__"))] | |
397 | 407 | } | |
398 | 408 | else throw("Strict value is not equal to itself.") | |
399 | 409 | } | |
400 | 410 | ||
401 | 411 | ||
402 | 412 | ||
403 | 413 | @Callable(i) | |
404 | 414 | func claimAll () = { | |
405 | 415 | let userAddress = toString(i.caller) | |
406 | - | let $ | |
407 | - | let claimActions = $ | |
408 | - | let totalAmount = $ | |
416 | + | let $t01090510970 = getClaimAllActions(userAddress) | |
417 | + | let claimActions = $t01090510970._1 | |
418 | + | let totalAmount = $t01090510970._2 | |
409 | 419 | let historyActions = [StringEntry(keyVestingHistory("claimed", userAddress, toBase58String(i.transactionId)), toString(totalAmount))] | |
410 | 420 | if ((totalAmount > 0)) | |
411 | 421 | then (claimActions ++ historyActions) | |
412 | 422 | else throwErr("nothing to claim") | |
413 | 423 | } | |
414 | 424 | ||
415 | 425 | ||
416 | 426 | ||
417 | 427 | @Callable(i) | |
418 | 428 | func userInfoREADONLY (userAddress) = { | |
419 | - | let $ | |
420 | - | let _a = $ | |
421 | - | let totalAmount = $ | |
429 | + | let $t01157111626 = getClaimAllActions(userAddress) | |
430 | + | let _a = $t01157111626._1 | |
431 | + | let totalAmount = $t01157111626._2 | |
422 | 432 | let accumulatedAmount = valueOrElse(getInteger(this, keyUserAccumulated(userAddress)), 0) | |
423 | 433 | $Tuple2(nil, $Tuple3(totalAmount, accumulatedAmount, getVestingUserInfo(userAddress))) | |
424 | - | } | |
425 | - | ||
426 | - | ||
427 | - | ||
428 | - | @Callable(i) | |
429 | - | func foo () = { | |
430 | - | let ch = throw("err") | |
431 | - | if ((ch == ch)) | |
432 | - | then nil | |
433 | - | else throw("Strict value is not equal to itself.") | |
434 | 434 | } | |
435 | 435 | ||
436 | 436 | ||
437 | 437 | @Verifier(tx) | |
438 | 438 | func verify () = { | |
439 | 439 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
440 | 440 | case pk: ByteVector => | |
441 | 441 | pk | |
442 | 442 | case _: Unit => | |
443 | 443 | tx.senderPublicKey | |
444 | 444 | case _ => | |
445 | 445 | throw("Match error") | |
446 | 446 | } | |
447 | 447 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
448 | 448 | } | |
449 | 449 |
github/deemru/w8io/169f3d6 81.18 ms ◑