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