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