tx · D3PVQH9UExw5C2NusxkZETYytjddhiEAZnHRQ1xrbhwi 3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy: -0.04000000 Waves 2022.10.13 12:13 [2270392] smart account 3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy > SELF 0.00000000 Waves
{ "type": 13, "id": "D3PVQH9UExw5C2NusxkZETYytjddhiEAZnHRQ1xrbhwi", "fee": 4000000, "feeAssetId": null, "timestamp": 1665652465316, "version": 1, "sender": "3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy", "senderPublicKey": "FK9j3YFWVChXKESTn33fMZz1JseCNMMqHhfB7smxJo4e", "proofs": [ "27vykrr6BGpRxcmXXbnSHJJHyLbTCSPzevoHEKjYiQv3ythTtGLokWpdjh1rmXLc2tfMK3f7R5zrxgDZz6CksnvQ" ], "script": "base64:BgIqCAISBQoDAQgIEgASABIDCgEBEgASABIAEgMKAQgSBAoCCAESAwoBARIAWAAJc2VwYXJhdG9yAgJfXwADU0VQAgJfXwAFTVVMVDYAwIQ9AAVNVUxUOACAwtcvAAZNVUxUWDYJALYCAQUFTVVMVDYABk1VTFRYOAkAtgIBBQVNVUxUOAAHTVVMVFgxOAkAtgIBAICAkLu61q3wDQAKV0FWRVNJRFNUUgIFV0FWRVMAB1dBVkVTSUQJANkEAQUKV0FWRVNJRFNUUgAJREFZTUlMTElTAIC4mSkAGUlkeENvbnRyb2xDZmdOZXV0cmlub0RhcHAAAQAYSWR4Q29udHJvbENmZ0F1Y3Rpb25EYXBwAAIAFElkeENvbnRyb2xDZmdScGREYXBwAAMAFUlkeENvbnRyb2xDZmdNYXRoRGFwcAAEABxJZHhDb250cm9sQ2ZnTGlxdWlkYXRpb25EYXBwAAUAFUlkeENvbnRyb2xDZmdSZXN0RGFwcAAGAB1JZHhDb250cm9sQ2ZnTm9kZVJlZ2lzdHJ5RGFwcAAHABxJZHhDb250cm9sQ2ZnTnNidFN0YWtpbmdEYXBwAAgAGUlkeENvbnRyb2xDZmd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WVyZ2VkRGF0YQJfMgQRdnBFZmZlY3RpdmVIZWlnaHQIBQptZXJnZWREYXRhAl8zBA9zdGFrZWRBbW91bnRORVcIBQptZXJnZWREYXRhAl80BBR2cEVmZmVjdGl2ZUhlaWdodE5FVwgFCm1lcmdlZERhdGECXzUECHN1cmZVc2VyBQxzdGFrZWRBbW91bnQEEWduc2J0RnJvbVN1cmZVc2VyCQELc3VyZlRvR25zYnQBBQhzdXJmVXNlcgkAlAoCBQNuaWwJAMwIAgUIc3VyZlVzZXIJAMwIAgUJc3VyZlRvdGFsCQDMCAIFEWduc2J0RnJvbVN1cmZVc2VyCQDMCAIFEmduc2J0RnJvbVN1cmZUb3RhbAkAzAgCBRF2cEVmZmVjdGl2ZUhlaWdodAkAzAgCBRR2cEVmZmVjdGl2ZUhlaWdodE5FVwUDbmlsAWkBGGduc2J0RnJvbVN1cmZTWVNSRUFET05MWQEHc3VyZkFtdAkAlAoCBQNuaWwJAQtzdXJmVG9HbnNidAEFB3N1cmZBbXQBaQERY29uZmlnU1lTUkVBRE9OTFkABAptaW5Mb2NrQW10CQERQGV4dHJOYXRpdmUoMTA1NSkBCQEQa2V5TWluTG9ja0Ftb3VudAAEIHN1cmZWb3RpbmdQb3dlclJlc3RyaWN0aXZlUGVyaW9kCQBoAgCgCwAOBBticlRvU3RhcnRTdXJmVHJhbnNmb3JtYXRpb24AsJhGCQCUCgIFA25pbAkAzAgCBQptaW5Mb2NrQW10CQDMCAIJAGgCBRJnbnNidEZyb21TdXJmQ29lZmYFBU1VTFQ2CQDMCAIFIHN1cmZWb3RpbmdQb3dlclJlc3RyaWN0aXZlUGVyaW9kCQDMCAIFG2JyVG9TdGFydFN1cmZUcmFuc2Zvcm1hdGlvbgUDbmlsAOjaJWw=", "chainId": 84, "height": 2270392, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4baeR1NLQcGbhAvGVafwveABprDax3iCKbAwMLFjZ8Xb Next: 8jMpDxhfGn11M1m7QqTccXb6n7P8EDQju6YCe2kjdH2J Diff:
Old | New | Differences | |
---|---|---|---|
18 | 18 | let WAVESIDSTR = "WAVES" | |
19 | 19 | ||
20 | 20 | let WAVESID = fromBase58String(WAVESIDSTR) | |
21 | + | ||
22 | + | let DAYMILLIS = 86400000 | |
21 | 23 | ||
22 | 24 | let IdxControlCfgNeutrinoDapp = 1 | |
23 | 25 | ||
102 | 104 | ||
103 | 105 | ||
104 | 106 | func keyStatsUsersCount () = makeString(["%s%s", "stats", "activeUsersCount"], separator) | |
107 | + | ||
108 | + | ||
109 | + | func keyStatsDepositAmtByDay (timestamp) = makeString(["%s%s%d", "stats", "depositAmtByDay", toString(timestamp)], separator) | |
110 | + | ||
111 | + | ||
112 | + | func keyStatsDepositAmtTotals () = makeString(["%s%s%d", "stats", "depositAmtTotals"], separator) | |
105 | 113 | ||
106 | 114 | ||
107 | 115 | func keyNextPeriod () = "%s__nextPeriod" | |
220 | 228 | } | |
221 | 229 | ||
222 | 230 | ||
231 | + | func toStartOfDay (timestamp) = ((timestamp / DAYMILLIS) * DAYMILLIS) | |
232 | + | ||
233 | + | ||
234 | + | func findElementPosition (src,element,sep) = { | |
235 | + | let elementStart = valueOrErrorMessage(indexOf(src, element), ((("there is no substring " + element) + " in ") + src)) | |
236 | + | if ((elementStart == 0)) | |
237 | + | then 0 | |
238 | + | else { | |
239 | + | let left = take(src, elementStart) | |
240 | + | (size(split(left, sep)) - 1) | |
241 | + | } | |
242 | + | } | |
243 | + | ||
244 | + | ||
245 | + | let DepositTotalsPREFIX = "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" | |
246 | + | ||
247 | + | func updateDepositTotals (currVal,idxToUpdate,deltaAmt) = { | |
248 | + | let currArr = split(currVal, SEP) | |
249 | + | func updDepTotByIdx (idx) = if ((idx != idxToUpdate)) | |
250 | + | then currArr[idx] | |
251 | + | else toString((parseIntValue(currArr[idx]) + deltaAmt)) | |
252 | + | ||
253 | + | makeString([DepositTotalsPREFIX, updDepTotByIdx(1), updDepTotByIdx(2), updDepTotByIdx(3), updDepTotByIdx(4), updDepTotByIdx(5), updDepTotByIdx(6), updDepTotByIdx(7), updDepTotByIdx(8), updDepTotByIdx(9), updDepTotByIdx(10), updDepTotByIdx(11), updDepTotByIdx(12), updDepTotByIdx(13), updDepTotByIdx(14), updDepTotByIdx(15), updDepTotByIdx(16), updDepTotByIdx(17), updDepTotByIdx(18)], SEP) | |
254 | + | } | |
255 | + | ||
256 | + | ||
257 | + | func DepositsTotalsEntries (depositAmount,assetIdStr) = { | |
258 | + | let startOfDay = toStartOfDay(lastBlock.timestamp) | |
259 | + | let byDayKEY = keyStatsDepositAmtByDay(startOfDay) | |
260 | + | let totalsKEY = keyStatsDepositAmtTotals() | |
261 | + | let position = findElementPosition(supportedAssetsStr, assetIdStr, "_") | |
262 | + | let defaultDATA = (DepositTotalsPREFIX + "__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0") | |
263 | + | let currTotalsDATA = valueOrElse(getString(this, totalsKEY), defaultDATA) | |
264 | + | let newTotalsDATA = updateDepositTotals(currTotalsDATA, (position + 1), depositAmount) | |
265 | + | [StringEntry(totalsKEY, newTotalsDATA), StringEntry(byDayKEY, newTotalsDATA)] | |
266 | + | } | |
267 | + | ||
268 | + | ||
223 | 269 | func RewardEntries (isNewUser,userAddress,stakedAmount) = { | |
224 | 270 | let stakedAmountX = toBigInt(stakedAmount) | |
225 | 271 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddress) | |
226 | 272 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
227 | 273 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
228 | 274 | func forEachAssetCacheUserReward (accum,asset) = { | |
229 | - | let $ | |
230 | - | let rewardTotal = $ | |
231 | - | let cached = $ | |
232 | - | let dynamic = $ | |
233 | - | let rewardCachedPartKEY = $ | |
275 | + | let $t01112011255 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
276 | + | let rewardTotal = $t01112011255._1 | |
277 | + | let cached = $t01112011255._2 | |
278 | + | let dynamic = $t01112011255._3 | |
279 | + | let rewardCachedPartKEY = $t01112011255._4 | |
234 | 280 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
235 | 281 | } | |
236 | 282 | ||
257 | 303 | ||
258 | 304 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
259 | 305 | then $a | |
260 | - | else throw("List size exceeds | |
306 | + | else throw("List size exceeds 9") | |
261 | 307 | ||
262 | - | $f0_2 | |
308 | + | $f0_2($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) | |
263 | 309 | } :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) | |
264 | 310 | else throw(((("uncovered condition: depositNumLast=" + toString(depositNumLast)) + " depositNumUser=") + toString(depositNumUser))) | |
265 | 311 | } | |
290 | 336 | ||
291 | 337 | ||
292 | 338 | func mergeStake (userAddress,amountToAdd) = { | |
293 | - | let $ | |
294 | - | let isNewUser = $ | |
295 | - | let stakedAmount = $ | |
296 | - | let vpEffectiveHeight = $ | |
339 | + | let $t01490715017 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
340 | + | let isNewUser = $t01490715017._1 | |
341 | + | let stakedAmount = $t01490715017._2 | |
342 | + | let vpEffectiveHeight = $t01490715017._3 | |
297 | 343 | let stakedAmountNEW = if (isNewUser) | |
298 | 344 | then amountToAdd | |
299 | 345 | else (amountToAdd + stakedAmount) | |
306 | 352 | ||
307 | 353 | ||
308 | 354 | func commonStake (userAddress,i) = { | |
309 | - | let $ | |
310 | - | let stakedAssetId = $ | |
311 | - | let minLockAmount = $ | |
355 | + | let $t01550315557 = getParamsOrFail() | |
356 | + | let stakedAssetId = $t01550315557._1 | |
357 | + | let minLockAmount = $t01550315557._2 | |
312 | 358 | if ((size(i.payments) != 1)) | |
313 | 359 | then throw("Invalid payments size") | |
314 | 360 | else { | |
329 | 375 | if ((minLockAmount > stakedAmountNEW)) | |
330 | 376 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
331 | 377 | else { | |
332 | - | let $ | |
378 | + | let $t01635616458 = StatsResult(amount, 1, if (isNewUser) | |
333 | 379 | then 1 | |
334 | 380 | else 0) | |
335 | - | let statsEntries = $ | |
336 | - | let totalStaked = $ | |
337 | - | let totalStakedNew = $ | |
381 | + | let statsEntries = $t01635616458._1 | |
382 | + | let totalStaked = $t01635616458._2 | |
383 | + | let totalStakedNew = $t01635616458._3 | |
338 | 384 | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) | |
339 | 385 | } | |
340 | 386 | } | |
347 | 393 | if ((size(i.payments) > 0)) | |
348 | 394 | then throw("payments are not accepted") | |
349 | 395 | else { | |
350 | - | let $ | |
351 | - | let isNewUser = $ | |
352 | - | let stakedAmount = $ | |
353 | - | let stakingStart = $ | |
396 | + | let $t01693717042 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
397 | + | let isNewUser = $t01693717042._1 | |
398 | + | let stakedAmount = $t01693717042._2 | |
399 | + | let stakingStart = $t01693717042._3 | |
354 | 400 | let stakedAmountX = toBigInt(stakedAmount) | |
355 | 401 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
356 | 402 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
357 | 403 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
358 | 404 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
359 | - | let $ | |
360 | - | let rewardTotal = $ | |
361 | - | let cached = $ | |
362 | - | let dynamic = $ | |
363 | - | let rewardCachedPartKEY = $ | |
405 | + | let $t01741317551 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
406 | + | let rewardTotal = $t01741317551._1 | |
407 | + | let cached = $t01741317551._2 | |
408 | + | let dynamic = $t01741317551._3 | |
409 | + | let rewardCachedPartKEY = $t01741317551._4 | |
364 | 410 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
365 | - | let $ | |
366 | - | let data = $ | |
367 | - | let claimedAmtByAsset = $ | |
411 | + | let $t01761117648 = accum | |
412 | + | let data = $t01761117648._1 | |
413 | + | let claimedAmtByAsset = $t01761117648._2 | |
368 | 414 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
369 | 415 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
370 | 416 | if ((0 >= rewardTotal)) | |
372 | 418 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
373 | 419 | } | |
374 | 420 | ||
375 | - | let $ | |
421 | + | let $t01810818221 = { | |
376 | 422 | let $l = supportedAssetsList | |
377 | 423 | let $s = size($l) | |
378 | 424 | let $acc0 = $Tuple2(nil, "") | |
382 | 428 | ||
383 | 429 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
384 | 430 | then $a | |
385 | - | else throw("List size exceeds | |
431 | + | else throw("List size exceeds 9") | |
386 | 432 | ||
387 | - | $f0_2 | |
433 | + | $f0_2($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) | |
388 | 434 | } | |
389 | - | let transfers = $ | |
390 | - | let claimedAmtByAssetResult = $ | |
435 | + | let transfers = $t01810818221._1 | |
436 | + | let claimedAmtByAssetResult = $t01810818221._2 | |
391 | 437 | if ((0 >= size(transfers))) | |
392 | - | then nil | |
393 | - | else ((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))) | |
438 | + | then $Tuple2(nil, 0) | |
439 | + | else $Tuple2(((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))), size(transfers)) | |
394 | 440 | } | |
395 | 441 | } | |
396 | 442 | ||
418 | 464 | else { | |
419 | 465 | let userAddress = i.caller | |
420 | 466 | let userAddressStr = toString(userAddress) | |
421 | - | let $ | |
422 | - | let stakedAssetId = $ | |
423 | - | let minLockAmount = $ | |
424 | - | let $ | |
425 | - | let isNewUser = $ | |
426 | - | let stakedAmount = $ | |
427 | - | let vpEffectiveHeight = $ | |
467 | + | let $t01915519209 = getParamsOrFail() | |
468 | + | let stakedAssetId = $t01915519209._1 | |
469 | + | let minLockAmount = $t01915519209._2 | |
470 | + | let $t01921219296 = getUserParamsOrFail(userAddress) | |
471 | + | let isNewUser = $t01921219296._1 | |
472 | + | let stakedAmount = $t01921219296._2 | |
473 | + | let vpEffectiveHeight = $t01921219296._3 | |
428 | 474 | let swapParamsSTRUCT = asSwapParamsSTRUCT(reentrantInvoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStr, 0], nil)) | |
429 | 475 | let swapLimitSpentInUsdn = swapParamsSTRUCT._2 | |
430 | 476 | let blcks2LmtReset = swapParamsSTRUCT._3 | |
436 | 482 | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(stakedAmount))) | |
437 | 483 | else { | |
438 | 484 | let stakedAmountNEW = (stakedAmount - amount) | |
439 | - | let $ | |
485 | + | let $t01993420092 = StatsResult(-(amount), if ((amount == stakedAmount)) | |
440 | 486 | then -1 | |
441 | 487 | else 0, if ((amount == stakedAmount)) | |
442 | 488 | then -1 | |
443 | 489 | else 0) | |
444 | - | let statsEntries = $ | |
445 | - | let totalStaked = $ | |
446 | - | let totalStakedNew = $ | |
490 | + | let statsEntries = $t01993420092._1 | |
491 | + | let totalStaked = $t01993420092._2 | |
492 | + | let totalStakedNew = $t01993420092._3 | |
447 | 493 | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) | |
448 | 494 | } | |
449 | 495 | } | |
484 | 530 | else StringEntry(rewardPerNsbtSumNewKEY, sumLastStr))) | |
485 | 531 | } | |
486 | 532 | ||
487 | - | ({ | |
533 | + | (({ | |
488 | 534 | let $l = supportedAssetsList | |
489 | 535 | let $s = size($l) | |
490 | 536 | let $acc0 = nil | |
494 | 540 | ||
495 | 541 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
496 | 542 | then $a | |
497 | - | else throw("List size exceeds | |
543 | + | else throw("List size exceeds 9") | |
498 | 544 | ||
499 | - | $f0_2 | |
500 | - | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) | |
545 | + | $f0_2($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) | |
546 | + | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) | |
501 | 547 | } | |
502 | 548 | } | |
503 | 549 | } | |
529 | 575 | ||
530 | 576 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
531 | 577 | then $a | |
532 | - | else throw("List size exceeds | |
578 | + | else throw("List size exceeds 9") | |
533 | 579 | ||
534 | - | $f0_2 | |
580 | + | $f0_2($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) | |
535 | 581 | } | |
536 | 582 | else { | |
537 | 583 | let userAddress = addressFromStringValue(userAddressStr) | |
538 | - | let $ | |
539 | - | let isNewUser = $ | |
540 | - | let stakedAmount = $ | |
541 | - | let stakingStart = $ | |
584 | + | let $t02271622821 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
585 | + | let isNewUser = $t02271622821._1 | |
586 | + | let stakedAmount = $t02271622821._2 | |
587 | + | let stakingStart = $t02271622821._3 | |
542 | 588 | let stakedAmountX = toBigInt(stakedAmount) | |
543 | 589 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
544 | 590 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
545 | 591 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
546 | 592 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
547 | - | let $ | |
548 | - | let rewardTotal = $ | |
549 | - | let cached = $ | |
550 | - | let dynamic = $ | |
551 | - | let rewardCachedPartKEY = $ | |
593 | + | let $t02316723305 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
594 | + | let rewardTotal = $t02316723305._1 | |
595 | + | let cached = $t02316723305._2 | |
596 | + | let dynamic = $t02316723305._3 | |
597 | + | let rewardCachedPartKEY = $t02316723305._4 | |
552 | 598 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
553 | 599 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
554 | 600 | } | |
562 | 608 | ||
563 | 609 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
564 | 610 | then $a | |
565 | - | else throw("List size exceeds | |
611 | + | else throw("List size exceeds 9") | |
566 | 612 | ||
567 | - | $f0_2 | |
613 | + | $f0_2($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) | |
568 | 614 | } | |
569 | 615 | $Tuple2(nil, dropRight(unclaimedRewardStr, 1)) | |
570 | 616 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let MULT6 = 1000000 | |
9 | 9 | ||
10 | 10 | let MULT8 = 100000000 | |
11 | 11 | ||
12 | 12 | let MULTX6 = toBigInt(MULT6) | |
13 | 13 | ||
14 | 14 | let MULTX8 = toBigInt(MULT8) | |
15 | 15 | ||
16 | 16 | let MULTX18 = toBigInt(1000000000000000000) | |
17 | 17 | ||
18 | 18 | let WAVESIDSTR = "WAVES" | |
19 | 19 | ||
20 | 20 | let WAVESID = fromBase58String(WAVESIDSTR) | |
21 | + | ||
22 | + | let DAYMILLIS = 86400000 | |
21 | 23 | ||
22 | 24 | let IdxControlCfgNeutrinoDapp = 1 | |
23 | 25 | ||
24 | 26 | let IdxControlCfgAuctionDapp = 2 | |
25 | 27 | ||
26 | 28 | let IdxControlCfgRpdDapp = 3 | |
27 | 29 | ||
28 | 30 | let IdxControlCfgMathDapp = 4 | |
29 | 31 | ||
30 | 32 | let IdxControlCfgLiquidationDapp = 5 | |
31 | 33 | ||
32 | 34 | let IdxControlCfgRestDapp = 6 | |
33 | 35 | ||
34 | 36 | let IdxControlCfgNodeRegistryDapp = 7 | |
35 | 37 | ||
36 | 38 | let IdxControlCfgNsbtStakingDapp = 8 | |
37 | 39 | ||
38 | 40 | let IdxControlCfgMediatorDapp = 9 | |
39 | 41 | ||
40 | 42 | let IdxControlCfgSurfStakingDapp = 10 | |
41 | 43 | ||
42 | 44 | let IdxControlCfgGnsbtControllerDapp = 11 | |
43 | 45 | ||
44 | 46 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
45 | 47 | ||
46 | 48 | ||
47 | 49 | func keyControlAddress () = "%s%s__config__controlAddress" | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | func keyControlCfg () = "%s__controlConfig" | |
51 | 53 | ||
52 | 54 | ||
53 | 55 | func keyGnsbtFromSurfCoeff () = "%s%s__cfg__gnsbtFromSurfCoeff" | |
54 | 56 | ||
55 | 57 | ||
56 | 58 | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
57 | 59 | ||
58 | 60 | ||
59 | 61 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
60 | 62 | ||
61 | 63 | ||
62 | 64 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
63 | 65 | ||
64 | 66 | let controlCfg = readControlCfgOrFail(controlContract) | |
65 | 67 | ||
66 | 68 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
67 | 69 | ||
68 | 70 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
69 | 71 | ||
70 | 72 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
71 | 73 | ||
72 | 74 | let gnsbtFromSurfCoeff = valueOrElse(getInteger(this, keyGnsbtFromSurfCoeff()), 300) | |
73 | 75 | ||
74 | 76 | func keyBondAsset () = "bond_asset_id" | |
75 | 77 | ||
76 | 78 | ||
77 | 79 | func keyAuctionContractAddress () = "auction_contract" | |
78 | 80 | ||
79 | 81 | ||
80 | 82 | func keyMinLockAmount () = "%s__minLockAmount" | |
81 | 83 | ||
82 | 84 | ||
83 | 85 | func keyStakedAssetId () = "%s__stakedAssetId" | |
84 | 86 | ||
85 | 87 | ||
86 | 88 | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "amount"], separator) | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | func keyLockParamStartBlock (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "start"], separator) | |
90 | 92 | ||
91 | 93 | ||
92 | 94 | func keyLockParamVotingPowerEffectiveHeight (userAddress) = makeString(["%s%s%s", "paramByUser", toString(userAddress), "vpEffectiveHeight"], separator) | |
93 | 95 | ||
94 | 96 | ||
95 | 97 | func keyHistoryRecord (type,userAddress,txId) = makeString(["%s%s%s%s", "history", type, toString(userAddress), toBase58String(txId)], separator) | |
96 | 98 | ||
97 | 99 | ||
98 | 100 | func keyLockParamTotalAmount () = makeString(["%s%s", "stats", "activeTotalLocked"], separator) | |
99 | 101 | ||
100 | 102 | ||
101 | 103 | func keyStatsLocksCount () = makeString(["%s%s", "stats", "locksCount"], separator) | |
102 | 104 | ||
103 | 105 | ||
104 | 106 | func keyStatsUsersCount () = makeString(["%s%s", "stats", "activeUsersCount"], separator) | |
107 | + | ||
108 | + | ||
109 | + | func keyStatsDepositAmtByDay (timestamp) = makeString(["%s%s%d", "stats", "depositAmtByDay", toString(timestamp)], separator) | |
110 | + | ||
111 | + | ||
112 | + | func keyStatsDepositAmtTotals () = makeString(["%s%s%d", "stats", "depositAmtTotals"], separator) | |
105 | 113 | ||
106 | 114 | ||
107 | 115 | func keyNextPeriod () = "%s__nextPeriod" | |
108 | 116 | ||
109 | 117 | ||
110 | 118 | func keySupportedRewardAssets () = "supportedRewardAssets" | |
111 | 119 | ||
112 | 120 | ||
113 | 121 | func keyDepositNumLast () = makeString(["%s%s%s", "dep", "lastNum"], separator) | |
114 | 122 | ||
115 | 123 | ||
116 | 124 | func keyUserRewardFromDepositNum (userAddress) = makeString(["%s%s%s", "userRwdFromDepNum", userAddress], separator) | |
117 | 125 | ||
118 | 126 | ||
119 | 127 | func keyRewardPerNsbtSumAt (depositNum,tkn) = makeString(["%s%d", "rwdPerNsbtSumByDepNum", toString(depositNum), tkn], separator) | |
120 | 128 | ||
121 | 129 | ||
122 | 130 | func keyReward (userAddress,tkn) = makeString(["%s%s%s", "rwd", userAddress, tkn], separator) | |
123 | 131 | ||
124 | 132 | ||
125 | 133 | func keyClaimed (userAddress,tkn) = makeString(["%s%s%s", "clm", userAddress, tkn], separator) | |
126 | 134 | ||
127 | 135 | ||
128 | 136 | func keyNotDistributedReward (tkn) = makeString(["%s%s", "notDistributed", tkn], separator) | |
129 | 137 | ||
130 | 138 | ||
131 | 139 | func toX18 (origVal,origMult) = fraction(toBigInt(origVal), MULTX18, origMult) | |
132 | 140 | ||
133 | 141 | ||
134 | 142 | func getIntOrZero (key) = valueOrElse(getInteger(this, key), 0) | |
135 | 143 | ||
136 | 144 | ||
137 | 145 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
138 | 146 | ||
139 | 147 | ||
140 | 148 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("Mandatory this." + key) + " is not defined")) | |
141 | 149 | ||
142 | 150 | ||
143 | 151 | func getStrOrElse (key,defaultVal) = valueOrElse(getString(this, key), defaultVal) | |
144 | 152 | ||
145 | 153 | ||
146 | 154 | func toAddressOrFail (addressStr) = valueOrErrorMessage(addressFromString(addressStr), ("couldn't parse passed addressStr=" + addressStr)) | |
147 | 155 | ||
148 | 156 | ||
149 | 157 | func toAssetVect (assetStr) = if ((assetStr == WAVESIDSTR)) | |
150 | 158 | then unit | |
151 | 159 | else fromBase58String(assetStr) | |
152 | 160 | ||
153 | 161 | ||
154 | 162 | func asInt (val) = match val { | |
155 | 163 | case valInt: Int => | |
156 | 164 | valInt | |
157 | 165 | case _ => | |
158 | 166 | throw("fail to cast into Int") | |
159 | 167 | } | |
160 | 168 | ||
161 | 169 | ||
162 | 170 | func asSwapParamsSTRUCT (v) = match v { | |
163 | 171 | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
164 | 172 | struct | |
165 | 173 | case _ => | |
166 | 174 | throw("fail to cast into Int") | |
167 | 175 | } | |
168 | 176 | ||
169 | 177 | ||
170 | 178 | func formatHistoryRecord (oldAmount,oldStart,newAmount,newStart) = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(oldAmount), toString(oldStart), toString(newAmount), toString(newStart)], separator) | |
171 | 179 | ||
172 | 180 | ||
173 | 181 | func formatClaimHistoryRecord (user,claimedRewards) = makeString(["%s%d%d%s", user, toString(lastBlock.height), toString(lastBlock.timestamp), claimedRewards], separator) | |
174 | 182 | ||
175 | 183 | ||
176 | 184 | func HistoryRecordEntry (type,userAddress,txId,oldAmount,oldStart,newAmount,newStart) = StringEntry(keyHistoryRecord(type, userAddress, txId), formatHistoryRecord(oldAmount, oldStart, newAmount, newStart)) | |
177 | 185 | ||
178 | 186 | ||
179 | 187 | func ClaimHistoryEntry (userAddress,txId,claimedRewards) = StringEntry(keyHistoryRecord("claim", userAddress, txId), formatClaimHistoryRecord(toString(userAddress), claimedRewards)) | |
180 | 188 | ||
181 | 189 | ||
182 | 190 | func StatsResult (totalLockedInc,lockCountInc,usersCountInc) = { | |
183 | 191 | let locksCount = getIntOrZero(keyStatsLocksCount()) | |
184 | 192 | let usersCount = getIntOrZero(keyStatsUsersCount()) | |
185 | 193 | let totalAmount = getIntOrZero(keyLockParamTotalAmount()) | |
186 | 194 | let totalAmountNew = (totalAmount + totalLockedInc) | |
187 | 195 | $Tuple3([IntegerEntry(keyStatsLocksCount(), (locksCount + lockCountInc)), IntegerEntry(keyStatsUsersCount(), (usersCount + usersCountInc)), IntegerEntry(keyLockParamTotalAmount(), totalAmountNew)], totalAmount, totalAmountNew) | |
188 | 196 | } | |
189 | 197 | ||
190 | 198 | ||
191 | 199 | func LockParamsEntry (userAddress,amount,votingPowerEffectiveHeight) = [IntegerEntry(keyLockParamUserAmount(userAddress), amount), IntegerEntry(keyLockParamStartBlock(userAddress), votingPowerEffectiveHeight)] | |
192 | 200 | ||
193 | 201 | ||
194 | 202 | func getParamsOrFail () = $Tuple2(fromBase58String(getStringOrFail(this, keyStakedAssetId())), getIntOrFail(keyMinLockAmount())) | |
195 | 203 | ||
196 | 204 | ||
197 | 205 | func isActiveUser (userAddress) = (getIntOrElse(keyLockParamUserAmount(userAddress), 0) > 0) | |
198 | 206 | ||
199 | 207 | ||
200 | 208 | func getUserParamsOrUnit (userAddress) = if (isActiveUser(userAddress)) | |
201 | 209 | then $Tuple3(false, getIntOrFail(keyLockParamUserAmount(userAddress)), getIntOrFail(keyLockParamStartBlock(userAddress))) | |
202 | 210 | else unit | |
203 | 211 | ||
204 | 212 | ||
205 | 213 | func getUserParamsOrFail (userAddress) = valueOrErrorMessage(getUserParamsOrUnit(userAddress), (("User " + toString(userAddress)) + " is not defined")) | |
206 | 214 | ||
207 | 215 | ||
208 | 216 | let supportedAssetsStr = getStrOrElse(keySupportedRewardAssets(), "") | |
209 | 217 | ||
210 | 218 | let supportedAssetsList = split(supportedAssetsStr, "_") | |
211 | 219 | ||
212 | 220 | func calcReward (userAddress,assetId,stakedAmountX,depositNumUser,depositNumLast) = { | |
213 | 221 | let rewardPerNsbtSumLastKEY = keyRewardPerNsbtSumAt(depositNumLast, assetId) | |
214 | 222 | let sumLastX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, assetId), "0")) | |
215 | 223 | let sumUserX18 = parseBigIntValue(getStrOrElse(keyRewardPerNsbtSumAt(depositNumUser, assetId), "0")) | |
216 | 224 | let rewardDynamicPart = toInt(fraction((sumLastX18 - sumUserX18), stakedAmountX, MULTX18)) | |
217 | 225 | let rewardCachedPartKEY = keyReward(userAddress, assetId) | |
218 | 226 | let rewardCachedPart = getIntOrElse(rewardCachedPartKEY, 0) | |
219 | 227 | $Tuple4((rewardCachedPart + rewardDynamicPart), rewardCachedPart, rewardDynamicPart, rewardCachedPartKEY) | |
220 | 228 | } | |
221 | 229 | ||
222 | 230 | ||
231 | + | func toStartOfDay (timestamp) = ((timestamp / DAYMILLIS) * DAYMILLIS) | |
232 | + | ||
233 | + | ||
234 | + | func findElementPosition (src,element,sep) = { | |
235 | + | let elementStart = valueOrErrorMessage(indexOf(src, element), ((("there is no substring " + element) + " in ") + src)) | |
236 | + | if ((elementStart == 0)) | |
237 | + | then 0 | |
238 | + | else { | |
239 | + | let left = take(src, elementStart) | |
240 | + | (size(split(left, sep)) - 1) | |
241 | + | } | |
242 | + | } | |
243 | + | ||
244 | + | ||
245 | + | let DepositTotalsPREFIX = "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" | |
246 | + | ||
247 | + | func updateDepositTotals (currVal,idxToUpdate,deltaAmt) = { | |
248 | + | let currArr = split(currVal, SEP) | |
249 | + | func updDepTotByIdx (idx) = if ((idx != idxToUpdate)) | |
250 | + | then currArr[idx] | |
251 | + | else toString((parseIntValue(currArr[idx]) + deltaAmt)) | |
252 | + | ||
253 | + | makeString([DepositTotalsPREFIX, updDepTotByIdx(1), updDepTotByIdx(2), updDepTotByIdx(3), updDepTotByIdx(4), updDepTotByIdx(5), updDepTotByIdx(6), updDepTotByIdx(7), updDepTotByIdx(8), updDepTotByIdx(9), updDepTotByIdx(10), updDepTotByIdx(11), updDepTotByIdx(12), updDepTotByIdx(13), updDepTotByIdx(14), updDepTotByIdx(15), updDepTotByIdx(16), updDepTotByIdx(17), updDepTotByIdx(18)], SEP) | |
254 | + | } | |
255 | + | ||
256 | + | ||
257 | + | func DepositsTotalsEntries (depositAmount,assetIdStr) = { | |
258 | + | let startOfDay = toStartOfDay(lastBlock.timestamp) | |
259 | + | let byDayKEY = keyStatsDepositAmtByDay(startOfDay) | |
260 | + | let totalsKEY = keyStatsDepositAmtTotals() | |
261 | + | let position = findElementPosition(supportedAssetsStr, assetIdStr, "_") | |
262 | + | let defaultDATA = (DepositTotalsPREFIX + "__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0__0") | |
263 | + | let currTotalsDATA = valueOrElse(getString(this, totalsKEY), defaultDATA) | |
264 | + | let newTotalsDATA = updateDepositTotals(currTotalsDATA, (position + 1), depositAmount) | |
265 | + | [StringEntry(totalsKEY, newTotalsDATA), StringEntry(byDayKEY, newTotalsDATA)] | |
266 | + | } | |
267 | + | ||
268 | + | ||
223 | 269 | func RewardEntries (isNewUser,userAddress,stakedAmount) = { | |
224 | 270 | let stakedAmountX = toBigInt(stakedAmount) | |
225 | 271 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddress) | |
226 | 272 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
227 | 273 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
228 | 274 | func forEachAssetCacheUserReward (accum,asset) = { | |
229 | - | let $ | |
230 | - | let rewardTotal = $ | |
231 | - | let cached = $ | |
232 | - | let dynamic = $ | |
233 | - | let rewardCachedPartKEY = $ | |
275 | + | let $t01112011255 = calcReward(userAddress, asset, stakedAmountX, depositNumUser, depositNumLast) | |
276 | + | let rewardTotal = $t01112011255._1 | |
277 | + | let cached = $t01112011255._2 | |
278 | + | let dynamic = $t01112011255._3 | |
279 | + | let rewardCachedPartKEY = $t01112011255._4 | |
234 | 280 | (accum :+ IntegerEntry(rewardCachedPartKEY, rewardTotal)) | |
235 | 281 | } | |
236 | 282 | ||
237 | 283 | if (if ((depositNumLast == -1)) | |
238 | 284 | then (depositNumUser == -1) | |
239 | 285 | else false) | |
240 | 286 | then nil | |
241 | 287 | else if (if ((depositNumLast == -1)) | |
242 | 288 | then (depositNumUser > -1) | |
243 | 289 | else false) | |
244 | 290 | then throw("invalid depositNumLast and depositNumUser state") | |
245 | 291 | else if (if ((depositNumLast > -1)) | |
246 | 292 | then (depositNumUser >= -1) | |
247 | 293 | else false) | |
248 | 294 | then if (isNewUser) | |
249 | 295 | then [IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)] | |
250 | 296 | else ({ | |
251 | 297 | let $l = supportedAssetsList | |
252 | 298 | let $s = size($l) | |
253 | 299 | let $acc0 = nil | |
254 | 300 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
255 | 301 | then $a | |
256 | 302 | else forEachAssetCacheUserReward($a, $l[$i]) | |
257 | 303 | ||
258 | 304 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
259 | 305 | then $a | |
260 | - | else throw("List size exceeds | |
306 | + | else throw("List size exceeds 9") | |
261 | 307 | ||
262 | - | $f0_2 | |
308 | + | $f0_2($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) | |
263 | 309 | } :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) | |
264 | 310 | else throw(((("uncovered condition: depositNumLast=" + toString(depositNumLast)) + " depositNumUser=") + toString(depositNumUser))) | |
265 | 311 | } | |
266 | 312 | ||
267 | 313 | ||
268 | 314 | func IncrementNotDistributedRewardEntry (tkn,amountInc) = { | |
269 | 315 | let notDistributedRewardKEY = keyNotDistributedReward(tkn) | |
270 | 316 | let notDistributedReward = getIntOrElse(notDistributedRewardKEY, 0) | |
271 | 317 | [IntegerEntry(notDistributedRewardKEY, (notDistributedReward + amountInc))] | |
272 | 318 | } | |
273 | 319 | ||
274 | 320 | ||
275 | 321 | func surfToGnsbt (surfAmt) = (surfAmt / gnsbtFromSurfCoeff) | |
276 | 322 | ||
277 | 323 | ||
278 | 324 | func mergeVotingPowerEffectiveHeight (quarantinePeriod,vpEffectiveHeight,stakedAmt,stakedAmtNEW) = { | |
279 | 325 | let remainingToWait = (vpEffectiveHeight - height) | |
280 | 326 | if ((0 >= remainingToWait)) | |
281 | 327 | then (height + quarantinePeriod) | |
282 | 328 | else { | |
283 | 329 | let alreadyWaited = (quarantinePeriod - remainingToWait) | |
284 | 330 | let kX8 = if ((stakedAmtNEW != 0)) | |
285 | 331 | then fraction(stakedAmt, MULT8, stakedAmtNEW) | |
286 | 332 | else vpEffectiveHeight | |
287 | 333 | ((quarantinePeriod + height) - fraction(alreadyWaited, kX8, MULT8)) | |
288 | 334 | } | |
289 | 335 | } | |
290 | 336 | ||
291 | 337 | ||
292 | 338 | func mergeStake (userAddress,amountToAdd) = { | |
293 | - | let $ | |
294 | - | let isNewUser = $ | |
295 | - | let stakedAmount = $ | |
296 | - | let vpEffectiveHeight = $ | |
339 | + | let $t01490715017 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
340 | + | let isNewUser = $t01490715017._1 | |
341 | + | let stakedAmount = $t01490715017._2 | |
342 | + | let vpEffectiveHeight = $t01490715017._3 | |
297 | 343 | let stakedAmountNEW = if (isNewUser) | |
298 | 344 | then amountToAdd | |
299 | 345 | else (amountToAdd + stakedAmount) | |
300 | 346 | let quarantinePeriod = (1440 * 14) | |
301 | 347 | let vpEffectiveHeightNEW = if (isNewUser) | |
302 | 348 | then (quarantinePeriod + height) | |
303 | 349 | else mergeVotingPowerEffectiveHeight(quarantinePeriod, vpEffectiveHeight, stakedAmount, stakedAmountNEW) | |
304 | 350 | $Tuple5(isNewUser, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW) | |
305 | 351 | } | |
306 | 352 | ||
307 | 353 | ||
308 | 354 | func commonStake (userAddress,i) = { | |
309 | - | let $ | |
310 | - | let stakedAssetId = $ | |
311 | - | let minLockAmount = $ | |
355 | + | let $t01550315557 = getParamsOrFail() | |
356 | + | let stakedAssetId = $t01550315557._1 | |
357 | + | let minLockAmount = $t01550315557._2 | |
312 | 358 | if ((size(i.payments) != 1)) | |
313 | 359 | then throw("Invalid payments size") | |
314 | 360 | else { | |
315 | 361 | let payment = i.payments[0] | |
316 | 362 | let amount = payment.amount | |
317 | 363 | let invalidAssetMessage = (("Invalid asset. " + toBase58String(stakedAssetId)) + " is expected") | |
318 | 364 | let assetId = valueOrErrorMessage(payment.assetId, invalidAssetMessage) | |
319 | 365 | if ((assetId != stakedAssetId)) | |
320 | 366 | then throw(invalidAssetMessage) | |
321 | 367 | else { | |
322 | 368 | let userAddressStr = toString(userAddress) | |
323 | 369 | let mergedData = mergeStake(userAddress, amount) | |
324 | 370 | let isNewUser = mergedData._1 | |
325 | 371 | let stakedAmount = mergedData._2 | |
326 | 372 | let vpEffectiveHeight = mergedData._3 | |
327 | 373 | let stakedAmountNEW = mergedData._4 | |
328 | 374 | let vpEffectiveHeightNEW = mergedData._5 | |
329 | 375 | if ((minLockAmount > stakedAmountNEW)) | |
330 | 376 | then throw(("Min lock amount is " + toString(minLockAmount))) | |
331 | 377 | else { | |
332 | - | let $ | |
378 | + | let $t01635616458 = StatsResult(amount, 1, if (isNewUser) | |
333 | 379 | then 1 | |
334 | 380 | else 0) | |
335 | - | let statsEntries = $ | |
336 | - | let totalStaked = $ | |
337 | - | let totalStakedNew = $ | |
381 | + | let statsEntries = $t01635616458._1 | |
382 | + | let totalStaked = $t01635616458._2 | |
383 | + | let totalStakedNew = $t01635616458._3 | |
338 | 384 | ((([HistoryRecordEntry("stake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeightNEW)] ++ RewardEntries(isNewUser, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeightNEW)) ++ statsEntries) | |
339 | 385 | } | |
340 | 386 | } | |
341 | 387 | } | |
342 | 388 | } | |
343 | 389 | ||
344 | 390 | ||
345 | 391 | func commonClaim (userAddress,i) = { | |
346 | 392 | let userAddressStr = toString(userAddress) | |
347 | 393 | if ((size(i.payments) > 0)) | |
348 | 394 | then throw("payments are not accepted") | |
349 | 395 | else { | |
350 | - | let $ | |
351 | - | let isNewUser = $ | |
352 | - | let stakedAmount = $ | |
353 | - | let stakingStart = $ | |
396 | + | let $t01693717042 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
397 | + | let isNewUser = $t01693717042._1 | |
398 | + | let stakedAmount = $t01693717042._2 | |
399 | + | let stakingStart = $t01693717042._3 | |
354 | 400 | let stakedAmountX = toBigInt(stakedAmount) | |
355 | 401 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
356 | 402 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
357 | 403 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
358 | 404 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
359 | - | let $ | |
360 | - | let rewardTotal = $ | |
361 | - | let cached = $ | |
362 | - | let dynamic = $ | |
363 | - | let rewardCachedPartKEY = $ | |
405 | + | let $t01741317551 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
406 | + | let rewardTotal = $t01741317551._1 | |
407 | + | let cached = $t01741317551._2 | |
408 | + | let dynamic = $t01741317551._3 | |
409 | + | let rewardCachedPartKEY = $t01741317551._4 | |
364 | 410 | let claimedKEY = keyClaimed(userAddressStr, asset) | |
365 | - | let $ | |
366 | - | let data = $ | |
367 | - | let claimedAmtByAsset = $ | |
411 | + | let $t01761117648 = accum | |
412 | + | let data = $t01761117648._1 | |
413 | + | let claimedAmtByAsset = $t01761117648._2 | |
368 | 414 | let newPart = makeString([asset, toString(rewardTotal)], ":") | |
369 | 415 | let claimedAmtByAssetNew = makeString([claimedAmtByAsset, newPart], "_") | |
370 | 416 | if ((0 >= rewardTotal)) | |
371 | 417 | then $Tuple2(data, claimedAmtByAssetNew) | |
372 | 418 | else $Tuple2((((data :+ ScriptTransfer(userAddress, rewardTotal, toAssetVect(asset))) :+ IntegerEntry(claimedKEY, (valueOrElse(getInteger(claimedKEY), 0) + rewardTotal))) :+ IntegerEntry(rewardCachedPartKEY, 0)), claimedAmtByAssetNew) | |
373 | 419 | } | |
374 | 420 | ||
375 | - | let $ | |
421 | + | let $t01810818221 = { | |
376 | 422 | let $l = supportedAssetsList | |
377 | 423 | let $s = size($l) | |
378 | 424 | let $acc0 = $Tuple2(nil, "") | |
379 | 425 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
380 | 426 | then $a | |
381 | 427 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
382 | 428 | ||
383 | 429 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
384 | 430 | then $a | |
385 | - | else throw("List size exceeds | |
431 | + | else throw("List size exceeds 9") | |
386 | 432 | ||
387 | - | $f0_2 | |
433 | + | $f0_2($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) | |
388 | 434 | } | |
389 | - | let transfers = $ | |
390 | - | let claimedAmtByAssetResult = $ | |
435 | + | let transfers = $t01810818221._1 | |
436 | + | let claimedAmtByAssetResult = $t01810818221._2 | |
391 | 437 | if ((0 >= size(transfers))) | |
392 | - | then nil | |
393 | - | else ((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))) | |
438 | + | then $Tuple2(nil, 0) | |
439 | + | else $Tuple2(((transfers :+ IntegerEntry(userRewardFromDepositNumKEY, depositNumLast)) :+ ClaimHistoryEntry(userAddress, i.transactionId, drop(claimedAmtByAssetResult, 1))), size(transfers)) | |
394 | 440 | } | |
395 | 441 | } | |
396 | 442 | ||
397 | 443 | ||
398 | 444 | @Callable(i) | |
399 | 445 | func constructor (minLockAmount,supportedRewardAssets,stakedAssetId) = if ((i.caller != this)) | |
400 | 446 | then throw("Permission denied") | |
401 | 447 | else [IntegerEntry(keyMinLockAmount(), minLockAmount), StringEntry(keySupportedRewardAssets(), supportedRewardAssets), StringEntry(keyStakedAssetId(), stakedAssetId)] | |
402 | 448 | ||
403 | 449 | ||
404 | 450 | ||
405 | 451 | @Callable(i) | |
406 | 452 | func stake () = commonStake(i.caller, i) | |
407 | 453 | ||
408 | 454 | ||
409 | 455 | ||
410 | 456 | @Callable(i) | |
411 | 457 | func stakeByOriginCaller () = commonStake(i.originCaller, i) | |
412 | 458 | ||
413 | 459 | ||
414 | 460 | ||
415 | 461 | @Callable(i) | |
416 | 462 | func unstake (amount) = if ((size(i.payments) != 0)) | |
417 | 463 | then throw("unstake doesn't require any payment") | |
418 | 464 | else { | |
419 | 465 | let userAddress = i.caller | |
420 | 466 | let userAddressStr = toString(userAddress) | |
421 | - | let $ | |
422 | - | let stakedAssetId = $ | |
423 | - | let minLockAmount = $ | |
424 | - | let $ | |
425 | - | let isNewUser = $ | |
426 | - | let stakedAmount = $ | |
427 | - | let vpEffectiveHeight = $ | |
467 | + | let $t01915519209 = getParamsOrFail() | |
468 | + | let stakedAssetId = $t01915519209._1 | |
469 | + | let minLockAmount = $t01915519209._2 | |
470 | + | let $t01921219296 = getUserParamsOrFail(userAddress) | |
471 | + | let isNewUser = $t01921219296._1 | |
472 | + | let stakedAmount = $t01921219296._2 | |
473 | + | let vpEffectiveHeight = $t01921219296._3 | |
428 | 474 | let swapParamsSTRUCT = asSwapParamsSTRUCT(reentrantInvoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [userAddressStr, 0], nil)) | |
429 | 475 | let swapLimitSpentInUsdn = swapParamsSTRUCT._2 | |
430 | 476 | let blcks2LmtReset = swapParamsSTRUCT._3 | |
431 | 477 | if ((swapLimitSpentInUsdn > 0)) | |
432 | 478 | then throw((("You have already made a swap operation. Wait " + toString((height + blcks2LmtReset))) + " height to unstake")) | |
433 | 479 | else if ((0 >= stakedAmount)) | |
434 | 480 | then throw("Nothing to unstake") | |
435 | 481 | else if ((amount > stakedAmount)) | |
436 | 482 | then throw(((("Requested " + toString(amount)) + ", but staked only ") + toString(stakedAmount))) | |
437 | 483 | else { | |
438 | 484 | let stakedAmountNEW = (stakedAmount - amount) | |
439 | - | let $ | |
485 | + | let $t01993420092 = StatsResult(-(amount), if ((amount == stakedAmount)) | |
440 | 486 | then -1 | |
441 | 487 | else 0, if ((amount == stakedAmount)) | |
442 | 488 | then -1 | |
443 | 489 | else 0) | |
444 | - | let statsEntries = $ | |
445 | - | let totalStaked = $ | |
446 | - | let totalStakedNew = $ | |
490 | + | let statsEntries = $t01993420092._1 | |
491 | + | let totalStaked = $t01993420092._2 | |
492 | + | let totalStakedNew = $t01993420092._3 | |
447 | 493 | ((([ScriptTransfer(userAddress, amount, stakedAssetId), HistoryRecordEntry("unstake", userAddress, i.transactionId, stakedAmount, vpEffectiveHeight, stakedAmountNEW, vpEffectiveHeight)] ++ RewardEntries(false, userAddressStr, stakedAmount)) ++ LockParamsEntry(userAddress, stakedAmountNEW, vpEffectiveHeight)) ++ statsEntries) | |
448 | 494 | } | |
449 | 495 | } | |
450 | 496 | ||
451 | 497 | ||
452 | 498 | ||
453 | 499 | @Callable(i) | |
454 | 500 | func deposit () = if ((size(i.payments) != 1)) | |
455 | 501 | then throw("exact 1 payment is allowed only") | |
456 | 502 | else { | |
457 | 503 | let pmt = i.payments[0] | |
458 | 504 | let amount = pmt.amount | |
459 | 505 | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
460 | 506 | let pmtAssetIdStr = toBase58String(pmtAssetId) | |
461 | 507 | let pmtMultX = if ((pmtAssetId == WAVESID)) | |
462 | 508 | then MULTX8 | |
463 | 509 | else MULTX6 | |
464 | 510 | let amountX = toBigInt(amount) | |
465 | 511 | let totalStaked = getIntOrElse(keyLockParamTotalAmount(), 0) | |
466 | 512 | let totalStakedX = toBigInt(totalStaked) | |
467 | 513 | if ((0 > totalStaked)) | |
468 | 514 | then throw("TODO: case is not supported") | |
469 | 515 | else if ((totalStaked == 0)) | |
470 | 516 | then IncrementNotDistributedRewardEntry(pmtAssetIdStr, amount) | |
471 | 517 | else { | |
472 | 518 | let rewardPerNsbtX18 = fraction(amountX, MULTX18, totalStakedX) | |
473 | 519 | let depositNumLastKEY = keyDepositNumLast() | |
474 | 520 | let depositNumLast = getIntOrElse(depositNumLastKEY, -1) | |
475 | 521 | let depositNumNew = (depositNumLast + 1) | |
476 | 522 | if (!(contains(supportedAssetsStr, pmtAssetIdStr))) | |
477 | 523 | then throw(((supportedAssetsStr + " doesn't contain ") + pmtAssetIdStr)) | |
478 | 524 | else { | |
479 | 525 | func refreshRewardPerNsbtSUM (accum,nextAsset) = { | |
480 | 526 | let rewardPerNsbtSumNewKEY = keyRewardPerNsbtSumAt(depositNumNew, nextAsset) | |
481 | 527 | let sumLastStr = getStrOrElse(keyRewardPerNsbtSumAt(depositNumLast, nextAsset), "0") | |
482 | 528 | (accum :+ (if ((nextAsset == pmtAssetIdStr)) | |
483 | 529 | then StringEntry(rewardPerNsbtSumNewKEY, toString((parseBigIntValue(sumLastStr) + rewardPerNsbtX18))) | |
484 | 530 | else StringEntry(rewardPerNsbtSumNewKEY, sumLastStr))) | |
485 | 531 | } | |
486 | 532 | ||
487 | - | ({ | |
533 | + | (({ | |
488 | 534 | let $l = supportedAssetsList | |
489 | 535 | let $s = size($l) | |
490 | 536 | let $acc0 = nil | |
491 | 537 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
492 | 538 | then $a | |
493 | 539 | else refreshRewardPerNsbtSUM($a, $l[$i]) | |
494 | 540 | ||
495 | 541 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
496 | 542 | then $a | |
497 | - | else throw("List size exceeds | |
543 | + | else throw("List size exceeds 9") | |
498 | 544 | ||
499 | - | $f0_2 | |
500 | - | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) | |
545 | + | $f0_2($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) | |
546 | + | } :+ IntegerEntry(depositNumLastKEY, depositNumNew)) ++ DepositsTotalsEntries(amount, pmtAssetIdStr)) | |
501 | 547 | } | |
502 | 548 | } | |
503 | 549 | } | |
504 | 550 | ||
505 | 551 | ||
506 | 552 | ||
507 | 553 | @Callable(i) | |
508 | 554 | func claimRewards () = commonClaim(i.caller, i) | |
509 | 555 | ||
510 | 556 | ||
511 | 557 | ||
512 | 558 | @Callable(i) | |
513 | 559 | func claimRewardsByOriginCaller () = commonClaim(i.originCaller, i) | |
514 | 560 | ||
515 | 561 | ||
516 | 562 | ||
517 | 563 | @Callable(i) | |
518 | 564 | func unclaimedRewardsREADONLY (userAddressStr) = { | |
519 | 565 | func forEachAssetZeroReward (accum,asset) = ((accum + makeString([asset, "0", "0"], ":")) + "_") | |
520 | 566 | ||
521 | 567 | let unclaimedRewardStr = if ((userAddressStr == "")) | |
522 | 568 | then { | |
523 | 569 | let $l = supportedAssetsList | |
524 | 570 | let $s = size($l) | |
525 | 571 | let $acc0 = "" | |
526 | 572 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
527 | 573 | then $a | |
528 | 574 | else forEachAssetZeroReward($a, $l[$i]) | |
529 | 575 | ||
530 | 576 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
531 | 577 | then $a | |
532 | - | else throw("List size exceeds | |
578 | + | else throw("List size exceeds 9") | |
533 | 579 | ||
534 | - | $f0_2 | |
580 | + | $f0_2($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) | |
535 | 581 | } | |
536 | 582 | else { | |
537 | 583 | let userAddress = addressFromStringValue(userAddressStr) | |
538 | - | let $ | |
539 | - | let isNewUser = $ | |
540 | - | let stakedAmount = $ | |
541 | - | let stakingStart = $ | |
584 | + | let $t02271622821 = valueOrElse(getUserParamsOrUnit(userAddress), $Tuple3(true, 0, 0)) | |
585 | + | let isNewUser = $t02271622821._1 | |
586 | + | let stakedAmount = $t02271622821._2 | |
587 | + | let stakingStart = $t02271622821._3 | |
542 | 588 | let stakedAmountX = toBigInt(stakedAmount) | |
543 | 589 | let userRewardFromDepositNumKEY = keyUserRewardFromDepositNum(userAddressStr) | |
544 | 590 | let depositNumUser = getIntOrElse(userRewardFromDepositNumKEY, -1) | |
545 | 591 | let depositNumLast = getIntOrElse(keyDepositNumLast(), -1) | |
546 | 592 | func forEachAssetCalcUnclaimedReward (accum,asset) = { | |
547 | - | let $ | |
548 | - | let rewardTotal = $ | |
549 | - | let cached = $ | |
550 | - | let dynamic = $ | |
551 | - | let rewardCachedPartKEY = $ | |
593 | + | let $t02316723305 = calcReward(userAddressStr, asset, stakedAmountX, depositNumUser, depositNumLast) | |
594 | + | let rewardTotal = $t02316723305._1 | |
595 | + | let cached = $t02316723305._2 | |
596 | + | let dynamic = $t02316723305._3 | |
597 | + | let rewardCachedPartKEY = $t02316723305._4 | |
552 | 598 | let claimed = valueOrElse(getInteger(keyClaimed(userAddressStr, asset)), 0) | |
553 | 599 | ((accum + makeString([asset, toString(rewardTotal), toString(claimed)], ":")) + "_") | |
554 | 600 | } | |
555 | 601 | ||
556 | 602 | let $l = supportedAssetsList | |
557 | 603 | let $s = size($l) | |
558 | 604 | let $acc0 = "" | |
559 | 605 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
560 | 606 | then $a | |
561 | 607 | else forEachAssetCalcUnclaimedReward($a, $l[$i]) | |
562 | 608 | ||
563 | 609 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
564 | 610 | then $a | |
565 | - | else throw("List size exceeds | |
611 | + | else throw("List size exceeds 9") | |
566 | 612 | ||
567 | - | $f0_2 | |
613 | + | $f0_2($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) | |
568 | 614 | } | |
569 | 615 | $Tuple2(nil, dropRight(unclaimedRewardStr, 1)) | |
570 | 616 | } | |
571 | 617 | ||
572 | 618 | ||
573 | 619 | ||
574 | 620 | @Callable(i) | |
575 | 621 | func surfStakingSYSREADONLY (userAddressStrOrEmpty,surfDiff) = { | |
576 | 622 | let surfTotal = getIntOrElse(keyLockParamTotalAmount(), 0) | |
577 | 623 | let gnsbtFromSurfTotal = surfToGnsbt(surfTotal) | |
578 | 624 | if ((userAddressStrOrEmpty == "")) | |
579 | 625 | then $Tuple2(nil, [0, surfTotal, 0, gnsbtFromSurfTotal, 0, height, height]) | |
580 | 626 | else { | |
581 | 627 | let userAddress = toAddressOrFail(userAddressStrOrEmpty) | |
582 | 628 | let mergedData = mergeStake(userAddress, surfDiff) | |
583 | 629 | let isNewUser = mergedData._1 | |
584 | 630 | let stakedAmount = mergedData._2 | |
585 | 631 | let vpEffectiveHeight = mergedData._3 | |
586 | 632 | let stakedAmountNEW = mergedData._4 | |
587 | 633 | let vpEffectiveHeightNEW = mergedData._5 | |
588 | 634 | let surfUser = stakedAmount | |
589 | 635 | let gnsbtFromSurfUser = surfToGnsbt(surfUser) | |
590 | 636 | $Tuple2(nil, [surfUser, surfTotal, gnsbtFromSurfUser, gnsbtFromSurfTotal, vpEffectiveHeight, vpEffectiveHeightNEW]) | |
591 | 637 | } | |
592 | 638 | } | |
593 | 639 | ||
594 | 640 | ||
595 | 641 | ||
596 | 642 | @Callable(i) | |
597 | 643 | func gnsbtFromSurfSYSREADONLY (surfAmt) = $Tuple2(nil, surfToGnsbt(surfAmt)) | |
598 | 644 | ||
599 | 645 | ||
600 | 646 | ||
601 | 647 | @Callable(i) | |
602 | 648 | func configSYSREADONLY () = { | |
603 | 649 | let minLockAmt = getIntegerValue(keyMinLockAmount()) | |
604 | 650 | let surfVotingPowerRestrictivePeriod = (1440 * 14) | |
605 | 651 | let brToStartSurfTransformation = 1150000 | |
606 | 652 | $Tuple2(nil, [minLockAmt, (gnsbtFromSurfCoeff * MULT6), surfVotingPowerRestrictivePeriod, brToStartSurfTransformation]) | |
607 | 653 | } | |
608 | 654 | ||
609 | 655 |
github/deemru/w8io/169f3d6 118.11 ms ◑