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