tx · 4QGBpEr1MLNb9nuazfRv9SPBRzZKUCdU3UwUCYA7JvAo

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.01400000 Waves

2024.02.16 10:30 [2978461] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "4QGBpEr1MLNb9nuazfRv9SPBRzZKUCdU3UwUCYA7JvAo", "fee": 1400000, "feeAssetId": null, "timestamp": 1708068617005, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "2sE3L86Y5wQk8TpTkgNCUkLBrV9vWhDZ1fAKfguUXee5bP7SDjwBQUqQ1yN3nvFj5vz9bbjXF7R2j1QAqUA8s5di" ], "script": "base64:BgI0CAISAwoBARIDCgEEEgMKAQgSAwoBCBIECgIICBIDCgEIEgQKAggBEgQKAggBEgMKAQESACgADGNvbnRyYWN0RmlsZQIRbDJtcF9sZWFzaW5nLnJpZGUAA1NFUAICX18BCHRocm93RXJyAQNtc2cJAAIBCQCsAgIJAKwCAgUMY29udHJhY3RGaWxlAgI6IAUDbXNnAAprZXlBc3NldElkCQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJZAUDbmlsBQNTRVAADGtleUFkbWluTGlzdAkAuQkCCQDMCAICAiVzCQDMCAICCWFkbWluTGlzdAUDbmlsBQNTRVAADGtleUZvcmNlU3RvcAkAuQkCCQDMCAICAiVzCQDMCAICCWZvcmNlU3RvcAUDbmlsBQNTRVAAEWtleVBlcmlvZE9mZnNldElkCQC5CQIJAMwIAgICJXMJAMwIAgIIb2Zmc2V0SWQFA25pbAUDU0VQABVrZXlQZXJpb2RPZmZzZXRIZWlnaHQJALkJAgkAzAgCAgIlcwkAzAgCAgxvZmZzZXRIZWlnaHQFA25pbAUDU0VQAA9rZXlQZXJpb2RMZW5ndGg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zAgULdXNlckFkZHJlc3MFBmFtb3VudAFpAQhjbGFpbUFsbAAEC3VzZXJBZGRyZXNzCQClCAEIBQFpBmNhbGxlcgQNJHQwMTUxMjMxNTE4MwkBFWdldFVzZXJUb0NsYWltQmFsYW5jZQEFC3VzZXJBZGRyZXNzBAd0b0NsYWltCAUNJHQwMTUxMjMxNTE4MwJfMQQIdG9VbmxvY2sIBQ0kdDAxNTEyMzE1MTgzAl8yBAZjaGVja3MJAMwIAgMJAGYCBQd0b0NsYWltAAAGCQEIdGhyb3dFcnIBAhBub3RoaW5nIHRvIGNsYWltBQNuaWwDCQAAAgUGY2hlY2tzBQZjaGVja3MJARdnZXRDbGFpbVVubG9ja2VkQWN0aW9ucwIFC3VzZXJBZGRyZXNzBQd0b0NsYWltCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAFeoGik=", "height": 2978461, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Eh4JLzabPA8AzVPjEcfj9V8sMt8xCEzA8fRbiiqmRfY8 Next: 4NdZVT5TqqUqQVVYoF2PB4hRrXjeTdxvhchn2KA1WptP Diff:
OldNewDifferences
242242 }
243243
244244
245-func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = {
246- let $t01010910169 = getUserToClaimBalance(userAddress)
247- let toClaim = $t01010910169._1
248- let toUnlock = $t01010910169._2
249- let available = (toUnlock + toClaim)
245+func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount,i) = {
246+ let $t01014810208 = getUserToClaimBalance(userAddress)
247+ let toClaim = $t01014810208._1
248+ let toUnlock = $t01014810208._2
249+ let paymentAmount = if ((size(i.payments) == 0))
250+ then 0
251+ else i.payments[0].amount
252+ let available = ((toUnlock + toClaim) + paymentAmount)
250253 let checks = [if (!(isForceStop))
251254 then true
252- else throwErr("contract is temporary stopped"), if ((userLeasingAmount > 0))
255+ else throwErr("contract is temporary stopped"), if ((1 >= size(i.payments)))
256+ then true
257+ else throwErr("maximum 1 payment"), if (if ((size(i.payments) == 0))
258+ then true
259+ else (i.payments[0].assetId == assetIdBytes))
260+ then true
261+ else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if ((userLeasingAmount > 0))
253262 then true
254263 else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount))
255264 then true
256- else throwErr("amount should be less or equal available amount"), if (isValidAddress(nodeAddress))
265+ else throwErr("amount should be less or equal (payment + available) amount"), if ((userLeasingAmount >= paymentAmount))
266+ then true
267+ else throw("amount should be greater or equal payment amount"), if (isValidAddress(nodeAddress))
257268 then true
258269 else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
259270 then true
260271 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
261272 if ((checks == checks))
262273 then {
263- let $t01075710830 = getLeasingNodeData(nodeAddress)
264- let nodeCurrentLeased = $t01075710830._1
265- let nodeNextLeased = $t01075710830._2
274+ let $t01125411327 = getLeasingNodeData(nodeAddress)
275+ let nodeCurrentLeased = $t01125411327._1
276+ let nodeNextLeased = $t01125411327._2
266277 let newNodeNextLease = (nodeNextLeased + userLeasingAmount)
267- let $t01089810984 = getUserLeasingData(nodeAddress, userAddress)
268- let userCurrentLeased = $t01089810984._1
269- let userNextLeased = $t01089810984._2
278+ let $t01139511481 = getUserLeasingData(nodeAddress, userAddress)
279+ let userCurrentLeased = $t01139511481._1
280+ let userNextLeased = $t01139511481._2
270281 let newUserNextLeased = (userNextLeased + userLeasingAmount)
271- let newToUnlock = max([0, (toUnlock - userLeasingAmount)])
272- let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))])
282+ let fromUnlockedAmount = (userLeasingAmount - paymentAmount)
283+ let newToUnlock = max([0, (toUnlock - fromUnlockedAmount)])
284+ let newToClaim = min([toClaim, (toClaim + (toUnlock - fromUnlockedAmount))])
273285 let userTotalLocked = getUserTotalLocked(userAddress)
274286 let newUserTotalLocked = (userTotalLocked + userLeasingAmount)
275287 [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, newToClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)]
316328
317329 @Callable(i)
318330 func getNodeDataREADONLY (nodeAddress) = {
319- let $t01307013134 = getLeasingNodeData(nodeAddress)
320- let currentLease = $t01307013134._1
321- let nextLeased = $t01307013134._2
331+ let $t01363213696 = getLeasingNodeData(nodeAddress)
332+ let currentLease = $t01363213696._1
333+ let nextLeased = $t01363213696._2
322334 $Tuple2(nil, $Tuple5(currentPeriodHeight, currentLease, nextPeriodHeight, nextLeased, height))
323335 }
324336
326338
327339 @Callable(i)
328340 func getUserDataREADONLY (userAddress) = {
329- let $t01349713557 = getUserToClaimBalance(userAddress)
330- let toClaim = $t01349713557._1
331- let toUnlock = $t01349713557._2
341+ let $t01405914119 = getUserToClaimBalance(userAddress)
342+ let toClaim = $t01405914119._1
343+ let toUnlock = $t01405914119._2
332344 let userTotalLocked = getUserTotalLocked(userAddress)
333345 $Tuple2(nil, $Tuple6(currentPeriodHeight, toClaim, nextPeriodHeight, toUnlock, userTotalLocked, height))
334346 }
351363 @Callable(i)
352364 func leaseFromLocked (nodeAddress,amount) = {
353365 let userAddress = toString(i.caller)
354- getStakeFromUnlockedActions(nodeAddress, userAddress, amount)
366+ getStakeFromUnlockedActions(nodeAddress, userAddress, amount, i)
355367 }
356368
357369
375387 @Callable(i)
376388 func claimAll () = {
377389 let userAddress = toString(i.caller)
378- let $t01455814618 = getUserToClaimBalance(userAddress)
379- let toClaim = $t01455814618._1
380- let toUnlock = $t01455814618._2
390+ let $t01512315183 = getUserToClaimBalance(userAddress)
391+ let toClaim = $t01512315183._1
392+ let toUnlock = $t01512315183._2
381393 let checks = [if ((toClaim > 0))
382394 then true
383395 else throwErr("nothing to claim")]
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFile = "l2mp_leasing.ride"
55
66 let SEP = "__"
77
88 func throwErr (msg) = throw(((contractFile + ": ") + msg))
99
1010
1111 let keyAssetId = makeString(["%s", "assetId"], SEP)
1212
1313 let keyAdminList = makeString(["%s", "adminList"], SEP)
1414
1515 let keyForceStop = makeString(["%s", "forceStop"], SEP)
1616
1717 let keyPeriodOffsetId = makeString(["%s", "offsetId"], SEP)
1818
1919 let keyPeriodOffsetHeight = makeString(["%s", "offsetHeight"], SEP)
2020
2121 let keyPeriodLength = makeString(["%s", "periodLength"], SEP)
2222
2323 let periodOffsetId = valueOrElse(getInteger(this, keyPeriodOffsetId), 0)
2424
2525 let periodLength = valueOrElse(getInteger(this, keyPeriodLength), 10000)
2626
2727 let periodOffsetHeight = valueOrElse(getInteger(this, keyPeriodOffsetHeight), -1)
2828
2929 let currentPeriodId = if (if ((height > periodOffsetHeight))
3030 then (periodOffsetHeight != -1)
3131 else false)
3232 then (((height - periodOffsetHeight) / periodLength) + periodOffsetId)
3333 else max([0, (periodOffsetId - 1)])
3434
3535 let currentPeriodHeight = (periodOffsetHeight + ((currentPeriodId - periodOffsetId) * periodLength))
3636
3737 let nextPeriodHeight = (currentPeriodHeight + periodLength)
3838
3939 func keyLeasingNodeData (nodeAddress) = makeString(["%s", nodeAddress], SEP)
4040
4141
4242 func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", nodeAddress, userAddress], SEP)
4343
4444
4545 func keyUserToClaim (userAddress) = makeString(["%s%s", "toClaim", userAddress], SEP)
4646
4747
4848 func keyUserTotalLocked (userAddress) = makeString(["%s%s", "userTotalLocked", userAddress], SEP)
4949
5050
5151 func keyNodeLeasingByHeight (nodeAddress) = makeString(["%s%d", nodeAddress, toString(height)], SEP)
5252
5353
5454 func keyUserLeasingByHeight (nodeAddress,userAddress) = makeString(["%s%s%d", nodeAddress, userAddress, toString(height)], SEP)
5555
5656
5757 let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES")
5858
5959 let assetIdBytes = if ((assetIdString == "WAVES"))
6060 then unit
6161 else fromBase58String(assetIdString)
6262
6363 let adminListRaw = split(valueOrElse(getString(this, keyAdminList), ""), SEP)
6464
6565 let isForceStop = valueOrElse(getBoolean(this, keyForceStop), false)
6666
6767 func isAdmin (address) = containsElement(adminListRaw, address)
6868
6969
7070 func isValidAddress (address) = match addressFromString(address) {
7171 case a: Address =>
7272 true
7373 case _ =>
7474 false
7575 }
7676
7777
7878 func getLeasingNodeEntry (nodeAddress,currentLeased,nextLeased) = {
7979 let valueString = makeString(["%d%d%d%d", toString(currentPeriodHeight), toString(currentLeased), toString(nextPeriodHeight), toString(nextLeased)], SEP)
8080 StringEntry(keyLeasingNodeData(nodeAddress), valueString)
8181 }
8282
8383
8484 func getLeasingNodeData (nodeAddress) = {
8585 let leasingNodeDataStringRaw = getString(this, keyLeasingNodeData(nodeAddress))
8686 match leasingNodeDataStringRaw {
8787 case ds: String =>
8888 let dataList = split(ds, SEP)
8989 let nodeCurrentPeriod = parseIntValue(dataList[1])
9090 let nodeCurrentLeased = parseIntValue(dataList[2])
9191 let nodeNextPeriod = parseIntValue(dataList[3])
9292 let nodeNextLeased = parseIntValue(dataList[4])
9393 if ((nodeNextPeriod > height))
9494 then $Tuple2(nodeCurrentLeased, nodeNextLeased)
9595 else $Tuple2(nodeNextLeased, nodeNextLeased)
9696 case _ =>
9797 $Tuple2(0, 0)
9898 }
9999 }
100100
101101
102102 func getUserLeasingEntry (nodeAddress,userAddress,userCurrentLeased,userNextLeased) = {
103103 let valueString = makeString(["%d%d%d%d", toString(currentPeriodHeight), toString(userCurrentLeased), toString(nextPeriodHeight), toString(userNextLeased)], SEP)
104104 StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString)
105105 }
106106
107107
108108 func getUserLeasingData (nodeAddress,userAddress) = {
109109 let leasingUserDataStringRaw = getString(this, keyUserLeasingNodeData(userAddress, nodeAddress))
110110 match leasingUserDataStringRaw {
111111 case ds: String =>
112112 let dataList = split(ds, SEP)
113113 let userCurrentPeriod = parseIntValue(dataList[1])
114114 let userCurrentLeased = parseIntValue(dataList[2])
115115 let userNextPeriod = parseIntValue(dataList[3])
116116 let userNextLeased = parseIntValue(dataList[4])
117117 if ((userNextPeriod > height))
118118 then $Tuple2(userCurrentLeased, userNextLeased)
119119 else $Tuple2(userNextLeased, userNextLeased)
120120 case _ =>
121121 $Tuple2(0, 0)
122122 }
123123 }
124124
125125
126126 func getUserToClaimEntry (userAddress,toClaim,toUnlock) = {
127127 let valueString = makeString(["%d%d%d%d", toString(currentPeriodHeight), toString(toClaim), toString(nextPeriodHeight), toString(toUnlock)], SEP)
128128 StringEntry(keyUserToClaim(userAddress), valueString)
129129 }
130130
131131
132132 func getUserToClaimBalance (userAddress) = {
133133 let userToClaimDataStringRaw = getString(this, keyUserToClaim(userAddress))
134134 match userToClaimDataStringRaw {
135135 case ds: String =>
136136 let dataList = split(ds, SEP)
137137 let currentPeriod = parseIntValue(dataList[1])
138138 let toClaim = parseIntValue(dataList[2])
139139 let nextPeriod = parseIntValue(dataList[3])
140140 let toUnlock = parseIntValue(dataList[4])
141141 if ((nextPeriod > height))
142142 then $Tuple2(toClaim, toUnlock)
143143 else $Tuple2((toClaim + toUnlock), 0)
144144 case _ =>
145145 $Tuple2(0, 0)
146146 }
147147 }
148148
149149
150150 func getUserTotalLockedEntry (userAddress,userTotalLocked) = IntegerEntry(keyUserTotalLocked(userAddress), userTotalLocked)
151151
152152
153153 func getUserTotalLocked (userAddress) = valueOrElse(getInteger(this, keyUserTotalLocked(userAddress)), 0)
154154
155155
156156 func getStakeActions (nodeAddress,userAddress,i) = {
157157 let checks = [if (!(isForceStop))
158158 then true
159159 else throwErr("contract is temporary stopped"), if ((size(i.payments) == 1))
160160 then true
161161 else throwErr("payment size should be exactly 1"), if ((i.payments[0].assetId == assetIdBytes))
162162 then true
163163 else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if (isValidAddress(nodeAddress))
164164 then true
165165 else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
166166 then true
167167 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
168168 if ((checks == checks))
169169 then {
170170 let userLeasingAmount = i.payments[0].amount
171171 let $t066206693 = getLeasingNodeData(nodeAddress)
172172 let nodeCurrentLeased = $t066206693._1
173173 let nodeNextLeased = $t066206693._2
174174 let newNodeNextLease = (nodeNextLeased + userLeasingAmount)
175175 let $t067616847 = getUserLeasingData(nodeAddress, userAddress)
176176 let userCurrentLeased = $t067616847._1
177177 let userNextLeased = $t067616847._2
178178 let newUserNextLeased = (userNextLeased + userLeasingAmount)
179179 let userTotalLocked = getUserTotalLocked(userAddress)
180180 let newUserTotalLocked = (userTotalLocked + userLeasingAmount)
181181 [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)]
182182 }
183183 else throw("Strict value is not equal to itself.")
184184 }
185185
186186
187187 func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = {
188188 let $t075497622 = getLeasingNodeData(nodeAddress)
189189 let nodeCurrentLeased = $t075497622._1
190190 let nodeNextLeased = $t075497622._2
191191 let $t076277713 = getUserLeasingData(nodeAddress, userAddress)
192192 let userCurrentLeased = $t076277713._1
193193 let userNextLeased = $t076277713._2
194194 let checks = [if (!(isForceStop))
195195 then true
196196 else throwErr("contract is temporary stopped"), if ((unstakeAmount > 0))
197197 then true
198198 else throwErr("unstake amount should be greater than 0"), if ((userNextLeased >= unstakeAmount))
199199 then true
200200 else throwErr("unstake amount should be less or equal user staked amount"), if ((nodeNextLeased >= unstakeAmount))
201201 then true
202202 else throwErr("unstake amount should be less or equal node staked amount"), if (isValidAddress(nodeAddress))
203203 then true
204204 else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
205205 then true
206206 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
207207 if ((checks == checks))
208208 then {
209209 let newNodeNextLease = (nodeNextLeased - unstakeAmount)
210210 let newUserNextLeased = (userNextLeased - unstakeAmount)
211211 let $t085268586 = getUserToClaimBalance(userAddress)
212212 let toClaim = $t085268586._1
213213 let toUnlock = $t085268586._2
214214 let newToUnlock = (toUnlock + unstakeAmount)
215215 let userTotalLocked = getUserTotalLocked(userAddress)
216216 let newUserTotalLocked = (userTotalLocked - unstakeAmount)
217217 [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, toClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)]
218218 }
219219 else throw("Strict value is not equal to itself.")
220220 }
221221
222222
223223 func getClaimUnlockedActions (userAddress,claimAmount) = {
224224 let $t093159375 = getUserToClaimBalance(userAddress)
225225 let toClaim = $t093159375._1
226226 let toUnlock = $t093159375._2
227227 let checks = [if (!(isForceStop))
228228 then true
229229 else throwErr("contract is temporary stopped"), if ((claimAmount > 0))
230230 then true
231231 else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount))
232232 then true
233233 else throwErr("claim amount should be less or equal unlocked amount"), if (isValidAddress(userAddress))
234234 then true
235235 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
236236 if ((checks == checks))
237237 then {
238238 let newToClaim = (toClaim - claimAmount)
239239 [getUserToClaimEntry(userAddress, newToClaim, toUnlock), ScriptTransfer(addressFromStringValue(userAddress), claimAmount, assetIdBytes)]
240240 }
241241 else throw("Strict value is not equal to itself.")
242242 }
243243
244244
245-func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = {
246- let $t01010910169 = getUserToClaimBalance(userAddress)
247- let toClaim = $t01010910169._1
248- let toUnlock = $t01010910169._2
249- let available = (toUnlock + toClaim)
245+func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount,i) = {
246+ let $t01014810208 = getUserToClaimBalance(userAddress)
247+ let toClaim = $t01014810208._1
248+ let toUnlock = $t01014810208._2
249+ let paymentAmount = if ((size(i.payments) == 0))
250+ then 0
251+ else i.payments[0].amount
252+ let available = ((toUnlock + toClaim) + paymentAmount)
250253 let checks = [if (!(isForceStop))
251254 then true
252- else throwErr("contract is temporary stopped"), if ((userLeasingAmount > 0))
255+ else throwErr("contract is temporary stopped"), if ((1 >= size(i.payments)))
256+ then true
257+ else throwErr("maximum 1 payment"), if (if ((size(i.payments) == 0))
258+ then true
259+ else (i.payments[0].assetId == assetIdBytes))
260+ then true
261+ else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if ((userLeasingAmount > 0))
253262 then true
254263 else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount))
255264 then true
256- else throwErr("amount should be less or equal available amount"), if (isValidAddress(nodeAddress))
265+ else throwErr("amount should be less or equal (payment + available) amount"), if ((userLeasingAmount >= paymentAmount))
266+ then true
267+ else throw("amount should be greater or equal payment amount"), if (isValidAddress(nodeAddress))
257268 then true
258269 else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
259270 then true
260271 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
261272 if ((checks == checks))
262273 then {
263- let $t01075710830 = getLeasingNodeData(nodeAddress)
264- let nodeCurrentLeased = $t01075710830._1
265- let nodeNextLeased = $t01075710830._2
274+ let $t01125411327 = getLeasingNodeData(nodeAddress)
275+ let nodeCurrentLeased = $t01125411327._1
276+ let nodeNextLeased = $t01125411327._2
266277 let newNodeNextLease = (nodeNextLeased + userLeasingAmount)
267- let $t01089810984 = getUserLeasingData(nodeAddress, userAddress)
268- let userCurrentLeased = $t01089810984._1
269- let userNextLeased = $t01089810984._2
278+ let $t01139511481 = getUserLeasingData(nodeAddress, userAddress)
279+ let userCurrentLeased = $t01139511481._1
280+ let userNextLeased = $t01139511481._2
270281 let newUserNextLeased = (userNextLeased + userLeasingAmount)
271- let newToUnlock = max([0, (toUnlock - userLeasingAmount)])
272- let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))])
282+ let fromUnlockedAmount = (userLeasingAmount - paymentAmount)
283+ let newToUnlock = max([0, (toUnlock - fromUnlockedAmount)])
284+ let newToClaim = min([toClaim, (toClaim + (toUnlock - fromUnlockedAmount))])
273285 let userTotalLocked = getUserTotalLocked(userAddress)
274286 let newUserTotalLocked = (userTotalLocked + userLeasingAmount)
275287 [getLeasingNodeEntry(nodeAddress, nodeCurrentLeased, newNodeNextLease), getUserLeasingEntry(nodeAddress, userAddress, userCurrentLeased, newUserNextLeased), getUserToClaimEntry(userAddress, newToClaim, newToUnlock), getUserTotalLockedEntry(userAddress, newUserTotalLocked), IntegerEntry(keyNodeLeasingByHeight(nodeAddress), newNodeNextLease), IntegerEntry(keyUserLeasingByHeight(nodeAddress, userAddress), newUserNextLeased)]
276288 }
277289 else throw("Strict value is not equal to itself.")
278290 }
279291
280292
281293 func getSetNewPeriodLengthActions (newPeriodLength) = {
282294 let check = [if ((newPeriodLength > 0))
283295 then true
284296 else throwErr("period length should be greater than 0")]
285297 if ((check == check))
286298 then if ((periodOffsetHeight == -1))
287299 then [IntegerEntry(keyPeriodLength, newPeriodLength), IntegerEntry(keyPeriodOffsetHeight, height)]
288300 else [IntegerEntry(keyPeriodOffsetId, (currentPeriodId + 1)), IntegerEntry(keyPeriodOffsetHeight, nextPeriodHeight), IntegerEntry(keyPeriodLength, newPeriodLength)]
289301 else throw("Strict value is not equal to itself.")
290302 }
291303
292304
293305 @Callable(i)
294306 func setNewPeriodLength (newPeriodLength) = {
295307 let checks = [if (isAdmin(toString(i.caller)))
296308 then true
297309 else throwErr("caller is not in adminList")]
298310 if ((checks == checks))
299311 then getSetNewPeriodLengthActions(newPeriodLength)
300312 else throw("Strict value is not equal to itself.")
301313 }
302314
303315
304316
305317 @Callable(i)
306318 func setForceStopFlag (stop) = {
307319 let check = [if (isAdmin(toString(i.caller)))
308320 then true
309321 else throwErr("caller is not an admin")]
310322 if ((check == check))
311323 then [BooleanEntry(keyForceStop, stop)]
312324 else throw("Strict value is not equal to itself.")
313325 }
314326
315327
316328
317329 @Callable(i)
318330 func getNodeDataREADONLY (nodeAddress) = {
319- let $t01307013134 = getLeasingNodeData(nodeAddress)
320- let currentLease = $t01307013134._1
321- let nextLeased = $t01307013134._2
331+ let $t01363213696 = getLeasingNodeData(nodeAddress)
332+ let currentLease = $t01363213696._1
333+ let nextLeased = $t01363213696._2
322334 $Tuple2(nil, $Tuple5(currentPeriodHeight, currentLease, nextPeriodHeight, nextLeased, height))
323335 }
324336
325337
326338
327339 @Callable(i)
328340 func getUserDataREADONLY (userAddress) = {
329- let $t01349713557 = getUserToClaimBalance(userAddress)
330- let toClaim = $t01349713557._1
331- let toUnlock = $t01349713557._2
341+ let $t01405914119 = getUserToClaimBalance(userAddress)
342+ let toClaim = $t01405914119._1
343+ let toUnlock = $t01405914119._2
332344 let userTotalLocked = getUserTotalLocked(userAddress)
333345 $Tuple2(nil, $Tuple6(currentPeriodHeight, toClaim, nextPeriodHeight, toUnlock, userTotalLocked, height))
334346 }
335347
336348
337349
338350 @Callable(i)
339351 func leaseByAddress (nodeAddress,userAddress) = getStakeActions(nodeAddress, userAddress, i)
340352
341353
342354
343355 @Callable(i)
344356 func lease (nodeAddress) = {
345357 let userAddress = toString(i.caller)
346358 getStakeActions(nodeAddress, userAddress, i)
347359 }
348360
349361
350362
351363 @Callable(i)
352364 func leaseFromLocked (nodeAddress,amount) = {
353365 let userAddress = toString(i.caller)
354- getStakeFromUnlockedActions(nodeAddress, userAddress, amount)
366+ getStakeFromUnlockedActions(nodeAddress, userAddress, amount, i)
355367 }
356368
357369
358370
359371 @Callable(i)
360372 func cancelLease (nodeAddress,amount) = {
361373 let userAddress = toString(i.caller)
362374 getUnstakeActions(nodeAddress, userAddress, amount)
363375 }
364376
365377
366378
367379 @Callable(i)
368380 func claim (amount) = {
369381 let userAddress = toString(i.caller)
370382 getClaimUnlockedActions(userAddress, amount)
371383 }
372384
373385
374386
375387 @Callable(i)
376388 func claimAll () = {
377389 let userAddress = toString(i.caller)
378- let $t01455814618 = getUserToClaimBalance(userAddress)
379- let toClaim = $t01455814618._1
380- let toUnlock = $t01455814618._2
390+ let $t01512315183 = getUserToClaimBalance(userAddress)
391+ let toClaim = $t01512315183._1
392+ let toUnlock = $t01512315183._2
381393 let checks = [if ((toClaim > 0))
382394 then true
383395 else throwErr("nothing to claim")]
384396 if ((checks == checks))
385397 then getClaimUnlockedActions(userAddress, toClaim)
386398 else throw("Strict value is not equal to itself.")
387399 }
388400
389401

github/deemru/w8io/026f985 
43.08 ms