tx · 6aEtkic7w2kjoqE2KDr9ihPFQHfxwFKF9L5D11sWxXGK 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h: -0.01100000 Waves 2024.02.05 17:15 [2963067] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves
{ "type": 13, "id": "6aEtkic7w2kjoqE2KDr9ihPFQHfxwFKF9L5D11sWxXGK", "fee": 1100000, "feeAssetId": null, "timestamp": 1707142583517, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "2fnPGowErQiUwPon7QTh1bU1Z8mV7GXp4csur2dE5byYMpcLWt8gCCFJ3hHS24tMh6B8bk3EVA2NgcAqS7pHXSDz" ], "script": "base64:BgIqCAISAwoBARIDCgEIEgQKAggIEgMKAQgSBAoCCAESBAoCCAESAwoBARIAIgAMY29udHJhY3RGaWxlAhFsMm1wX2xlYXNpbmcucmlkZQADU0VQAgJfXwAGc2NhbGU4AIDC1y8BCHRocm93RXJyAQNtc2cJAAIBCQCsAgIJAKwCAgUMY29udHJhY3RGaWxlAgI6IAUDbXNnAAprZXlBc3NldElkCQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJZAUDbmlsBQNTRVAAEWtleVBlcmlvZE9mZnNldElkCQC5CQIJAMwIAgICJXMJAMwIAgIIb2Zmc2V0SWQFA25pbAUDU0VQABVrZXlQZXJpb2RPZmZzZXRIZWlnaHQJALkJAgkAzAgCAgIlcwkAzAgCAgxvZmZzZXRIZWlnaHQFA25pbAUDU0VQAA9rZXlQZXJpb2RMZW5ndGgJALkJAgkAzAgCAgIlcwkAzAgCAgxwZXJpb2RMZW5ndGgFA25pbAUDU0VQAA5wZXJpb2RPZmZzZXRJZAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRFrZXlQZXJpb2RPZmZzZXRJZ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xvY2tlZEFjdGlvbnMCBQt1c2VyQWRkcmVzcwUHdG9DbGFpbQBwXdPC", "height": 2963067, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BNTmFe1gxhB7dFTPouzucf7hfw552fVJ1i7BpTZ6L4AY Next: HrB96xP1V5rTpGr9vnLL1r6Q3Pyyp2S4Y4REcEa8Swpi Diff:
Old | New | Differences | |
---|---|---|---|
340 | 340 | } | |
341 | 341 | ||
342 | 342 | ||
343 | + | ||
344 | + | @Callable(i) | |
345 | + | func claimAll () = { | |
346 | + | let userAddress = toString(i.caller) | |
347 | + | let $t01182911901 = getUserBalances(userAddress) | |
348 | + | let periodId = $t01182911901._1 | |
349 | + | let leased = $t01182911901._2 | |
350 | + | let toUnlock = $t01182911901._3 | |
351 | + | let toClaim = $t01182911901._4 | |
352 | + | getClaimUnlockedActions(userAddress, toClaim) | |
353 | + | } | |
354 | + | ||
355 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "l2mp_leasing.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let scale8 = 100000000 | |
9 | 9 | ||
10 | 10 | func throwErr (msg) = throw(((contractFile + ": ") + msg)) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | let keyAssetId = makeString(["%s", "assetId"], SEP) | |
14 | 14 | ||
15 | 15 | let keyPeriodOffsetId = makeString(["%s", "offsetId"], SEP) | |
16 | 16 | ||
17 | 17 | let keyPeriodOffsetHeight = makeString(["%s", "offsetHeight"], SEP) | |
18 | 18 | ||
19 | 19 | let keyPeriodLength = makeString(["%s", "periodLength"], SEP) | |
20 | 20 | ||
21 | 21 | let periodOffsetId = valueOrElse(getInteger(this, keyPeriodOffsetId), 0) | |
22 | 22 | ||
23 | 23 | let periodLength = valueOrElse(getInteger(this, keyPeriodLength), 10000) | |
24 | 24 | ||
25 | 25 | let periodOffsetHeight = valueOrElse(getInteger(this, keyPeriodOffsetHeight), -1) | |
26 | 26 | ||
27 | 27 | let currentPeriodId = if (if ((height > periodOffsetHeight)) | |
28 | 28 | then (periodOffsetHeight != -1) | |
29 | 29 | else false) | |
30 | 30 | then (((height - periodOffsetHeight) / periodLength) + periodOffsetId) | |
31 | 31 | else max([0, (periodOffsetId - 1)]) | |
32 | 32 | ||
33 | 33 | func keyLeasingNodeData (nodeAddress) = makeString(["%s", "leasingNode", nodeAddress], SEP) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyUserLeasingNodeList (userAddress) = makeString(["%s%s", "userLeasingNodeList", userAddress], SEP) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", "userLeasingNodeData", userAddress, nodeAddress], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyUserBalances (userAddress) = makeString(["%s%s", "userBalances", userAddress], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
46 | 46 | ||
47 | 47 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
48 | 48 | then unit | |
49 | 49 | else fromBase58String(assetIdString) | |
50 | 50 | ||
51 | 51 | func isValidAddress (address) = match addressFromString(address) { | |
52 | 52 | case a: Address => | |
53 | 53 | true | |
54 | 54 | case _ => | |
55 | 55 | false | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func getLeasingNodeEntry (nodeAddress,totalLeased) = { | |
60 | 60 | let valueString = makeString(["%d", toString(totalLeased)], SEP) | |
61 | 61 | StringEntry(keyLeasingNodeData(nodeAddress), valueString) | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getLeasingNodeData (nodeAddress) = { | |
66 | 66 | let leasingDataStringRaw = getString(this, keyLeasingNodeData(nodeAddress)) | |
67 | 67 | match leasingDataStringRaw { | |
68 | 68 | case ds: String => | |
69 | 69 | let dataList = split(ds, SEP) | |
70 | 70 | let totalLeased = parseIntValue(dataList[1]) | |
71 | 71 | totalLeased | |
72 | 72 | case _ => | |
73 | 73 | 0 | |
74 | 74 | } | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func getUserLeasingEntry (nodeAddress,userAddress,totalUserLeased) = { | |
79 | 79 | let valueString = makeString(["%d", toString(totalUserLeased)], SEP) | |
80 | 80 | StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString) | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func getUserLeasingData (nodeAddress,userAddress) = { | |
85 | 85 | let leasingDataStringRaw = getString(this, keyUserLeasingNodeData(userAddress, nodeAddress)) | |
86 | 86 | match leasingDataStringRaw { | |
87 | 87 | case ds: String => | |
88 | 88 | let dataList = split(ds, SEP) | |
89 | 89 | let totalLeased = parseIntValue(dataList[1]) | |
90 | 90 | totalLeased | |
91 | 91 | case _ => | |
92 | 92 | 0 | |
93 | 93 | } | |
94 | 94 | } | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func getUserBalancesEntry (userAddress,periodId,leased,toUnlock,toClaim) = { | |
98 | 98 | let valueString = makeString(["%d%d%d%d", toString(periodId), toString(leased), toString(toUnlock), toString(toClaim)], SEP) | |
99 | 99 | StringEntry(keyUserBalances(userAddress), valueString) | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func getUserBalances (userAddress) = { | |
104 | 104 | let leasingDataStringRaw = getString(this, keyUserBalances(userAddress)) | |
105 | 105 | match leasingDataStringRaw { | |
106 | 106 | case ds: String => | |
107 | 107 | let dataList = split(ds, SEP) | |
108 | 108 | let periodId = parseIntValue(dataList[1]) | |
109 | 109 | let leased = parseIntValue(dataList[2]) | |
110 | 110 | let toUnlock = parseIntValue(dataList[3]) | |
111 | 111 | let toClaim = parseIntValue(dataList[4]) | |
112 | 112 | if (((currentPeriodId - periodId) > 0)) | |
113 | 113 | then $Tuple4(periodId, leased, 0, (toClaim + toUnlock)) | |
114 | 114 | else $Tuple4(periodId, leased, toUnlock, toClaim) | |
115 | 115 | case _ => | |
116 | 116 | $Tuple4(0, 0, 0, 0) | |
117 | 117 | } | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func getUserLeasingNodeList (userAddress) = { | |
122 | 122 | let leasingDataStringRaw = getString(this, keyUserLeasingNodeList(userAddress)) | |
123 | 123 | match leasingDataStringRaw { | |
124 | 124 | case ds: String => | |
125 | 125 | let dataList = split_51C(ds, SEP) | |
126 | 126 | dataList | |
127 | 127 | case _ => | |
128 | 128 | nil | |
129 | 129 | } | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func getUserNodeListEntry (userAddress,nodeList) = if ((size(nodeList) == 0)) | |
134 | 134 | then DeleteEntry(keyUserLeasingNodeList(userAddress)) | |
135 | 135 | else StringEntry(keyUserLeasingNodeList(userAddress), makeString_11C(nodeList, SEP)) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func addNodeToNodeList (userAddress,nodeAddress) = { | |
139 | 139 | let nodeList = getUserLeasingNodeList(userAddress) | |
140 | 140 | if (containsElement(nodeList, nodeAddress)) | |
141 | 141 | then nodeList | |
142 | 142 | else (nodeList :+ nodeAddress) | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func removeNodeFromNodeList (userAddress,nodeAddress) = { | |
147 | 147 | let nodeList = getUserLeasingNodeList(userAddress) | |
148 | 148 | match indexOf(nodeList, nodeAddress) { | |
149 | 149 | case index: Int => | |
150 | 150 | removeByIndex(nodeList, index) | |
151 | 151 | case _ => | |
152 | 152 | nodeList | |
153 | 153 | } | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func getStakeActions (nodeAddress,userAddress,i) = { | |
158 | 158 | let checks = [if ((size(i.payments) == 1)) | |
159 | 159 | then true | |
160 | 160 | else throwErr("payment size should be exactly 1"), if ((i.payments[0].assetId == assetIdBytes)) | |
161 | 161 | then true | |
162 | 162 | else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if (isValidAddress(nodeAddress)) | |
163 | 163 | then true | |
164 | 164 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
165 | 165 | then true | |
166 | 166 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
167 | 167 | if ((checks == checks)) | |
168 | 168 | then { | |
169 | 169 | let userLeasingAmount = i.payments[0].amount | |
170 | 170 | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
171 | 171 | let newTotalLease = (totalNodeLeased + userLeasingAmount) | |
172 | 172 | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
173 | 173 | let newUserTotalLease = (userTotalLeased + userLeasingAmount) | |
174 | 174 | let $t058645936 = getUserBalances(userAddress) | |
175 | 175 | let periodId = $t058645936._1 | |
176 | 176 | let leased = $t058645936._2 | |
177 | 177 | let toUnlock = $t058645936._3 | |
178 | 178 | let toClaim = $t058645936._4 | |
179 | 179 | let newLeased = (leased + userLeasingAmount) | |
180 | 180 | [getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
181 | 181 | } | |
182 | 182 | else throw("Strict value is not equal to itself.") | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = { | |
187 | 187 | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
188 | 188 | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
189 | 189 | let checks = [if ((unstakeAmount > 0)) | |
190 | 190 | then true | |
191 | 191 | else throwErr("unstake amount should be greater than 0"), if ((userTotalLeased >= unstakeAmount)) | |
192 | 192 | then true | |
193 | 193 | else throwErr("unstake amount should be less or equal user staked amount"), if ((totalNodeLeased >= unstakeAmount)) | |
194 | 194 | then true | |
195 | 195 | else throwErr("unstake amount should be less or equal node staked amount"), if (isValidAddress(nodeAddress)) | |
196 | 196 | then true | |
197 | 197 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
198 | 198 | then true | |
199 | 199 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
200 | 200 | if ((checks == checks)) | |
201 | 201 | then { | |
202 | 202 | let newTotalLease = (totalNodeLeased - unstakeAmount) | |
203 | 203 | let newUserTotalLease = (userTotalLeased - unstakeAmount) | |
204 | 204 | let $t072127284 = getUserBalances(userAddress) | |
205 | 205 | let periodId = $t072127284._1 | |
206 | 206 | let leased = $t072127284._2 | |
207 | 207 | let toUnlock = $t072127284._3 | |
208 | 208 | let toClaim = $t072127284._4 | |
209 | 209 | let newLeased = (leased - unstakeAmount) | |
210 | 210 | let newToUnlock = (toUnlock + unstakeAmount) | |
211 | 211 | let removeNodeActions = if ((newUserTotalLease == 0)) | |
212 | 212 | then [getUserNodeListEntry(userAddress, removeNodeFromNodeList(userAddress, nodeAddress))] | |
213 | 213 | else nil | |
214 | 214 | ([getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, currentPeriodId, newLeased, newToUnlock, toClaim)] ++ removeNodeActions) | |
215 | 215 | } | |
216 | 216 | else throw("Strict value is not equal to itself.") | |
217 | 217 | } | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | func getClaimUnlockedActions (userAddress,claimAmount) = { | |
221 | 221 | let $t078857957 = getUserBalances(userAddress) | |
222 | 222 | let periodId = $t078857957._1 | |
223 | 223 | let leased = $t078857957._2 | |
224 | 224 | let toUnlock = $t078857957._3 | |
225 | 225 | let toClaim = $t078857957._4 | |
226 | 226 | let checks = [if ((claimAmount > 0)) | |
227 | 227 | then true | |
228 | 228 | else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount)) | |
229 | 229 | then true | |
230 | 230 | else throwErr("claim amount should be less or equal unlocked amount"), if (isValidAddress(userAddress)) | |
231 | 231 | then true | |
232 | 232 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
233 | 233 | if ((checks == checks)) | |
234 | 234 | then { | |
235 | 235 | let newToClaim = (toClaim - claimAmount) | |
236 | 236 | [getUserBalancesEntry(userAddress, currentPeriodId, leased, toUnlock, newToClaim)] | |
237 | 237 | } | |
238 | 238 | else throw("Strict value is not equal to itself.") | |
239 | 239 | } | |
240 | 240 | ||
241 | 241 | ||
242 | 242 | func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = { | |
243 | 243 | let $t085348606 = getUserBalances(userAddress) | |
244 | 244 | let periodId = $t085348606._1 | |
245 | 245 | let leased = $t085348606._2 | |
246 | 246 | let toUnlock = $t085348606._3 | |
247 | 247 | let toClaim = $t085348606._4 | |
248 | 248 | let available = (toUnlock + toClaim) | |
249 | 249 | let checks = [if ((userLeasingAmount > 0)) | |
250 | 250 | then true | |
251 | 251 | else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount)) | |
252 | 252 | then true | |
253 | 253 | else throwErr("amount should be less or equal to available"), if (isValidAddress(nodeAddress)) | |
254 | 254 | then true | |
255 | 255 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
256 | 256 | then true | |
257 | 257 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
258 | 258 | if ((checks == checks)) | |
259 | 259 | then { | |
260 | 260 | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
261 | 261 | let newTotalLease = (totalNodeLeased + userLeasingAmount) | |
262 | 262 | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
263 | 263 | let newUserTotalLease = (userTotalLeased + userLeasingAmount) | |
264 | 264 | let newLeased = (leased + userLeasingAmount) | |
265 | 265 | let newToUnlock = max([0, (toUnlock - userLeasingAmount)]) | |
266 | 266 | let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))]) | |
267 | 267 | [getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, newToUnlock, newToClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
268 | 268 | } | |
269 | 269 | else throw("Strict value is not equal to itself.") | |
270 | 270 | } | |
271 | 271 | ||
272 | 272 | ||
273 | 273 | func getSetNewPeriodLengthActions (newPeriodLength) = { | |
274 | 274 | let check = [if ((newPeriodLength > 0)) | |
275 | 275 | then true | |
276 | 276 | else throwErr("period length should be greater than 0")] | |
277 | 277 | if ((check == check)) | |
278 | 278 | then if ((periodOffsetHeight == -1)) | |
279 | 279 | then [IntegerEntry(keyPeriodLength, newPeriodLength), IntegerEntry(keyPeriodOffsetHeight, height)] | |
280 | 280 | else { | |
281 | 281 | let newPeriodOffsetId = (currentPeriodId + 1) | |
282 | 282 | let newOffsetHeight = ((periodLength * (newPeriodOffsetId - periodOffsetId)) + periodOffsetHeight) | |
283 | 283 | [IntegerEntry(keyPeriodOffsetId, newPeriodOffsetId), IntegerEntry(keyPeriodOffsetHeight, newOffsetHeight), IntegerEntry(keyPeriodLength, newPeriodLength)] | |
284 | 284 | } | |
285 | 285 | else throw("Strict value is not equal to itself.") | |
286 | 286 | } | |
287 | 287 | ||
288 | 288 | ||
289 | 289 | @Callable(i) | |
290 | 290 | func setNewPeriodLength (newPeriodLength) = getSetNewPeriodLengthActions(newPeriodLength) | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | ||
294 | 294 | @Callable(i) | |
295 | 295 | func getUserData (userAddress) = { | |
296 | 296 | let $t01075810830 = getUserBalances(userAddress) | |
297 | 297 | let periodId = $t01075810830._1 | |
298 | 298 | let leased = $t01075810830._2 | |
299 | 299 | let toUnlock = $t01075810830._3 | |
300 | 300 | let toClaim = $t01075810830._4 | |
301 | 301 | let nodeList = getUserLeasingNodeList(userAddress) | |
302 | 302 | $Tuple2(nil, $Tuple6($Tuple2(currentPeriodId, periodLength), leased, toUnlock, toClaim, (toUnlock + toClaim), nodeList)) | |
303 | 303 | } | |
304 | 304 | ||
305 | 305 | ||
306 | 306 | ||
307 | 307 | @Callable(i) | |
308 | 308 | func stakeFor (nodeAddress,userAddress) = getStakeActions(nodeAddress, userAddress, i) | |
309 | 309 | ||
310 | 310 | ||
311 | 311 | ||
312 | 312 | @Callable(i) | |
313 | 313 | func stake (nodeAddress) = { | |
314 | 314 | let userAddress = toString(i.caller) | |
315 | 315 | getStakeActions(nodeAddress, userAddress, i) | |
316 | 316 | } | |
317 | 317 | ||
318 | 318 | ||
319 | 319 | ||
320 | 320 | @Callable(i) | |
321 | 321 | func stakeFromUnlocked (nodeAddress,amount) = { | |
322 | 322 | let userAddress = toString(i.caller) | |
323 | 323 | getStakeFromUnlockedActions(nodeAddress, userAddress, amount) | |
324 | 324 | } | |
325 | 325 | ||
326 | 326 | ||
327 | 327 | ||
328 | 328 | @Callable(i) | |
329 | 329 | func unstake (nodeAddress,amount) = { | |
330 | 330 | let userAddress = toString(i.caller) | |
331 | 331 | getUnstakeActions(nodeAddress, userAddress, amount) | |
332 | 332 | } | |
333 | 333 | ||
334 | 334 | ||
335 | 335 | ||
336 | 336 | @Callable(i) | |
337 | 337 | func claim (amount) = { | |
338 | 338 | let userAddress = toString(i.caller) | |
339 | 339 | getClaimUnlockedActions(userAddress, amount) | |
340 | 340 | } | |
341 | 341 | ||
342 | 342 | ||
343 | + | ||
344 | + | @Callable(i) | |
345 | + | func claimAll () = { | |
346 | + | let userAddress = toString(i.caller) | |
347 | + | let $t01182911901 = getUserBalances(userAddress) | |
348 | + | let periodId = $t01182911901._1 | |
349 | + | let leased = $t01182911901._2 | |
350 | + | let toUnlock = $t01182911901._3 | |
351 | + | let toClaim = $t01182911901._4 | |
352 | + | getClaimUnlockedActions(userAddress, toClaim) | |
353 | + | } | |
354 | + | ||
355 | + |
github/deemru/w8io/169f3d6 118.10 ms ◑