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