tx · Eh4JLzabPA8AzVPjEcfj9V8sMt8xCEzA8fRbiiqmRfY8 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h: -0.01300000 Waves 2024.02.14 09:54 [2975559] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves
{ "type": 13, "id": "Eh4JLzabPA8AzVPjEcfj9V8sMt8xCEzA8fRbiiqmRfY8", "fee": 1300000, "feeAssetId": null, "timestamp": 1707893655847, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "VSAfuztj954gxHaD8WXG9E2WDDRSdGXgWkqN92EsvvcYGiMPBQ9VQmtKucNqwjuCPAqdAQdLEHDtRzArFkHxNr6" ], "script": "base64:BgI0CAISAwoBARIDCgEEEgMKAQgSAwoBCBIECgIICBIDCgEIEgQKAggBEgQKAggBEgMKAQESACgADGNvbnRyYWN0RmlsZQIRbDJtcF9sZWFzaW5nLnJpZGUAA1NFUAICX18BCHRocm93RXJyAQNtc2cJAAIBCQCsAgIJAKwCAgUMY29udHJhY3RGaWxlAgI6IAUDbXNnAAprZXlBc3NldElkCQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJZAUDbmlsBQNTRVAADGtleUFkbWluTGlzdAkAuQkCCQDMCAICAiVzCQDMCAICCWFkbWluTGlzdAUDbmlsBQNTRVAADGtleUZvcmNlU3RvcAkAuQkCCQDMCAICAiVzCQDMCAICCWZvcmNlU3RvcAUDbmlsBQNTRVAAEWtleVBlcmlvZE9mZnNldElkCQC5CQIJAMwIAgICJXMJAMwIAgIIb2Zmc2V0SWQFA25pbAUDU0VQABVrZXlQZXJpb2RPZmZzZXRIZWlnaHQJALkJAgkAzAgCAgIlcwkAzAgCAgxvZmZzZXRIZWlnaHQFA25pbAUDU0VQAA9rZXlQZXJpb2RMZW5ndGgJALkJA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2NrZWQCC25vZGVBZGRyZXNzBmFtb3VudAQLdXNlckFkZHJlc3MJAKUIAQgFAWkGY2FsbGVyCQEbZ2V0U3Rha2VGcm9tVW5sb2NrZWRBY3Rpb25zAwULbm9kZUFkZHJlc3MFC3VzZXJBZGRyZXNzBQZhbW91bnQBaQELY2FuY2VsTGVhc2UCC25vZGVBZGRyZXNzBmFtb3VudAQLdXNlckFkZHJlc3MJAKUIAQgFAWkGY2FsbGVyCQERZ2V0VW5zdGFrZUFjdGlvbnMDBQtub2RlQWRkcmVzcwULdXNlckFkZHJlc3MFBmFtb3VudAFpAQVjbGFpbQEGYW1vdW50BAt1c2VyQWRkcmVzcwkApQgBCAUBaQZjYWxsZXIJARdnZXRDbGFpbVVubG9ja2VkQWN0aW9ucwIFC3VzZXJBZGRyZXNzBQZhbW91bnQBaQEIY2xhaW1BbGwABAt1c2VyQWRkcmVzcwkApQgBCAUBaQZjYWxsZXIEDSR0MDE0NTU4MTQ2MTgJARVnZXRVc2VyVG9DbGFpbUJhbGFuY2UBBQt1c2VyQWRkcmVzcwQHdG9DbGFpbQgFDSR0MDE0NTU4MTQ2MTgCXzEECHRvVW5sb2NrCAUNJHQwMTQ1NTgxNDYxOAJfMgQGY2hlY2tzCQDMCAIDCQBmAgUHdG9DbGFpbQAABgkBCHRocm93RXJyAQIQbm90aGluZyB0byBjbGFpbQUDbmlsAwkAAAIFBmNoZWNrcwUGY2hlY2tzCQEXZ2V0Q2xhaW1VbmxvY2tlZEFjdGlvbnMCBQt1c2VyQWRkcmVzcwUHdG9DbGFpbQkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgB6Kn7f", "height": 2975559, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EHjWDZsTpFpnHRJcNvoFYUXwufcHiSSgN5ZQY6LN25up Next: 4QGBpEr1MLNb9nuazfRv9SPBRzZKUCdU3UwUCYA7JvAo Diff:
Old | New | Differences | |
---|---|---|---|
39 | 39 | func keyLeasingNodeData (nodeAddress) = makeString(["%s", nodeAddress], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | + | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", nodeAddress, userAddress], SEP) | |
43 | + | ||
44 | + | ||
42 | 45 | func keyUserToClaim (userAddress) = makeString(["%s%s", "toClaim", userAddress], SEP) | |
43 | 46 | ||
44 | 47 | ||
45 | - | func | |
48 | + | func keyUserTotalLocked (userAddress) = makeString(["%s%s", "userTotalLocked", userAddress], SEP) | |
46 | 49 | ||
47 | 50 | ||
48 | 51 | func keyNodeLeasingByHeight (nodeAddress) = makeString(["%s%d", nodeAddress, toString(height)], SEP) | |
144 | 147 | } | |
145 | 148 | ||
146 | 149 | ||
150 | + | func getUserTotalLockedEntry (userAddress,userTotalLocked) = IntegerEntry(keyUserTotalLocked(userAddress), userTotalLocked) | |
151 | + | ||
152 | + | ||
153 | + | func getUserTotalLocked (userAddress) = valueOrElse(getInteger(this, keyUserTotalLocked(userAddress)), 0) | |
154 | + | ||
155 | + | ||
147 | 156 | func getStakeActions (nodeAddress,userAddress,i) = { | |
148 | 157 | let checks = [if (!(isForceStop)) | |
149 | 158 | then true | |
159 | 168 | if ((checks == checks)) | |
160 | 169 | then { | |
161 | 170 | let userLeasingAmount = i.payments[0].amount | |
162 | - | let $ | |
163 | - | let nodeCurrentLeased = $ | |
164 | - | let nodeNextLeased = $ | |
171 | + | let $t066206693 = getLeasingNodeData(nodeAddress) | |
172 | + | let nodeCurrentLeased = $t066206693._1 | |
173 | + | let nodeNextLeased = $t066206693._2 | |
165 | 174 | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
166 | - | let $ | |
167 | - | let userCurrentLeased = $ | |
168 | - | let userNextLeased = $ | |
175 | + | let $t067616847 = getUserLeasingData(nodeAddress, userAddress) | |
176 | + | let userCurrentLeased = $t067616847._1 | |
177 | + | let userNextLeased = $t067616847._2 | |
169 | 178 | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
170 | - | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
179 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
180 | + | let newUserTotalLocked = (userTotalLocked + userLeasingAmount) | |
181 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
171 | 182 | } | |
172 | 183 | else throw("Strict value is not equal to itself.") | |
173 | 184 | } | |
174 | 185 | ||
175 | 186 | ||
176 | 187 | func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = { | |
177 | - | let $ | |
178 | - | let nodeCurrentLeased = $ | |
179 | - | let nodeNextLeased = $ | |
180 | - | let $ | |
181 | - | let userCurrentLeased = $ | |
182 | - | let userNextLeased = $ | |
188 | + | let $t075497622 = getLeasingNodeData(nodeAddress) | |
189 | + | let nodeCurrentLeased = $t075497622._1 | |
190 | + | let nodeNextLeased = $t075497622._2 | |
191 | + | let $t076277713 = getUserLeasingData(nodeAddress, userAddress) | |
192 | + | let userCurrentLeased = $t076277713._1 | |
193 | + | let userNextLeased = $t076277713._2 | |
183 | 194 | let checks = [if (!(isForceStop)) | |
184 | 195 | then true | |
185 | 196 | else throwErr("contract is temporary stopped"), if ((unstakeAmount > 0)) | |
197 | 208 | then { | |
198 | 209 | let newNodeNextLease = (nodeNextLeased - unstakeAmount) | |
199 | 210 | let newUserNextLeased = (userNextLeased - unstakeAmount) | |
200 | - | let $ | |
201 | - | let toClaim = $ | |
202 | - | let toUnlock = $ | |
211 | + | let $t085268586 = getUserToClaimBalance(userAddress) | |
212 | + | let toClaim = $t085268586._1 | |
213 | + | let toUnlock = $t085268586._2 | |
203 | 214 | let newToUnlock = (toUnlock + unstakeAmount) | |
204 | - | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, toClaim, newToUnlock), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
215 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
216 | + | let newUserTotalLocked = (userTotalLocked - unstakeAmount) | |
217 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, toClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
205 | 218 | } | |
206 | 219 | else throw("Strict value is not equal to itself.") | |
207 | 220 | } | |
208 | 221 | ||
209 | 222 | ||
210 | 223 | func getClaimUnlockedActions (userAddress,claimAmount) = { | |
211 | - | let $ | |
212 | - | let toClaim = $ | |
213 | - | let toUnlock = $ | |
224 | + | let $t093159375 = getUserToClaimBalance(userAddress) | |
225 | + | let toClaim = $t093159375._1 | |
226 | + | let toUnlock = $t093159375._2 | |
214 | 227 | let checks = [if (!(isForceStop)) | |
215 | 228 | then true | |
216 | 229 | else throwErr("contract is temporary stopped"), if ((claimAmount > 0)) | |
230 | 243 | ||
231 | 244 | ||
232 | 245 | func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = { | |
233 | - | let $ | |
234 | - | let toClaim = $ | |
235 | - | let toUnlock = $ | |
246 | + | let $t01010910169 = getUserToClaimBalance(userAddress) | |
247 | + | let toClaim = $t01010910169._1 | |
248 | + | let toUnlock = $t01010910169._2 | |
236 | 249 | let available = (toUnlock + toClaim) | |
237 | 250 | let checks = [if (!(isForceStop)) | |
238 | 251 | then true | |
240 | 253 | then true | |
241 | 254 | else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount)) | |
242 | 255 | then true | |
243 | - | else throwErr("amount should be less or equal | |
256 | + | else throwErr("amount should be less or equal available amount"), if (isValidAddress(nodeAddress)) | |
244 | 257 | then true | |
245 | 258 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
246 | 259 | then true | |
247 | 260 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
248 | 261 | if ((checks == checks)) | |
249 | 262 | then { | |
250 | - | let $ | |
251 | - | let nodeCurrentLeased = $ | |
252 | - | let nodeNextLeased = $ | |
263 | + | let $t01075710830 = getLeasingNodeData(nodeAddress) | |
264 | + | let nodeCurrentLeased = $t01075710830._1 | |
265 | + | let nodeNextLeased = $t01075710830._2 | |
253 | 266 | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
254 | - | let $ | |
255 | - | let userCurrentLeased = $ | |
256 | - | let userNextLeased = $ | |
267 | + | let $t01089810984 = getUserLeasingData(nodeAddress, userAddress) | |
268 | + | let userCurrentLeased = $t01089810984._1 | |
269 | + | let userNextLeased = $t01089810984._2 | |
257 | 270 | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
258 | 271 | let newToUnlock = max([0, (toUnlock - userLeasingAmount)]) | |
259 | 272 | let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))]) | |
260 | - | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, newToClaim, newToUnlock), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
273 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
274 | + | let newUserTotalLocked = (userTotalLocked + userLeasingAmount) | |
275 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, newToClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
261 | 276 | } | |
262 | 277 | else throw("Strict value is not equal to itself.") | |
263 | 278 | } | |
301 | 316 | ||
302 | 317 | @Callable(i) | |
303 | 318 | func getNodeDataREADONLY (nodeAddress) = { | |
304 | - | let $ | |
305 | - | let currentLease = $ | |
306 | - | let nextLeased = $ | |
319 | + | let $t01307013134 = getLeasingNodeData(nodeAddress) | |
320 | + | let currentLease = $t01307013134._1 | |
321 | + | let nextLeased = $t01307013134._2 | |
307 | 322 | $Tuple2(nil, $Tuple5(currentPeriodHeight, currentLease, nextPeriodHeight, nextLeased, height)) | |
308 | 323 | } | |
309 | 324 | ||
311 | 326 | ||
312 | 327 | @Callable(i) | |
313 | 328 | func getUserDataREADONLY (userAddress) = { | |
314 | - | let $t01239912459 = getUserToClaimBalance(userAddress) | |
315 | - | let toClaim = $t01239912459._1 | |
316 | - | let toUnlock = $t01239912459._2 | |
317 | - | $Tuple2(nil, $Tuple5(currentPeriodHeight, toClaim, nextPeriodHeight, toUnlock, height)) | |
329 | + | let $t01349713557 = getUserToClaimBalance(userAddress) | |
330 | + | let toClaim = $t01349713557._1 | |
331 | + | let toUnlock = $t01349713557._2 | |
332 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
333 | + | $Tuple2(nil, $Tuple6(currentPeriodHeight, toClaim, nextPeriodHeight, toUnlock, userTotalLocked, height)) | |
318 | 334 | } | |
319 | 335 | ||
320 | 336 | ||
333 | 349 | ||
334 | 350 | ||
335 | 351 | @Callable(i) | |
336 | - | func | |
352 | + | func leaseFromLocked (nodeAddress,amount) = { | |
337 | 353 | let userAddress = toString(i.caller) | |
338 | 354 | getStakeFromUnlockedActions(nodeAddress, userAddress, amount) | |
339 | 355 | } | |
359 | 375 | @Callable(i) | |
360 | 376 | func claimAll () = { | |
361 | 377 | let userAddress = toString(i.caller) | |
362 | - | let $ | |
363 | - | let toClaim = $ | |
364 | - | let toUnlock = $ | |
378 | + | let $t01455814618 = getUserToClaimBalance(userAddress) | |
379 | + | let toClaim = $t01455814618._1 | |
380 | + | let toUnlock = $t01455814618._2 | |
365 | 381 | let checks = [if ((toClaim > 0)) | |
366 | 382 | then true | |
367 | 383 | else throwErr("nothing to claim")] |
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 | func throwErr (msg) = throw(((contractFile + ": ") + msg)) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | let keyAssetId = makeString(["%s", "assetId"], SEP) | |
12 | 12 | ||
13 | 13 | let keyAdminList = makeString(["%s", "adminList"], SEP) | |
14 | 14 | ||
15 | 15 | let keyForceStop = makeString(["%s", "forceStop"], SEP) | |
16 | 16 | ||
17 | 17 | let keyPeriodOffsetId = makeString(["%s", "offsetId"], SEP) | |
18 | 18 | ||
19 | 19 | let keyPeriodOffsetHeight = makeString(["%s", "offsetHeight"], SEP) | |
20 | 20 | ||
21 | 21 | let keyPeriodLength = makeString(["%s", "periodLength"], SEP) | |
22 | 22 | ||
23 | 23 | let periodOffsetId = valueOrElse(getInteger(this, keyPeriodOffsetId), 0) | |
24 | 24 | ||
25 | 25 | let periodLength = valueOrElse(getInteger(this, keyPeriodLength), 10000) | |
26 | 26 | ||
27 | 27 | let periodOffsetHeight = valueOrElse(getInteger(this, keyPeriodOffsetHeight), -1) | |
28 | 28 | ||
29 | 29 | let currentPeriodId = if (if ((height > periodOffsetHeight)) | |
30 | 30 | then (periodOffsetHeight != -1) | |
31 | 31 | else false) | |
32 | 32 | then (((height - periodOffsetHeight) / periodLength) + periodOffsetId) | |
33 | 33 | else max([0, (periodOffsetId - 1)]) | |
34 | 34 | ||
35 | 35 | let currentPeriodHeight = (periodOffsetHeight + ((currentPeriodId - periodOffsetId) * periodLength)) | |
36 | 36 | ||
37 | 37 | let nextPeriodHeight = (currentPeriodHeight + periodLength) | |
38 | 38 | ||
39 | 39 | func keyLeasingNodeData (nodeAddress) = makeString(["%s", nodeAddress], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | + | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", nodeAddress, userAddress], SEP) | |
43 | + | ||
44 | + | ||
42 | 45 | func keyUserToClaim (userAddress) = makeString(["%s%s", "toClaim", userAddress], SEP) | |
43 | 46 | ||
44 | 47 | ||
45 | - | func | |
48 | + | func keyUserTotalLocked (userAddress) = makeString(["%s%s", "userTotalLocked", userAddress], SEP) | |
46 | 49 | ||
47 | 50 | ||
48 | 51 | func keyNodeLeasingByHeight (nodeAddress) = makeString(["%s%d", nodeAddress, toString(height)], SEP) | |
49 | 52 | ||
50 | 53 | ||
51 | 54 | func keyUserLeasingByHeight (nodeAddress,userAddress) = makeString(["%s%s%d", nodeAddress, userAddress, toString(height)], SEP) | |
52 | 55 | ||
53 | 56 | ||
54 | 57 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
55 | 58 | ||
56 | 59 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
57 | 60 | then unit | |
58 | 61 | else fromBase58String(assetIdString) | |
59 | 62 | ||
60 | 63 | let adminListRaw = split(valueOrElse(getString(this, keyAdminList), ""), SEP) | |
61 | 64 | ||
62 | 65 | let isForceStop = valueOrElse(getBoolean(this, keyForceStop), false) | |
63 | 66 | ||
64 | 67 | func isAdmin (address) = containsElement(adminListRaw, address) | |
65 | 68 | ||
66 | 69 | ||
67 | 70 | func isValidAddress (address) = match addressFromString(address) { | |
68 | 71 | case a: Address => | |
69 | 72 | true | |
70 | 73 | case _ => | |
71 | 74 | false | |
72 | 75 | } | |
73 | 76 | ||
74 | 77 | ||
75 | 78 | func getLeasingNodeEntry (nodeAddress,currentLeased,nextLeased) = { | |
76 | 79 | let valueString = makeString(["%d%d%d%d", toString(currentPeriodHeight), toString(currentLeased), toString(nextPeriodHeight), toString(nextLeased)], SEP) | |
77 | 80 | StringEntry(keyLeasingNodeData(nodeAddress), valueString) | |
78 | 81 | } | |
79 | 82 | ||
80 | 83 | ||
81 | 84 | func getLeasingNodeData (nodeAddress) = { | |
82 | 85 | let leasingNodeDataStringRaw = getString(this, keyLeasingNodeData(nodeAddress)) | |
83 | 86 | match leasingNodeDataStringRaw { | |
84 | 87 | case ds: String => | |
85 | 88 | let dataList = split(ds, SEP) | |
86 | 89 | let nodeCurrentPeriod = parseIntValue(dataList[1]) | |
87 | 90 | let nodeCurrentLeased = parseIntValue(dataList[2]) | |
88 | 91 | let nodeNextPeriod = parseIntValue(dataList[3]) | |
89 | 92 | let nodeNextLeased = parseIntValue(dataList[4]) | |
90 | 93 | if ((nodeNextPeriod > height)) | |
91 | 94 | then $Tuple2(nodeCurrentLeased, nodeNextLeased) | |
92 | 95 | else $Tuple2(nodeNextLeased, nodeNextLeased) | |
93 | 96 | case _ => | |
94 | 97 | $Tuple2(0, 0) | |
95 | 98 | } | |
96 | 99 | } | |
97 | 100 | ||
98 | 101 | ||
99 | 102 | func getUserLeasingEntry (nodeAddress,userAddress,userCurrentLeased,userNextLeased) = { | |
100 | 103 | let valueString = makeString(["%d%d%d%d", toString(currentPeriodHeight), toString(userCurrentLeased), toString(nextPeriodHeight), toString(userNextLeased)], SEP) | |
101 | 104 | StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString) | |
102 | 105 | } | |
103 | 106 | ||
104 | 107 | ||
105 | 108 | func getUserLeasingData (nodeAddress,userAddress) = { | |
106 | 109 | let leasingUserDataStringRaw = getString(this, keyUserLeasingNodeData(userAddress, nodeAddress)) | |
107 | 110 | match leasingUserDataStringRaw { | |
108 | 111 | case ds: String => | |
109 | 112 | let dataList = split(ds, SEP) | |
110 | 113 | let userCurrentPeriod = parseIntValue(dataList[1]) | |
111 | 114 | let userCurrentLeased = parseIntValue(dataList[2]) | |
112 | 115 | let userNextPeriod = parseIntValue(dataList[3]) | |
113 | 116 | let userNextLeased = parseIntValue(dataList[4]) | |
114 | 117 | if ((userNextPeriod > height)) | |
115 | 118 | then $Tuple2(userCurrentLeased, userNextLeased) | |
116 | 119 | else $Tuple2(userNextLeased, userNextLeased) | |
117 | 120 | case _ => | |
118 | 121 | $Tuple2(0, 0) | |
119 | 122 | } | |
120 | 123 | } | |
121 | 124 | ||
122 | 125 | ||
123 | 126 | func getUserToClaimEntry (userAddress,toClaim,toUnlock) = { | |
124 | 127 | let valueString = makeString(["%d%d%d%d", toString(currentPeriodHeight), toString(toClaim), toString(nextPeriodHeight), toString(toUnlock)], SEP) | |
125 | 128 | StringEntry(keyUserToClaim(userAddress), valueString) | |
126 | 129 | } | |
127 | 130 | ||
128 | 131 | ||
129 | 132 | func getUserToClaimBalance (userAddress) = { | |
130 | 133 | let userToClaimDataStringRaw = getString(this, keyUserToClaim(userAddress)) | |
131 | 134 | match userToClaimDataStringRaw { | |
132 | 135 | case ds: String => | |
133 | 136 | let dataList = split(ds, SEP) | |
134 | 137 | let currentPeriod = parseIntValue(dataList[1]) | |
135 | 138 | let toClaim = parseIntValue(dataList[2]) | |
136 | 139 | let nextPeriod = parseIntValue(dataList[3]) | |
137 | 140 | let toUnlock = parseIntValue(dataList[4]) | |
138 | 141 | if ((nextPeriod > height)) | |
139 | 142 | then $Tuple2(toClaim, toUnlock) | |
140 | 143 | else $Tuple2((toClaim + toUnlock), 0) | |
141 | 144 | case _ => | |
142 | 145 | $Tuple2(0, 0) | |
143 | 146 | } | |
144 | 147 | } | |
145 | 148 | ||
146 | 149 | ||
150 | + | func getUserTotalLockedEntry (userAddress,userTotalLocked) = IntegerEntry(keyUserTotalLocked(userAddress), userTotalLocked) | |
151 | + | ||
152 | + | ||
153 | + | func getUserTotalLocked (userAddress) = valueOrElse(getInteger(this, keyUserTotalLocked(userAddress)), 0) | |
154 | + | ||
155 | + | ||
147 | 156 | func getStakeActions (nodeAddress,userAddress,i) = { | |
148 | 157 | let checks = [if (!(isForceStop)) | |
149 | 158 | then true | |
150 | 159 | else throwErr("contract is temporary stopped"), if ((size(i.payments) == 1)) | |
151 | 160 | then true | |
152 | 161 | else throwErr("payment size should be exactly 1"), if ((i.payments[0].assetId == assetIdBytes)) | |
153 | 162 | then true | |
154 | 163 | else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if (isValidAddress(nodeAddress)) | |
155 | 164 | then true | |
156 | 165 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
157 | 166 | then true | |
158 | 167 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
159 | 168 | if ((checks == checks)) | |
160 | 169 | then { | |
161 | 170 | let userLeasingAmount = i.payments[0].amount | |
162 | - | let $ | |
163 | - | let nodeCurrentLeased = $ | |
164 | - | let nodeNextLeased = $ | |
171 | + | let $t066206693 = getLeasingNodeData(nodeAddress) | |
172 | + | let nodeCurrentLeased = $t066206693._1 | |
173 | + | let nodeNextLeased = $t066206693._2 | |
165 | 174 | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
166 | - | let $ | |
167 | - | let userCurrentLeased = $ | |
168 | - | let userNextLeased = $ | |
175 | + | let $t067616847 = getUserLeasingData(nodeAddress, userAddress) | |
176 | + | let userCurrentLeased = $t067616847._1 | |
177 | + | let userNextLeased = $t067616847._2 | |
169 | 178 | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
170 | - | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
179 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
180 | + | let newUserTotalLocked = (userTotalLocked + userLeasingAmount) | |
181 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
171 | 182 | } | |
172 | 183 | else throw("Strict value is not equal to itself.") | |
173 | 184 | } | |
174 | 185 | ||
175 | 186 | ||
176 | 187 | func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = { | |
177 | - | let $ | |
178 | - | let nodeCurrentLeased = $ | |
179 | - | let nodeNextLeased = $ | |
180 | - | let $ | |
181 | - | let userCurrentLeased = $ | |
182 | - | let userNextLeased = $ | |
188 | + | let $t075497622 = getLeasingNodeData(nodeAddress) | |
189 | + | let nodeCurrentLeased = $t075497622._1 | |
190 | + | let nodeNextLeased = $t075497622._2 | |
191 | + | let $t076277713 = getUserLeasingData(nodeAddress, userAddress) | |
192 | + | let userCurrentLeased = $t076277713._1 | |
193 | + | let userNextLeased = $t076277713._2 | |
183 | 194 | let checks = [if (!(isForceStop)) | |
184 | 195 | then true | |
185 | 196 | else throwErr("contract is temporary stopped"), if ((unstakeAmount > 0)) | |
186 | 197 | then true | |
187 | 198 | else throwErr("unstake amount should be greater than 0"), if ((userNextLeased >= unstakeAmount)) | |
188 | 199 | then true | |
189 | 200 | else throwErr("unstake amount should be less or equal user staked amount"), if ((nodeNextLeased >= unstakeAmount)) | |
190 | 201 | then true | |
191 | 202 | else throwErr("unstake amount should be less or equal node staked amount"), if (isValidAddress(nodeAddress)) | |
192 | 203 | then true | |
193 | 204 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
194 | 205 | then true | |
195 | 206 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
196 | 207 | if ((checks == checks)) | |
197 | 208 | then { | |
198 | 209 | let newNodeNextLease = (nodeNextLeased - unstakeAmount) | |
199 | 210 | let newUserNextLeased = (userNextLeased - unstakeAmount) | |
200 | - | let $ | |
201 | - | let toClaim = $ | |
202 | - | let toUnlock = $ | |
211 | + | let $t085268586 = getUserToClaimBalance(userAddress) | |
212 | + | let toClaim = $t085268586._1 | |
213 | + | let toUnlock = $t085268586._2 | |
203 | 214 | let newToUnlock = (toUnlock + unstakeAmount) | |
204 | - | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, toClaim, newToUnlock), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
215 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
216 | + | let newUserTotalLocked = (userTotalLocked - unstakeAmount) | |
217 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, toClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
205 | 218 | } | |
206 | 219 | else throw("Strict value is not equal to itself.") | |
207 | 220 | } | |
208 | 221 | ||
209 | 222 | ||
210 | 223 | func getClaimUnlockedActions (userAddress,claimAmount) = { | |
211 | - | let $ | |
212 | - | let toClaim = $ | |
213 | - | let toUnlock = $ | |
224 | + | let $t093159375 = getUserToClaimBalance(userAddress) | |
225 | + | let toClaim = $t093159375._1 | |
226 | + | let toUnlock = $t093159375._2 | |
214 | 227 | let checks = [if (!(isForceStop)) | |
215 | 228 | then true | |
216 | 229 | else throwErr("contract is temporary stopped"), if ((claimAmount > 0)) | |
217 | 230 | then true | |
218 | 231 | else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount)) | |
219 | 232 | then true | |
220 | 233 | else throwErr("claim amount should be less or equal unlocked amount"), if (isValidAddress(userAddress)) | |
221 | 234 | then true | |
222 | 235 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
223 | 236 | if ((checks == checks)) | |
224 | 237 | then { | |
225 | 238 | let newToClaim = (toClaim - claimAmount) | |
226 | 239 | [getUserToClaimEntry(userAddress, newToClaim, toUnlock), ScriptTransfer(addressFromStringValue(userAddress), claimAmount, assetIdBytes)] | |
227 | 240 | } | |
228 | 241 | else throw("Strict value is not equal to itself.") | |
229 | 242 | } | |
230 | 243 | ||
231 | 244 | ||
232 | 245 | func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = { | |
233 | - | let $ | |
234 | - | let toClaim = $ | |
235 | - | let toUnlock = $ | |
246 | + | let $t01010910169 = getUserToClaimBalance(userAddress) | |
247 | + | let toClaim = $t01010910169._1 | |
248 | + | let toUnlock = $t01010910169._2 | |
236 | 249 | let available = (toUnlock + toClaim) | |
237 | 250 | let checks = [if (!(isForceStop)) | |
238 | 251 | then true | |
239 | 252 | else throwErr("contract is temporary stopped"), if ((userLeasingAmount > 0)) | |
240 | 253 | then true | |
241 | 254 | else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount)) | |
242 | 255 | then true | |
243 | - | else throwErr("amount should be less or equal | |
256 | + | else throwErr("amount should be less or equal available amount"), if (isValidAddress(nodeAddress)) | |
244 | 257 | then true | |
245 | 258 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
246 | 259 | then true | |
247 | 260 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
248 | 261 | if ((checks == checks)) | |
249 | 262 | then { | |
250 | - | let $ | |
251 | - | let nodeCurrentLeased = $ | |
252 | - | let nodeNextLeased = $ | |
263 | + | let $t01075710830 = getLeasingNodeData(nodeAddress) | |
264 | + | let nodeCurrentLeased = $t01075710830._1 | |
265 | + | let nodeNextLeased = $t01075710830._2 | |
253 | 266 | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
254 | - | let $ | |
255 | - | let userCurrentLeased = $ | |
256 | - | let userNextLeased = $ | |
267 | + | let $t01089810984 = getUserLeasingData(nodeAddress, userAddress) | |
268 | + | let userCurrentLeased = $t01089810984._1 | |
269 | + | let userNextLeased = $t01089810984._2 | |
257 | 270 | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
258 | 271 | let newToUnlock = max([0, (toUnlock - userLeasingAmount)]) | |
259 | 272 | let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))]) | |
260 | - | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, newToClaim, newToUnlock), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
273 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
274 | + | let newUserTotalLocked = (userTotalLocked + userLeasingAmount) | |
275 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, newToClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)] | |
261 | 276 | } | |
262 | 277 | else throw("Strict value is not equal to itself.") | |
263 | 278 | } | |
264 | 279 | ||
265 | 280 | ||
266 | 281 | func getSetNewPeriodLengthActions (newPeriodLength) = { | |
267 | 282 | let check = [if ((newPeriodLength > 0)) | |
268 | 283 | then true | |
269 | 284 | else throwErr("period length should be greater than 0")] | |
270 | 285 | if ((check == check)) | |
271 | 286 | then if ((periodOffsetHeight == -1)) | |
272 | 287 | then [IntegerEntry(keyPeriodLength, newPeriodLength), IntegerEntry(keyPeriodOffsetHeight, height)] | |
273 | 288 | else [IntegerEntry(keyPeriodOffsetId, (currentPeriodId + 1)), IntegerEntry(keyPeriodOffsetHeight, nextPeriodHeight), IntegerEntry(keyPeriodLength, newPeriodLength)] | |
274 | 289 | else throw("Strict value is not equal to itself.") | |
275 | 290 | } | |
276 | 291 | ||
277 | 292 | ||
278 | 293 | @Callable(i) | |
279 | 294 | func setNewPeriodLength (newPeriodLength) = { | |
280 | 295 | let checks = [if (isAdmin(toString(i.caller))) | |
281 | 296 | then true | |
282 | 297 | else throwErr("caller is not in adminList")] | |
283 | 298 | if ((checks == checks)) | |
284 | 299 | then getSetNewPeriodLengthActions(newPeriodLength) | |
285 | 300 | else throw("Strict value is not equal to itself.") | |
286 | 301 | } | |
287 | 302 | ||
288 | 303 | ||
289 | 304 | ||
290 | 305 | @Callable(i) | |
291 | 306 | func setForceStopFlag (stop) = { | |
292 | 307 | let check = [if (isAdmin(toString(i.caller))) | |
293 | 308 | then true | |
294 | 309 | else throwErr("caller is not an admin")] | |
295 | 310 | if ((check == check)) | |
296 | 311 | then [BooleanEntry(keyForceStop, stop)] | |
297 | 312 | else throw("Strict value is not equal to itself.") | |
298 | 313 | } | |
299 | 314 | ||
300 | 315 | ||
301 | 316 | ||
302 | 317 | @Callable(i) | |
303 | 318 | func getNodeDataREADONLY (nodeAddress) = { | |
304 | - | let $ | |
305 | - | let currentLease = $ | |
306 | - | let nextLeased = $ | |
319 | + | let $t01307013134 = getLeasingNodeData(nodeAddress) | |
320 | + | let currentLease = $t01307013134._1 | |
321 | + | let nextLeased = $t01307013134._2 | |
307 | 322 | $Tuple2(nil, $Tuple5(currentPeriodHeight, currentLease, nextPeriodHeight, nextLeased, height)) | |
308 | 323 | } | |
309 | 324 | ||
310 | 325 | ||
311 | 326 | ||
312 | 327 | @Callable(i) | |
313 | 328 | func getUserDataREADONLY (userAddress) = { | |
314 | - | let $t01239912459 = getUserToClaimBalance(userAddress) | |
315 | - | let toClaim = $t01239912459._1 | |
316 | - | let toUnlock = $t01239912459._2 | |
317 | - | $Tuple2(nil, $Tuple5(currentPeriodHeight, toClaim, nextPeriodHeight, toUnlock, height)) | |
329 | + | let $t01349713557 = getUserToClaimBalance(userAddress) | |
330 | + | let toClaim = $t01349713557._1 | |
331 | + | let toUnlock = $t01349713557._2 | |
332 | + | let userTotalLocked = getUserTotalLocked(userAddress) | |
333 | + | $Tuple2(nil, $Tuple6(currentPeriodHeight, toClaim, nextPeriodHeight, toUnlock, userTotalLocked, height)) | |
318 | 334 | } | |
319 | 335 | ||
320 | 336 | ||
321 | 337 | ||
322 | 338 | @Callable(i) | |
323 | 339 | func leaseByAddress (nodeAddress,userAddress) = getStakeActions(nodeAddress, userAddress, i) | |
324 | 340 | ||
325 | 341 | ||
326 | 342 | ||
327 | 343 | @Callable(i) | |
328 | 344 | func lease (nodeAddress) = { | |
329 | 345 | let userAddress = toString(i.caller) | |
330 | 346 | getStakeActions(nodeAddress, userAddress, i) | |
331 | 347 | } | |
332 | 348 | ||
333 | 349 | ||
334 | 350 | ||
335 | 351 | @Callable(i) | |
336 | - | func | |
352 | + | func leaseFromLocked (nodeAddress,amount) = { | |
337 | 353 | let userAddress = toString(i.caller) | |
338 | 354 | getStakeFromUnlockedActions(nodeAddress, userAddress, amount) | |
339 | 355 | } | |
340 | 356 | ||
341 | 357 | ||
342 | 358 | ||
343 | 359 | @Callable(i) | |
344 | 360 | func cancelLease (nodeAddress,amount) = { | |
345 | 361 | let userAddress = toString(i.caller) | |
346 | 362 | getUnstakeActions(nodeAddress, userAddress, amount) | |
347 | 363 | } | |
348 | 364 | ||
349 | 365 | ||
350 | 366 | ||
351 | 367 | @Callable(i) | |
352 | 368 | func claim (amount) = { | |
353 | 369 | let userAddress = toString(i.caller) | |
354 | 370 | getClaimUnlockedActions(userAddress, amount) | |
355 | 371 | } | |
356 | 372 | ||
357 | 373 | ||
358 | 374 | ||
359 | 375 | @Callable(i) | |
360 | 376 | func claimAll () = { | |
361 | 377 | let userAddress = toString(i.caller) | |
362 | - | let $ | |
363 | - | let toClaim = $ | |
364 | - | let toUnlock = $ | |
378 | + | let $t01455814618 = getUserToClaimBalance(userAddress) | |
379 | + | let toClaim = $t01455814618._1 | |
380 | + | let toUnlock = $t01455814618._2 | |
365 | 381 | let checks = [if ((toClaim > 0)) | |
366 | 382 | then true | |
367 | 383 | else throwErr("nothing to claim")] | |
368 | 384 | if ((checks == checks)) | |
369 | 385 | then getClaimUnlockedActions(userAddress, toClaim) | |
370 | 386 | else throw("Strict value is not equal to itself.") | |
371 | 387 | } | |
372 | 388 | ||
373 | 389 |
github/deemru/w8io/026f985 80.72 ms ◑