tx · ALtC3XNS9GqZwkD4e9R528GegaScZPP52ExxmxjFf7Q2 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.02200000 Waves 2023.02.28 14:15 [2469479] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "ALtC3XNS9GqZwkD4e9R528GegaScZPP52ExxmxjFf7Q2", "fee": 2200000, "feeAssetId": null, "timestamp": 1677582965057, "version": 2, "chainId": 84, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "3RroqkMjTHaLPmPgyQetQPRuo7QoqRc38WmHPuLSCrfTANWasaKoPt86hQNvtECHywb1GK7Bm2a7tPgWuBAjcz4T" ], "script": "base64:BgL1HggCEgMKAQgSAwoBCBIDCgEIEgASABIECgIIARIDCgEIEgQKAggIEgYKBAEYCBgSBAoCGAgSBAoCCAgSAwoBCBIECgIICCIGU0NBTEU4IgVNVUxUOCIHU0NBTEUxOCIGTVVMVDE4IgNTRVAiDlBPT0xXRUlHSFRNVUxUIgp6ZXJvQmlnSW50IglvbmVCaWdJbnQiCWFzQW55TGlzdCIDdmFsIgckbWF0Y2gwIgp2YWxBbnlMeXN0IgVhc0ludCIGdmFsSW50Ighhc1N0cmluZyIGdmFsU3RyIgxhc0J5dGVWZWN0b3IiBnZhbEJpbiIPZ2V0U3RyaW5nT3JGYWlsIgdhZGRyZXNzIgNrZXkiGGdldFN0cmluZ0J5QWRkcmVzc09yRmFpbCIMZ2V0SW50T3JaZXJvIg9nZXRJbnRPckRlZmF1bHQiCmRlZmF1bHRWYWwiDGdldEludE9yRmFpbCIZZ2V0QmlnSW50RnJvbVN0cmluZ09yWmVybyIcZ2V0QmlnSW50RnJvbVN0cmluZ09yRGVmYXVsdCIBcyIFdG9YMTgiB29yaWdWYWwiDW9yaWdTY2FsZ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"height": 2469479, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4bAHMDZPDfjo93XqDJejLHZaJBkRXbaNhT6iXn2zzfkZ Next: DNvSMRFDobjtEsCMh7HiyYVbXfbMeNsc8TdmnjMo3Fyq Diff:
Old | New | Differences | |
---|---|---|---|
16 | 16 | let zeroBigInt = toBigInt(0) | |
17 | 17 | ||
18 | 18 | let oneBigInt = toBigInt(1) | |
19 | - | ||
20 | - | func wrapErr (msg) = makeString(["staking.ride:", toString(this), msg], " ") | |
21 | - | ||
22 | - | ||
23 | - | func throwErr (msg) = throw(wrapErr(msg)) | |
24 | - | ||
25 | 19 | ||
26 | 20 | func asAnyList (val) = match val { | |
27 | 21 | case valAnyLyst: List[Any] => | |
245 | 239 | ||
246 | 240 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
247 | 241 | ||
248 | - | let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address")) | |
249 | - | ||
250 | 242 | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
251 | 243 | ||
252 | 244 | ||
357 | 349 | ||
358 | 350 | ||
359 | 351 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
360 | - | let $ | |
361 | - | let wxPerLpIntegralNew = $ | |
362 | - | let poolIntegralSTATE = $ | |
363 | - | let poolDEBUG = $ | |
352 | + | let $t01427414396 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
353 | + | let wxPerLpIntegralNew = $t01427414396._1 | |
354 | + | let poolIntegralSTATE = $t01427414396._2 | |
355 | + | let poolDEBUG = $t01427414396._3 | |
364 | 356 | let MULT3 = 1000 | |
365 | 357 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
366 | 358 | let stakedByUser = readStaked(stakedByUserKEY) | |
418 | 410 | case _ => | |
419 | 411 | throw("Match error") | |
420 | 412 | } | |
421 | - | ||
422 | - | ||
423 | - | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
424 | - | let userAddressStr = toString(userAddress) | |
425 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
426 | - | let poolAddressStr = toString(poolAddress) | |
427 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
428 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
429 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
430 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
431 | - | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
432 | - | let listName = getUsersListName(lpAssetIdStr) | |
433 | - | let listActions = if (if (containsNode(listName, userAddressStr)) | |
434 | - | then (amount == stakedByUser) | |
435 | - | else false) | |
436 | - | then deleteNodeActions(listName, userAddressStr) | |
437 | - | else nil | |
438 | - | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
439 | - | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)._1 | |
440 | - | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
441 | - | let throwIfNothingToClaim = true | |
442 | - | let r = if ((availableToClaim > zeroBigInt)) | |
443 | - | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
444 | - | else unit | |
445 | - | if ((r == r)) | |
446 | - | then if ((amount > stakedByUser)) | |
447 | - | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
448 | - | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
449 | - | else throw("Strict value is not equal to itself.") | |
450 | - | } | |
451 | 413 | ||
452 | 414 | ||
453 | 415 | @Callable(i) | |
524 | 486 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 487 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | 488 | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $ | |
528 | - | let wxToClaimUserNew = $ | |
529 | - | let integralSTATE = $ | |
530 | - | let debug = $ | |
489 | + | let $t01883218949 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
490 | + | let wxToClaimUserNew = $t01883218949._1 | |
491 | + | let integralSTATE = $t01883218949._2 | |
492 | + | let debug = $t01883218949._3 | |
531 | 493 | let listName = getUsersListName(lpAssetIdStr) | |
532 | 494 | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | 495 | then nil | |
541 | 503 | func unstake (lpAssetIdStr,amount) = { | |
542 | 504 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
543 | 505 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
544 | - | let poolAddress = addressFromStringValue(poolAddressStr) | |
545 | - | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
506 | + | let poolAddon = valueOrElse(getString(addressFromStringValue(poolAddressStr), keyAddonAddr()), poolAddressStr) | |
546 | 507 | let callerStr = toString(i.caller) | |
547 | - | let | |
508 | + | let userAddressStr = if (if ((callerStr == poolAddressStr)) | |
548 | 509 | then true | |
549 | 510 | else (callerStr == poolAddon)) | |
550 | - | then i.originCaller | |
551 | - | else i.caller | |
552 | - | let lpAssetRecipientAddress = i.caller | |
553 | - | unstakeActions(i, lpAssetId, poolAddress, userAddress, lpAssetRecipientAddress, amount) | |
554 | - | } | |
555 | - | ||
556 | - | ||
557 | - | ||
558 | - | @Callable(i) | |
559 | - | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
560 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
561 | - | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
562 | - | let checkCaller = if ((i.caller == poolAddress)) | |
563 | - | then true | |
564 | - | else permissionDeniedError | |
565 | - | if ((checkCaller == checkCaller)) | |
566 | - | then unstakeActions(i, lpAssetId, poolAddress, Address(userAddress), Address(lpAssetRecipientAddress), amount) | |
511 | + | then toString(i.originCaller) | |
512 | + | else callerStr | |
513 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
514 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
515 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
516 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
517 | + | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
518 | + | let listName = getUsersListName(lpAssetIdStr) | |
519 | + | let listActions = if (if (containsNode(listName, userAddressStr)) | |
520 | + | then (amount == stakedByUser) | |
521 | + | else false) | |
522 | + | then deleteNodeActions(listName, userAddressStr) | |
523 | + | else nil | |
524 | + | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
525 | + | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
526 | + | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddress, 0)._1 | |
527 | + | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
528 | + | let r = if ((availableToClaim > zeroBigInt)) | |
529 | + | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
530 | + | else unit | |
531 | + | if ((r == r)) | |
532 | + | then if ((amount > stakedByUser)) | |
533 | + | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
534 | + | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
567 | 535 | else throw("Strict value is not equal to itself.") | |
568 | 536 | } | |
569 | 537 | ||
572 | 540 | @Callable(i) | |
573 | 541 | func claimWx (lpAssetIdStr) = { | |
574 | 542 | let userAddressStr = toString(i.caller) | |
575 | - | let throwIfNothingToClaim = true | |
576 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
543 | + | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
577 | 544 | $Tuple2(nil, result) | |
578 | 545 | } | |
579 | 546 | ||
580 | 547 | ||
581 | 548 | ||
582 | 549 | @Callable(i) | |
583 | - | func claimWxDoNotThrow (lpAssetIdStr) = { | |
584 | - | let userAddressStr = toString(i.caller) | |
585 | - | let throwIfNothingToClaim = false | |
586 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
587 | - | $Tuple2(nil, result) | |
588 | - | } | |
589 | - | ||
590 | - | ||
591 | - | ||
592 | - | @Callable(i) | |
593 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr,throwIfNothingToClaim) = { | |
550 | + | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
594 | 551 | let checkCaller = mustThis(i) | |
595 | 552 | if ((checkCaller == checkCaller)) | |
596 | 553 | then { | |
604 | 561 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
605 | 562 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
606 | 563 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
607 | - | let $ | |
608 | - | let wxToClaimUserNew = $ | |
609 | - | let integralSTATE = $ | |
610 | - | let debug = $ | |
564 | + | let $t02281422926 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
565 | + | let wxToClaimUserNew = $t02281422926._1 | |
566 | + | let integralSTATE = $t02281422926._2 | |
567 | + | let debug = $t02281422926._3 | |
611 | 568 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
612 | 569 | if ((zeroBigInt >= availableToClaim)) | |
613 | - | then if (throwIfNothingToClaim) | |
614 | - | then throw("nothing to claim") | |
615 | - | else $Tuple2(nil, 0) | |
570 | + | then throw("nothing to claim") | |
616 | 571 | else { | |
617 | 572 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
618 | 573 | let minRewardPart = availableToClaim | |
619 | 574 | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
620 | - | let totalReward = (minRewardPart + boostRewardPart) | |
621 | 575 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
622 | 576 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
623 | 577 | if ((emitBoost == emitBoost)) | |
626 | 580 | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
627 | 581 | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserBoostReward + boostRewardPart) | |
628 | 582 | let claimedTotalPlusAvailableToClaim = (claimedTotal + availableToClaim) | |
629 | - | ||
583 | + | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
630 | 584 | } | |
631 | 585 | else throw("Strict value is not equal to itself.") | |
632 | 586 | } | |
690 | 644 | else (height - emissionStartBlock) | |
691 | 645 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
692 | 646 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
693 | - | let $ | |
694 | - | let wxToClaimUserNew = $ | |
695 | - | let integralSTATE = $ | |
696 | - | let debug = $ | |
647 | + | let $t02658426696 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
648 | + | let wxToClaimUserNew = $t02658426696._1 | |
649 | + | let integralSTATE = $t02658426696._2 | |
650 | + | let debug = $t02658426696._3 | |
697 | 651 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
698 | 652 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
699 | 653 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
702 | 656 | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
703 | 657 | let totalReward = (minRewardPart + boostRewardPart) | |
704 | 658 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
705 | - | } | |
706 | - | ||
707 | - | ||
708 | - | ||
709 | - | @Callable(i) | |
710 | - | func stakedByUserREADONLY (lpAssetIdStr,userAddressStr) = { | |
711 | - | let stakedByUser = valueOrElse(getInteger(keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
712 | - | $Tuple2(nil, stakedByUser) | |
713 | 659 | } | |
714 | 660 | ||
715 | 661 | ||
739 | 685 | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
740 | 686 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0)._1 | |
741 | 687 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
742 | - | let throwIfNothingToClaim = true | |
743 | 688 | let r = if ((availableToClaim > zeroBigInt)) | |
744 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress | |
689 | + | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
745 | 690 | else unit | |
746 | 691 | if ((r == r)) | |
747 | 692 | then { | |
769 | 714 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
770 | 715 | then throw("permissions denied") | |
771 | 716 | else { | |
772 | - | let $ | |
773 | - | let wxPerLpIntegralNew = $ | |
774 | - | let poolIntegralSTATE = $ | |
775 | - | let poolDEBUG = $ | |
717 | + | let $t02903229142 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
718 | + | let wxPerLpIntegralNew = $t02903229142._1 | |
719 | + | let poolIntegralSTATE = $t02903229142._2 | |
720 | + | let poolDEBUG = $t02903229142._3 | |
776 | 721 | poolIntegralSTATE | |
777 | 722 | } | |
778 | 723 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let SCALE18 = 18 | |
9 | 9 | ||
10 | 10 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | 13 | ||
14 | 14 | let POOLWEIGHTMULT = MULT8 | |
15 | 15 | ||
16 | 16 | let zeroBigInt = toBigInt(0) | |
17 | 17 | ||
18 | 18 | let oneBigInt = toBigInt(1) | |
19 | - | ||
20 | - | func wrapErr (msg) = makeString(["staking.ride:", toString(this), msg], " ") | |
21 | - | ||
22 | - | ||
23 | - | func throwErr (msg) = throw(wrapErr(msg)) | |
24 | - | ||
25 | 19 | ||
26 | 20 | func asAnyList (val) = match val { | |
27 | 21 | case valAnyLyst: List[Any] => | |
28 | 22 | valAnyLyst | |
29 | 23 | case _ => | |
30 | 24 | throw("fail to cast into List[Any]") | |
31 | 25 | } | |
32 | 26 | ||
33 | 27 | ||
34 | 28 | func asInt (val) = match val { | |
35 | 29 | case valInt: Int => | |
36 | 30 | valInt | |
37 | 31 | case _ => | |
38 | 32 | throw("fail to cast into Int") | |
39 | 33 | } | |
40 | 34 | ||
41 | 35 | ||
42 | 36 | func asString (val) = match val { | |
43 | 37 | case valStr: String => | |
44 | 38 | valStr | |
45 | 39 | case _ => | |
46 | 40 | throw("fail to cast into Int") | |
47 | 41 | } | |
48 | 42 | ||
49 | 43 | ||
50 | 44 | func asByteVector (val) = match val { | |
51 | 45 | case valBin: ByteVector => | |
52 | 46 | valBin | |
53 | 47 | case _ => | |
54 | 48 | throw("fail to cast into Int") | |
55 | 49 | } | |
56 | 50 | ||
57 | 51 | ||
58 | 52 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
59 | 53 | ||
60 | 54 | ||
61 | 55 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
62 | 56 | ||
63 | 57 | ||
64 | 58 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
65 | 59 | ||
66 | 60 | ||
67 | 61 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
68 | 62 | ||
69 | 63 | ||
70 | 64 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
71 | 65 | ||
72 | 66 | ||
73 | 67 | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
74 | 68 | ||
75 | 69 | ||
76 | 70 | func getBigIntFromStringOrDefault (address,key,defaultVal) = match getString(address, key) { | |
77 | 71 | case s: String => | |
78 | 72 | value(parseBigInt(s)) | |
79 | 73 | case _: Unit => | |
80 | 74 | defaultVal | |
81 | 75 | case _ => | |
82 | 76 | throw("Match error") | |
83 | 77 | } | |
84 | 78 | ||
85 | 79 | ||
86 | 80 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
87 | 81 | ||
88 | 82 | ||
89 | 83 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
90 | 84 | ||
91 | 85 | ||
92 | 86 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
93 | 87 | ||
94 | 88 | ||
95 | 89 | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
96 | 90 | ||
97 | 91 | ||
98 | 92 | let IdxFactoryCfgStakingDapp = 1 | |
99 | 93 | ||
100 | 94 | let IdxFactoryCfgBoostingDapp = 2 | |
101 | 95 | ||
102 | 96 | let IdxFactoryCfgIdoDapp = 3 | |
103 | 97 | ||
104 | 98 | let IdxFactoryCfgTeamDapp = 4 | |
105 | 99 | ||
106 | 100 | let IdxFactoryCfgEmissionDapp = 5 | |
107 | 101 | ||
108 | 102 | let IdxFactoryCfgRestDapp = 6 | |
109 | 103 | ||
110 | 104 | let IdxFactoryCfgSlippageDapp = 7 | |
111 | 105 | ||
112 | 106 | func keyFactoryCfg () = "%s__factoryConfig" | |
113 | 107 | ||
114 | 108 | ||
115 | 109 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
116 | 110 | ||
117 | 111 | ||
118 | 112 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
119 | 113 | ||
120 | 114 | ||
121 | 115 | func keyStablePoolAddonAddr () = "%s__stablePoolAddonAddr" | |
122 | 116 | ||
123 | 117 | ||
124 | 118 | func keyAddonAddr () = "%s__addonAddr" | |
125 | 119 | ||
126 | 120 | ||
127 | 121 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
128 | 122 | ||
129 | 123 | ||
130 | 124 | func keyFactoryLpList () = "%s__lpTokensList" | |
131 | 125 | ||
132 | 126 | ||
133 | 127 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
134 | 128 | ||
135 | 129 | ||
136 | 130 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
137 | 131 | ||
138 | 132 | ||
139 | 133 | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
140 | 134 | ||
141 | 135 | ||
142 | 136 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
143 | 137 | ||
144 | 138 | ||
145 | 139 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
146 | 140 | ||
147 | 141 | ||
148 | 142 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
149 | 143 | ||
150 | 144 | ||
151 | 145 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
152 | 146 | ||
153 | 147 | ||
154 | 148 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
155 | 149 | ||
156 | 150 | ||
157 | 151 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
158 | 152 | ||
159 | 153 | ||
160 | 154 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
161 | 155 | ||
162 | 156 | ||
163 | 157 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
164 | 158 | ||
165 | 159 | ||
166 | 160 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
167 | 161 | ||
168 | 162 | ||
169 | 163 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
170 | 164 | ||
171 | 165 | ||
172 | 166 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
173 | 167 | ||
174 | 168 | ||
175 | 169 | func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
176 | 170 | ||
177 | 171 | ||
178 | 172 | func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP) | |
179 | 173 | ||
180 | 174 | ||
181 | 175 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
182 | 176 | ||
183 | 177 | ||
184 | 178 | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed__total", lpAssetIdStr], SEP) | |
185 | 179 | ||
186 | 180 | ||
187 | 181 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
188 | 182 | ||
189 | 183 | ||
190 | 184 | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
191 | 185 | ||
192 | 186 | ||
193 | 187 | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
194 | 188 | ||
195 | 189 | ||
196 | 190 | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
197 | 191 | ||
198 | 192 | ||
199 | 193 | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
200 | 194 | ||
201 | 195 | ||
202 | 196 | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
203 | 197 | ||
204 | 198 | ||
205 | 199 | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
206 | 200 | ||
207 | 201 | ||
208 | 202 | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
209 | 203 | ||
210 | 204 | ||
211 | 205 | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
212 | 206 | ||
213 | 207 | ||
214 | 208 | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
215 | 209 | ||
216 | 210 | ||
217 | 211 | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
218 | 212 | ||
219 | 213 | ||
220 | 214 | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
221 | 215 | ||
222 | 216 | ||
223 | 217 | func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP) | |
224 | 218 | ||
225 | 219 | ||
226 | 220 | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
227 | 221 | ||
228 | 222 | ||
229 | 223 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
230 | 224 | ||
231 | 225 | ||
232 | 226 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
233 | 227 | ||
234 | 228 | ||
235 | 229 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
236 | 230 | ||
237 | 231 | ||
238 | 232 | let factoryAddress = getStringOrFail(this, keyFactoryAddress()) | |
239 | 233 | ||
240 | 234 | let factoryContract = addressFromStringValue(factoryAddress) | |
241 | 235 | ||
242 | 236 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
243 | 237 | ||
244 | 238 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
245 | 239 | ||
246 | 240 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
247 | 241 | ||
248 | - | let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address")) | |
249 | - | ||
250 | 242 | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
251 | 243 | ||
252 | 244 | ||
253 | 245 | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
254 | 246 | ||
255 | 247 | ||
256 | 248 | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
257 | 249 | ||
258 | 250 | ||
259 | 251 | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
260 | 252 | ||
261 | 253 | ||
262 | 254 | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
263 | 255 | ||
264 | 256 | ||
265 | 257 | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
266 | 258 | ||
267 | 259 | ||
268 | 260 | func containsNode (listName,id) = { | |
269 | 261 | let headOrUnit = getString(this, keyListHead(listName)) | |
270 | 262 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
271 | 263 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
272 | 264 | if (if ((id == valueOrElse(headOrUnit, ""))) | |
273 | 265 | then true | |
274 | 266 | else (prevOrUnit != unit)) | |
275 | 267 | then true | |
276 | 268 | else (nextOrUnit != unit) | |
277 | 269 | } | |
278 | 270 | ||
279 | 271 | ||
280 | 272 | func insertNodeActions (listName,id) = { | |
281 | 273 | let headOrUnit = getString(this, keyListHead(listName)) | |
282 | 274 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
283 | 275 | let checkNode = if (!(containsNode(listName, id))) | |
284 | 276 | then true | |
285 | 277 | else throw("Node exists") | |
286 | 278 | if ((checkNode == checkNode)) | |
287 | 279 | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
288 | 280 | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
289 | 281 | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
290 | 282 | else throw("Strict value is not equal to itself.") | |
291 | 283 | } | |
292 | 284 | ||
293 | 285 | ||
294 | 286 | func deleteNodeActions (listName,id) = { | |
295 | 287 | let headOrUnit = getString(this, keyListHead(listName)) | |
296 | 288 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
297 | 289 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
298 | 290 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
299 | 291 | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
300 | 292 | then (nextOrUnit != unit) | |
301 | 293 | else false) | |
302 | 294 | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
303 | 295 | else if ((nextOrUnit != unit)) | |
304 | 296 | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
305 | 297 | else if ((prevOrUnit != unit)) | |
306 | 298 | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
307 | 299 | else if ((id == valueOrElse(headOrUnit, ""))) | |
308 | 300 | then [DeleteEntry(keyListHead(listName))] | |
309 | 301 | else throw(((("invalid node: " + listName) + ".") + id)))) | |
310 | 302 | } | |
311 | 303 | ||
312 | 304 | ||
313 | 305 | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
314 | 306 | then (stakedByUser > zeroBigInt) | |
315 | 307 | else false) | |
316 | 308 | then zeroBigInt | |
317 | 309 | else if ((stakedByUser == zeroBigInt)) | |
318 | 310 | then wxPerLpIntegralNew | |
319 | 311 | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > zeroBigInt)) | |
320 | 312 | then (stakedByUser > zeroBigInt) | |
321 | 313 | else false) | |
322 | 314 | then value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY))) | |
323 | 315 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
324 | 316 | ||
325 | 317 | ||
326 | 318 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
327 | 319 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
328 | 320 | let stakedTotal = toBigInt(readStaked(stakedTotalKEY)) | |
329 | 321 | let nonZeroStakedTotal = if ((stakedTotal == zeroBigInt)) | |
330 | 322 | then oneBigInt | |
331 | 323 | else stakedTotal | |
332 | 324 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
333 | 325 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
334 | 326 | let MULT3 = 1000 | |
335 | 327 | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
336 | 328 | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * 3)) | |
337 | 329 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
338 | 330 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
339 | 331 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
340 | 332 | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
341 | 333 | let wxPerLpIntegral = getBigIntFromStringOrZero(this, wxPerLpIntegralKEY) | |
342 | 334 | let wxPerLpOrZeroX3 = 0 | |
343 | 335 | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
344 | 336 | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
345 | 337 | then toBigInt(wxPerLpOrZeroX3) | |
346 | 338 | else fraction(toBigInt(poolWxEmissionPerBlockX3), toBigInt(MULT8), nonZeroStakedTotal) | |
347 | 339 | let stakedTotalNew = (stakedTotal + toBigInt(lpDeltaAmount)) | |
348 | 340 | let nonZeroStakedTotalNew = if ((stakedTotalNew == zeroBigInt)) | |
349 | 341 | then oneBigInt | |
350 | 342 | else stakedTotalNew | |
351 | 343 | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
352 | 344 | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
353 | 345 | let wxPerLpIntegralLastUpdHeightNew = height | |
354 | 346 | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
355 | 347 | $Tuple3(wxPerLpIntegralNew, [StringEntry(wxPerLpIntegralKEY, toString(wxPerLpIntegralNew)), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), StringEntry(wxPerLpKEY, toString(wxPerLpX3New))], debug) | |
356 | 348 | } | |
357 | 349 | ||
358 | 350 | ||
359 | 351 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
360 | - | let $ | |
361 | - | let wxPerLpIntegralNew = $ | |
362 | - | let poolIntegralSTATE = $ | |
363 | - | let poolDEBUG = $ | |
352 | + | let $t01427414396 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
353 | + | let wxPerLpIntegralNew = $t01427414396._1 | |
354 | + | let poolIntegralSTATE = $t01427414396._2 | |
355 | + | let poolDEBUG = $t01427414396._3 | |
364 | 356 | let MULT3 = 1000 | |
365 | 357 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
366 | 358 | let stakedByUser = readStaked(stakedByUserKEY) | |
367 | 359 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
368 | 360 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
369 | 361 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
370 | 362 | let wxToClaimUser = getBigIntFromStringOrZero(this, wxToClaimUserKEY) | |
371 | 363 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
372 | 364 | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(toBigInt(stakedByUser), toBigInt(wxPerLpIntegralUserLastUpdHeightOrZero), wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
373 | 365 | let MULT11 = (MULT8 * MULT3) | |
374 | 366 | let wxToClaimUserNew = max([(wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))), zeroBigInt]) | |
375 | 367 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
376 | 368 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
377 | 369 | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
378 | 370 | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [StringEntry(wxToClaimUserKEY, toString(wxToClaimUserNew)), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), StringEntry(wxPerLpIntegralUserLastKEY, toString(wxPerLpIntegralUserLastNew))]), debug) | |
379 | 371 | } | |
380 | 372 | ||
381 | 373 | ||
382 | 374 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
383 | 375 | case s: String => | |
384 | 376 | fromBase58String(s) | |
385 | 377 | case _: Unit => | |
386 | 378 | unit | |
387 | 379 | case _ => | |
388 | 380 | throw("Match error") | |
389 | 381 | } | |
390 | 382 | ||
391 | 383 | ||
392 | 384 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
393 | 385 | case s: String => | |
394 | 386 | fromBase58String(s) | |
395 | 387 | case _: Unit => | |
396 | 388 | unit | |
397 | 389 | case _ => | |
398 | 390 | throw("Match error") | |
399 | 391 | } | |
400 | 392 | ||
401 | 393 | ||
402 | 394 | let permissionDeniedError = throw("Permission denied") | |
403 | 395 | ||
404 | 396 | func mustThis (i) = if ((i.caller == this)) | |
405 | 397 | then true | |
406 | 398 | else permissionDeniedError | |
407 | 399 | ||
408 | 400 | ||
409 | 401 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
410 | 402 | case pk: ByteVector => | |
411 | 403 | if ((i.callerPublicKey == pk)) | |
412 | 404 | then true | |
413 | 405 | else permissionDeniedError | |
414 | 406 | case _: Unit => | |
415 | 407 | if ((i.caller == this)) | |
416 | 408 | then true | |
417 | 409 | else permissionDeniedError | |
418 | 410 | case _ => | |
419 | 411 | throw("Match error") | |
420 | 412 | } | |
421 | - | ||
422 | - | ||
423 | - | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
424 | - | let userAddressStr = toString(userAddress) | |
425 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
426 | - | let poolAddressStr = toString(poolAddress) | |
427 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
428 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
429 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
430 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
431 | - | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
432 | - | let listName = getUsersListName(lpAssetIdStr) | |
433 | - | let listActions = if (if (containsNode(listName, userAddressStr)) | |
434 | - | then (amount == stakedByUser) | |
435 | - | else false) | |
436 | - | then deleteNodeActions(listName, userAddressStr) | |
437 | - | else nil | |
438 | - | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
439 | - | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)._1 | |
440 | - | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
441 | - | let throwIfNothingToClaim = true | |
442 | - | let r = if ((availableToClaim > zeroBigInt)) | |
443 | - | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
444 | - | else unit | |
445 | - | if ((r == r)) | |
446 | - | then if ((amount > stakedByUser)) | |
447 | - | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
448 | - | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
449 | - | else throw("Strict value is not equal to itself.") | |
450 | - | } | |
451 | 413 | ||
452 | 414 | ||
453 | 415 | @Callable(i) | |
454 | 416 | func constructor (factoryAddressStr) = { | |
455 | 417 | let checkCaller = mustManager(i) | |
456 | 418 | if ((checkCaller == checkCaller)) | |
457 | 419 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
458 | 420 | else throw("Strict value is not equal to itself.") | |
459 | 421 | } | |
460 | 422 | ||
461 | 423 | ||
462 | 424 | ||
463 | 425 | @Callable(i) | |
464 | 426 | func constructorV2 (votingEmissionContract) = { | |
465 | 427 | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
466 | 428 | then true | |
467 | 429 | else "invalid voting emission contract address"] | |
468 | 430 | if ((cheks == cheks)) | |
469 | 431 | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
470 | 432 | else throw("Strict value is not equal to itself.") | |
471 | 433 | } | |
472 | 434 | ||
473 | 435 | ||
474 | 436 | ||
475 | 437 | @Callable(i) | |
476 | 438 | func setManager (pendingManagerPublicKey) = { | |
477 | 439 | let checkCaller = mustManager(i) | |
478 | 440 | if ((checkCaller == checkCaller)) | |
479 | 441 | then { | |
480 | 442 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
481 | 443 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
482 | 444 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
483 | 445 | else throw("Strict value is not equal to itself.") | |
484 | 446 | } | |
485 | 447 | else throw("Strict value is not equal to itself.") | |
486 | 448 | } | |
487 | 449 | ||
488 | 450 | ||
489 | 451 | ||
490 | 452 | @Callable(i) | |
491 | 453 | func confirmManager () = { | |
492 | 454 | let pm = pendingManagerPublicKeyOrUnit() | |
493 | 455 | let hasPM = if (isDefined(pm)) | |
494 | 456 | then true | |
495 | 457 | else throw("No pending manager") | |
496 | 458 | if ((hasPM == hasPM)) | |
497 | 459 | then { | |
498 | 460 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
499 | 461 | then true | |
500 | 462 | else throw("You are not pending manager") | |
501 | 463 | if ((checkPM == checkPM)) | |
502 | 464 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
503 | 465 | else throw("Strict value is not equal to itself.") | |
504 | 466 | } | |
505 | 467 | else throw("Strict value is not equal to itself.") | |
506 | 468 | } | |
507 | 469 | ||
508 | 470 | ||
509 | 471 | ||
510 | 472 | @Callable(i) | |
511 | 473 | func stake () = if ((size(i.payments) != 1)) | |
512 | 474 | then throw("invalid payment - exact one payment must be attached") | |
513 | 475 | else { | |
514 | 476 | let pmt = i.payments[0] | |
515 | 477 | let lpAssetId = value(pmt.assetId) | |
516 | 478 | let lpAssetIdStr = toBase58String(lpAssetId) | |
517 | 479 | let amount = pmt.amount | |
518 | 480 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
519 | 481 | let callerStr = toString(i.caller) | |
520 | 482 | let userAddressStr = if ((callerStr == poolAddressStr)) | |
521 | 483 | then toString(i.originCaller) | |
522 | 484 | else callerStr | |
523 | 485 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
524 | 486 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 487 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | 488 | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $ | |
528 | - | let wxToClaimUserNew = $ | |
529 | - | let integralSTATE = $ | |
530 | - | let debug = $ | |
489 | + | let $t01883218949 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
490 | + | let wxToClaimUserNew = $t01883218949._1 | |
491 | + | let integralSTATE = $t01883218949._2 | |
492 | + | let debug = $t01883218949._3 | |
531 | 493 | let listName = getUsersListName(lpAssetIdStr) | |
532 | 494 | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | 495 | then nil | |
534 | 496 | else insertNodeActions(listName, userAddressStr) | |
535 | 497 | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
536 | 498 | } | |
537 | 499 | ||
538 | 500 | ||
539 | 501 | ||
540 | 502 | @Callable(i) | |
541 | 503 | func unstake (lpAssetIdStr,amount) = { | |
542 | 504 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
543 | 505 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
544 | - | let poolAddress = addressFromStringValue(poolAddressStr) | |
545 | - | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
506 | + | let poolAddon = valueOrElse(getString(addressFromStringValue(poolAddressStr), keyAddonAddr()), poolAddressStr) | |
546 | 507 | let callerStr = toString(i.caller) | |
547 | - | let | |
508 | + | let userAddressStr = if (if ((callerStr == poolAddressStr)) | |
548 | 509 | then true | |
549 | 510 | else (callerStr == poolAddon)) | |
550 | - | then i.originCaller | |
551 | - | else i.caller | |
552 | - | let lpAssetRecipientAddress = i.caller | |
553 | - | unstakeActions(i, lpAssetId, poolAddress, userAddress, lpAssetRecipientAddress, amount) | |
554 | - | } | |
555 | - | ||
556 | - | ||
557 | - | ||
558 | - | @Callable(i) | |
559 | - | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
560 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
561 | - | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
562 | - | let checkCaller = if ((i.caller == poolAddress)) | |
563 | - | then true | |
564 | - | else permissionDeniedError | |
565 | - | if ((checkCaller == checkCaller)) | |
566 | - | then unstakeActions(i, lpAssetId, poolAddress, Address(userAddress), Address(lpAssetRecipientAddress), amount) | |
511 | + | then toString(i.originCaller) | |
512 | + | else callerStr | |
513 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
514 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
515 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
516 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
517 | + | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
518 | + | let listName = getUsersListName(lpAssetIdStr) | |
519 | + | let listActions = if (if (containsNode(listName, userAddressStr)) | |
520 | + | then (amount == stakedByUser) | |
521 | + | else false) | |
522 | + | then deleteNodeActions(listName, userAddressStr) | |
523 | + | else nil | |
524 | + | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
525 | + | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
526 | + | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddress, 0)._1 | |
527 | + | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
528 | + | let r = if ((availableToClaim > zeroBigInt)) | |
529 | + | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
530 | + | else unit | |
531 | + | if ((r == r)) | |
532 | + | then if ((amount > stakedByUser)) | |
533 | + | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
534 | + | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
567 | 535 | else throw("Strict value is not equal to itself.") | |
568 | 536 | } | |
569 | 537 | ||
570 | 538 | ||
571 | 539 | ||
572 | 540 | @Callable(i) | |
573 | 541 | func claimWx (lpAssetIdStr) = { | |
574 | 542 | let userAddressStr = toString(i.caller) | |
575 | - | let throwIfNothingToClaim = true | |
576 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
543 | + | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
577 | 544 | $Tuple2(nil, result) | |
578 | 545 | } | |
579 | 546 | ||
580 | 547 | ||
581 | 548 | ||
582 | 549 | @Callable(i) | |
583 | - | func claimWxDoNotThrow (lpAssetIdStr) = { | |
584 | - | let userAddressStr = toString(i.caller) | |
585 | - | let throwIfNothingToClaim = false | |
586 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
587 | - | $Tuple2(nil, result) | |
588 | - | } | |
589 | - | ||
590 | - | ||
591 | - | ||
592 | - | @Callable(i) | |
593 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr,throwIfNothingToClaim) = { | |
550 | + | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
594 | 551 | let checkCaller = mustThis(i) | |
595 | 552 | if ((checkCaller == checkCaller)) | |
596 | 553 | then { | |
597 | 554 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
598 | 555 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
599 | 556 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
600 | 557 | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
601 | 558 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
602 | 559 | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
603 | 560 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
604 | 561 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
605 | 562 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
606 | 563 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
607 | - | let $ | |
608 | - | let wxToClaimUserNew = $ | |
609 | - | let integralSTATE = $ | |
610 | - | let debug = $ | |
564 | + | let $t02281422926 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
565 | + | let wxToClaimUserNew = $t02281422926._1 | |
566 | + | let integralSTATE = $t02281422926._2 | |
567 | + | let debug = $t02281422926._3 | |
611 | 568 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
612 | 569 | if ((zeroBigInt >= availableToClaim)) | |
613 | - | then if (throwIfNothingToClaim) | |
614 | - | then throw("nothing to claim") | |
615 | - | else $Tuple2(nil, 0) | |
570 | + | then throw("nothing to claim") | |
616 | 571 | else { | |
617 | 572 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
618 | 573 | let minRewardPart = availableToClaim | |
619 | 574 | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
620 | - | let totalReward = (minRewardPart + boostRewardPart) | |
621 | 575 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
622 | 576 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
623 | 577 | if ((emitBoost == emitBoost)) | |
624 | 578 | then { | |
625 | 579 | let claimedByUserValue = ((claimedByUser + minRewardPart) + boostRewardPart) | |
626 | 580 | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
627 | 581 | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserBoostReward + boostRewardPart) | |
628 | 582 | let claimedTotalPlusAvailableToClaim = (claimedTotal + availableToClaim) | |
629 | - | ||
583 | + | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
630 | 584 | } | |
631 | 585 | else throw("Strict value is not equal to itself.") | |
632 | 586 | } | |
633 | 587 | } | |
634 | 588 | else throw("Strict value is not equal to itself.") | |
635 | 589 | } | |
636 | 590 | ||
637 | 591 | ||
638 | 592 | ||
639 | 593 | @Callable(i) | |
640 | 594 | func claimWxBulkInternalREADONLY (currentIter,lpAssetIds,userAddressStr,resAcc) = if ((currentIter == size(lpAssetIds))) | |
641 | 595 | then $Tuple2(nil, resAcc) | |
642 | 596 | else { | |
643 | 597 | let lpAssetId = lpAssetIds[currentIter] | |
644 | 598 | let info = split({ | |
645 | 599 | let @ = invoke(this, "claimWxREADONLY", [lpAssetId, userAddressStr], nil) | |
646 | 600 | if ($isInstanceOf(@, "String")) | |
647 | 601 | then @ | |
648 | 602 | else throw(($getType(@) + " couldn't be cast to String")) | |
649 | 603 | }, SEP) | |
650 | 604 | let unclaimed = info[3] | |
651 | 605 | let claimed = info[4] | |
652 | 606 | let res = (resAcc :+ makeString(["%d%d", unclaimed, claimed], SEP)) | |
653 | 607 | let inv = { | |
654 | 608 | let @ = invoke(this, "claimWxBulkInternalREADONLY", [(currentIter + 1), lpAssetIds, userAddressStr, res], nil) | |
655 | 609 | if ($isInstanceOf(@, "List[Any]")) | |
656 | 610 | then @ | |
657 | 611 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
658 | 612 | } | |
659 | 613 | if ((inv == inv)) | |
660 | 614 | then $Tuple2(nil, inv) | |
661 | 615 | else throw("Strict value is not equal to itself.") | |
662 | 616 | } | |
663 | 617 | ||
664 | 618 | ||
665 | 619 | ||
666 | 620 | @Callable(i) | |
667 | 621 | func claimWxBulkREADONLY (lpAssetIds,userAddressStr) = { | |
668 | 622 | let res = invoke(this, "claimWxBulkInternalREADONLY", [0, lpAssetIds, userAddressStr, nil], nil) | |
669 | 623 | $Tuple2(nil, res) | |
670 | 624 | } | |
671 | 625 | ||
672 | 626 | ||
673 | 627 | ||
674 | 628 | @Callable(i) | |
675 | 629 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
676 | 630 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
677 | 631 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
678 | 632 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
679 | 633 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
680 | 634 | let stakedByUser = readStaked(stakedByUserKEY) | |
681 | 635 | let stakedTotal = readStaked(stakedTotalKEY) | |
682 | 636 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
683 | 637 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
684 | 638 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
685 | 639 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
686 | 640 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
687 | 641 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
688 | 642 | let passedBlocks = if ((emissionStartBlock > height)) | |
689 | 643 | then 0 | |
690 | 644 | else (height - emissionStartBlock) | |
691 | 645 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
692 | 646 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
693 | - | let $ | |
694 | - | let wxToClaimUserNew = $ | |
695 | - | let integralSTATE = $ | |
696 | - | let debug = $ | |
647 | + | let $t02658426696 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
648 | + | let wxToClaimUserNew = $t02658426696._1 | |
649 | + | let integralSTATE = $t02658426696._2 | |
650 | + | let debug = $t02658426696._3 | |
697 | 651 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
698 | 652 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
699 | 653 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
700 | 654 | let boostDebug = asString(boostInvResult[1]) | |
701 | 655 | let minRewardPart = availableToClaim | |
702 | 656 | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
703 | 657 | let totalReward = (minRewardPart + boostRewardPart) | |
704 | 658 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
705 | - | } | |
706 | - | ||
707 | - | ||
708 | - | ||
709 | - | @Callable(i) | |
710 | - | func stakedByUserREADONLY (lpAssetIdStr,userAddressStr) = { | |
711 | - | let stakedByUser = valueOrElse(getInteger(keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
712 | - | $Tuple2(nil, stakedByUser) | |
713 | 659 | } | |
714 | 660 | ||
715 | 661 | ||
716 | 662 | ||
717 | 663 | @Callable(i) | |
718 | 664 | func usersListTraversal (lpAssetId) = { | |
719 | 665 | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
720 | 666 | then true | |
721 | 667 | else mustManager(i) | |
722 | 668 | if ((checkCaller == checkCaller)) | |
723 | 669 | then { | |
724 | 670 | let listName = getUsersListName(lpAssetId) | |
725 | 671 | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
726 | 672 | let headOrUnit = getString(keyListHead(listName)) | |
727 | 673 | match userOrUnit { | |
728 | 674 | case _: Unit => | |
729 | 675 | match headOrUnit { | |
730 | 676 | case _: Unit => | |
731 | 677 | $Tuple2(nil, false) | |
732 | 678 | case head: String => | |
733 | 679 | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
734 | 680 | case _ => | |
735 | 681 | throw("Match error") | |
736 | 682 | } | |
737 | 683 | case userAddress: String => | |
738 | 684 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetId, userAddress)) | |
739 | 685 | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
740 | 686 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0)._1 | |
741 | 687 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
742 | - | let throwIfNothingToClaim = true | |
743 | 688 | let r = if ((availableToClaim > zeroBigInt)) | |
744 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress | |
689 | + | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
745 | 690 | else unit | |
746 | 691 | if ((r == r)) | |
747 | 692 | then { | |
748 | 693 | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
749 | 694 | match nextUserOrUnit { | |
750 | 695 | case _: Unit => | |
751 | 696 | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
752 | 697 | case nextUser: String => | |
753 | 698 | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
754 | 699 | case _ => | |
755 | 700 | throw("Match error") | |
756 | 701 | } | |
757 | 702 | } | |
758 | 703 | else throw("Strict value is not equal to itself.") | |
759 | 704 | case _ => | |
760 | 705 | throw("Match error") | |
761 | 706 | } | |
762 | 707 | } | |
763 | 708 | else throw("Strict value is not equal to itself.") | |
764 | 709 | } | |
765 | 710 | ||
766 | 711 | ||
767 | 712 | ||
768 | 713 | @Callable(i) | |
769 | 714 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
770 | 715 | then throw("permissions denied") | |
771 | 716 | else { | |
772 | - | let $ | |
773 | - | let wxPerLpIntegralNew = $ | |
774 | - | let poolIntegralSTATE = $ | |
775 | - | let poolDEBUG = $ | |
717 | + | let $t02903229142 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
718 | + | let wxPerLpIntegralNew = $t02903229142._1 | |
719 | + | let poolIntegralSTATE = $t02903229142._2 | |
720 | + | let poolDEBUG = $t02903229142._3 | |
776 | 721 | poolIntegralSTATE | |
777 | 722 | } | |
778 | 723 | ||
779 | 724 | ||
780 | 725 | @Verifier(tx) | |
781 | 726 | func verify () = { | |
782 | 727 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
783 | 728 | case pk: ByteVector => | |
784 | 729 | pk | |
785 | 730 | case _: Unit => | |
786 | 731 | tx.senderPublicKey | |
787 | 732 | case _ => | |
788 | 733 | throw("Match error") | |
789 | 734 | } | |
790 | 735 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
791 | 736 | } | |
792 | 737 |
github/deemru/w8io/026f985 96.72 ms ◑