tx · 42vGnGiVpH7pUFxoMExUo42xj52nfGRJQskBfYrVXMw1 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h: -0.01300000 Waves 2024.02.12 14:02 [2972950] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves
{ "type": 13, "id": "42vGnGiVpH7pUFxoMExUo42xj52nfGRJQskBfYrVXMw1", "fee": 1300000, "feeAssetId": null, "timestamp": 1707735756551, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "rNNyuHub6QVVU9qHqt2WqYmAVPjAR7qZQkCBEo4DXiFXovBLLohYEdh5eUDm3hi5vTSKi3EKdwYrKf8sDkenGAi" ], "script": "base64:BgIqCAISAwoBARIDCgEIEgQKAggIEgMKAQgSBAoCCAESBAoCCAESAwoBARIAJAAMY29udHJhY3RGaWxlAhFsMm1wX2xlYXNpbmcucmlkZQADU0VQAgJfXwAGc2NhbGU4AIDC1y8BCHRocm93RXJyAQNtc2cJAAIBCQCsAgIJAKwCAgUMY29udHJhY3RGaWxlAgI6IAUDbXNnAAprZXlBc3NldElkCQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJZAUDbmlsBQNTRVAAEWtleVBlcmlvZE9mZnNldElkCQC5CQIJAMwIAgICJXMJAMwIAgIIb2Zmc2V0SWQFA25pbAUDU0VQABVrZXlQZXJpb2RPZmZzZXRIZWlnaHQJALkJAgkAzAgCAgIlcwkAzAgCAgxvZmZzZXRIZWlnaHQFA25pbAUDU0VQAA9rZXlQZXJpb2RMZW5ndGgJALkJAgkAzAgCAgIlcwkAzAgCAgxwZXJpb2RMZW5ndGgFA25pbAUDU0VQAA5wZXJpb2RPZmZzZXRJZAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRFrZXlQZXJpb2RPZmZzZXRJZAAAAAx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Jlc3MGYW1vdW50BAt1c2VyQWRkcmVzcwkApQgBCAUBaQZjYWxsZXIJARFnZXRVbnN0YWtlQWN0aW9ucwMFC25vZGVBZGRyZXNzBQt1c2VyQWRkcmVzcwUGYW1vdW50AWkBBWNsYWltAQZhbW91bnQEC3VzZXJBZGRyZXNzCQClCAEIBQFpBmNhbGxlcgkBF2dldENsYWltVW5sb2NrZWRBY3Rpb25zAgULdXNlckFkZHJlc3MFBmFtb3VudAFpAQhjbGFpbUFsbAAEC3VzZXJBZGRyZXNzCQClCAEIBQFpBmNhbGxlcgQNJHQwMTQwMDAxNDA4NwkBFWdldFVzZXJUb0NsYWltQmFsYW5jZQEFC3VzZXJBZGRyZXNzBA1jdXJyZW50UGVyaW9kCAUNJHQwMTQwMDAxNDA4NwJfMQQHdG9DbGFpbQgFDSR0MDE0MDAwMTQwODcCXzIECm5leHRQZXJpb2QIBQ0kdDAxNDAwMDE0MDg3Al8zBAh0b1VubG9jawgFDSR0MDE0MDAwMTQwODcCXzQJARdnZXRDbGFpbVVubG9ja2VkQWN0aW9ucwIFC3VzZXJBZGRyZXNzBQd0b0NsYWltANQbd/M=", "height": 2972950, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FDxNChEkCHScZTSYJ6rffX4kSUAhr4AzgniBsZxzhYGc Next: 2b4k2v9V4QPpAYj1UMVF52Kofuvb55uFBkjiwHpBSxHw Diff:
Old | New | Differences | |
---|---|---|---|
30 | 30 | then (((height - periodOffsetHeight) / periodLength) + periodOffsetId) | |
31 | 31 | else max([0, (periodOffsetId - 1)]) | |
32 | 32 | ||
33 | - | func keyLeasingNodeData (nodeAddress) = makeString(["%s", "leasingNode", nodeAddress], SEP) | |
33 | + | let currentPeriodHeight = (periodOffsetHeight + ((currentPeriodId - periodOffsetId) * periodLength)) | |
34 | + | ||
35 | + | let nextPeriodHeight = (currentPeriodHeight + periodLength) | |
36 | + | ||
37 | + | func keyLeasingNodeData (nodeAddress) = makeString(["%s", nodeAddress], SEP) | |
34 | 38 | ||
35 | 39 | ||
36 | 40 | func keyUserLeasingNodeList (userAddress) = makeString(["%s%s", "userLeasingNodeList", userAddress], SEP) | |
37 | 41 | ||
38 | 42 | ||
39 | - | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", | |
43 | + | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", nodeAddress, userAddress], SEP) | |
40 | 44 | ||
41 | 45 | ||
42 | - | func | |
46 | + | func keyUserToClaim (userAddress) = makeString(["%s%s", "toClaim", userAddress], SEP) | |
43 | 47 | ||
44 | 48 | ||
45 | 49 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
56 | 60 | } | |
57 | 61 | ||
58 | 62 | ||
59 | - | func getLeasingNodeEntry (nodeAddress,totalLeased) = { | |
60 | - | let valueString = makeString(["%d", toString(totalLeased)], SEP) | |
61 | - | if ((totalLeased != 0)) | |
62 | - | then StringEntry(keyLeasingNodeData(nodeAddress), valueString) | |
63 | - | else DeleteEntry(keyLeasingNodeData(nodeAddress)) | |
63 | + | func getLeasingNodeEntry (nodeAddress,currentPeriod,currentLeased,nextPeriod,nextLeased) = { | |
64 | + | let valueString = makeString(["%d%d%d%d", toString(currentPeriod), toString(currentLeased), toString(nextPeriod), toString(nextLeased)], SEP) | |
65 | + | StringEntry(keyLeasingNodeData(nodeAddress), valueString) | |
64 | 66 | } | |
65 | 67 | ||
66 | 68 | ||
69 | 71 | match leasingDataStringRaw { | |
70 | 72 | case ds: String => | |
71 | 73 | let dataList = split(ds, SEP) | |
72 | - | let totalLeased = parseIntValue(dataList[1]) | |
73 | - | totalLeased | |
74 | + | let nodeCurrentPeriod = parseIntValue(dataList[1]) | |
75 | + | let nodeCurrentLeased = parseIntValue(dataList[2]) | |
76 | + | let nodeNextPeriod = parseIntValue(dataList[3]) | |
77 | + | let nodeNextLeased = parseIntValue(dataList[4]) | |
78 | + | if ((nodeNextPeriod > height)) | |
79 | + | then $Tuple4(nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, nodeNextLeased) | |
80 | + | else $Tuple4(currentPeriodHeight, nodeNextLeased, nextPeriodHeight, nodeNextLeased) | |
74 | 81 | case _ => | |
75 | - | 0 | |
82 | + | $Tuple4(0, 0, 0, 0) | |
76 | 83 | } | |
77 | 84 | } | |
78 | 85 | ||
79 | 86 | ||
80 | - | func getUserLeasingEntry (nodeAddress,userAddress,totalUserLeased) = { | |
81 | - | let valueString = makeString(["%d", toString(totalUserLeased)], SEP) | |
82 | - | if ((totalUserLeased != 0)) | |
83 | - | then StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString) | |
84 | - | else DeleteEntry(keyUserLeasingNodeData(userAddress, nodeAddress)) | |
87 | + | func getUserLeasingEntry (nodeAddress,userAddress,userCurrentPeriod,userCurrentLeased,userNextPeriod,userNextLeased) = { | |
88 | + | let valueString = makeString(["%d%d%d%d", toString(userCurrentPeriod), toString(userCurrentLeased), toString(userNextPeriod), toString(userNextLeased)], SEP) | |
89 | + | StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString) | |
85 | 90 | } | |
86 | 91 | ||
87 | 92 | ||
90 | 95 | match leasingDataStringRaw { | |
91 | 96 | case ds: String => | |
92 | 97 | let dataList = split(ds, SEP) | |
93 | - | let totalLeased = parseIntValue(dataList[1]) | |
94 | - | totalLeased | |
98 | + | let userCurrentPeriod = parseIntValue(dataList[1]) | |
99 | + | let userCurrentLeased = parseIntValue(dataList[2]) | |
100 | + | let userNextPeriod = parseIntValue(dataList[3]) | |
101 | + | let userNextLeased = parseIntValue(dataList[4]) | |
102 | + | if ((userNextPeriod > height)) | |
103 | + | then $Tuple4(userCurrentPeriod, userCurrentLeased, userNextPeriod, userNextLeased) | |
104 | + | else $Tuple4(currentPeriodHeight, userNextLeased, nextPeriodHeight, userNextLeased) | |
95 | 105 | case _ => | |
96 | - | 0 | |
106 | + | $Tuple4(0, 0, 0, 0) | |
97 | 107 | } | |
98 | 108 | } | |
99 | 109 | ||
100 | 110 | ||
101 | - | func | |
102 | - | let valueString = makeString(["%d%d%d%d", toString( | |
103 | - | StringEntry( | |
111 | + | func getUserToClaimEntry (userAddress,currentPeriod,toClaim,nextPeriod,toUnlock) = { | |
112 | + | let valueString = makeString(["%d%d%d%d", toString(currentPeriod), toString(toClaim), toString(nextPeriod), toString(toUnlock)], SEP) | |
113 | + | StringEntry(keyUserToClaim(userAddress), valueString) | |
104 | 114 | } | |
105 | 115 | ||
106 | 116 | ||
107 | - | func | |
108 | - | let | |
109 | - | match | |
117 | + | func getUserToClaimBalance (userAddress) = { | |
118 | + | let userToClaimDataRaw = getString(this, keyUserToClaim(userAddress)) | |
119 | + | match userToClaimDataRaw { | |
110 | 120 | case ds: String => | |
111 | 121 | let dataList = split(ds, SEP) | |
112 | - | let | |
113 | - | let | |
114 | - | let | |
115 | - | let | |
116 | - | if (( | |
117 | - | then $Tuple4( | |
118 | - | else $Tuple4( | |
122 | + | let currentPeriod = parseIntValue(dataList[1]) | |
123 | + | let toClaim = parseIntValue(dataList[2]) | |
124 | + | let nextPeriod = parseIntValue(dataList[3]) | |
125 | + | let toUnlock = parseIntValue(dataList[4]) | |
126 | + | if ((nextPeriod > height)) | |
127 | + | then $Tuple4(currentPeriod, toClaim, nextPeriod, toUnlock) | |
128 | + | else $Tuple4(currentPeriodHeight, (toClaim + toUnlock), nextPeriodHeight, 0) | |
119 | 129 | case _ => | |
120 | 130 | $Tuple4(0, 0, 0, 0) | |
121 | 131 | } | |
171 | 181 | if ((checks == checks)) | |
172 | 182 | then { | |
173 | 183 | let userLeasingAmount = i.payments[0].amount | |
174 | - | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
175 | - | let newTotalLease = (totalNodeLeased + userLeasingAmount) | |
176 | - | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
177 | - | let newUserTotalLease = (userTotalLeased + userLeasingAmount) | |
178 | - | let $t060716143 = getUserBalances(userAddress) | |
179 | - | let periodId = $t060716143._1 | |
180 | - | let leased = $t060716143._2 | |
181 | - | let toUnlock = $t060716143._3 | |
182 | - | let toClaim = $t060716143._4 | |
183 | - | let newLeased = (leased + userLeasingAmount) | |
184 | - | [getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
184 | + | let $t070397147 = getLeasingNodeData(nodeAddress) | |
185 | + | let nodeCurrentPeriod = $t070397147._1 | |
186 | + | let nodeCurrentLeased = $t070397147._2 | |
187 | + | let nodeNextPeriod = $t070397147._3 | |
188 | + | let nodeNextLeased = $t070397147._4 | |
189 | + | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
190 | + | let $t072157336 = getUserLeasingData(nodeAddress, userAddress) | |
191 | + | let userCurrentPeriod = $t072157336._1 | |
192 | + | let userCurrentLeased = $t072157336._2 | |
193 | + | let userNextPeriod = $t072157336._3 | |
194 | + | let userNextLeased = $t072157336._4 | |
195 | + | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
196 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentPeriod, userCurrentLeased, userNextPeriod, newUserNextLeased), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
185 | 197 | } | |
186 | 198 | else throw("Strict value is not equal to itself.") | |
187 | 199 | } | |
188 | 200 | ||
189 | 201 | ||
190 | 202 | func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = { | |
191 | - | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
192 | - | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
203 | + | let $t080248132 = getLeasingNodeData(nodeAddress) | |
204 | + | let nodeCurrentPeriod = $t080248132._1 | |
205 | + | let nodeCurrentLeased = $t080248132._2 | |
206 | + | let nodeNextPeriod = $t080248132._3 | |
207 | + | let nodeNextLeased = $t080248132._4 | |
208 | + | let $t081378258 = getUserLeasingData(nodeAddress, userAddress) | |
209 | + | let userCurrentPeriod = $t081378258._1 | |
210 | + | let userCurrentLeased = $t081378258._2 | |
211 | + | let userNextPeriod = $t081378258._3 | |
212 | + | let userNextLeased = $t081378258._4 | |
193 | 213 | let checks = [if ((unstakeAmount > 0)) | |
194 | 214 | then true | |
195 | - | else throwErr("unstake amount should be greater than 0"), if (( | |
215 | + | else throwErr("unstake amount should be greater than 0"), if ((userNextLeased >= unstakeAmount)) | |
196 | 216 | then true | |
197 | - | else throwErr("unstake amount should be less or equal user staked amount"), if (( | |
217 | + | else throwErr("unstake amount should be less or equal user staked amount"), if ((nodeNextLeased >= unstakeAmount)) | |
198 | 218 | then true | |
199 | 219 | else throwErr("unstake amount should be less or equal node staked amount"), if (isValidAddress(nodeAddress)) | |
200 | 220 | then true | |
203 | 223 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
204 | 224 | if ((checks == checks)) | |
205 | 225 | then { | |
206 | - | let newTotalLease = (totalNodeLeased - unstakeAmount) | |
207 | - | let newUserTotalLease = (userTotalLeased - unstakeAmount) | |
208 | - | let $t074197491 = getUserBalances(userAddress) | |
209 | - | let periodId = $t074197491._1 | |
210 | - | let leased = $t074197491._2 | |
211 | - | let toUnlock = $t074197491._3 | |
212 | - | let toClaim = $t074197491._4 | |
213 | - | let newLeased = (leased - unstakeAmount) | |
226 | + | let newNodeNextLease = (nodeNextLeased - unstakeAmount) | |
227 | + | let newUserNextLeased = (userNextLeased - unstakeAmount) | |
228 | + | let $t089519083 = getUserToClaimBalance(userAddress) | |
229 | + | let currentPeriod = $t089519083._1 | |
230 | + | let toClaim = $t089519083._2 | |
231 | + | let nextPeriod = $t089519083._3 | |
232 | + | let toUnlock = $t089519083._4 | |
214 | 233 | let newToUnlock = (toUnlock + unstakeAmount) | |
215 | - | let removeNodeActions = if (( | |
234 | + | let removeNodeActions = if ((newUserNextLeased == 0)) | |
216 | 235 | then [getUserNodeListEntry(userAddress, removeNodeFromNodeList(userAddress, nodeAddress))] | |
217 | 236 | else nil | |
218 | - | ([getLeasingNodeEntry(nodeAddress, | |
237 | + | ([getLeasingNodeEntry(nodeAddress, nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentPeriod, userCurrentLeased, userNextPeriod, newUserNextLeased), getUserToClaimEntry(userAddress, currentPeriod, toClaim, nextPeriod, newToUnlock)] ++ removeNodeActions) | |
219 | 238 | } | |
220 | 239 | else throw("Strict value is not equal to itself.") | |
221 | 240 | } | |
222 | 241 | ||
223 | 242 | ||
224 | 243 | func getClaimUnlockedActions (userAddress,claimAmount) = { | |
225 | - | let $ | |
226 | - | let | |
227 | - | let | |
228 | - | let | |
229 | - | let | |
244 | + | let $t097509837 = getUserToClaimBalance(userAddress) | |
245 | + | let currentPeriod = $t097509837._1 | |
246 | + | let toClaim = $t097509837._2 | |
247 | + | let nextPeriod = $t097509837._3 | |
248 | + | let toUnlock = $t097509837._4 | |
230 | 249 | let checks = [if ((claimAmount > 0)) | |
231 | 250 | then true | |
232 | 251 | else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount)) | |
237 | 256 | if ((checks == checks)) | |
238 | 257 | then { | |
239 | 258 | let newToClaim = (toClaim - claimAmount) | |
240 | - | [ | |
259 | + | [getUserToClaimEntry(userAddress, currentPeriod, newToClaim, nextPeriod, toUnlock), ScriptTransfer(addressFromStringValue(userAddress), claimAmount, assetIdBytes)] | |
241 | 260 | } | |
242 | 261 | else throw("Strict value is not equal to itself.") | |
243 | 262 | } | |
244 | 263 | ||
245 | 264 | ||
246 | 265 | func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = { | |
247 | - | let $ | |
248 | - | let | |
249 | - | let | |
250 | - | let | |
251 | - | let | |
266 | + | let $t01050410591 = getUserToClaimBalance(userAddress) | |
267 | + | let currentPeriod = $t01050410591._1 | |
268 | + | let toClaim = $t01050410591._2 | |
269 | + | let nextPeriod = $t01050410591._3 | |
270 | + | let toUnlock = $t01050410591._4 | |
252 | 271 | let available = (toUnlock + toClaim) | |
253 | 272 | let checks = [if ((userLeasingAmount > 0)) | |
254 | 273 | then true | |
261 | 280 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
262 | 281 | if ((checks == checks)) | |
263 | 282 | then { | |
264 | - | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
265 | - | let newTotalLease = (totalNodeLeased + userLeasingAmount) | |
266 | - | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
267 | - | let newUserTotalLease = (userTotalLeased + userLeasingAmount) | |
268 | - | let newLeased = (leased + userLeasingAmount) | |
283 | + | let $t01106811176 = getLeasingNodeData(nodeAddress) | |
284 | + | let nodeCurrentPeriod = $t01106811176._1 | |
285 | + | let nodeCurrentLeased = $t01106811176._2 | |
286 | + | let nodeNextPeriod = $t01106811176._3 | |
287 | + | let nodeNextLeased = $t01106811176._4 | |
288 | + | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
289 | + | let $t01124411365 = getUserLeasingData(nodeAddress, userAddress) | |
290 | + | let userCurrentPeriod = $t01124411365._1 | |
291 | + | let userCurrentLeased = $t01124411365._2 | |
292 | + | let userNextPeriod = $t01124411365._3 | |
293 | + | let userNextLeased = $t01124411365._4 | |
294 | + | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
269 | 295 | let newToUnlock = max([0, (toUnlock - userLeasingAmount)]) | |
270 | 296 | let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))]) | |
271 | - | [getLeasingNodeEntry(nodeAddress, | |
297 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, nodeNextLeased), getUserLeasingEntry(nodeAddress, userAddress, userCurrentPeriod, userCurrentLeased, userNextPeriod, newUserNextLeased), getUserToClaimEntry(userAddress, currentPeriod, newToClaim, nextPeriod, newToUnlock), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
272 | 298 | } | |
273 | 299 | else throw("Strict value is not equal to itself.") | |
274 | 300 | } | |
297 | 323 | ||
298 | 324 | @Callable(i) | |
299 | 325 | func getUserData (userAddress) = { | |
300 | - | let $ | |
301 | - | let | |
302 | - | let | |
303 | - | let | |
304 | - | let | |
326 | + | let $t01292213009 = getUserToClaimBalance(userAddress) | |
327 | + | let currentPeriod = $t01292213009._1 | |
328 | + | let toClaim = $t01292213009._2 | |
329 | + | let nextPeriod = $t01292213009._3 | |
330 | + | let toUnlock = $t01292213009._4 | |
305 | 331 | let nodeList = getUserLeasingNodeList(userAddress) | |
306 | - | $Tuple2(nil, $ | |
332 | + | $Tuple2(nil, $Tuple5($Tuple2(currentPeriodId, periodLength), toClaim, toUnlock, (toUnlock + toClaim), nodeList)) | |
307 | 333 | } | |
308 | 334 | ||
309 | 335 | ||
348 | 374 | @Callable(i) | |
349 | 375 | func claimAll () = { | |
350 | 376 | let userAddress = toString(i.caller) | |
351 | - | let $ | |
352 | - | let | |
353 | - | let | |
354 | - | let | |
355 | - | let | |
377 | + | let $t01400014087 = getUserToClaimBalance(userAddress) | |
378 | + | let currentPeriod = $t01400014087._1 | |
379 | + | let toClaim = $t01400014087._2 | |
380 | + | let nextPeriod = $t01400014087._3 | |
381 | + | let toUnlock = $t01400014087._4 | |
356 | 382 | getClaimUnlockedActions(userAddress, toClaim) | |
357 | 383 | } | |
358 | 384 |
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 | - | func keyLeasingNodeData (nodeAddress) = makeString(["%s", "leasingNode", nodeAddress], SEP) | |
33 | + | let currentPeriodHeight = (periodOffsetHeight + ((currentPeriodId - periodOffsetId) * periodLength)) | |
34 | + | ||
35 | + | let nextPeriodHeight = (currentPeriodHeight + periodLength) | |
36 | + | ||
37 | + | func keyLeasingNodeData (nodeAddress) = makeString(["%s", nodeAddress], SEP) | |
34 | 38 | ||
35 | 39 | ||
36 | 40 | func keyUserLeasingNodeList (userAddress) = makeString(["%s%s", "userLeasingNodeList", userAddress], SEP) | |
37 | 41 | ||
38 | 42 | ||
39 | - | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", | |
43 | + | func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", nodeAddress, userAddress], SEP) | |
40 | 44 | ||
41 | 45 | ||
42 | - | func | |
46 | + | func keyUserToClaim (userAddress) = makeString(["%s%s", "toClaim", userAddress], SEP) | |
43 | 47 | ||
44 | 48 | ||
45 | 49 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
46 | 50 | ||
47 | 51 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
48 | 52 | then unit | |
49 | 53 | else fromBase58String(assetIdString) | |
50 | 54 | ||
51 | 55 | func isValidAddress (address) = match addressFromString(address) { | |
52 | 56 | case a: Address => | |
53 | 57 | true | |
54 | 58 | case _ => | |
55 | 59 | false | |
56 | 60 | } | |
57 | 61 | ||
58 | 62 | ||
59 | - | func getLeasingNodeEntry (nodeAddress,totalLeased) = { | |
60 | - | let valueString = makeString(["%d", toString(totalLeased)], SEP) | |
61 | - | if ((totalLeased != 0)) | |
62 | - | then StringEntry(keyLeasingNodeData(nodeAddress), valueString) | |
63 | - | else DeleteEntry(keyLeasingNodeData(nodeAddress)) | |
63 | + | func getLeasingNodeEntry (nodeAddress,currentPeriod,currentLeased,nextPeriod,nextLeased) = { | |
64 | + | let valueString = makeString(["%d%d%d%d", toString(currentPeriod), toString(currentLeased), toString(nextPeriod), toString(nextLeased)], SEP) | |
65 | + | StringEntry(keyLeasingNodeData(nodeAddress), valueString) | |
64 | 66 | } | |
65 | 67 | ||
66 | 68 | ||
67 | 69 | func getLeasingNodeData (nodeAddress) = { | |
68 | 70 | let leasingDataStringRaw = getString(this, keyLeasingNodeData(nodeAddress)) | |
69 | 71 | match leasingDataStringRaw { | |
70 | 72 | case ds: String => | |
71 | 73 | let dataList = split(ds, SEP) | |
72 | - | let totalLeased = parseIntValue(dataList[1]) | |
73 | - | totalLeased | |
74 | + | let nodeCurrentPeriod = parseIntValue(dataList[1]) | |
75 | + | let nodeCurrentLeased = parseIntValue(dataList[2]) | |
76 | + | let nodeNextPeriod = parseIntValue(dataList[3]) | |
77 | + | let nodeNextLeased = parseIntValue(dataList[4]) | |
78 | + | if ((nodeNextPeriod > height)) | |
79 | + | then $Tuple4(nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, nodeNextLeased) | |
80 | + | else $Tuple4(currentPeriodHeight, nodeNextLeased, nextPeriodHeight, nodeNextLeased) | |
74 | 81 | case _ => | |
75 | - | 0 | |
82 | + | $Tuple4(0, 0, 0, 0) | |
76 | 83 | } | |
77 | 84 | } | |
78 | 85 | ||
79 | 86 | ||
80 | - | func getUserLeasingEntry (nodeAddress,userAddress,totalUserLeased) = { | |
81 | - | let valueString = makeString(["%d", toString(totalUserLeased)], SEP) | |
82 | - | if ((totalUserLeased != 0)) | |
83 | - | then StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString) | |
84 | - | else DeleteEntry(keyUserLeasingNodeData(userAddress, nodeAddress)) | |
87 | + | func getUserLeasingEntry (nodeAddress,userAddress,userCurrentPeriod,userCurrentLeased,userNextPeriod,userNextLeased) = { | |
88 | + | let valueString = makeString(["%d%d%d%d", toString(userCurrentPeriod), toString(userCurrentLeased), toString(userNextPeriod), toString(userNextLeased)], SEP) | |
89 | + | StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString) | |
85 | 90 | } | |
86 | 91 | ||
87 | 92 | ||
88 | 93 | func getUserLeasingData (nodeAddress,userAddress) = { | |
89 | 94 | let leasingDataStringRaw = getString(this, keyUserLeasingNodeData(userAddress, nodeAddress)) | |
90 | 95 | match leasingDataStringRaw { | |
91 | 96 | case ds: String => | |
92 | 97 | let dataList = split(ds, SEP) | |
93 | - | let totalLeased = parseIntValue(dataList[1]) | |
94 | - | totalLeased | |
98 | + | let userCurrentPeriod = parseIntValue(dataList[1]) | |
99 | + | let userCurrentLeased = parseIntValue(dataList[2]) | |
100 | + | let userNextPeriod = parseIntValue(dataList[3]) | |
101 | + | let userNextLeased = parseIntValue(dataList[4]) | |
102 | + | if ((userNextPeriod > height)) | |
103 | + | then $Tuple4(userCurrentPeriod, userCurrentLeased, userNextPeriod, userNextLeased) | |
104 | + | else $Tuple4(currentPeriodHeight, userNextLeased, nextPeriodHeight, userNextLeased) | |
95 | 105 | case _ => | |
96 | - | 0 | |
106 | + | $Tuple4(0, 0, 0, 0) | |
97 | 107 | } | |
98 | 108 | } | |
99 | 109 | ||
100 | 110 | ||
101 | - | func | |
102 | - | let valueString = makeString(["%d%d%d%d", toString( | |
103 | - | StringEntry( | |
111 | + | func getUserToClaimEntry (userAddress,currentPeriod,toClaim,nextPeriod,toUnlock) = { | |
112 | + | let valueString = makeString(["%d%d%d%d", toString(currentPeriod), toString(toClaim), toString(nextPeriod), toString(toUnlock)], SEP) | |
113 | + | StringEntry(keyUserToClaim(userAddress), valueString) | |
104 | 114 | } | |
105 | 115 | ||
106 | 116 | ||
107 | - | func | |
108 | - | let | |
109 | - | match | |
117 | + | func getUserToClaimBalance (userAddress) = { | |
118 | + | let userToClaimDataRaw = getString(this, keyUserToClaim(userAddress)) | |
119 | + | match userToClaimDataRaw { | |
110 | 120 | case ds: String => | |
111 | 121 | let dataList = split(ds, SEP) | |
112 | - | let | |
113 | - | let | |
114 | - | let | |
115 | - | let | |
116 | - | if (( | |
117 | - | then $Tuple4( | |
118 | - | else $Tuple4( | |
122 | + | let currentPeriod = parseIntValue(dataList[1]) | |
123 | + | let toClaim = parseIntValue(dataList[2]) | |
124 | + | let nextPeriod = parseIntValue(dataList[3]) | |
125 | + | let toUnlock = parseIntValue(dataList[4]) | |
126 | + | if ((nextPeriod > height)) | |
127 | + | then $Tuple4(currentPeriod, toClaim, nextPeriod, toUnlock) | |
128 | + | else $Tuple4(currentPeriodHeight, (toClaim + toUnlock), nextPeriodHeight, 0) | |
119 | 129 | case _ => | |
120 | 130 | $Tuple4(0, 0, 0, 0) | |
121 | 131 | } | |
122 | 132 | } | |
123 | 133 | ||
124 | 134 | ||
125 | 135 | func getUserLeasingNodeList (userAddress) = { | |
126 | 136 | let leasingDataStringRaw = getString(this, keyUserLeasingNodeList(userAddress)) | |
127 | 137 | match leasingDataStringRaw { | |
128 | 138 | case ds: String => | |
129 | 139 | let dataList = split_51C(ds, SEP) | |
130 | 140 | dataList | |
131 | 141 | case _ => | |
132 | 142 | nil | |
133 | 143 | } | |
134 | 144 | } | |
135 | 145 | ||
136 | 146 | ||
137 | 147 | func getUserNodeListEntry (userAddress,nodeList) = if ((size(nodeList) == 0)) | |
138 | 148 | then DeleteEntry(keyUserLeasingNodeList(userAddress)) | |
139 | 149 | else StringEntry(keyUserLeasingNodeList(userAddress), makeString_11C(nodeList, SEP)) | |
140 | 150 | ||
141 | 151 | ||
142 | 152 | func addNodeToNodeList (userAddress,nodeAddress) = { | |
143 | 153 | let nodeList = getUserLeasingNodeList(userAddress) | |
144 | 154 | if (containsElement(nodeList, nodeAddress)) | |
145 | 155 | then nodeList | |
146 | 156 | else (nodeList :+ nodeAddress) | |
147 | 157 | } | |
148 | 158 | ||
149 | 159 | ||
150 | 160 | func removeNodeFromNodeList (userAddress,nodeAddress) = { | |
151 | 161 | let nodeList = getUserLeasingNodeList(userAddress) | |
152 | 162 | match indexOf(nodeList, nodeAddress) { | |
153 | 163 | case index: Int => | |
154 | 164 | removeByIndex(nodeList, index) | |
155 | 165 | case _ => | |
156 | 166 | nodeList | |
157 | 167 | } | |
158 | 168 | } | |
159 | 169 | ||
160 | 170 | ||
161 | 171 | func getStakeActions (nodeAddress,userAddress,i) = { | |
162 | 172 | let checks = [if ((size(i.payments) == 1)) | |
163 | 173 | then true | |
164 | 174 | else throwErr("payment size should be exactly 1"), if ((i.payments[0].assetId == assetIdBytes)) | |
165 | 175 | then true | |
166 | 176 | else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if (isValidAddress(nodeAddress)) | |
167 | 177 | then true | |
168 | 178 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
169 | 179 | then true | |
170 | 180 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
171 | 181 | if ((checks == checks)) | |
172 | 182 | then { | |
173 | 183 | let userLeasingAmount = i.payments[0].amount | |
174 | - | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
175 | - | let newTotalLease = (totalNodeLeased + userLeasingAmount) | |
176 | - | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
177 | - | let newUserTotalLease = (userTotalLeased + userLeasingAmount) | |
178 | - | let $t060716143 = getUserBalances(userAddress) | |
179 | - | let periodId = $t060716143._1 | |
180 | - | let leased = $t060716143._2 | |
181 | - | let toUnlock = $t060716143._3 | |
182 | - | let toClaim = $t060716143._4 | |
183 | - | let newLeased = (leased + userLeasingAmount) | |
184 | - | [getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
184 | + | let $t070397147 = getLeasingNodeData(nodeAddress) | |
185 | + | let nodeCurrentPeriod = $t070397147._1 | |
186 | + | let nodeCurrentLeased = $t070397147._2 | |
187 | + | let nodeNextPeriod = $t070397147._3 | |
188 | + | let nodeNextLeased = $t070397147._4 | |
189 | + | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
190 | + | let $t072157336 = getUserLeasingData(nodeAddress, userAddress) | |
191 | + | let userCurrentPeriod = $t072157336._1 | |
192 | + | let userCurrentLeased = $t072157336._2 | |
193 | + | let userNextPeriod = $t072157336._3 | |
194 | + | let userNextLeased = $t072157336._4 | |
195 | + | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
196 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentPeriod, userCurrentLeased, userNextPeriod, newUserNextLeased), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
185 | 197 | } | |
186 | 198 | else throw("Strict value is not equal to itself.") | |
187 | 199 | } | |
188 | 200 | ||
189 | 201 | ||
190 | 202 | func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = { | |
191 | - | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
192 | - | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
203 | + | let $t080248132 = getLeasingNodeData(nodeAddress) | |
204 | + | let nodeCurrentPeriod = $t080248132._1 | |
205 | + | let nodeCurrentLeased = $t080248132._2 | |
206 | + | let nodeNextPeriod = $t080248132._3 | |
207 | + | let nodeNextLeased = $t080248132._4 | |
208 | + | let $t081378258 = getUserLeasingData(nodeAddress, userAddress) | |
209 | + | let userCurrentPeriod = $t081378258._1 | |
210 | + | let userCurrentLeased = $t081378258._2 | |
211 | + | let userNextPeriod = $t081378258._3 | |
212 | + | let userNextLeased = $t081378258._4 | |
193 | 213 | let checks = [if ((unstakeAmount > 0)) | |
194 | 214 | then true | |
195 | - | else throwErr("unstake amount should be greater than 0"), if (( | |
215 | + | else throwErr("unstake amount should be greater than 0"), if ((userNextLeased >= unstakeAmount)) | |
196 | 216 | then true | |
197 | - | else throwErr("unstake amount should be less or equal user staked amount"), if (( | |
217 | + | else throwErr("unstake amount should be less or equal user staked amount"), if ((nodeNextLeased >= unstakeAmount)) | |
198 | 218 | then true | |
199 | 219 | else throwErr("unstake amount should be less or equal node staked amount"), if (isValidAddress(nodeAddress)) | |
200 | 220 | then true | |
201 | 221 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
202 | 222 | then true | |
203 | 223 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
204 | 224 | if ((checks == checks)) | |
205 | 225 | then { | |
206 | - | let newTotalLease = (totalNodeLeased - unstakeAmount) | |
207 | - | let newUserTotalLease = (userTotalLeased - unstakeAmount) | |
208 | - | let $t074197491 = getUserBalances(userAddress) | |
209 | - | let periodId = $t074197491._1 | |
210 | - | let leased = $t074197491._2 | |
211 | - | let toUnlock = $t074197491._3 | |
212 | - | let toClaim = $t074197491._4 | |
213 | - | let newLeased = (leased - unstakeAmount) | |
226 | + | let newNodeNextLease = (nodeNextLeased - unstakeAmount) | |
227 | + | let newUserNextLeased = (userNextLeased - unstakeAmount) | |
228 | + | let $t089519083 = getUserToClaimBalance(userAddress) | |
229 | + | let currentPeriod = $t089519083._1 | |
230 | + | let toClaim = $t089519083._2 | |
231 | + | let nextPeriod = $t089519083._3 | |
232 | + | let toUnlock = $t089519083._4 | |
214 | 233 | let newToUnlock = (toUnlock + unstakeAmount) | |
215 | - | let removeNodeActions = if (( | |
234 | + | let removeNodeActions = if ((newUserNextLeased == 0)) | |
216 | 235 | then [getUserNodeListEntry(userAddress, removeNodeFromNodeList(userAddress, nodeAddress))] | |
217 | 236 | else nil | |
218 | - | ([getLeasingNodeEntry(nodeAddress, | |
237 | + | ([getLeasingNodeEntry(nodeAddress, nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentPeriod, userCurrentLeased, userNextPeriod, newUserNextLeased), getUserToClaimEntry(userAddress, currentPeriod, toClaim, nextPeriod, newToUnlock)] ++ removeNodeActions) | |
219 | 238 | } | |
220 | 239 | else throw("Strict value is not equal to itself.") | |
221 | 240 | } | |
222 | 241 | ||
223 | 242 | ||
224 | 243 | func getClaimUnlockedActions (userAddress,claimAmount) = { | |
225 | - | let $ | |
226 | - | let | |
227 | - | let | |
228 | - | let | |
229 | - | let | |
244 | + | let $t097509837 = getUserToClaimBalance(userAddress) | |
245 | + | let currentPeriod = $t097509837._1 | |
246 | + | let toClaim = $t097509837._2 | |
247 | + | let nextPeriod = $t097509837._3 | |
248 | + | let toUnlock = $t097509837._4 | |
230 | 249 | let checks = [if ((claimAmount > 0)) | |
231 | 250 | then true | |
232 | 251 | else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount)) | |
233 | 252 | then true | |
234 | 253 | else throwErr("claim amount should be less or equal unlocked amount"), if (isValidAddress(userAddress)) | |
235 | 254 | then true | |
236 | 255 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
237 | 256 | if ((checks == checks)) | |
238 | 257 | then { | |
239 | 258 | let newToClaim = (toClaim - claimAmount) | |
240 | - | [ | |
259 | + | [getUserToClaimEntry(userAddress, currentPeriod, newToClaim, nextPeriod, toUnlock), ScriptTransfer(addressFromStringValue(userAddress), claimAmount, assetIdBytes)] | |
241 | 260 | } | |
242 | 261 | else throw("Strict value is not equal to itself.") | |
243 | 262 | } | |
244 | 263 | ||
245 | 264 | ||
246 | 265 | func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = { | |
247 | - | let $ | |
248 | - | let | |
249 | - | let | |
250 | - | let | |
251 | - | let | |
266 | + | let $t01050410591 = getUserToClaimBalance(userAddress) | |
267 | + | let currentPeriod = $t01050410591._1 | |
268 | + | let toClaim = $t01050410591._2 | |
269 | + | let nextPeriod = $t01050410591._3 | |
270 | + | let toUnlock = $t01050410591._4 | |
252 | 271 | let available = (toUnlock + toClaim) | |
253 | 272 | let checks = [if ((userLeasingAmount > 0)) | |
254 | 273 | then true | |
255 | 274 | else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount)) | |
256 | 275 | then true | |
257 | 276 | else throwErr("amount should be less or equal to available"), if (isValidAddress(nodeAddress)) | |
258 | 277 | then true | |
259 | 278 | else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress)) | |
260 | 279 | then true | |
261 | 280 | else throwErr(makeString(["user address is not valid:", userAddress], " "))] | |
262 | 281 | if ((checks == checks)) | |
263 | 282 | then { | |
264 | - | let totalNodeLeased = getLeasingNodeData(nodeAddress) | |
265 | - | let newTotalLease = (totalNodeLeased + userLeasingAmount) | |
266 | - | let userTotalLeased = getUserLeasingData(nodeAddress, userAddress) | |
267 | - | let newUserTotalLease = (userTotalLeased + userLeasingAmount) | |
268 | - | let newLeased = (leased + userLeasingAmount) | |
283 | + | let $t01106811176 = getLeasingNodeData(nodeAddress) | |
284 | + | let nodeCurrentPeriod = $t01106811176._1 | |
285 | + | let nodeCurrentLeased = $t01106811176._2 | |
286 | + | let nodeNextPeriod = $t01106811176._3 | |
287 | + | let nodeNextLeased = $t01106811176._4 | |
288 | + | let newNodeNextLease = (nodeNextLeased + userLeasingAmount) | |
289 | + | let $t01124411365 = getUserLeasingData(nodeAddress, userAddress) | |
290 | + | let userCurrentPeriod = $t01124411365._1 | |
291 | + | let userCurrentLeased = $t01124411365._2 | |
292 | + | let userNextPeriod = $t01124411365._3 | |
293 | + | let userNextLeased = $t01124411365._4 | |
294 | + | let newUserNextLeased = (userNextLeased + userLeasingAmount) | |
269 | 295 | let newToUnlock = max([0, (toUnlock - userLeasingAmount)]) | |
270 | 296 | let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))]) | |
271 | - | [getLeasingNodeEntry(nodeAddress, | |
297 | + | [getLeasingNodeEntry(nodeAddress, nodeCurrentPeriod, nodeCurrentLeased, nodeNextPeriod, nodeNextLeased), getUserLeasingEntry(nodeAddress, userAddress, userCurrentPeriod, userCurrentLeased, userNextPeriod, newUserNextLeased), getUserToClaimEntry(userAddress, currentPeriod, newToClaim, nextPeriod, newToUnlock), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))] | |
272 | 298 | } | |
273 | 299 | else throw("Strict value is not equal to itself.") | |
274 | 300 | } | |
275 | 301 | ||
276 | 302 | ||
277 | 303 | func getSetNewPeriodLengthActions (newPeriodLength) = { | |
278 | 304 | let check = [if ((newPeriodLength > 0)) | |
279 | 305 | then true | |
280 | 306 | else throwErr("period length should be greater than 0")] | |
281 | 307 | if ((check == check)) | |
282 | 308 | then if ((periodOffsetHeight == -1)) | |
283 | 309 | then [IntegerEntry(keyPeriodLength, newPeriodLength), IntegerEntry(keyPeriodOffsetHeight, height)] | |
284 | 310 | else { | |
285 | 311 | let newPeriodOffsetId = (currentPeriodId + 1) | |
286 | 312 | let newOffsetHeight = ((periodLength * (newPeriodOffsetId - periodOffsetId)) + periodOffsetHeight) | |
287 | 313 | [IntegerEntry(keyPeriodOffsetId, newPeriodOffsetId), IntegerEntry(keyPeriodOffsetHeight, newOffsetHeight), IntegerEntry(keyPeriodLength, newPeriodLength)] | |
288 | 314 | } | |
289 | 315 | else throw("Strict value is not equal to itself.") | |
290 | 316 | } | |
291 | 317 | ||
292 | 318 | ||
293 | 319 | @Callable(i) | |
294 | 320 | func setNewPeriodLength (newPeriodLength) = getSetNewPeriodLengthActions(newPeriodLength) | |
295 | 321 | ||
296 | 322 | ||
297 | 323 | ||
298 | 324 | @Callable(i) | |
299 | 325 | func getUserData (userAddress) = { | |
300 | - | let $ | |
301 | - | let | |
302 | - | let | |
303 | - | let | |
304 | - | let | |
326 | + | let $t01292213009 = getUserToClaimBalance(userAddress) | |
327 | + | let currentPeriod = $t01292213009._1 | |
328 | + | let toClaim = $t01292213009._2 | |
329 | + | let nextPeriod = $t01292213009._3 | |
330 | + | let toUnlock = $t01292213009._4 | |
305 | 331 | let nodeList = getUserLeasingNodeList(userAddress) | |
306 | - | $Tuple2(nil, $ | |
332 | + | $Tuple2(nil, $Tuple5($Tuple2(currentPeriodId, periodLength), toClaim, toUnlock, (toUnlock + toClaim), nodeList)) | |
307 | 333 | } | |
308 | 334 | ||
309 | 335 | ||
310 | 336 | ||
311 | 337 | @Callable(i) | |
312 | 338 | func stakeFor (nodeAddress,userAddress) = getStakeActions(nodeAddress, userAddress, i) | |
313 | 339 | ||
314 | 340 | ||
315 | 341 | ||
316 | 342 | @Callable(i) | |
317 | 343 | func stake (nodeAddress) = { | |
318 | 344 | let userAddress = toString(i.caller) | |
319 | 345 | getStakeActions(nodeAddress, userAddress, i) | |
320 | 346 | } | |
321 | 347 | ||
322 | 348 | ||
323 | 349 | ||
324 | 350 | @Callable(i) | |
325 | 351 | func stakeFromUnlocked (nodeAddress,amount) = { | |
326 | 352 | let userAddress = toString(i.caller) | |
327 | 353 | getStakeFromUnlockedActions(nodeAddress, userAddress, amount) | |
328 | 354 | } | |
329 | 355 | ||
330 | 356 | ||
331 | 357 | ||
332 | 358 | @Callable(i) | |
333 | 359 | func unstake (nodeAddress,amount) = { | |
334 | 360 | let userAddress = toString(i.caller) | |
335 | 361 | getUnstakeActions(nodeAddress, userAddress, amount) | |
336 | 362 | } | |
337 | 363 | ||
338 | 364 | ||
339 | 365 | ||
340 | 366 | @Callable(i) | |
341 | 367 | func claim (amount) = { | |
342 | 368 | let userAddress = toString(i.caller) | |
343 | 369 | getClaimUnlockedActions(userAddress, amount) | |
344 | 370 | } | |
345 | 371 | ||
346 | 372 | ||
347 | 373 | ||
348 | 374 | @Callable(i) | |
349 | 375 | func claimAll () = { | |
350 | 376 | let userAddress = toString(i.caller) | |
351 | - | let $ | |
352 | - | let | |
353 | - | let | |
354 | - | let | |
355 | - | let | |
377 | + | let $t01400014087 = getUserToClaimBalance(userAddress) | |
378 | + | let currentPeriod = $t01400014087._1 | |
379 | + | let toClaim = $t01400014087._2 | |
380 | + | let nextPeriod = $t01400014087._3 | |
381 | + | let toUnlock = $t01400014087._4 | |
356 | 382 | getClaimUnlockedActions(userAddress, toClaim) | |
357 | 383 | } | |
358 | 384 | ||
359 | 385 |
github/deemru/w8io/026f985 71.91 ms ◑