tx · FyHkarCnBzEjCo6XAg9Bj2dZs7pPz62Mwb9fqAii9fcP 3N8E9LU71MDkdP8FWtbP4TBXCNhoc15hWfs: -0.14000000 Waves 2022.10.18 17:24 [2277953] smart account 3N8E9LU71MDkdP8FWtbP4TBXCNhoc15hWfs > SELF 0.00000000 Waves
{ "type": 13, "id": "FyHkarCnBzEjCo6XAg9Bj2dZs7pPz62Mwb9fqAii9fcP", "fee": 14000000, "feeAssetId": null, "timestamp": 1666103082627, "version": 2, "chainId": 84, "sender": "3N8E9LU71MDkdP8FWtbP4TBXCNhoc15hWfs", "senderPublicKey": "2EDucEDvqYfn6hdx4PbvykQFRoNgPMWX6SiVPjM8AyxM", "proofs": [ "3AaTXsoiw4UttR8vtfnC3SaqKsQuyh4GuCsMPhy8Qe7kSutb6VLoUxJbYbg2tyQPboJBqFzUtpycKL7mx2jte41Y", "5ygs8AMUDHYD6wYLwDY1TdzMq799DUvHtkauy6u9y12pvJZDs5DQyfoyaAThsFqueEYUWfhxzobM4hyrnaxacYm9" ], "script": "base64:BgIdCAISABIAEgMKAQESABIAEgASBgoEGBEBARIAEgBXAAdrQWN0aXZlAgZhY3RpdmUABmtDYXVzZQIOc2h1dGRvd25fY2F1c2UADWtMYXN0SW50ZXJlc3QCDWxhc3RfaW50ZXJlc3QAEWtVc2VyTGFzdEludGVyZXN0Ag5fbGFzdF9pbnRlcmVzdAAPa1VzZXJTV09QTG9ja2VkAgxfU1dPUF9hbW91bnQAEGtUb3RhbFNXT1BMb2NrZWQCEXRvdGFsX1NXT1BfYW1vdW50ABVrVXNlclN3b3BVbmxvY2tIZWlnaHQCE19TV09QX3VubG9ja19oZWlnaHQAEGtVc2VyR1N3b3BMb2NrZWQCDV9HU3dvcF9hbW91bnQAEWtUb3RhbEdTd29wTG9ja2VkAhJ0b3RhbF9HU3dvcF9hbW91bnQAEmtVc2VyVG90YWxWb3RlU1dPUAIWX3VzZXJfdG90YWxfdm90ZV9nU1dPUAAWa1VzZXJBdmFpbGFib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AQxCb29sZWFuRW50cnkCBQdrQWN0aXZlBgkAzAgCCQELRGVsZXRlRW50cnkBBQZrQ2F1c2UFA25pbAECdHgBBnZlcmlmeQAEEmFkbWluUHViS2V5MVNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFDGFkbWluUHViS2V5MQABAAAEEmFkbWluUHViS2V5MlNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAEFDGFkbWluUHViS2V5MgABAAAEEmFkbWluUHViS2V5M1NpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAIFDGFkbWluUHViS2V5MwABAAAJAGcCCQBkAgkAZAIFEmFkbWluUHViS2V5MVNpZ25lZAUSYWRtaW5QdWJLZXkyU2lnbmVkBRJhZG1pblB1YktleTNTaWduZWQAAoPqhZI=", "height": 2277953, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HT1o8kaQLrJahFFqVZ83YoNTc8em6KgsBABweM8tkaAm Next: DUg3371WqvKdHqXYPo6PGFt8PPWKGKBNPRSqTTLwGgqb Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kActive = "active" | |
11 | 11 | ||
12 | 12 | let kUserSWOPLocked = "_SWOP_amount" | |
13 | 13 | ||
14 | - | let kUserGetBackHeight = "_getBackHeight" | |
15 | - | ||
16 | 14 | let kTotalSWOPLocked = "total_SWOP_amount" | |
17 | 15 | ||
18 | - | let | |
16 | + | let kUserSwopUnlockHeight = "_SWOP_unlock_height" | |
19 | 17 | ||
20 | - | let | |
18 | + | let kUserGSwopLocked = "_GSwop_amount" | |
21 | 19 | ||
22 | - | let | |
20 | + | let kTotalGSwopLocked = "total_GSwop_amount" | |
23 | 21 | ||
24 | - | let | |
22 | + | let kUserTotalVoteSWOP = "_user_total_vote_gSWOP" | |
25 | 23 | ||
26 | - | let kUserSWOPLastClaimedAmount = "_SWOP_last_claimed_amount" | |
27 | - | ||
28 | - | let kVoteName = "vote_name" | |
29 | - | ||
30 | - | let kOptionName = "_option_name" | |
31 | - | ||
32 | - | let kVotingStartHeight = "_startHeight" | |
33 | - | ||
34 | - | let kVoteDuration = "_vote_duration" | |
24 | + | let kUserAvailableForClaim = "_user_available_for_claim" | |
35 | 25 | ||
36 | 26 | let kRewardPoolFractionCurrent = "_current_pool_fraction_reward" | |
37 | 27 | ||
38 | 28 | let kRewardPoolFractionPrevious = "_previous_pool_fraction_reward" | |
39 | 29 | ||
40 | 30 | let kHeightPoolFraction = "_pool_reward_update_height" | |
41 | - | ||
42 | - | let kTotalRewardPerBlockCurrent = "total_reward_per_block_current" | |
43 | - | ||
44 | - | let kTotalRewardPerBlockPrevious = "total_reward_per_block_previous" | |
45 | 31 | ||
46 | 32 | let kRewardUpdateHeight = "reward_update_height" | |
47 | 33 | ||
50 | 36 | let kNoVotingForNewPool = "_vote_no" | |
51 | 37 | ||
52 | 38 | let kYesVotingForNewPool = "_vote_yes" | |
53 | - | ||
54 | - | let kAmountOfVotingForNewPool = "max_amount_voting" | |
55 | 39 | ||
56 | 40 | let kStatusOfVotingForNewPool = "_status" | |
57 | 41 | ||
135 | 119 | ||
136 | 120 | let airdropMoneyBoxAddr = Address(getBase58FromOracle(kAirdropMoneyBoxAddr)) | |
137 | 121 | ||
122 | + | let lockSwopBlocksAmount = (10102 * 4) | |
123 | + | ||
138 | 124 | let SWOP = fromBase58String(getStringValue(farmingAddr, kSWOPid)) | |
139 | 125 | ||
140 | 126 | let scaleValue = 100000000 | |
155 | 141 | ||
156 | 142 | let thirdActiveVote = valueOrElse(getString(votingNewPoolAddr, activeVoteThird), "") | |
157 | 143 | ||
158 | - | let | |
144 | + | let active = valueOrElse(getBoolean(this, kActive), true) | |
159 | 145 | ||
160 | 146 | let airdropFee = getIntegerValue(oracle, kAirdropFee) | |
161 | 147 | ||
164 | 150 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
165 | 151 | ||
166 | 152 | ||
167 | - | func throwNotEnoughSWOP () = throw("Not enough SWOP: userSWOPLocked - userTotalVoteAmount < voteSWOPAmount") | |
153 | + | func isActive () = if (active) | |
154 | + | then unit | |
155 | + | else throw("DApp is inactive at this moment") | |
156 | + | ||
157 | + | ||
158 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
159 | + | then unit | |
160 | + | else throw("Only admin can call this function") | |
168 | 161 | ||
169 | 162 | ||
170 | 163 | func getLastInterestInfo () = valueOrElse(getInteger(this, kLastInterest), 0) | |
171 | 164 | ||
172 | 165 | ||
173 | - | func getUserSWOPLocked (user) = valueOrElse(getInteger(this, (toString(user) + kUserSWOPLocked)), 0) | |
166 | + | func getTotalLockedInfo () = { | |
167 | + | let totalSwopLocked = valueOrElse(getInteger(this, kTotalSWOPLocked), 0) | |
168 | + | let totalGSwopLocked = valueOrElse(getInteger(this, kTotalGSwopLocked), totalSwopLocked) | |
169 | + | $Tuple2(totalSwopLocked, totalGSwopLocked) | |
170 | + | } | |
174 | 171 | ||
175 | 172 | ||
176 | - | func getUserSWOPClaimedAmount (user) = valueOrElse(getInteger(this, (toString(user) + kUserSWOPClaimedAmount)), 0) | |
177 | - | ||
178 | - | ||
179 | - | func getUserTotalVoteAmount (user) = valueOrElse(getInteger(votingAddr, (toString(user) + kUserTotalVoteSWOP)), 0) | |
173 | + | func getUserLockedInfo (user) = { | |
174 | + | let userSwopLocked = valueOrElse(getInteger(this, (user + kUserSWOPLocked)), 0) | |
175 | + | let userGSwopLocked = valueOrElse(getInteger(this, (user + kUserGSwopLocked)), userSwopLocked) | |
176 | + | $Tuple2(userSwopLocked, userGSwopLocked) | |
177 | + | } | |
180 | 178 | ||
181 | 179 | ||
182 | 180 | func getUserInterestInfo (user,lastInterest) = { | |
183 | - | let userSWOPAmount = getUserSWOPLocked(user) | |
184 | - | let userLastInterest = getInteger(this, (toString(user) + kUserLastInterest)) | |
185 | - | let userLastInterestValue = match userLastInterest { | |
186 | - | case userLastInterest: Int => | |
187 | - | userLastInterest | |
188 | - | case _ => | |
189 | - | lastInterest | |
181 | + | let $t048874950 = getUserLockedInfo(user) | |
182 | + | let userSWOPAmount = $t048874950._1 | |
183 | + | let userGSwopAmount = $t048874950._2 | |
184 | + | let userLastInterest = valueOrElse(getInteger(this, (user + kUserLastInterest)), lastInterest) | |
185 | + | $Tuple3(userLastInterest, userSWOPAmount, userGSwopAmount) | |
190 | 186 | } | |
191 | - | $Tuple2(userLastInterestValue, userSWOPAmount) | |
192 | - | } | |
187 | + | ||
188 | + | ||
189 | + | func getUserAvailableForClaim (user) = valueOrElse(getInteger(this, (user + kUserAvailableForClaim)), 0) | |
193 | 190 | ||
194 | 191 | ||
195 | 192 | func getUserTotalVoteAmountForOnePool (pool,user) = { | |
233 | 230 | } | |
234 | 231 | ||
235 | 232 | ||
236 | - | func getTotalSWOPLocked () = valueOrElse(getInteger(this, kTotalSWOPLocked), 0) | |
237 | - | ||
238 | - | ||
239 | 233 | func getUserVoteInfo (user) = { | |
240 | - | let $ | |
234 | + | let $t073147847 = if (isDefined(getString(votingAddr, (toString(user) + kUserTotalStruc)))) | |
241 | 235 | then { | |
242 | 236 | let data = split(valueOrErrorMessage(getString(votingAddr, (toString(user) + kUserTotalStruc)), "Empty kUserTotalStruc"), "_") | |
243 | 237 | $Tuple3(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2])) | |
246 | 240 | let uPoolTotalSWOP = valueOrElse(getInteger(votingAddr, (toString(user) + kUserTotalVoteSWOP)), 0) | |
247 | 241 | $Tuple3(uPoolTotalSWOP, 0, currVotingPeriod) | |
248 | 242 | } | |
249 | - | let userTotalVoteSWOP = $ | |
250 | - | let userUnvoted = $ | |
251 | - | let userUnvotedPeriod = $ | |
243 | + | let userTotalVoteSWOP = $t073147847._1 | |
244 | + | let userUnvoted = $t073147847._2 | |
245 | + | let userUnvotedPeriod = $t073147847._3 | |
252 | 246 | let userUnvotedActual = if ((userUnvotedPeriod == currVotingPeriod)) | |
253 | 247 | then userUnvoted | |
254 | 248 | else 0 | |
255 | 249 | $Tuple2(userTotalVoteSWOP, userUnvotedActual) | |
256 | 250 | } | |
257 | - | ||
258 | - | ||
259 | - | func getUserVoteOptionAmount (user) = valueOrElse(getInteger(this, (toString(user) + kUserVoteOptionAmount)), 0) | |
260 | - | ||
261 | - | ||
262 | - | func getVotingStartHeight (voteName) = valueOrElse(getInteger(this, (voteName + kVotingStartHeight)), 0) | |
263 | 251 | ||
264 | 252 | ||
265 | 253 | func getPoolUpdateHeight (pool) = valueOrElse(getInteger(this, (pool + kHeightPoolFraction)), 0) | |
274 | 262 | func getPrevPoolWeight (pool) = valueOrElse(getInteger(this, (pool + kRewardPoolFractionPrevious)), 0) | |
275 | 263 | ||
276 | 264 | ||
277 | - | func getVoteOptionAmount (user,voteName,option) = { | |
278 | - | let userVoteOptionAmount = getInteger(this, (((voteName + option) + toString(user)) + kUserVoteOptionAmount)) | |
279 | - | let uvoa = match userVoteOptionAmount { | |
280 | - | case uvoa: Int => | |
281 | - | uvoa | |
282 | - | case uvoa: Unit => | |
283 | - | 0 | |
284 | - | case _ => | |
285 | - | throw("Match error") | |
286 | - | } | |
287 | - | valueOrErrorMessage(uvoa, (((("No data on the key: " + voteName) + option) + toString(user)) + kUserVoteOptionAmount)) | |
288 | - | } | |
289 | - | ||
290 | - | ||
291 | - | func getVoteDuration (voteName) = valueOrErrorMessage(getInteger(this, (voteName + kVoteDuration)), (("No data on the key: " + voteName) + kVoteDuration)) | |
292 | - | ||
293 | - | ||
294 | - | func getTotalVoteOptionAmount (voteName,option) = { | |
295 | - | let totalVoteOptionAmount = getInteger(this, ((voteName + option) + kTotalVoteOptionAmount)) | |
296 | - | let tvoa = match totalVoteOptionAmount { | |
297 | - | case tvoa: Int => | |
298 | - | tvoa | |
299 | - | case tvoa: Unit => | |
300 | - | 0 | |
301 | - | case _ => | |
302 | - | throw("Match error") | |
303 | - | } | |
304 | - | tvoa | |
305 | - | } | |
306 | - | ||
307 | - | ||
308 | - | func getUserGetBackAmount (voteName,option,user,getBackSWOPHeight) = { | |
309 | - | let key = ((((((voteName + "_") + option) + "_") + toString(user)) + "_") + toString(getBackSWOPHeight)) | |
310 | - | valueOrErrorMessage(getInteger(this, key), ("No data on the key: " + key)) | |
311 | - | } | |
312 | - | ||
313 | - | ||
314 | - | func claimCalc (caller) = { | |
265 | + | func claimCalc (user) = { | |
315 | 266 | let lastInterest = getLastInterestInfo() | |
316 | - | let $t01053010612 = getUserInterestInfo(caller, lastInterest) | |
317 | - | let userLastInterest = $t01053010612._1 | |
318 | - | let userSWOPLocked = $t01053010612._2 | |
319 | - | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
267 | + | let $t087218818 = getUserInterestInfo(user, lastInterest) | |
268 | + | let userLastInterest = $t087218818._1 | |
269 | + | let userSWOPLocked = $t087218818._2 | |
270 | + | let userGSwopAmount = $t087218818._3 | |
271 | + | let claimAmount = fraction(userGSwopAmount, (lastInterest - userLastInterest), scaleValue) | |
320 | 272 | let userNewInterest = lastInterest | |
321 | 273 | $Tuple2(userNewInterest, claimAmount) | |
322 | 274 | } | |
323 | 275 | ||
324 | 276 | ||
325 | 277 | @Callable(i) | |
326 | - | func airDrop () = | |
327 | - | | |
328 | - | | |
329 | - | ||
330 | - | | |
331 | - | | |
332 | - | | |
333 | - | | |
334 | - | | |
335 | - | ||
336 | - | ||
337 | - | ||
338 | - | ||
278 | + | func airDrop () = valueOrElse(isActive(), { | |
279 | + | let $t090489123 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
280 | + | let pmtAmount = $t090489123._1 | |
281 | + | let pmtAssetId = $t090489123._2 | |
282 | + | if ((pmtAssetId != SWOP)) | |
283 | + | then throw("Incorrect pmtAssetId") | |
284 | + | else { | |
285 | + | let airdropFeeAmount = fraction(pmtAmount, airdropFee, feeSacle6, CEILING) | |
286 | + | let $t092969358 = getTotalLockedInfo() | |
287 | + | let totalSWOPLocked = $t092969358._1 | |
288 | + | let totalGSwopLocked = $t092969358._2 | |
289 | + | let lastInterest = getLastInterestInfo() | |
290 | + | let interestNew = (lastInterest + fraction((pmtAmount - airdropFeeAmount), scaleValue, totalGSwopLocked)) | |
339 | 291 | [IntegerEntry(kLastInterest, interestNew), ScriptTransfer(airdropMoneyBoxAddr, airdropFeeAmount, SWOP)] | |
340 | - | ||
341 | - | ||
292 | + | } | |
293 | + | }) | |
342 | 294 | ||
343 | 295 | ||
344 | 296 | ||
345 | 297 | @Callable(i) | |
346 | - | func lockSWOP () = if (!(isActive)) | |
347 | - | then throw("DApp is inactive at this moment") | |
348 | - | else { | |
349 | - | let $t01158811663 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
350 | - | let pmtAmount = $t01158811663._1 | |
351 | - | let pmtAssetId = $t01158811663._2 | |
352 | - | if ((pmtAssetId != SWOP)) | |
353 | - | then throw("Incorrect pmtAssetId") | |
354 | - | else { | |
355 | - | let lastInterest = getLastInterestInfo() | |
356 | - | let $t01177911863 = getUserInterestInfo(i.caller, lastInterest) | |
357 | - | let userLastInterest = $t01177911863._1 | |
358 | - | let userSWOPLocked = $t01177911863._2 | |
359 | - | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
360 | - | let userSWOPLockedNew = ((userSWOPLocked + pmtAmount) + claimAmount) | |
361 | - | let userNewInterest = lastInterest | |
362 | - | let totalSWOPLocked = getTotalSWOPLocked() | |
363 | - | let totalSWOPLockedNew = ((totalSWOPLocked + pmtAmount) + claimAmount) | |
364 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
365 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
366 | - | [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount)] | |
367 | - | } | |
368 | - | } | |
298 | + | func lockSWOP () = valueOrElse(isActive(), { | |
299 | + | let $t097369811 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
300 | + | let pmtAmount = $t097369811._1 | |
301 | + | let pmtAssetId = $t097369811._2 | |
302 | + | if ((pmtAssetId != SWOP)) | |
303 | + | then throw("Incorrect pmtAssetId") | |
304 | + | else { | |
305 | + | let user = toString(i.caller) | |
306 | + | let lastInterest = getLastInterestInfo() | |
307 | + | let $t0996210025 = getUserLockedInfo(user) | |
308 | + | let userSWOPLocked = $t0996210025._1 | |
309 | + | let userGSwopLocked = $t0996210025._2 | |
310 | + | let $t01003010091 = claimCalc(user) | |
311 | + | let userNewInterest = $t01003010091._1 | |
312 | + | let claimAmountAvailable = $t01003010091._2 | |
313 | + | let availableForClaim = getUserAvailableForClaim(user) | |
314 | + | let availableForClaimNew = (availableForClaim + claimAmountAvailable) | |
315 | + | let userSWOPLockedNew = (userSWOPLocked + pmtAmount) | |
316 | + | let userGSwopLockedNew = (userGSwopLocked + pmtAmount) | |
317 | + | let $t01033910401 = getTotalLockedInfo() | |
318 | + | let totalSWOPLocked = $t01033910401._1 | |
319 | + | let totalGSwopLocked = $t01033910401._2 | |
320 | + | let totalSWOPLockedNew = (totalSWOPLocked + pmtAmount) | |
321 | + | let totalGSwopLockedNew = (totalGSwopLocked + pmtAmount) | |
322 | + | [IntegerEntry((user + kUserSwopUnlockHeight), (height + lockSwopBlocksAmount)), IntegerEntry((user + kUserLastInterest), userNewInterest), IntegerEntry((user + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((user + kUserGSwopLocked), userGSwopLocked), IntegerEntry((user + kUserAvailableForClaim), availableForClaimNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew)] | |
323 | + | } | |
324 | + | }) | |
369 | 325 | ||
370 | 326 | ||
371 | 327 | ||
372 | 328 | @Callable(i) | |
373 | - | func withdrawSWOP (withdrawAmount) = if (!(isActive)) | |
374 | - | then throw("DApp is inactive at this moment") | |
375 | - | else if ((0 >= withdrawAmount)) | |
329 | + | func withdrawSWOP (withdrawAmount) = valueOrElse(isActive(), { | |
330 | + | let user = toString(i.caller) | |
331 | + | let unlockHeight = valueOrElse(getInteger(this, (user + kUserSwopUnlockHeight)), 0) | |
332 | + | if ((0 >= withdrawAmount)) | |
376 | 333 | then throw("withdrawAmount <= 0") | |
377 | - | else { | |
378 | - | let totalSWOPLocked = getTotalSWOPLocked() | |
379 | - | let userSWOPLocked = getUserSWOPLocked(i.caller) | |
380 | - | let $t01300413059 = claimCalc(i.caller) | |
381 | - | let userNewInterest = $t01300413059._1 | |
382 | - | let claimAmount = $t01300413059._2 | |
383 | - | let $t01306413129 = getUserVoteInfo(i.caller) | |
384 | - | let userVoteAmount = $t01306413129._1 | |
385 | - | let userUnvoteAmount = $t01306413129._2 | |
386 | - | let userVoteAmountForNewPool = getUserTotalVoteForNewPoolAmount(i.caller) | |
387 | - | let blockedInLaunchpad = getUserBlockedInLauchpad(i.caller) | |
388 | - | if (if (if ((0 > userUnvoteAmount)) | |
389 | - | then true | |
390 | - | else (0 > userVoteAmount)) | |
391 | - | then true | |
392 | - | else (0 > userVoteAmountForNewPool)) | |
393 | - | then throw("userUnvoteAmount < 0 || userVoteAmount < 0 || userVoteAmountForNewPool < 0") | |
394 | - | else { | |
395 | - | let availableToUnstake = (userSWOPLocked - max([userVoteAmountForNewPool, (userVoteAmount + userUnvoteAmount), blockedInLaunchpad])) | |
396 | - | if ((withdrawAmount > availableToUnstake)) | |
397 | - | then throw("withdrawAmount > availableToUnstake") | |
398 | - | else { | |
399 | - | let totalSWOPLockedNew = ((totalSWOPLocked + claimAmount) - withdrawAmount) | |
400 | - | let userSWOPamountNew = ((userSWOPLocked + claimAmount) - withdrawAmount) | |
401 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
402 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
403 | - | [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPamountNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), ScriptTransfer(i.caller, withdrawAmount, SWOP), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount)] | |
404 | - | } | |
405 | - | } | |
406 | - | } | |
334 | + | else if ((unlockHeight > height)) | |
335 | + | then throw(("You can't withdraw till " + toString(unlockHeight))) | |
336 | + | else { | |
337 | + | let $t01137611438 = getTotalLockedInfo() | |
338 | + | let totalSWOPLocked = $t01137611438._1 | |
339 | + | let totalGSwopLocked = $t01137611438._2 | |
340 | + | let $t01144311506 = getUserLockedInfo(user) | |
341 | + | let userSWOPLocked = $t01144311506._1 | |
342 | + | let userGSwopLocked = $t01144311506._2 | |
343 | + | let $t01151111572 = claimCalc(user) | |
344 | + | let userNewInterest = $t01151111572._1 | |
345 | + | let claimAmountAvailable = $t01151111572._2 | |
346 | + | let $t01157711643 = getUserVoteInfo(i.caller) | |
347 | + | let userVoteAmount = $t01157711643._1 | |
348 | + | let userUnvoteAmount = $t01157711643._2 | |
349 | + | let userVoteAmountForNewPool = getUserTotalVoteForNewPoolAmount(i.caller) | |
350 | + | let blockedInLaunchpad = getUserBlockedInLauchpad(i.caller) | |
351 | + | if (if (if ((0 > userUnvoteAmount)) | |
352 | + | then true | |
353 | + | else (0 > userVoteAmount)) | |
354 | + | then true | |
355 | + | else (0 > userVoteAmountForNewPool)) | |
356 | + | then throw("userUnvoteAmount < 0 || userVoteAmount < 0 || userVoteAmountForNewPool < 0") | |
357 | + | else { | |
358 | + | let availableToUnstake = (userSWOPLocked - max([userVoteAmountForNewPool, (userVoteAmount + userUnvoteAmount), blockedInLaunchpad])) | |
359 | + | if ((withdrawAmount > availableToUnstake)) | |
360 | + | then throw("withdrawAmount > availableToUnstake") | |
361 | + | else { | |
362 | + | let availableForClaim = getUserAvailableForClaim(user) | |
363 | + | let availableForClaimNew = (availableForClaim + claimAmountAvailable) | |
364 | + | let totalSWOPLockedNew = (totalSWOPLocked - withdrawAmount) | |
365 | + | let userSWOPAmountNew = (userSWOPLocked - withdrawAmount) | |
366 | + | let totalGSwopLockedNew = ((totalGSwopLocked - userGSwopLocked) + userSWOPAmountNew) | |
367 | + | [IntegerEntry((user + kUserLastInterest), userNewInterest), IntegerEntry((user + kUserSWOPLocked), userSWOPAmountNew), IntegerEntry((user + kUserGSwopLocked), userSWOPAmountNew), IntegerEntry((user + kUserAvailableForClaim), availableForClaimNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew), ScriptTransfer(i.caller, withdrawAmount, SWOP)] | |
368 | + | } | |
369 | + | } | |
370 | + | } | |
371 | + | }) | |
407 | 372 | ||
408 | 373 | ||
409 | 374 | ||
410 | 375 | @Callable(i) | |
411 | - | func claimAndWithdrawSWOP () = if (!(isActive)) | |
412 | - | then throw("DApp is inactive at this moment") | |
413 | - | else { | |
414 | - | let lastInterest = getLastInterestInfo() | |
415 | - | let $t01457914634 = claimCalc(i.caller) | |
416 | - | let userNewInterest = $t01457914634._1 | |
417 | - | let claimAmount = $t01457914634._2 | |
418 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
419 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
420 | - | if ((claimAmount == 0)) | |
421 | - | then throw("You have 0 available SWOP") | |
422 | - | else [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount), ScriptTransfer(i.caller, claimAmount, SWOP)] | |
423 | - | } | |
376 | + | func claimAndWithdrawSWOP () = valueOrElse(isActive(), { | |
377 | + | let user = toString(i.caller) | |
378 | + | let availableForClaim = getUserAvailableForClaim(user) | |
379 | + | let $t01316213214 = claimCalc(user) | |
380 | + | let userNewInterest = $t01316213214._1 | |
381 | + | let claimAmount = $t01316213214._2 | |
382 | + | let userClaimAmount = (availableForClaim + claimAmount) | |
383 | + | if ((userClaimAmount == 0)) | |
384 | + | then throw("You have 0 available SWOP") | |
385 | + | else [IntegerEntry((user + kUserLastInterest), userNewInterest), ScriptTransfer(i.caller, userClaimAmount, SWOP)] | |
386 | + | }) | |
424 | 387 | ||
425 | 388 | ||
426 | 389 | ||
427 | 390 | @Callable(i) | |
428 | - | func claimAndStakeSWOP () = if (!(isActive)) | |
429 | - | then throw("DApp is inactive at this moment") | |
430 | - | else { | |
431 | - | let totalSWOPLocked = getTotalSWOPLocked() | |
432 | - | let userSWOPLocked = getUserSWOPLocked(i.caller) | |
433 | - | let lastInterest = getLastInterestInfo() | |
434 | - | let $t01540715462 = claimCalc(i.caller) | |
435 | - | let userNewInterest = $t01540715462._1 | |
436 | - | let claimAmount = $t01540715462._2 | |
437 | - | let userSWOPLockedNew = (userSWOPLocked + claimAmount) | |
438 | - | let totalSWOPLockedNew = (totalSWOPLocked + claimAmount) | |
439 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
440 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
441 | - | if ((claimAmount == 0)) | |
442 | - | then throw("You have 0 available SWOP") | |
443 | - | else [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount)] | |
444 | - | } | |
391 | + | func claimAndStakeSWOP () = valueOrElse(isActive(), { | |
392 | + | let user = toString(i.caller) | |
393 | + | let $t01358713649 = getTotalLockedInfo() | |
394 | + | let totalSWOPLocked = $t01358713649._1 | |
395 | + | let totalGSwopLocked = $t01358713649._2 | |
396 | + | let $t01365413717 = getUserLockedInfo(user) | |
397 | + | let userSWOPLocked = $t01365413717._1 | |
398 | + | let userGSwopLocked = $t01365413717._2 | |
399 | + | let availableForClaim = getUserAvailableForClaim(user) | |
400 | + | let $t01378113832 = claimCalc(user) | |
401 | + | let userNewInterest = $t01378113832._1 | |
402 | + | let claimAmount = $t01378113832._2 | |
403 | + | let userClaimAmount = (availableForClaim + claimAmount) | |
404 | + | let userSWOPLockedNew = (userSWOPLocked + userClaimAmount) | |
405 | + | let userGSwopLockedNew = (userGSwopLocked + (userClaimAmount * 2)) | |
406 | + | let totalSWOPLockedNew = (totalSWOPLocked + userClaimAmount) | |
407 | + | let totalGSwopLockedNew = (totalGSwopLocked + (userClaimAmount * 2)) | |
408 | + | if ((userClaimAmount == 0)) | |
409 | + | then throw("You have 0 available SWOP") | |
410 | + | else [IntegerEntry((toString(i.caller) + kUserSwopUnlockHeight), (height + lockSwopBlocksAmount)), IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserGSwopLocked), userGSwopLockedNew)] | |
411 | + | }) | |
445 | 412 | ||
446 | 413 | ||
447 | 414 | ||
448 | 415 | @Callable(i) | |
449 | - | func updateWeights (currentPools,currentRewards,rewardUpdateHeight,pagination) = if (!(isActive)) | |
450 | - | then throw("DApp is inactive at this moment") | |
451 | - | else { | |
452 | - | let amountPools = 10 | |
453 | - | let totalRewardUpdateHeight = valueOrElse(getInteger(this, kRewardUpdateHeight), 0) | |
454 | - | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, moneyBoxPubKey], i.callerPublicKey))) | |
455 | - | then throw("Only admin can call this function") | |
456 | - | else if ((size(currentPools) > amountPools)) | |
457 | - | then throw(("Max amount of pool is " + toString(amountPools))) | |
458 | - | else if ((totalRewardUpdateHeight >= rewardUpdateHeight)) | |
459 | - | then throw("rewardUpdateHeight <= totalRewardUpdateHeight") | |
460 | - | else if ((height >= rewardUpdateHeight)) | |
461 | - | then throw("height >= rewardUpdateHeight") | |
462 | - | else if ((0 >= rewardUpdateHeight)) | |
463 | - | then throw("0 >= rewardUpdateHeight ") | |
464 | - | else { | |
465 | - | func sum (a,b) = (a + b) | |
466 | - | ||
467 | - | func changePreviousRewardEntry (accumulated,pool) = { | |
468 | - | let poolRewardUpdateHeight = getPoolUpdateHeight(pool) | |
469 | - | if (if (!(isDefinePoolUpdateHeight(pool))) | |
470 | - | then true | |
471 | - | else if ((rewardUpdateHeight != poolRewardUpdateHeight)) | |
472 | - | then (poolRewardUpdateHeight == totalRewardUpdateHeight) | |
473 | - | else false) | |
474 | - | then { | |
475 | - | let poolReward = getCurPoolWeight(pool) | |
476 | - | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
477 | - | } | |
478 | - | else { | |
479 | - | let poolReward = getPrevPoolWeight(pool) | |
480 | - | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
481 | - | } | |
482 | - | } | |
483 | - | ||
484 | - | func changeCurrentRewardEntry (accumulated,pool) = { | |
485 | - | let poolIndex = value(indexOf(currentPools, pool)) | |
486 | - | let poolReward = currentRewards[poolIndex] | |
487 | - | if ((0 > poolReward)) | |
488 | - | then throw("PoolReward < 0") | |
489 | - | else IntegerEntry((pool + kRewardPoolFractionCurrent), poolReward) :: accumulated | |
490 | - | } | |
491 | - | ||
492 | - | func changeHeightEntry (accumulated,pool) = { | |
493 | - | let poolHeight = rewardUpdateHeight | |
494 | - | IntegerEntry((pool + kHeightPoolFraction), poolHeight) :: accumulated | |
495 | - | } | |
496 | - | ||
497 | - | func getSumReward (curTempSum,pagination) = if ((pagination == 0)) | |
498 | - | then if ((curTempSum > totalVoteShare)) | |
499 | - | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString(curTempSum))) | |
500 | - | else $Tuple2([IntegerEntry(kTempCurSum, curTempSum)], [IntegerEntry(kRewardUpdateFirstPaginationHeight, rewardUpdateHeight)]) | |
501 | - | else if ((pagination == 1)) | |
502 | - | then { | |
503 | - | let curTempSumFromKey = valueOrElse(getInteger(this, kTempCurSum), 0) | |
504 | - | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
505 | - | if (((curTempSum + curTempSumFromKey) > totalVoteShare)) | |
506 | - | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString((curTempSum + curTempSumFromKey)))) | |
507 | - | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
508 | - | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
509 | - | else $Tuple2([IntegerEntry(kTempCurSum, (curTempSum + curTempSumFromKey))], nil) | |
510 | - | } | |
511 | - | else if ((pagination == 2)) | |
512 | - | then { | |
513 | - | let curSum = (valueOrElse(getInteger(this, kTempCurSum), 0) + curTempSum) | |
514 | - | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
515 | - | if ((curSum != totalVoteShare)) | |
516 | - | then throw("sumRewardPrevious != totalVoteShare or sumRewardCurrent != totalVoteShare") | |
517 | - | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
518 | - | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
519 | - | else $Tuple2([IntegerEntry(kTempCurSum, curSum)], nil) | |
520 | - | } | |
521 | - | else throw("Incorrect pagination") | |
522 | - | ||
523 | - | let previousRewardEntryNew = { | |
524 | - | let $l = currentPools | |
525 | - | let $s = size($l) | |
526 | - | let $acc0 = nil | |
527 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
528 | - | then $a | |
529 | - | else changePreviousRewardEntry($a, $l[$i]) | |
530 | - | ||
531 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
532 | - | then $a | |
533 | - | else throw("List size exceeds 10") | |
534 | - | ||
535 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
536 | - | } | |
537 | - | let currentRewardEntryNew = { | |
538 | - | let $l = currentPools | |
539 | - | let $s = size($l) | |
540 | - | let $acc0 = nil | |
541 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
542 | - | then $a | |
543 | - | else changeCurrentRewardEntry($a, $l[$i]) | |
544 | - | ||
545 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
546 | - | then $a | |
547 | - | else throw("List size exceeds 10") | |
548 | - | ||
549 | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
550 | - | } | |
551 | - | let heightEntryNewCur = { | |
552 | - | let $l = currentPools | |
553 | - | let $s = size($l) | |
554 | - | let $acc0 = nil | |
555 | - | func $f2_1 ($a,$i) = if (($i >= $s)) | |
556 | - | then $a | |
557 | - | else changeHeightEntry($a, $l[$i]) | |
558 | - | ||
559 | - | func $f2_2 ($a,$i) = if (($i >= $s)) | |
560 | - | then $a | |
561 | - | else throw("List size exceeds 10") | |
562 | - | ||
563 | - | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
564 | - | } | |
565 | - | let sumRewardCurrentTemp = { | |
566 | - | let $l = currentRewards | |
567 | - | let $s = size($l) | |
568 | - | let $acc0 = 0 | |
569 | - | func $f3_1 ($a,$i) = if (($i >= $s)) | |
570 | - | then $a | |
571 | - | else sum($a, $l[$i]) | |
572 | - | ||
573 | - | func $f3_2 ($a,$i) = if (($i >= $s)) | |
574 | - | then $a | |
575 | - | else throw("List size exceeds 10") | |
576 | - | ||
577 | - | $f3_2($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
578 | - | } | |
579 | - | let $t02055720668 = getSumReward(sumRewardCurrentTemp, pagination) | |
580 | - | let sumRewardCurrent = $t02055720668._1 | |
581 | - | let rewardUpdateHeightFirstPaginationEntry = $t02055720668._2 | |
582 | - | let rewardUpdateHeightEntry = if ((pagination == 2)) | |
583 | - | then [IntegerEntry(kRewardUpdateHeight, rewardUpdateHeight)] | |
584 | - | else nil | |
585 | - | if ((height > rewardUpdateHeight)) | |
586 | - | then throw("rewardUpdateHeight < height") | |
587 | - | else (((((previousRewardEntryNew ++ currentRewardEntryNew) ++ heightEntryNewCur) ++ sumRewardCurrent) ++ rewardUpdateHeightEntry) ++ rewardUpdateHeightFirstPaginationEntry) | |
588 | - | } | |
589 | - | } | |
416 | + | func lockSWOPFromFarming () = valueOrElse(isActive(), { | |
417 | + | let $t01477214847 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
418 | + | let pmtAmount = $t01477214847._1 | |
419 | + | let pmtAssetId = $t01477214847._2 | |
420 | + | if ((i.caller != farmingAddr)) | |
421 | + | then throw("Only farming can call this function") | |
422 | + | else if ((pmtAssetId != SWOP)) | |
423 | + | then throw("Incorrect pmtAssetId") | |
424 | + | else { | |
425 | + | let user = toString(i.originCaller) | |
426 | + | let lastInterest = getLastInterestInfo() | |
427 | + | let $t01509015153 = getUserLockedInfo(user) | |
428 | + | let userSWOPLocked = $t01509015153._1 | |
429 | + | let userGSwopLocked = $t01509015153._2 | |
430 | + | let $t01515815219 = claimCalc(user) | |
431 | + | let userNewInterest = $t01515815219._1 | |
432 | + | let claimAmountAvailable = $t01515815219._2 | |
433 | + | let availableForClaim = getUserAvailableForClaim(user) | |
434 | + | let availableForClaimNew = (availableForClaim + claimAmountAvailable) | |
435 | + | let userSWOPLockedNew = (userSWOPLocked + pmtAmount) | |
436 | + | let userGSwopLockedNew = (userGSwopLocked + (pmtAmount * 2)) | |
437 | + | let $t01547115533 = getTotalLockedInfo() | |
438 | + | let totalSWOPLocked = $t01547115533._1 | |
439 | + | let totalGSwopLocked = $t01547115533._2 | |
440 | + | let totalSWOPLockedNew = (totalSWOPLocked + pmtAmount) | |
441 | + | let totalGSwopLockedNew = (totalGSwopLocked + (pmtAmount * 2)) | |
442 | + | [IntegerEntry((user + kUserSwopUnlockHeight), (height + lockSwopBlocksAmount)), IntegerEntry((user + kUserLastInterest), userNewInterest), IntegerEntry((user + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((user + kUserGSwopLocked), userGSwopLocked), IntegerEntry((user + kUserAvailableForClaim), availableForClaimNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew)] | |
443 | + | } | |
444 | + | }) | |
590 | 445 | ||
591 | 446 | ||
592 | 447 | ||
593 | 448 | @Callable(i) | |
594 | - | func shutdown () = if (!(isActive)) | |
595 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
596 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
449 | + | func updateWeights (currentPools,currentRewards,rewardUpdateHeight,pagination) = valueOrElse(isActive(), { | |
450 | + | let amountPools = 10 | |
451 | + | let totalRewardUpdateHeight = valueOrElse(getInteger(this, kRewardUpdateHeight), 0) | |
452 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, moneyBoxPubKey], i.callerPublicKey))) | |
597 | 453 | then throw("Only admin can call this function") | |
598 | - | else suspend("Paused by admin") | |
454 | + | else if ((size(currentPools) > amountPools)) | |
455 | + | then throw(("Max amount of pool is " + toString(amountPools))) | |
456 | + | else if ((totalRewardUpdateHeight >= rewardUpdateHeight)) | |
457 | + | then throw("rewardUpdateHeight <= totalRewardUpdateHeight") | |
458 | + | else if ((height >= rewardUpdateHeight)) | |
459 | + | then throw("height >= rewardUpdateHeight") | |
460 | + | else if ((0 >= rewardUpdateHeight)) | |
461 | + | then throw("0 >= rewardUpdateHeight ") | |
462 | + | else { | |
463 | + | func sum (a,b) = (a + b) | |
464 | + | ||
465 | + | func changePreviousRewardEntry (accumulated,pool) = { | |
466 | + | let poolRewardUpdateHeight = getPoolUpdateHeight(pool) | |
467 | + | if (if (!(isDefinePoolUpdateHeight(pool))) | |
468 | + | then true | |
469 | + | else if ((rewardUpdateHeight != poolRewardUpdateHeight)) | |
470 | + | then (poolRewardUpdateHeight == totalRewardUpdateHeight) | |
471 | + | else false) | |
472 | + | then { | |
473 | + | let poolReward = getCurPoolWeight(pool) | |
474 | + | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
475 | + | } | |
476 | + | else { | |
477 | + | let poolReward = getPrevPoolWeight(pool) | |
478 | + | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
479 | + | } | |
480 | + | } | |
481 | + | ||
482 | + | func changeCurrentRewardEntry (accumulated,pool) = { | |
483 | + | let poolIndex = value(indexOf(currentPools, pool)) | |
484 | + | let poolReward = currentRewards[poolIndex] | |
485 | + | if ((0 > poolReward)) | |
486 | + | then throw("PoolReward < 0") | |
487 | + | else IntegerEntry((pool + kRewardPoolFractionCurrent), poolReward) :: accumulated | |
488 | + | } | |
489 | + | ||
490 | + | func changeHeightEntry (accumulated,pool) = { | |
491 | + | let poolHeight = rewardUpdateHeight | |
492 | + | let upUIntr = invoke(farmingAddr, "updatePoolInterest", [pool], nil) | |
493 | + | if ((upUIntr == upUIntr)) | |
494 | + | then IntegerEntry((pool + kHeightPoolFraction), poolHeight) :: accumulated | |
495 | + | else throw("Strict value is not equal to itself.") | |
496 | + | } | |
497 | + | ||
498 | + | func getSumReward (curTempSum,pagination) = if ((pagination == 0)) | |
499 | + | then if ((curTempSum > totalVoteShare)) | |
500 | + | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString(curTempSum))) | |
501 | + | else $Tuple2([IntegerEntry(kTempCurSum, curTempSum)], [IntegerEntry(kRewardUpdateFirstPaginationHeight, rewardUpdateHeight)]) | |
502 | + | else if ((pagination == 1)) | |
503 | + | then { | |
504 | + | let curTempSumFromKey = valueOrElse(getInteger(this, kTempCurSum), 0) | |
505 | + | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
506 | + | if (((curTempSum + curTempSumFromKey) > totalVoteShare)) | |
507 | + | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString((curTempSum + curTempSumFromKey)))) | |
508 | + | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
509 | + | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
510 | + | else $Tuple2([IntegerEntry(kTempCurSum, (curTempSum + curTempSumFromKey))], nil) | |
511 | + | } | |
512 | + | else if ((pagination == 2)) | |
513 | + | then { | |
514 | + | let curSum = (valueOrElse(getInteger(this, kTempCurSum), 0) + curTempSum) | |
515 | + | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
516 | + | if ((curSum != totalVoteShare)) | |
517 | + | then throw("sumRewardPrevious != totalVoteShare or sumRewardCurrent != totalVoteShare") | |
518 | + | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
519 | + | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
520 | + | else $Tuple2([IntegerEntry(kTempCurSum, curSum)], nil) | |
521 | + | } | |
522 | + | else throw("Incorrect pagination") | |
523 | + | ||
524 | + | let previousRewardEntryNew = { | |
525 | + | let $l = currentPools | |
526 | + | let $s = size($l) | |
527 | + | let $acc0 = nil | |
528 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
529 | + | then $a | |
530 | + | else changePreviousRewardEntry($a, $l[$i]) | |
531 | + | ||
532 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
533 | + | then $a | |
534 | + | else throw("List size exceeds 10") | |
535 | + | ||
536 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
537 | + | } | |
538 | + | let currentRewardEntryNew = { | |
539 | + | let $l = currentPools | |
540 | + | let $s = size($l) | |
541 | + | let $acc0 = nil | |
542 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
543 | + | then $a | |
544 | + | else changeCurrentRewardEntry($a, $l[$i]) | |
545 | + | ||
546 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
547 | + | then $a | |
548 | + | else throw("List size exceeds 10") | |
549 | + | ||
550 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
551 | + | } | |
552 | + | let heightEntryNewCur = { | |
553 | + | let $l = currentPools | |
554 | + | let $s = size($l) | |
555 | + | let $acc0 = nil | |
556 | + | func $f2_1 ($a,$i) = if (($i >= $s)) | |
557 | + | then $a | |
558 | + | else changeHeightEntry($a, $l[$i]) | |
559 | + | ||
560 | + | func $f2_2 ($a,$i) = if (($i >= $s)) | |
561 | + | then $a | |
562 | + | else throw("List size exceeds 10") | |
563 | + | ||
564 | + | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
565 | + | } | |
566 | + | let sumRewardCurrentTemp = { | |
567 | + | let $l = currentRewards | |
568 | + | let $s = size($l) | |
569 | + | let $acc0 = 0 | |
570 | + | func $f3_1 ($a,$i) = if (($i >= $s)) | |
571 | + | then $a | |
572 | + | else sum($a, $l[$i]) | |
573 | + | ||
574 | + | func $f3_2 ($a,$i) = if (($i >= $s)) | |
575 | + | then $a | |
576 | + | else throw("List size exceeds 10") | |
577 | + | ||
578 | + | $f3_2($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
579 | + | } | |
580 | + | let $t02055420665 = getSumReward(sumRewardCurrentTemp, pagination) | |
581 | + | let sumRewardCurrent = $t02055420665._1 | |
582 | + | let rewardUpdateHeightFirstPaginationEntry = $t02055420665._2 | |
583 | + | let rewardUpdateHeightEntry = if ((pagination == 2)) | |
584 | + | then [IntegerEntry(kRewardUpdateHeight, rewardUpdateHeight)] | |
585 | + | else nil | |
586 | + | if ((height > rewardUpdateHeight)) | |
587 | + | then throw("rewardUpdateHeight < height") | |
588 | + | else (((((previousRewardEntryNew ++ currentRewardEntryNew) ++ heightEntryNewCur) ++ sumRewardCurrent) ++ rewardUpdateHeightEntry) ++ rewardUpdateHeightFirstPaginationEntry) | |
589 | + | } | |
590 | + | }) | |
599 | 591 | ||
600 | 592 | ||
601 | 593 | ||
602 | 594 | @Callable(i) | |
603 | - | func activate () = if (isActive) | |
595 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
596 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
597 | + | else suspend("Paused by admin")) | |
598 | + | ||
599 | + | ||
600 | + | ||
601 | + | @Callable(i) | |
602 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
604 | 603 | then throw("DApp is already active") | |
605 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
606 | - | then throw("Only admin can call this function") | |
607 | - | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
604 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
608 | 605 | ||
609 | 606 | ||
610 | 607 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kActive = "active" | |
5 | 5 | ||
6 | 6 | let kCause = "shutdown_cause" | |
7 | 7 | ||
8 | 8 | let kLastInterest = "last_interest" | |
9 | 9 | ||
10 | 10 | let kUserLastInterest = "_last_interest" | |
11 | 11 | ||
12 | 12 | let kUserSWOPLocked = "_SWOP_amount" | |
13 | 13 | ||
14 | - | let kUserGetBackHeight = "_getBackHeight" | |
15 | - | ||
16 | 14 | let kTotalSWOPLocked = "total_SWOP_amount" | |
17 | 15 | ||
18 | - | let | |
16 | + | let kUserSwopUnlockHeight = "_SWOP_unlock_height" | |
19 | 17 | ||
20 | - | let | |
18 | + | let kUserGSwopLocked = "_GSwop_amount" | |
21 | 19 | ||
22 | - | let | |
20 | + | let kTotalGSwopLocked = "total_GSwop_amount" | |
23 | 21 | ||
24 | - | let | |
22 | + | let kUserTotalVoteSWOP = "_user_total_vote_gSWOP" | |
25 | 23 | ||
26 | - | let kUserSWOPLastClaimedAmount = "_SWOP_last_claimed_amount" | |
27 | - | ||
28 | - | let kVoteName = "vote_name" | |
29 | - | ||
30 | - | let kOptionName = "_option_name" | |
31 | - | ||
32 | - | let kVotingStartHeight = "_startHeight" | |
33 | - | ||
34 | - | let kVoteDuration = "_vote_duration" | |
24 | + | let kUserAvailableForClaim = "_user_available_for_claim" | |
35 | 25 | ||
36 | 26 | let kRewardPoolFractionCurrent = "_current_pool_fraction_reward" | |
37 | 27 | ||
38 | 28 | let kRewardPoolFractionPrevious = "_previous_pool_fraction_reward" | |
39 | 29 | ||
40 | 30 | let kHeightPoolFraction = "_pool_reward_update_height" | |
41 | - | ||
42 | - | let kTotalRewardPerBlockCurrent = "total_reward_per_block_current" | |
43 | - | ||
44 | - | let kTotalRewardPerBlockPrevious = "total_reward_per_block_previous" | |
45 | 31 | ||
46 | 32 | let kRewardUpdateHeight = "reward_update_height" | |
47 | 33 | ||
48 | 34 | let kRewardUpdateFirstPaginationHeight = "reward_update_height_first_pagination" | |
49 | 35 | ||
50 | 36 | let kNoVotingForNewPool = "_vote_no" | |
51 | 37 | ||
52 | 38 | let kYesVotingForNewPool = "_vote_yes" | |
53 | - | ||
54 | - | let kAmountOfVotingForNewPool = "max_amount_voting" | |
55 | 39 | ||
56 | 40 | let kStatusOfVotingForNewPool = "_status" | |
57 | 41 | ||
58 | 42 | let kHeightOfPoolVotingForNewPool = "_finish_height" | |
59 | 43 | ||
60 | 44 | let activeVoteFirst = "voting_active_cell_1" | |
61 | 45 | ||
62 | 46 | let activeVoteSecond = "voting_active_cell_2" | |
63 | 47 | ||
64 | 48 | let activeVoteThird = "voting_active_cell_3" | |
65 | 49 | ||
66 | 50 | let kTempCurSum = "sum_reward_current" | |
67 | 51 | ||
68 | 52 | let kLaunchpadBoughtTickets = "_bought_tickets" | |
69 | 53 | ||
70 | 54 | let kLaunchpadSwopPerTickets = "_swop_per_ticket" | |
71 | 55 | ||
72 | 56 | let kLaunchpadActiveId = "launchpad_active_id" | |
73 | 57 | ||
74 | 58 | let kLaunchpadDuration = "_duration" | |
75 | 59 | ||
76 | 60 | let kLaunchpadStartHeight = "_start_height" | |
77 | 61 | ||
78 | 62 | let kStartHeight = "start_height" | |
79 | 63 | ||
80 | 64 | let kBasePeriod = "base_period" | |
81 | 65 | ||
82 | 66 | let kPeriodLength = "period_length" | |
83 | 67 | ||
84 | 68 | let kUserTotalStruc = "_user_total_struc" | |
85 | 69 | ||
86 | 70 | let kLauchpadFreezSwopDuration = "_freeze_swop_duration" | |
87 | 71 | ||
88 | 72 | let kSWOPid = "SWOP_id" | |
89 | 73 | ||
90 | 74 | let kAirdropFee = "airdrop_fee" | |
91 | 75 | ||
92 | 76 | let kAdminPubKey1 = "admin_pub_1" | |
93 | 77 | ||
94 | 78 | let kAdminPubKey2 = "admin_pub_2" | |
95 | 79 | ||
96 | 80 | let kAdminPubKey3 = "admin_pub_3" | |
97 | 81 | ||
98 | 82 | let kMoneyBoxPubKey = "money_box_pub_key" | |
99 | 83 | ||
100 | 84 | let kFarmingAddr = "farming_address" | |
101 | 85 | ||
102 | 86 | let kVotingAddr = "voting_address" | |
103 | 87 | ||
104 | 88 | let kVotingNewPoolAddr = "voting_new_pool_address" | |
105 | 89 | ||
106 | 90 | let kLaunchpadAddr = "launchpad_address" | |
107 | 91 | ||
108 | 92 | let kAirdropMoneyBoxAddr = "airdrop_fee_money_box" | |
109 | 93 | ||
110 | 94 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
111 | 95 | ||
112 | 96 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
113 | 97 | case string: String => | |
114 | 98 | fromBase58String(string) | |
115 | 99 | case nothing => | |
116 | 100 | throw((key + "is empty")) | |
117 | 101 | } | |
118 | 102 | ||
119 | 103 | ||
120 | 104 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
121 | 105 | ||
122 | 106 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
123 | 107 | ||
124 | 108 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
125 | 109 | ||
126 | 110 | let moneyBoxPubKey = getBase58FromOracle(kMoneyBoxPubKey) | |
127 | 111 | ||
128 | 112 | let farmingAddr = Address(getBase58FromOracle(kFarmingAddr)) | |
129 | 113 | ||
130 | 114 | let votingAddr = Address(getBase58FromOracle(kVotingAddr)) | |
131 | 115 | ||
132 | 116 | let votingNewPoolAddr = Address(getBase58FromOracle(kVotingNewPoolAddr)) | |
133 | 117 | ||
134 | 118 | let launchpadAddr = Address(getBase58FromOracle(kLaunchpadAddr)) | |
135 | 119 | ||
136 | 120 | let airdropMoneyBoxAddr = Address(getBase58FromOracle(kAirdropMoneyBoxAddr)) | |
137 | 121 | ||
122 | + | let lockSwopBlocksAmount = (10102 * 4) | |
123 | + | ||
138 | 124 | let SWOP = fromBase58String(getStringValue(farmingAddr, kSWOPid)) | |
139 | 125 | ||
140 | 126 | let scaleValue = 100000000 | |
141 | 127 | ||
142 | 128 | let totalVoteShare = 10000000000 | |
143 | 129 | ||
144 | 130 | let feeSacle6 = 1000000 | |
145 | 131 | ||
146 | 132 | let basePeriod = valueOrErrorMessage(getInteger(votingAddr, kBasePeriod), "Empty kBasePeriod at voting contract") | |
147 | 133 | ||
148 | 134 | let startHeight = valueOrErrorMessage(getInteger(votingAddr, kStartHeight), "Empty kStartHeight at voting contract") | |
149 | 135 | ||
150 | 136 | let periodLength = valueOrErrorMessage(getInteger(votingAddr, kPeriodLength), "Empty kPeriodLength at voting contract") | |
151 | 137 | ||
152 | 138 | let firstActiveVote = valueOrElse(getString(votingNewPoolAddr, activeVoteFirst), "") | |
153 | 139 | ||
154 | 140 | let secondActiveVote = valueOrElse(getString(votingNewPoolAddr, activeVoteSecond), "") | |
155 | 141 | ||
156 | 142 | let thirdActiveVote = valueOrElse(getString(votingNewPoolAddr, activeVoteThird), "") | |
157 | 143 | ||
158 | - | let | |
144 | + | let active = valueOrElse(getBoolean(this, kActive), true) | |
159 | 145 | ||
160 | 146 | let airdropFee = getIntegerValue(oracle, kAirdropFee) | |
161 | 147 | ||
162 | 148 | let currVotingPeriod = (basePeriod + ((height - startHeight) / periodLength)) | |
163 | 149 | ||
164 | 150 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
165 | 151 | ||
166 | 152 | ||
167 | - | func throwNotEnoughSWOP () = throw("Not enough SWOP: userSWOPLocked - userTotalVoteAmount < voteSWOPAmount") | |
153 | + | func isActive () = if (active) | |
154 | + | then unit | |
155 | + | else throw("DApp is inactive at this moment") | |
156 | + | ||
157 | + | ||
158 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
159 | + | then unit | |
160 | + | else throw("Only admin can call this function") | |
168 | 161 | ||
169 | 162 | ||
170 | 163 | func getLastInterestInfo () = valueOrElse(getInteger(this, kLastInterest), 0) | |
171 | 164 | ||
172 | 165 | ||
173 | - | func getUserSWOPLocked (user) = valueOrElse(getInteger(this, (toString(user) + kUserSWOPLocked)), 0) | |
166 | + | func getTotalLockedInfo () = { | |
167 | + | let totalSwopLocked = valueOrElse(getInteger(this, kTotalSWOPLocked), 0) | |
168 | + | let totalGSwopLocked = valueOrElse(getInteger(this, kTotalGSwopLocked), totalSwopLocked) | |
169 | + | $Tuple2(totalSwopLocked, totalGSwopLocked) | |
170 | + | } | |
174 | 171 | ||
175 | 172 | ||
176 | - | func getUserSWOPClaimedAmount (user) = valueOrElse(getInteger(this, (toString(user) + kUserSWOPClaimedAmount)), 0) | |
177 | - | ||
178 | - | ||
179 | - | func getUserTotalVoteAmount (user) = valueOrElse(getInteger(votingAddr, (toString(user) + kUserTotalVoteSWOP)), 0) | |
173 | + | func getUserLockedInfo (user) = { | |
174 | + | let userSwopLocked = valueOrElse(getInteger(this, (user + kUserSWOPLocked)), 0) | |
175 | + | let userGSwopLocked = valueOrElse(getInteger(this, (user + kUserGSwopLocked)), userSwopLocked) | |
176 | + | $Tuple2(userSwopLocked, userGSwopLocked) | |
177 | + | } | |
180 | 178 | ||
181 | 179 | ||
182 | 180 | func getUserInterestInfo (user,lastInterest) = { | |
183 | - | let userSWOPAmount = getUserSWOPLocked(user) | |
184 | - | let userLastInterest = getInteger(this, (toString(user) + kUserLastInterest)) | |
185 | - | let userLastInterestValue = match userLastInterest { | |
186 | - | case userLastInterest: Int => | |
187 | - | userLastInterest | |
188 | - | case _ => | |
189 | - | lastInterest | |
181 | + | let $t048874950 = getUserLockedInfo(user) | |
182 | + | let userSWOPAmount = $t048874950._1 | |
183 | + | let userGSwopAmount = $t048874950._2 | |
184 | + | let userLastInterest = valueOrElse(getInteger(this, (user + kUserLastInterest)), lastInterest) | |
185 | + | $Tuple3(userLastInterest, userSWOPAmount, userGSwopAmount) | |
190 | 186 | } | |
191 | - | $Tuple2(userLastInterestValue, userSWOPAmount) | |
192 | - | } | |
187 | + | ||
188 | + | ||
189 | + | func getUserAvailableForClaim (user) = valueOrElse(getInteger(this, (user + kUserAvailableForClaim)), 0) | |
193 | 190 | ||
194 | 191 | ||
195 | 192 | func getUserTotalVoteAmountForOnePool (pool,user) = { | |
196 | 193 | let voting = valueOrElse(getInteger(votingNewPoolAddr, pool), -1) | |
197 | 194 | let heightOfVoting = valueOrElse(getInteger(votingNewPoolAddr, (toString(voting) + kHeightOfPoolVotingForNewPool)), 0) | |
198 | 195 | let statusOfVoting = valueOrElse(getBoolean(votingNewPoolAddr, (toString(voting) + kStatusOfVotingForNewPool)), true) | |
199 | 196 | let currentHeight = height | |
200 | 197 | if ((0 > voting)) | |
201 | 198 | then 0 | |
202 | 199 | else if (!(statusOfVoting)) | |
203 | 200 | then 0 | |
204 | 201 | else if ((heightOfVoting > currentHeight)) | |
205 | 202 | then (valueOrElse(getInteger(votingNewPoolAddr, (((toString(user) + "_") + toString(voting)) + kYesVotingForNewPool)), 0) + valueOrElse(getInteger(votingNewPoolAddr, (((toString(user) + "_") + toString(voting)) + kNoVotingForNewPool)), 0)) | |
206 | 203 | else 0 | |
207 | 204 | } | |
208 | 205 | ||
209 | 206 | ||
210 | 207 | func getUserTotalVoteForNewPoolAmount (user) = { | |
211 | 208 | let listOfVoting = [getUserTotalVoteAmountForOnePool(firstActiveVote, user), getUserTotalVoteAmountForOnePool(secondActiveVote, user), getUserTotalVoteAmountForOnePool(thirdActiveVote, user)] | |
212 | 209 | max(listOfVoting) | |
213 | 210 | } | |
214 | 211 | ||
215 | 212 | ||
216 | 213 | func getUserBlockedInLauchpad (user) = { | |
217 | 214 | let lauchpadId = toString(valueOrElse(getInteger(launchpadAddr, kLaunchpadActiveId), 0)) | |
218 | 215 | if ((lauchpadId == "0")) | |
219 | 216 | then 0 | |
220 | 217 | else { | |
221 | 218 | let lStartHeight = valueOrElse(getInteger(launchpadAddr, (lauchpadId + kLaunchpadStartHeight)), 0) | |
222 | 219 | let lDuration = valueOrElse(getInteger(launchpadAddr, (lauchpadId + kLaunchpadDuration)), 0) | |
223 | 220 | let lFreezeSwopDuration = valueOrElse(getInteger(launchpadAddr, (lauchpadId + kLauchpadFreezSwopDuration)), 0) | |
224 | 221 | let blockEndHeight = ((lStartHeight + lDuration) + lFreezeSwopDuration) | |
225 | 222 | if ((height > blockEndHeight)) | |
226 | 223 | then 0 | |
227 | 224 | else { | |
228 | 225 | let boughtTickets = valueOrElse(getInteger(launchpadAddr, (((toString(user) + "_") + lauchpadId) + kLaunchpadBoughtTickets)), 0) | |
229 | 226 | let swopPerTicket = valueOrElse(getInteger(launchpadAddr, (lauchpadId + kLaunchpadSwopPerTickets)), 0) | |
230 | 227 | (boughtTickets * swopPerTicket) | |
231 | 228 | } | |
232 | 229 | } | |
233 | 230 | } | |
234 | 231 | ||
235 | 232 | ||
236 | - | func getTotalSWOPLocked () = valueOrElse(getInteger(this, kTotalSWOPLocked), 0) | |
237 | - | ||
238 | - | ||
239 | 233 | func getUserVoteInfo (user) = { | |
240 | - | let $ | |
234 | + | let $t073147847 = if (isDefined(getString(votingAddr, (toString(user) + kUserTotalStruc)))) | |
241 | 235 | then { | |
242 | 236 | let data = split(valueOrErrorMessage(getString(votingAddr, (toString(user) + kUserTotalStruc)), "Empty kUserTotalStruc"), "_") | |
243 | 237 | $Tuple3(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2])) | |
244 | 238 | } | |
245 | 239 | else { | |
246 | 240 | let uPoolTotalSWOP = valueOrElse(getInteger(votingAddr, (toString(user) + kUserTotalVoteSWOP)), 0) | |
247 | 241 | $Tuple3(uPoolTotalSWOP, 0, currVotingPeriod) | |
248 | 242 | } | |
249 | - | let userTotalVoteSWOP = $ | |
250 | - | let userUnvoted = $ | |
251 | - | let userUnvotedPeriod = $ | |
243 | + | let userTotalVoteSWOP = $t073147847._1 | |
244 | + | let userUnvoted = $t073147847._2 | |
245 | + | let userUnvotedPeriod = $t073147847._3 | |
252 | 246 | let userUnvotedActual = if ((userUnvotedPeriod == currVotingPeriod)) | |
253 | 247 | then userUnvoted | |
254 | 248 | else 0 | |
255 | 249 | $Tuple2(userTotalVoteSWOP, userUnvotedActual) | |
256 | 250 | } | |
257 | - | ||
258 | - | ||
259 | - | func getUserVoteOptionAmount (user) = valueOrElse(getInteger(this, (toString(user) + kUserVoteOptionAmount)), 0) | |
260 | - | ||
261 | - | ||
262 | - | func getVotingStartHeight (voteName) = valueOrElse(getInteger(this, (voteName + kVotingStartHeight)), 0) | |
263 | 251 | ||
264 | 252 | ||
265 | 253 | func getPoolUpdateHeight (pool) = valueOrElse(getInteger(this, (pool + kHeightPoolFraction)), 0) | |
266 | 254 | ||
267 | 255 | ||
268 | 256 | func isDefinePoolUpdateHeight (pool) = isDefined(getInteger(this, (pool + kHeightPoolFraction))) | |
269 | 257 | ||
270 | 258 | ||
271 | 259 | func getCurPoolWeight (pool) = valueOrElse(getInteger(this, (pool + kRewardPoolFractionCurrent)), 0) | |
272 | 260 | ||
273 | 261 | ||
274 | 262 | func getPrevPoolWeight (pool) = valueOrElse(getInteger(this, (pool + kRewardPoolFractionPrevious)), 0) | |
275 | 263 | ||
276 | 264 | ||
277 | - | func getVoteOptionAmount (user,voteName,option) = { | |
278 | - | let userVoteOptionAmount = getInteger(this, (((voteName + option) + toString(user)) + kUserVoteOptionAmount)) | |
279 | - | let uvoa = match userVoteOptionAmount { | |
280 | - | case uvoa: Int => | |
281 | - | uvoa | |
282 | - | case uvoa: Unit => | |
283 | - | 0 | |
284 | - | case _ => | |
285 | - | throw("Match error") | |
286 | - | } | |
287 | - | valueOrErrorMessage(uvoa, (((("No data on the key: " + voteName) + option) + toString(user)) + kUserVoteOptionAmount)) | |
288 | - | } | |
289 | - | ||
290 | - | ||
291 | - | func getVoteDuration (voteName) = valueOrErrorMessage(getInteger(this, (voteName + kVoteDuration)), (("No data on the key: " + voteName) + kVoteDuration)) | |
292 | - | ||
293 | - | ||
294 | - | func getTotalVoteOptionAmount (voteName,option) = { | |
295 | - | let totalVoteOptionAmount = getInteger(this, ((voteName + option) + kTotalVoteOptionAmount)) | |
296 | - | let tvoa = match totalVoteOptionAmount { | |
297 | - | case tvoa: Int => | |
298 | - | tvoa | |
299 | - | case tvoa: Unit => | |
300 | - | 0 | |
301 | - | case _ => | |
302 | - | throw("Match error") | |
303 | - | } | |
304 | - | tvoa | |
305 | - | } | |
306 | - | ||
307 | - | ||
308 | - | func getUserGetBackAmount (voteName,option,user,getBackSWOPHeight) = { | |
309 | - | let key = ((((((voteName + "_") + option) + "_") + toString(user)) + "_") + toString(getBackSWOPHeight)) | |
310 | - | valueOrErrorMessage(getInteger(this, key), ("No data on the key: " + key)) | |
311 | - | } | |
312 | - | ||
313 | - | ||
314 | - | func claimCalc (caller) = { | |
265 | + | func claimCalc (user) = { | |
315 | 266 | let lastInterest = getLastInterestInfo() | |
316 | - | let $t01053010612 = getUserInterestInfo(caller, lastInterest) | |
317 | - | let userLastInterest = $t01053010612._1 | |
318 | - | let userSWOPLocked = $t01053010612._2 | |
319 | - | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
267 | + | let $t087218818 = getUserInterestInfo(user, lastInterest) | |
268 | + | let userLastInterest = $t087218818._1 | |
269 | + | let userSWOPLocked = $t087218818._2 | |
270 | + | let userGSwopAmount = $t087218818._3 | |
271 | + | let claimAmount = fraction(userGSwopAmount, (lastInterest - userLastInterest), scaleValue) | |
320 | 272 | let userNewInterest = lastInterest | |
321 | 273 | $Tuple2(userNewInterest, claimAmount) | |
322 | 274 | } | |
323 | 275 | ||
324 | 276 | ||
325 | 277 | @Callable(i) | |
326 | - | func airDrop () = | |
327 | - | | |
328 | - | | |
329 | - | ||
330 | - | | |
331 | - | | |
332 | - | | |
333 | - | | |
334 | - | | |
335 | - | ||
336 | - | ||
337 | - | ||
338 | - | ||
278 | + | func airDrop () = valueOrElse(isActive(), { | |
279 | + | let $t090489123 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
280 | + | let pmtAmount = $t090489123._1 | |
281 | + | let pmtAssetId = $t090489123._2 | |
282 | + | if ((pmtAssetId != SWOP)) | |
283 | + | then throw("Incorrect pmtAssetId") | |
284 | + | else { | |
285 | + | let airdropFeeAmount = fraction(pmtAmount, airdropFee, feeSacle6, CEILING) | |
286 | + | let $t092969358 = getTotalLockedInfo() | |
287 | + | let totalSWOPLocked = $t092969358._1 | |
288 | + | let totalGSwopLocked = $t092969358._2 | |
289 | + | let lastInterest = getLastInterestInfo() | |
290 | + | let interestNew = (lastInterest + fraction((pmtAmount - airdropFeeAmount), scaleValue, totalGSwopLocked)) | |
339 | 291 | [IntegerEntry(kLastInterest, interestNew), ScriptTransfer(airdropMoneyBoxAddr, airdropFeeAmount, SWOP)] | |
340 | - | ||
341 | - | ||
292 | + | } | |
293 | + | }) | |
342 | 294 | ||
343 | 295 | ||
344 | 296 | ||
345 | 297 | @Callable(i) | |
346 | - | func lockSWOP () = if (!(isActive)) | |
347 | - | then throw("DApp is inactive at this moment") | |
348 | - | else { | |
349 | - | let $t01158811663 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
350 | - | let pmtAmount = $t01158811663._1 | |
351 | - | let pmtAssetId = $t01158811663._2 | |
352 | - | if ((pmtAssetId != SWOP)) | |
353 | - | then throw("Incorrect pmtAssetId") | |
354 | - | else { | |
355 | - | let lastInterest = getLastInterestInfo() | |
356 | - | let $t01177911863 = getUserInterestInfo(i.caller, lastInterest) | |
357 | - | let userLastInterest = $t01177911863._1 | |
358 | - | let userSWOPLocked = $t01177911863._2 | |
359 | - | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
360 | - | let userSWOPLockedNew = ((userSWOPLocked + pmtAmount) + claimAmount) | |
361 | - | let userNewInterest = lastInterest | |
362 | - | let totalSWOPLocked = getTotalSWOPLocked() | |
363 | - | let totalSWOPLockedNew = ((totalSWOPLocked + pmtAmount) + claimAmount) | |
364 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
365 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
366 | - | [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount)] | |
367 | - | } | |
368 | - | } | |
298 | + | func lockSWOP () = valueOrElse(isActive(), { | |
299 | + | let $t097369811 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
300 | + | let pmtAmount = $t097369811._1 | |
301 | + | let pmtAssetId = $t097369811._2 | |
302 | + | if ((pmtAssetId != SWOP)) | |
303 | + | then throw("Incorrect pmtAssetId") | |
304 | + | else { | |
305 | + | let user = toString(i.caller) | |
306 | + | let lastInterest = getLastInterestInfo() | |
307 | + | let $t0996210025 = getUserLockedInfo(user) | |
308 | + | let userSWOPLocked = $t0996210025._1 | |
309 | + | let userGSwopLocked = $t0996210025._2 | |
310 | + | let $t01003010091 = claimCalc(user) | |
311 | + | let userNewInterest = $t01003010091._1 | |
312 | + | let claimAmountAvailable = $t01003010091._2 | |
313 | + | let availableForClaim = getUserAvailableForClaim(user) | |
314 | + | let availableForClaimNew = (availableForClaim + claimAmountAvailable) | |
315 | + | let userSWOPLockedNew = (userSWOPLocked + pmtAmount) | |
316 | + | let userGSwopLockedNew = (userGSwopLocked + pmtAmount) | |
317 | + | let $t01033910401 = getTotalLockedInfo() | |
318 | + | let totalSWOPLocked = $t01033910401._1 | |
319 | + | let totalGSwopLocked = $t01033910401._2 | |
320 | + | let totalSWOPLockedNew = (totalSWOPLocked + pmtAmount) | |
321 | + | let totalGSwopLockedNew = (totalGSwopLocked + pmtAmount) | |
322 | + | [IntegerEntry((user + kUserSwopUnlockHeight), (height + lockSwopBlocksAmount)), IntegerEntry((user + kUserLastInterest), userNewInterest), IntegerEntry((user + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((user + kUserGSwopLocked), userGSwopLocked), IntegerEntry((user + kUserAvailableForClaim), availableForClaimNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew)] | |
323 | + | } | |
324 | + | }) | |
369 | 325 | ||
370 | 326 | ||
371 | 327 | ||
372 | 328 | @Callable(i) | |
373 | - | func withdrawSWOP (withdrawAmount) = if (!(isActive)) | |
374 | - | then throw("DApp is inactive at this moment") | |
375 | - | else if ((0 >= withdrawAmount)) | |
329 | + | func withdrawSWOP (withdrawAmount) = valueOrElse(isActive(), { | |
330 | + | let user = toString(i.caller) | |
331 | + | let unlockHeight = valueOrElse(getInteger(this, (user + kUserSwopUnlockHeight)), 0) | |
332 | + | if ((0 >= withdrawAmount)) | |
376 | 333 | then throw("withdrawAmount <= 0") | |
377 | - | else { | |
378 | - | let totalSWOPLocked = getTotalSWOPLocked() | |
379 | - | let userSWOPLocked = getUserSWOPLocked(i.caller) | |
380 | - | let $t01300413059 = claimCalc(i.caller) | |
381 | - | let userNewInterest = $t01300413059._1 | |
382 | - | let claimAmount = $t01300413059._2 | |
383 | - | let $t01306413129 = getUserVoteInfo(i.caller) | |
384 | - | let userVoteAmount = $t01306413129._1 | |
385 | - | let userUnvoteAmount = $t01306413129._2 | |
386 | - | let userVoteAmountForNewPool = getUserTotalVoteForNewPoolAmount(i.caller) | |
387 | - | let blockedInLaunchpad = getUserBlockedInLauchpad(i.caller) | |
388 | - | if (if (if ((0 > userUnvoteAmount)) | |
389 | - | then true | |
390 | - | else (0 > userVoteAmount)) | |
391 | - | then true | |
392 | - | else (0 > userVoteAmountForNewPool)) | |
393 | - | then throw("userUnvoteAmount < 0 || userVoteAmount < 0 || userVoteAmountForNewPool < 0") | |
394 | - | else { | |
395 | - | let availableToUnstake = (userSWOPLocked - max([userVoteAmountForNewPool, (userVoteAmount + userUnvoteAmount), blockedInLaunchpad])) | |
396 | - | if ((withdrawAmount > availableToUnstake)) | |
397 | - | then throw("withdrawAmount > availableToUnstake") | |
398 | - | else { | |
399 | - | let totalSWOPLockedNew = ((totalSWOPLocked + claimAmount) - withdrawAmount) | |
400 | - | let userSWOPamountNew = ((userSWOPLocked + claimAmount) - withdrawAmount) | |
401 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
402 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
403 | - | [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPamountNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), ScriptTransfer(i.caller, withdrawAmount, SWOP), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount)] | |
404 | - | } | |
405 | - | } | |
406 | - | } | |
334 | + | else if ((unlockHeight > height)) | |
335 | + | then throw(("You can't withdraw till " + toString(unlockHeight))) | |
336 | + | else { | |
337 | + | let $t01137611438 = getTotalLockedInfo() | |
338 | + | let totalSWOPLocked = $t01137611438._1 | |
339 | + | let totalGSwopLocked = $t01137611438._2 | |
340 | + | let $t01144311506 = getUserLockedInfo(user) | |
341 | + | let userSWOPLocked = $t01144311506._1 | |
342 | + | let userGSwopLocked = $t01144311506._2 | |
343 | + | let $t01151111572 = claimCalc(user) | |
344 | + | let userNewInterest = $t01151111572._1 | |
345 | + | let claimAmountAvailable = $t01151111572._2 | |
346 | + | let $t01157711643 = getUserVoteInfo(i.caller) | |
347 | + | let userVoteAmount = $t01157711643._1 | |
348 | + | let userUnvoteAmount = $t01157711643._2 | |
349 | + | let userVoteAmountForNewPool = getUserTotalVoteForNewPoolAmount(i.caller) | |
350 | + | let blockedInLaunchpad = getUserBlockedInLauchpad(i.caller) | |
351 | + | if (if (if ((0 > userUnvoteAmount)) | |
352 | + | then true | |
353 | + | else (0 > userVoteAmount)) | |
354 | + | then true | |
355 | + | else (0 > userVoteAmountForNewPool)) | |
356 | + | then throw("userUnvoteAmount < 0 || userVoteAmount < 0 || userVoteAmountForNewPool < 0") | |
357 | + | else { | |
358 | + | let availableToUnstake = (userSWOPLocked - max([userVoteAmountForNewPool, (userVoteAmount + userUnvoteAmount), blockedInLaunchpad])) | |
359 | + | if ((withdrawAmount > availableToUnstake)) | |
360 | + | then throw("withdrawAmount > availableToUnstake") | |
361 | + | else { | |
362 | + | let availableForClaim = getUserAvailableForClaim(user) | |
363 | + | let availableForClaimNew = (availableForClaim + claimAmountAvailable) | |
364 | + | let totalSWOPLockedNew = (totalSWOPLocked - withdrawAmount) | |
365 | + | let userSWOPAmountNew = (userSWOPLocked - withdrawAmount) | |
366 | + | let totalGSwopLockedNew = ((totalGSwopLocked - userGSwopLocked) + userSWOPAmountNew) | |
367 | + | [IntegerEntry((user + kUserLastInterest), userNewInterest), IntegerEntry((user + kUserSWOPLocked), userSWOPAmountNew), IntegerEntry((user + kUserGSwopLocked), userSWOPAmountNew), IntegerEntry((user + kUserAvailableForClaim), availableForClaimNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew), ScriptTransfer(i.caller, withdrawAmount, SWOP)] | |
368 | + | } | |
369 | + | } | |
370 | + | } | |
371 | + | }) | |
407 | 372 | ||
408 | 373 | ||
409 | 374 | ||
410 | 375 | @Callable(i) | |
411 | - | func claimAndWithdrawSWOP () = if (!(isActive)) | |
412 | - | then throw("DApp is inactive at this moment") | |
413 | - | else { | |
414 | - | let lastInterest = getLastInterestInfo() | |
415 | - | let $t01457914634 = claimCalc(i.caller) | |
416 | - | let userNewInterest = $t01457914634._1 | |
417 | - | let claimAmount = $t01457914634._2 | |
418 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
419 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
420 | - | if ((claimAmount == 0)) | |
421 | - | then throw("You have 0 available SWOP") | |
422 | - | else [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount), ScriptTransfer(i.caller, claimAmount, SWOP)] | |
423 | - | } | |
376 | + | func claimAndWithdrawSWOP () = valueOrElse(isActive(), { | |
377 | + | let user = toString(i.caller) | |
378 | + | let availableForClaim = getUserAvailableForClaim(user) | |
379 | + | let $t01316213214 = claimCalc(user) | |
380 | + | let userNewInterest = $t01316213214._1 | |
381 | + | let claimAmount = $t01316213214._2 | |
382 | + | let userClaimAmount = (availableForClaim + claimAmount) | |
383 | + | if ((userClaimAmount == 0)) | |
384 | + | then throw("You have 0 available SWOP") | |
385 | + | else [IntegerEntry((user + kUserLastInterest), userNewInterest), ScriptTransfer(i.caller, userClaimAmount, SWOP)] | |
386 | + | }) | |
424 | 387 | ||
425 | 388 | ||
426 | 389 | ||
427 | 390 | @Callable(i) | |
428 | - | func claimAndStakeSWOP () = if (!(isActive)) | |
429 | - | then throw("DApp is inactive at this moment") | |
430 | - | else { | |
431 | - | let totalSWOPLocked = getTotalSWOPLocked() | |
432 | - | let userSWOPLocked = getUserSWOPLocked(i.caller) | |
433 | - | let lastInterest = getLastInterestInfo() | |
434 | - | let $t01540715462 = claimCalc(i.caller) | |
435 | - | let userNewInterest = $t01540715462._1 | |
436 | - | let claimAmount = $t01540715462._2 | |
437 | - | let userSWOPLockedNew = (userSWOPLocked + claimAmount) | |
438 | - | let totalSWOPLockedNew = (totalSWOPLocked + claimAmount) | |
439 | - | let userClaimedAmount = getUserSWOPClaimedAmount(i.caller) | |
440 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
441 | - | if ((claimAmount == 0)) | |
442 | - | then throw("You have 0 available SWOP") | |
443 | - | else [IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + kUserSWOPLastClaimedAmount), claimAmount)] | |
444 | - | } | |
391 | + | func claimAndStakeSWOP () = valueOrElse(isActive(), { | |
392 | + | let user = toString(i.caller) | |
393 | + | let $t01358713649 = getTotalLockedInfo() | |
394 | + | let totalSWOPLocked = $t01358713649._1 | |
395 | + | let totalGSwopLocked = $t01358713649._2 | |
396 | + | let $t01365413717 = getUserLockedInfo(user) | |
397 | + | let userSWOPLocked = $t01365413717._1 | |
398 | + | let userGSwopLocked = $t01365413717._2 | |
399 | + | let availableForClaim = getUserAvailableForClaim(user) | |
400 | + | let $t01378113832 = claimCalc(user) | |
401 | + | let userNewInterest = $t01378113832._1 | |
402 | + | let claimAmount = $t01378113832._2 | |
403 | + | let userClaimAmount = (availableForClaim + claimAmount) | |
404 | + | let userSWOPLockedNew = (userSWOPLocked + userClaimAmount) | |
405 | + | let userGSwopLockedNew = (userGSwopLocked + (userClaimAmount * 2)) | |
406 | + | let totalSWOPLockedNew = (totalSWOPLocked + userClaimAmount) | |
407 | + | let totalGSwopLockedNew = (totalGSwopLocked + (userClaimAmount * 2)) | |
408 | + | if ((userClaimAmount == 0)) | |
409 | + | then throw("You have 0 available SWOP") | |
410 | + | else [IntegerEntry((toString(i.caller) + kUserSwopUnlockHeight), (height + lockSwopBlocksAmount)), IntegerEntry((toString(i.caller) + kUserLastInterest), userNewInterest), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew), IntegerEntry((toString(i.caller) + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((toString(i.caller) + kUserGSwopLocked), userGSwopLockedNew)] | |
411 | + | }) | |
445 | 412 | ||
446 | 413 | ||
447 | 414 | ||
448 | 415 | @Callable(i) | |
449 | - | func updateWeights (currentPools,currentRewards,rewardUpdateHeight,pagination) = if (!(isActive)) | |
450 | - | then throw("DApp is inactive at this moment") | |
451 | - | else { | |
452 | - | let amountPools = 10 | |
453 | - | let totalRewardUpdateHeight = valueOrElse(getInteger(this, kRewardUpdateHeight), 0) | |
454 | - | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, moneyBoxPubKey], i.callerPublicKey))) | |
455 | - | then throw("Only admin can call this function") | |
456 | - | else if ((size(currentPools) > amountPools)) | |
457 | - | then throw(("Max amount of pool is " + toString(amountPools))) | |
458 | - | else if ((totalRewardUpdateHeight >= rewardUpdateHeight)) | |
459 | - | then throw("rewardUpdateHeight <= totalRewardUpdateHeight") | |
460 | - | else if ((height >= rewardUpdateHeight)) | |
461 | - | then throw("height >= rewardUpdateHeight") | |
462 | - | else if ((0 >= rewardUpdateHeight)) | |
463 | - | then throw("0 >= rewardUpdateHeight ") | |
464 | - | else { | |
465 | - | func sum (a,b) = (a + b) | |
466 | - | ||
467 | - | func changePreviousRewardEntry (accumulated,pool) = { | |
468 | - | let poolRewardUpdateHeight = getPoolUpdateHeight(pool) | |
469 | - | if (if (!(isDefinePoolUpdateHeight(pool))) | |
470 | - | then true | |
471 | - | else if ((rewardUpdateHeight != poolRewardUpdateHeight)) | |
472 | - | then (poolRewardUpdateHeight == totalRewardUpdateHeight) | |
473 | - | else false) | |
474 | - | then { | |
475 | - | let poolReward = getCurPoolWeight(pool) | |
476 | - | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
477 | - | } | |
478 | - | else { | |
479 | - | let poolReward = getPrevPoolWeight(pool) | |
480 | - | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
481 | - | } | |
482 | - | } | |
483 | - | ||
484 | - | func changeCurrentRewardEntry (accumulated,pool) = { | |
485 | - | let poolIndex = value(indexOf(currentPools, pool)) | |
486 | - | let poolReward = currentRewards[poolIndex] | |
487 | - | if ((0 > poolReward)) | |
488 | - | then throw("PoolReward < 0") | |
489 | - | else IntegerEntry((pool + kRewardPoolFractionCurrent), poolReward) :: accumulated | |
490 | - | } | |
491 | - | ||
492 | - | func changeHeightEntry (accumulated,pool) = { | |
493 | - | let poolHeight = rewardUpdateHeight | |
494 | - | IntegerEntry((pool + kHeightPoolFraction), poolHeight) :: accumulated | |
495 | - | } | |
496 | - | ||
497 | - | func getSumReward (curTempSum,pagination) = if ((pagination == 0)) | |
498 | - | then if ((curTempSum > totalVoteShare)) | |
499 | - | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString(curTempSum))) | |
500 | - | else $Tuple2([IntegerEntry(kTempCurSum, curTempSum)], [IntegerEntry(kRewardUpdateFirstPaginationHeight, rewardUpdateHeight)]) | |
501 | - | else if ((pagination == 1)) | |
502 | - | then { | |
503 | - | let curTempSumFromKey = valueOrElse(getInteger(this, kTempCurSum), 0) | |
504 | - | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
505 | - | if (((curTempSum + curTempSumFromKey) > totalVoteShare)) | |
506 | - | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString((curTempSum + curTempSumFromKey)))) | |
507 | - | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
508 | - | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
509 | - | else $Tuple2([IntegerEntry(kTempCurSum, (curTempSum + curTempSumFromKey))], nil) | |
510 | - | } | |
511 | - | else if ((pagination == 2)) | |
512 | - | then { | |
513 | - | let curSum = (valueOrElse(getInteger(this, kTempCurSum), 0) + curTempSum) | |
514 | - | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
515 | - | if ((curSum != totalVoteShare)) | |
516 | - | then throw("sumRewardPrevious != totalVoteShare or sumRewardCurrent != totalVoteShare") | |
517 | - | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
518 | - | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
519 | - | else $Tuple2([IntegerEntry(kTempCurSum, curSum)], nil) | |
520 | - | } | |
521 | - | else throw("Incorrect pagination") | |
522 | - | ||
523 | - | let previousRewardEntryNew = { | |
524 | - | let $l = currentPools | |
525 | - | let $s = size($l) | |
526 | - | let $acc0 = nil | |
527 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
528 | - | then $a | |
529 | - | else changePreviousRewardEntry($a, $l[$i]) | |
530 | - | ||
531 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
532 | - | then $a | |
533 | - | else throw("List size exceeds 10") | |
534 | - | ||
535 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
536 | - | } | |
537 | - | let currentRewardEntryNew = { | |
538 | - | let $l = currentPools | |
539 | - | let $s = size($l) | |
540 | - | let $acc0 = nil | |
541 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
542 | - | then $a | |
543 | - | else changeCurrentRewardEntry($a, $l[$i]) | |
544 | - | ||
545 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
546 | - | then $a | |
547 | - | else throw("List size exceeds 10") | |
548 | - | ||
549 | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
550 | - | } | |
551 | - | let heightEntryNewCur = { | |
552 | - | let $l = currentPools | |
553 | - | let $s = size($l) | |
554 | - | let $acc0 = nil | |
555 | - | func $f2_1 ($a,$i) = if (($i >= $s)) | |
556 | - | then $a | |
557 | - | else changeHeightEntry($a, $l[$i]) | |
558 | - | ||
559 | - | func $f2_2 ($a,$i) = if (($i >= $s)) | |
560 | - | then $a | |
561 | - | else throw("List size exceeds 10") | |
562 | - | ||
563 | - | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
564 | - | } | |
565 | - | let sumRewardCurrentTemp = { | |
566 | - | let $l = currentRewards | |
567 | - | let $s = size($l) | |
568 | - | let $acc0 = 0 | |
569 | - | func $f3_1 ($a,$i) = if (($i >= $s)) | |
570 | - | then $a | |
571 | - | else sum($a, $l[$i]) | |
572 | - | ||
573 | - | func $f3_2 ($a,$i) = if (($i >= $s)) | |
574 | - | then $a | |
575 | - | else throw("List size exceeds 10") | |
576 | - | ||
577 | - | $f3_2($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
578 | - | } | |
579 | - | let $t02055720668 = getSumReward(sumRewardCurrentTemp, pagination) | |
580 | - | let sumRewardCurrent = $t02055720668._1 | |
581 | - | let rewardUpdateHeightFirstPaginationEntry = $t02055720668._2 | |
582 | - | let rewardUpdateHeightEntry = if ((pagination == 2)) | |
583 | - | then [IntegerEntry(kRewardUpdateHeight, rewardUpdateHeight)] | |
584 | - | else nil | |
585 | - | if ((height > rewardUpdateHeight)) | |
586 | - | then throw("rewardUpdateHeight < height") | |
587 | - | else (((((previousRewardEntryNew ++ currentRewardEntryNew) ++ heightEntryNewCur) ++ sumRewardCurrent) ++ rewardUpdateHeightEntry) ++ rewardUpdateHeightFirstPaginationEntry) | |
588 | - | } | |
589 | - | } | |
416 | + | func lockSWOPFromFarming () = valueOrElse(isActive(), { | |
417 | + | let $t01477214847 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
418 | + | let pmtAmount = $t01477214847._1 | |
419 | + | let pmtAssetId = $t01477214847._2 | |
420 | + | if ((i.caller != farmingAddr)) | |
421 | + | then throw("Only farming can call this function") | |
422 | + | else if ((pmtAssetId != SWOP)) | |
423 | + | then throw("Incorrect pmtAssetId") | |
424 | + | else { | |
425 | + | let user = toString(i.originCaller) | |
426 | + | let lastInterest = getLastInterestInfo() | |
427 | + | let $t01509015153 = getUserLockedInfo(user) | |
428 | + | let userSWOPLocked = $t01509015153._1 | |
429 | + | let userGSwopLocked = $t01509015153._2 | |
430 | + | let $t01515815219 = claimCalc(user) | |
431 | + | let userNewInterest = $t01515815219._1 | |
432 | + | let claimAmountAvailable = $t01515815219._2 | |
433 | + | let availableForClaim = getUserAvailableForClaim(user) | |
434 | + | let availableForClaimNew = (availableForClaim + claimAmountAvailable) | |
435 | + | let userSWOPLockedNew = (userSWOPLocked + pmtAmount) | |
436 | + | let userGSwopLockedNew = (userGSwopLocked + (pmtAmount * 2)) | |
437 | + | let $t01547115533 = getTotalLockedInfo() | |
438 | + | let totalSWOPLocked = $t01547115533._1 | |
439 | + | let totalGSwopLocked = $t01547115533._2 | |
440 | + | let totalSWOPLockedNew = (totalSWOPLocked + pmtAmount) | |
441 | + | let totalGSwopLockedNew = (totalGSwopLocked + (pmtAmount * 2)) | |
442 | + | [IntegerEntry((user + kUserSwopUnlockHeight), (height + lockSwopBlocksAmount)), IntegerEntry((user + kUserLastInterest), userNewInterest), IntegerEntry((user + kUserSWOPLocked), userSWOPLockedNew), IntegerEntry((user + kUserGSwopLocked), userGSwopLocked), IntegerEntry((user + kUserAvailableForClaim), availableForClaimNew), IntegerEntry(kTotalSWOPLocked, totalSWOPLockedNew), IntegerEntry(kTotalGSwopLocked, totalGSwopLockedNew)] | |
443 | + | } | |
444 | + | }) | |
590 | 445 | ||
591 | 446 | ||
592 | 447 | ||
593 | 448 | @Callable(i) | |
594 | - | func shutdown () = if (!(isActive)) | |
595 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
596 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
449 | + | func updateWeights (currentPools,currentRewards,rewardUpdateHeight,pagination) = valueOrElse(isActive(), { | |
450 | + | let amountPools = 10 | |
451 | + | let totalRewardUpdateHeight = valueOrElse(getInteger(this, kRewardUpdateHeight), 0) | |
452 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, moneyBoxPubKey], i.callerPublicKey))) | |
597 | 453 | then throw("Only admin can call this function") | |
598 | - | else suspend("Paused by admin") | |
454 | + | else if ((size(currentPools) > amountPools)) | |
455 | + | then throw(("Max amount of pool is " + toString(amountPools))) | |
456 | + | else if ((totalRewardUpdateHeight >= rewardUpdateHeight)) | |
457 | + | then throw("rewardUpdateHeight <= totalRewardUpdateHeight") | |
458 | + | else if ((height >= rewardUpdateHeight)) | |
459 | + | then throw("height >= rewardUpdateHeight") | |
460 | + | else if ((0 >= rewardUpdateHeight)) | |
461 | + | then throw("0 >= rewardUpdateHeight ") | |
462 | + | else { | |
463 | + | func sum (a,b) = (a + b) | |
464 | + | ||
465 | + | func changePreviousRewardEntry (accumulated,pool) = { | |
466 | + | let poolRewardUpdateHeight = getPoolUpdateHeight(pool) | |
467 | + | if (if (!(isDefinePoolUpdateHeight(pool))) | |
468 | + | then true | |
469 | + | else if ((rewardUpdateHeight != poolRewardUpdateHeight)) | |
470 | + | then (poolRewardUpdateHeight == totalRewardUpdateHeight) | |
471 | + | else false) | |
472 | + | then { | |
473 | + | let poolReward = getCurPoolWeight(pool) | |
474 | + | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
475 | + | } | |
476 | + | else { | |
477 | + | let poolReward = getPrevPoolWeight(pool) | |
478 | + | IntegerEntry((pool + kRewardPoolFractionPrevious), poolReward) :: accumulated | |
479 | + | } | |
480 | + | } | |
481 | + | ||
482 | + | func changeCurrentRewardEntry (accumulated,pool) = { | |
483 | + | let poolIndex = value(indexOf(currentPools, pool)) | |
484 | + | let poolReward = currentRewards[poolIndex] | |
485 | + | if ((0 > poolReward)) | |
486 | + | then throw("PoolReward < 0") | |
487 | + | else IntegerEntry((pool + kRewardPoolFractionCurrent), poolReward) :: accumulated | |
488 | + | } | |
489 | + | ||
490 | + | func changeHeightEntry (accumulated,pool) = { | |
491 | + | let poolHeight = rewardUpdateHeight | |
492 | + | let upUIntr = invoke(farmingAddr, "updatePoolInterest", [pool], nil) | |
493 | + | if ((upUIntr == upUIntr)) | |
494 | + | then IntegerEntry((pool + kHeightPoolFraction), poolHeight) :: accumulated | |
495 | + | else throw("Strict value is not equal to itself.") | |
496 | + | } | |
497 | + | ||
498 | + | func getSumReward (curTempSum,pagination) = if ((pagination == 0)) | |
499 | + | then if ((curTempSum > totalVoteShare)) | |
500 | + | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString(curTempSum))) | |
501 | + | else $Tuple2([IntegerEntry(kTempCurSum, curTempSum)], [IntegerEntry(kRewardUpdateFirstPaginationHeight, rewardUpdateHeight)]) | |
502 | + | else if ((pagination == 1)) | |
503 | + | then { | |
504 | + | let curTempSumFromKey = valueOrElse(getInteger(this, kTempCurSum), 0) | |
505 | + | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
506 | + | if (((curTempSum + curTempSumFromKey) > totalVoteShare)) | |
507 | + | then throw(((("sumRewardPrevious > totalVoteShare or sumRewardCurrent > totalVoteShare - " + toString(pagination)) + " ") + toString((curTempSum + curTempSumFromKey)))) | |
508 | + | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
509 | + | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
510 | + | else $Tuple2([IntegerEntry(kTempCurSum, (curTempSum + curTempSumFromKey))], nil) | |
511 | + | } | |
512 | + | else if ((pagination == 2)) | |
513 | + | then { | |
514 | + | let curSum = (valueOrElse(getInteger(this, kTempCurSum), 0) + curTempSum) | |
515 | + | let rewardUpdateHeightFirstPaginationEntry = valueOrElse(getInteger(this, kRewardUpdateFirstPaginationHeight), 0) | |
516 | + | if ((curSum != totalVoteShare)) | |
517 | + | then throw("sumRewardPrevious != totalVoteShare or sumRewardCurrent != totalVoteShare") | |
518 | + | else if ((rewardUpdateHeightFirstPaginationEntry != rewardUpdateHeight)) | |
519 | + | then throw("current rewardUpdateHeight != rewardUpdateHeightFirstPaginationEntry") | |
520 | + | else $Tuple2([IntegerEntry(kTempCurSum, curSum)], nil) | |
521 | + | } | |
522 | + | else throw("Incorrect pagination") | |
523 | + | ||
524 | + | let previousRewardEntryNew = { | |
525 | + | let $l = currentPools | |
526 | + | let $s = size($l) | |
527 | + | let $acc0 = nil | |
528 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
529 | + | then $a | |
530 | + | else changePreviousRewardEntry($a, $l[$i]) | |
531 | + | ||
532 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
533 | + | then $a | |
534 | + | else throw("List size exceeds 10") | |
535 | + | ||
536 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
537 | + | } | |
538 | + | let currentRewardEntryNew = { | |
539 | + | let $l = currentPools | |
540 | + | let $s = size($l) | |
541 | + | let $acc0 = nil | |
542 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
543 | + | then $a | |
544 | + | else changeCurrentRewardEntry($a, $l[$i]) | |
545 | + | ||
546 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
547 | + | then $a | |
548 | + | else throw("List size exceeds 10") | |
549 | + | ||
550 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
551 | + | } | |
552 | + | let heightEntryNewCur = { | |
553 | + | let $l = currentPools | |
554 | + | let $s = size($l) | |
555 | + | let $acc0 = nil | |
556 | + | func $f2_1 ($a,$i) = if (($i >= $s)) | |
557 | + | then $a | |
558 | + | else changeHeightEntry($a, $l[$i]) | |
559 | + | ||
560 | + | func $f2_2 ($a,$i) = if (($i >= $s)) | |
561 | + | then $a | |
562 | + | else throw("List size exceeds 10") | |
563 | + | ||
564 | + | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
565 | + | } | |
566 | + | let sumRewardCurrentTemp = { | |
567 | + | let $l = currentRewards | |
568 | + | let $s = size($l) | |
569 | + | let $acc0 = 0 | |
570 | + | func $f3_1 ($a,$i) = if (($i >= $s)) | |
571 | + | then $a | |
572 | + | else sum($a, $l[$i]) | |
573 | + | ||
574 | + | func $f3_2 ($a,$i) = if (($i >= $s)) | |
575 | + | then $a | |
576 | + | else throw("List size exceeds 10") | |
577 | + | ||
578 | + | $f3_2($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($f3_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
579 | + | } | |
580 | + | let $t02055420665 = getSumReward(sumRewardCurrentTemp, pagination) | |
581 | + | let sumRewardCurrent = $t02055420665._1 | |
582 | + | let rewardUpdateHeightFirstPaginationEntry = $t02055420665._2 | |
583 | + | let rewardUpdateHeightEntry = if ((pagination == 2)) | |
584 | + | then [IntegerEntry(kRewardUpdateHeight, rewardUpdateHeight)] | |
585 | + | else nil | |
586 | + | if ((height > rewardUpdateHeight)) | |
587 | + | then throw("rewardUpdateHeight < height") | |
588 | + | else (((((previousRewardEntryNew ++ currentRewardEntryNew) ++ heightEntryNewCur) ++ sumRewardCurrent) ++ rewardUpdateHeightEntry) ++ rewardUpdateHeightFirstPaginationEntry) | |
589 | + | } | |
590 | + | }) | |
599 | 591 | ||
600 | 592 | ||
601 | 593 | ||
602 | 594 | @Callable(i) | |
603 | - | func activate () = if (isActive) | |
595 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
596 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
597 | + | else suspend("Paused by admin")) | |
598 | + | ||
599 | + | ||
600 | + | ||
601 | + | @Callable(i) | |
602 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
604 | 603 | then throw("DApp is already active") | |
605 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
606 | - | then throw("Only admin can call this function") | |
607 | - | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
604 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
608 | 605 | ||
609 | 606 | ||
610 | 607 | @Verifier(tx) | |
611 | 608 | func verify () = { | |
612 | 609 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
613 | 610 | then 1 | |
614 | 611 | else 0 | |
615 | 612 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
616 | 613 | then 1 | |
617 | 614 | else 0 | |
618 | 615 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
619 | 616 | then 1 | |
620 | 617 | else 0 | |
621 | 618 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
622 | 619 | } | |
623 | 620 |
github/deemru/w8io/026f985 95.01 ms ◑