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