tx · BNTmFe1gxhB7dFTPouzucf7hfw552fVJ1i7BpTZ6L4AY

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.01100000 Waves

2024.02.05 17:04 [2963056] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "BNTmFe1gxhB7dFTPouzucf7hfw552fVJ1i7BpTZ6L4AY", "fee": 1100000, "feeAssetId": null, "timestamp": 1707141934661, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "5kDGJMgsTrgS9LLZAJrW6zHp515ADFYKBeKaSkNaC4CGHmMrEu6xuqaQ2n6ZWRBYqAX2fzBdiHjMXpWzFy3h4Eip" ], "script": "base64:BgIoCAISAwoBARIDCgEIEgQKAggIEgMKAQgSBAoCCAESBAoCCAESAwoBASIADGNvbnRyYWN0RmlsZQIRbDJtcF9sZWFzaW5nLnJpZGUAA1NFUAICX18ABnNjYWxlOACAwtcvAQh0aHJvd0VycgEDbXNnCQACAQkArAICCQCsAgIFDGNvbnRyYWN0RmlsZQICOiAFA21zZwAKa2V5QXNzZXRJZAkAuQkCCQDMCAICAiVzCQDMCAICB2Fzc2V0SWQFA25pbAUDU0VQABFrZXlQZXJpb2RPZmZzZXRJZAkAuQkCCQDMCAICAiVzCQDMCAICCG9mZnNldElkBQNuaWwFA1NFUAAVa2V5UGVyaW9kT2Zmc2V0SGVpZ2h0CQC5CQIJAMwIAgICJXMJAMwIAgIMb2Zmc2V0SGVpZ2h0BQNuaWwFA1NFUAAPa2V5UGVyaW9kTGVuZ3RoCQC5CQIJAMwIAgICJXMJAMwIAgIMcGVyaW9kTGVuZ3RoBQNuaWwFA1NFUAAOcGVyaW9kT2Zmc2V0SWQJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwURa2V5UGVyaW9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vQ2xhaW0FCG5vZGVMaXN0AWkBCHN0YWtlRm9yAgtub2RlQWRkcmVzcwt1c2VyQWRkcmVzcwkBD2dldFN0YWtlQWN0aW9ucwMFC25vZGVBZGRyZXNzBQt1c2VyQWRkcmVzcwUBaQFpAQVzdGFrZQELbm9kZUFkZHJlc3MEC3VzZXJBZGRyZXNzCQClCAEIBQFpBmNhbGxlcgkBD2dldFN0YWtlQWN0aW9ucwMFC25vZGVBZGRyZXNzBQt1c2VyQWRkcmVzcwUBaQFpARFzdGFrZUZyb21VbmxvY2tlZAILbm9kZUFkZHJlc3MGYW1vdW50BAt1c2VyQWRkcmVzcwkApQgBCAUBaQZjYWxsZXIJARtnZXRTdGFrZUZyb21VbmxvY2tlZEFjdGlvbnMDBQtub2RlQWRkcmVzcwULdXNlckFkZHJlc3MFBmFtb3VudAFpAQd1bnN0YWtlAgtub2RlQWRkcmVzcwZhbW91bnQEC3VzZXJBZGRyZXNzCQClCAEIBQFpBmNhbGxlcgkBEWdldFVuc3Rha2VBY3Rpb25zAwULbm9kZUFkZHJlc3MFC3VzZXJBZGRyZXNzBQZhbW91bnQBaQEFY2xhaW0BBmFtb3VudAQLdXNlckFkZHJlc3MJAKUIAQgFAWkGY2FsbGVyCQEXZ2V0Q2xhaW1VbmxvY2tlZEFjdGlvbnMCBQt1c2VyQWRkcmVzcwUGYW1vdW50ACN5g00=", "height": 2963056, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GXqANHgwu7bmDdDXLT2WC9P85qgcbpcrh7RaLaWsYLkF Next: 6aEtkic7w2kjoqE2KDr9ihPFQHfxwFKF9L5D11sWxXGK Diff:
OldNewDifferences
177177 let toUnlock = $t058645936._3
178178 let toClaim = $t058645936._4
179179 let newLeased = (leased + userLeasingAmount)
180-[getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, currentPeriodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))]
180+[getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))]
181181 }
182182 else throw("Strict value is not equal to itself.")
183183 }
201201 then {
202202 let newTotalLease = (totalNodeLeased - unstakeAmount)
203203 let newUserTotalLease = (userTotalLeased - unstakeAmount)
204- let $t072197291 = getUserBalances(userAddress)
205- let periodId = $t072197291._1
206- let leased = $t072197291._2
207- let toUnlock = $t072197291._3
208- let toClaim = $t072197291._4
204+ let $t072127284 = getUserBalances(userAddress)
205+ let periodId = $t072127284._1
206+ let leased = $t072127284._2
207+ let toUnlock = $t072127284._3
208+ let toClaim = $t072127284._4
209209 let newLeased = (leased - unstakeAmount)
210210 let newToUnlock = (toUnlock + unstakeAmount)
211211 let removeNodeActions = if ((newUserTotalLease == 0))
218218
219219
220220 func getClaimUnlockedActions (userAddress,claimAmount) = {
221- let $t078927964 = getUserBalances(userAddress)
222- let periodId = $t078927964._1
223- let leased = $t078927964._2
224- let toUnlock = $t078927964._3
225- let toClaim = $t078927964._4
221+ let $t078857957 = getUserBalances(userAddress)
222+ let periodId = $t078857957._1
223+ let leased = $t078857957._2
224+ let toUnlock = $t078857957._3
225+ let toClaim = $t078857957._4
226226 let checks = [if ((claimAmount > 0))
227227 then true
228228 else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount))
234234 then {
235235 let newToClaim = (toClaim - claimAmount)
236236 [getUserBalancesEntry(userAddress, currentPeriodId, leased, toUnlock, newToClaim)]
237+ }
238+ else throw("Strict value is not equal to itself.")
239+ }
240+
241+
242+func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = {
243+ let $t085348606 = getUserBalances(userAddress)
244+ let periodId = $t085348606._1
245+ let leased = $t085348606._2
246+ let toUnlock = $t085348606._3
247+ let toClaim = $t085348606._4
248+ let available = (toUnlock + toClaim)
249+ let checks = [if ((userLeasingAmount > 0))
250+ then true
251+ else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount))
252+ then true
253+ else throwErr("amount should be less or equal to available"), if (isValidAddress(nodeAddress))
254+ then true
255+ else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
256+ then true
257+ else throwErr(makeString(["user address is not valid:", userAddress], " "))]
258+ if ((checks == checks))
259+ then {
260+ let totalNodeLeased = getLeasingNodeData(nodeAddress)
261+ let newTotalLease = (totalNodeLeased + userLeasingAmount)
262+ let userTotalLeased = getUserLeasingData(nodeAddress, userAddress)
263+ let newUserTotalLease = (userTotalLeased + userLeasingAmount)
264+ let newLeased = (leased + userLeasingAmount)
265+ let newToUnlock = max([0, (toUnlock - userLeasingAmount)])
266+ let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))])
267+[getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, newToUnlock, newToClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))]
237268 }
238269 else throw("Strict value is not equal to itself.")
239270 }
262293
263294 @Callable(i)
264295 func getUserData (userAddress) = {
265- let $t093469418 = getUserBalances(userAddress)
266- let periodId = $t093469418._1
267- let leased = $t093469418._2
268- let toUnlock = $t093469418._3
269- let toClaim = $t093469418._4
296+ let $t01075810830 = getUserBalances(userAddress)
297+ let periodId = $t01075810830._1
298+ let leased = $t01075810830._2
299+ let toUnlock = $t01075810830._3
300+ let toClaim = $t01075810830._4
270301 let nodeList = getUserLeasingNodeList(userAddress)
271- $Tuple2(nil, $Tuple5($Tuple4(currentPeriodId, periodOffsetHeight, height, periodLength), leased, toUnlock, toClaim, nodeList))
302+ $Tuple2(nil, $Tuple6($Tuple2(currentPeriodId, periodLength), leased, toUnlock, toClaim, (toUnlock + toClaim), nodeList))
272303 }
273304
274305
282313 func stake (nodeAddress) = {
283314 let userAddress = toString(i.caller)
284315 getStakeActions(nodeAddress, userAddress, i)
316+ }
317+
318+
319+
320+@Callable(i)
321+func stakeFromUnlocked (nodeAddress,amount) = {
322+ let userAddress = toString(i.caller)
323+ getStakeFromUnlockedActions(nodeAddress, userAddress, amount)
285324 }
286325
287326
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 let scale8 = 100000000
99
1010 func throwErr (msg) = throw(((contractFile + ": ") + msg))
1111
1212
1313 let keyAssetId = makeString(["%s", "assetId"], SEP)
1414
1515 let keyPeriodOffsetId = makeString(["%s", "offsetId"], SEP)
1616
1717 let keyPeriodOffsetHeight = makeString(["%s", "offsetHeight"], SEP)
1818
1919 let keyPeriodLength = makeString(["%s", "periodLength"], SEP)
2020
2121 let periodOffsetId = valueOrElse(getInteger(this, keyPeriodOffsetId), 0)
2222
2323 let periodLength = valueOrElse(getInteger(this, keyPeriodLength), 10000)
2424
2525 let periodOffsetHeight = valueOrElse(getInteger(this, keyPeriodOffsetHeight), -1)
2626
2727 let currentPeriodId = if (if ((height > periodOffsetHeight))
2828 then (periodOffsetHeight != -1)
2929 else false)
3030 then (((height - periodOffsetHeight) / periodLength) + periodOffsetId)
3131 else max([0, (periodOffsetId - 1)])
3232
3333 func keyLeasingNodeData (nodeAddress) = makeString(["%s", "leasingNode", nodeAddress], SEP)
3434
3535
3636 func keyUserLeasingNodeList (userAddress) = makeString(["%s%s", "userLeasingNodeList", userAddress], SEP)
3737
3838
3939 func keyUserLeasingNodeData (userAddress,nodeAddress) = makeString(["%s%s", "userLeasingNodeData", userAddress, nodeAddress], SEP)
4040
4141
4242 func keyUserBalances (userAddress) = makeString(["%s%s", "userBalances", userAddress], SEP)
4343
4444
4545 let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES")
4646
4747 let assetIdBytes = if ((assetIdString == "WAVES"))
4848 then unit
4949 else fromBase58String(assetIdString)
5050
5151 func isValidAddress (address) = match addressFromString(address) {
5252 case a: Address =>
5353 true
5454 case _ =>
5555 false
5656 }
5757
5858
5959 func getLeasingNodeEntry (nodeAddress,totalLeased) = {
6060 let valueString = makeString(["%d", toString(totalLeased)], SEP)
6161 StringEntry(keyLeasingNodeData(nodeAddress), valueString)
6262 }
6363
6464
6565 func getLeasingNodeData (nodeAddress) = {
6666 let leasingDataStringRaw = getString(this, keyLeasingNodeData(nodeAddress))
6767 match leasingDataStringRaw {
6868 case ds: String =>
6969 let dataList = split(ds, SEP)
7070 let totalLeased = parseIntValue(dataList[1])
7171 totalLeased
7272 case _ =>
7373 0
7474 }
7575 }
7676
7777
7878 func getUserLeasingEntry (nodeAddress,userAddress,totalUserLeased) = {
7979 let valueString = makeString(["%d", toString(totalUserLeased)], SEP)
8080 StringEntry(keyUserLeasingNodeData(userAddress, nodeAddress), valueString)
8181 }
8282
8383
8484 func getUserLeasingData (nodeAddress,userAddress) = {
8585 let leasingDataStringRaw = getString(this, keyUserLeasingNodeData(userAddress, nodeAddress))
8686 match leasingDataStringRaw {
8787 case ds: String =>
8888 let dataList = split(ds, SEP)
8989 let totalLeased = parseIntValue(dataList[1])
9090 totalLeased
9191 case _ =>
9292 0
9393 }
9494 }
9595
9696
9797 func getUserBalancesEntry (userAddress,periodId,leased,toUnlock,toClaim) = {
9898 let valueString = makeString(["%d%d%d%d", toString(periodId), toString(leased), toString(toUnlock), toString(toClaim)], SEP)
9999 StringEntry(keyUserBalances(userAddress), valueString)
100100 }
101101
102102
103103 func getUserBalances (userAddress) = {
104104 let leasingDataStringRaw = getString(this, keyUserBalances(userAddress))
105105 match leasingDataStringRaw {
106106 case ds: String =>
107107 let dataList = split(ds, SEP)
108108 let periodId = parseIntValue(dataList[1])
109109 let leased = parseIntValue(dataList[2])
110110 let toUnlock = parseIntValue(dataList[3])
111111 let toClaim = parseIntValue(dataList[4])
112112 if (((currentPeriodId - periodId) > 0))
113113 then $Tuple4(periodId, leased, 0, (toClaim + toUnlock))
114114 else $Tuple4(periodId, leased, toUnlock, toClaim)
115115 case _ =>
116116 $Tuple4(0, 0, 0, 0)
117117 }
118118 }
119119
120120
121121 func getUserLeasingNodeList (userAddress) = {
122122 let leasingDataStringRaw = getString(this, keyUserLeasingNodeList(userAddress))
123123 match leasingDataStringRaw {
124124 case ds: String =>
125125 let dataList = split_51C(ds, SEP)
126126 dataList
127127 case _ =>
128128 nil
129129 }
130130 }
131131
132132
133133 func getUserNodeListEntry (userAddress,nodeList) = if ((size(nodeList) == 0))
134134 then DeleteEntry(keyUserLeasingNodeList(userAddress))
135135 else StringEntry(keyUserLeasingNodeList(userAddress), makeString_11C(nodeList, SEP))
136136
137137
138138 func addNodeToNodeList (userAddress,nodeAddress) = {
139139 let nodeList = getUserLeasingNodeList(userAddress)
140140 if (containsElement(nodeList, nodeAddress))
141141 then nodeList
142142 else (nodeList :+ nodeAddress)
143143 }
144144
145145
146146 func removeNodeFromNodeList (userAddress,nodeAddress) = {
147147 let nodeList = getUserLeasingNodeList(userAddress)
148148 match indexOf(nodeList, nodeAddress) {
149149 case index: Int =>
150150 removeByIndex(nodeList, index)
151151 case _ =>
152152 nodeList
153153 }
154154 }
155155
156156
157157 func getStakeActions (nodeAddress,userAddress,i) = {
158158 let checks = [if ((size(i.payments) == 1))
159159 then true
160160 else throwErr("payment size should be exactly 1"), if ((i.payments[0].assetId == assetIdBytes))
161161 then true
162162 else throwErr(makeString(["payment assetId should be:", assetIdString], " ")), if (isValidAddress(nodeAddress))
163163 then true
164164 else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
165165 then true
166166 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
167167 if ((checks == checks))
168168 then {
169169 let userLeasingAmount = i.payments[0].amount
170170 let totalNodeLeased = getLeasingNodeData(nodeAddress)
171171 let newTotalLease = (totalNodeLeased + userLeasingAmount)
172172 let userTotalLeased = getUserLeasingData(nodeAddress, userAddress)
173173 let newUserTotalLease = (userTotalLeased + userLeasingAmount)
174174 let $t058645936 = getUserBalances(userAddress)
175175 let periodId = $t058645936._1
176176 let leased = $t058645936._2
177177 let toUnlock = $t058645936._3
178178 let toClaim = $t058645936._4
179179 let newLeased = (leased + userLeasingAmount)
180-[getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, currentPeriodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))]
180+[getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, toUnlock, toClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))]
181181 }
182182 else throw("Strict value is not equal to itself.")
183183 }
184184
185185
186186 func getUnstakeActions (nodeAddress,userAddress,unstakeAmount) = {
187187 let totalNodeLeased = getLeasingNodeData(nodeAddress)
188188 let userTotalLeased = getUserLeasingData(nodeAddress, userAddress)
189189 let checks = [if ((unstakeAmount > 0))
190190 then true
191191 else throwErr("unstake amount should be greater than 0"), if ((userTotalLeased >= unstakeAmount))
192192 then true
193193 else throwErr("unstake amount should be less or equal user staked amount"), if ((totalNodeLeased >= unstakeAmount))
194194 then true
195195 else throwErr("unstake amount should be less or equal node staked amount"), if (isValidAddress(nodeAddress))
196196 then true
197197 else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
198198 then true
199199 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
200200 if ((checks == checks))
201201 then {
202202 let newTotalLease = (totalNodeLeased - unstakeAmount)
203203 let newUserTotalLease = (userTotalLeased - unstakeAmount)
204- let $t072197291 = getUserBalances(userAddress)
205- let periodId = $t072197291._1
206- let leased = $t072197291._2
207- let toUnlock = $t072197291._3
208- let toClaim = $t072197291._4
204+ let $t072127284 = getUserBalances(userAddress)
205+ let periodId = $t072127284._1
206+ let leased = $t072127284._2
207+ let toUnlock = $t072127284._3
208+ let toClaim = $t072127284._4
209209 let newLeased = (leased - unstakeAmount)
210210 let newToUnlock = (toUnlock + unstakeAmount)
211211 let removeNodeActions = if ((newUserTotalLease == 0))
212212 then [getUserNodeListEntry(userAddress, removeNodeFromNodeList(userAddress, nodeAddress))]
213213 else nil
214214 ([getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, currentPeriodId, newLeased, newToUnlock, toClaim)] ++ removeNodeActions)
215215 }
216216 else throw("Strict value is not equal to itself.")
217217 }
218218
219219
220220 func getClaimUnlockedActions (userAddress,claimAmount) = {
221- let $t078927964 = getUserBalances(userAddress)
222- let periodId = $t078927964._1
223- let leased = $t078927964._2
224- let toUnlock = $t078927964._3
225- let toClaim = $t078927964._4
221+ let $t078857957 = getUserBalances(userAddress)
222+ let periodId = $t078857957._1
223+ let leased = $t078857957._2
224+ let toUnlock = $t078857957._3
225+ let toClaim = $t078857957._4
226226 let checks = [if ((claimAmount > 0))
227227 then true
228228 else throwErr("claim amount should be greater than 0"), if ((toClaim >= claimAmount))
229229 then true
230230 else throwErr("claim amount should be less or equal unlocked amount"), if (isValidAddress(userAddress))
231231 then true
232232 else throwErr(makeString(["user address is not valid:", userAddress], " "))]
233233 if ((checks == checks))
234234 then {
235235 let newToClaim = (toClaim - claimAmount)
236236 [getUserBalancesEntry(userAddress, currentPeriodId, leased, toUnlock, newToClaim)]
237+ }
238+ else throw("Strict value is not equal to itself.")
239+ }
240+
241+
242+func getStakeFromUnlockedActions (nodeAddress,userAddress,userLeasingAmount) = {
243+ let $t085348606 = getUserBalances(userAddress)
244+ let periodId = $t085348606._1
245+ let leased = $t085348606._2
246+ let toUnlock = $t085348606._3
247+ let toClaim = $t085348606._4
248+ let available = (toUnlock + toClaim)
249+ let checks = [if ((userLeasingAmount > 0))
250+ then true
251+ else throwErr("amount should be greater than 0"), if ((available >= userLeasingAmount))
252+ then true
253+ else throwErr("amount should be less or equal to available"), if (isValidAddress(nodeAddress))
254+ then true
255+ else throwErr(makeString(["node address is not valid:", nodeAddress], " ")), if (isValidAddress(userAddress))
256+ then true
257+ else throwErr(makeString(["user address is not valid:", userAddress], " "))]
258+ if ((checks == checks))
259+ then {
260+ let totalNodeLeased = getLeasingNodeData(nodeAddress)
261+ let newTotalLease = (totalNodeLeased + userLeasingAmount)
262+ let userTotalLeased = getUserLeasingData(nodeAddress, userAddress)
263+ let newUserTotalLease = (userTotalLeased + userLeasingAmount)
264+ let newLeased = (leased + userLeasingAmount)
265+ let newToUnlock = max([0, (toUnlock - userLeasingAmount)])
266+ let newToClaim = min([toClaim, (toClaim + (toUnlock - userLeasingAmount))])
267+[getLeasingNodeEntry(nodeAddress, newTotalLease), getUserLeasingEntry(nodeAddress, userAddress, newUserTotalLease), getUserBalancesEntry(userAddress, periodId, newLeased, newToUnlock, newToClaim), getUserNodeListEntry(userAddress, addNodeToNodeList(userAddress, nodeAddress))]
237268 }
238269 else throw("Strict value is not equal to itself.")
239270 }
240271
241272
242273 func getSetNewPeriodLengthActions (newPeriodLength) = {
243274 let check = [if ((newPeriodLength > 0))
244275 then true
245276 else throwErr("period length should be greater than 0")]
246277 if ((check == check))
247278 then if ((periodOffsetHeight == -1))
248279 then [IntegerEntry(keyPeriodLength, newPeriodLength), IntegerEntry(keyPeriodOffsetHeight, height)]
249280 else {
250281 let newPeriodOffsetId = (currentPeriodId + 1)
251282 let newOffsetHeight = ((periodLength * (newPeriodOffsetId - periodOffsetId)) + periodOffsetHeight)
252283 [IntegerEntry(keyPeriodOffsetId, newPeriodOffsetId), IntegerEntry(keyPeriodOffsetHeight, newOffsetHeight), IntegerEntry(keyPeriodLength, newPeriodLength)]
253284 }
254285 else throw("Strict value is not equal to itself.")
255286 }
256287
257288
258289 @Callable(i)
259290 func setNewPeriodLength (newPeriodLength) = getSetNewPeriodLengthActions(newPeriodLength)
260291
261292
262293
263294 @Callable(i)
264295 func getUserData (userAddress) = {
265- let $t093469418 = getUserBalances(userAddress)
266- let periodId = $t093469418._1
267- let leased = $t093469418._2
268- let toUnlock = $t093469418._3
269- let toClaim = $t093469418._4
296+ let $t01075810830 = getUserBalances(userAddress)
297+ let periodId = $t01075810830._1
298+ let leased = $t01075810830._2
299+ let toUnlock = $t01075810830._3
300+ let toClaim = $t01075810830._4
270301 let nodeList = getUserLeasingNodeList(userAddress)
271- $Tuple2(nil, $Tuple5($Tuple4(currentPeriodId, periodOffsetHeight, height, periodLength), leased, toUnlock, toClaim, nodeList))
302+ $Tuple2(nil, $Tuple6($Tuple2(currentPeriodId, periodLength), leased, toUnlock, toClaim, (toUnlock + toClaim), nodeList))
272303 }
273304
274305
275306
276307 @Callable(i)
277308 func stakeFor (nodeAddress,userAddress) = getStakeActions(nodeAddress, userAddress, i)
278309
279310
280311
281312 @Callable(i)
282313 func stake (nodeAddress) = {
283314 let userAddress = toString(i.caller)
284315 getStakeActions(nodeAddress, userAddress, i)
316+ }
317+
318+
319+
320+@Callable(i)
321+func stakeFromUnlocked (nodeAddress,amount) = {
322+ let userAddress = toString(i.caller)
323+ getStakeFromUnlockedActions(nodeAddress, userAddress, amount)
285324 }
286325
287326
288327
289328 @Callable(i)
290329 func unstake (nodeAddress,amount) = {
291330 let userAddress = toString(i.caller)
292331 getUnstakeActions(nodeAddress, userAddress, amount)
293332 }
294333
295334
296335
297336 @Callable(i)
298337 func claim (amount) = {
299338 let userAddress = toString(i.caller)
300339 getClaimUnlockedActions(userAddress, amount)
301340 }
302341
303342

github/deemru/w8io/169f3d6 
43.78 ms