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