tx · ENGeASJMBfe4UoixCsc2kaPQqqVXNM3ELohMRqNDehRW 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02500000 Waves 2023.08.08 13:53 [2701527] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "ENGeASJMBfe4UoixCsc2kaPQqqVXNM3ELohMRqNDehRW", "fee": 2500000, "feeAssetId": null, "timestamp": 1691491989012, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "KscBD1vURGUJ6PTobNc6Ub5rFRZf7nskGHRNWNQcvUDQxPkQoduUtDkg2GSpPkVcXEhXhemNdNS2iz1DJMjv2hj" ], "script": "base64:BgK5LQgCEggKBggIAQEBCBIFCgMBCAISAwoBARIECgIICBIECgIICBIFCgMICAESAwoBCBIDCgEIEgQKAggBEgMKAQgSABIAEgUKAwgIBBIDCgEIEgMKAQgSBAoCCAgSBAoCCAgiA1NFUCIGU0NBTEU4IgVNVUxUOCIOUE9PTFdFSUdIVE1VTFQiEGNvbnRyYWN0RmlsZW5hbWUiB1NDQUxFMTgiBk1VTFQxOCIITVVMVDE4QkkiC2Jsb2Nrc0luRGF5Ig1ibG9ja3NJbk1vbnRoIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIg9nZXRTdHJpbmdPckZhaWwiB2FkZHJlc3MiA2tleSIMZ2V0SW50T3JaZXJvIg9nZXRJbnRPckRlZmF1bHQiCmRlZmF1bHRWYWwiDGdldEludE9yRmFpbCIDYWJzIgN2YWwiDmVuc3VyZVBvc2l0aXZlIgF2IgFtIhtrZXlSZWZlcnJhbHNDb250cmFjdEFkZHJlc3MiHnJlZmVycmFsc0NvbnRyYWN0QWRkcmVzc09yRmFpbCIWa2V5UmVmZXJyYWxQcm9ncmFtTmFtZSIacmVmZXJ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XF1YWwgdG8gaXRzZWxmLgJhTQEdZ2V0Vm90aW5nUmVzdWx0U3Rha2VkUkVBRE9OTFkBAmJFCQCUCgIFA25pbAkBAmNUAQUCYkUCYU0BJWdldFZvdGluZ1Jlc3VsdFN0YWtlZEludGVncmFsUkVBRE9OTFkBAmJFCQCUCgIFA25pbAkBAmNYAQUCYkUCYU0BHGdldFVzZXJWb3RlRmluYWxpemVkUkVBRE9OTFkCAmJFAmJNCQCUCgIFA25pbAkBAmNNAgUCYkUFAmJNAmFNASFnZXRVc2VyVm90ZVN0YWtlZEludGVncmFsUkVBRE9OTFkCAmJFAmJNCQCUCgIFA25pbAkBAmRoAgUCYkUFAmJNAQJlVgECZVcABAJlWAQCYUgJAQJhSgADCQABAgUCYUgCCkJ5dGVWZWN0b3IEAmFPBQJhSAUCYU8DCQABAgUCYUgCBFVuaXQIBQJlVg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCZVYJYm9keUJ5dGVzCQCRAwIIBQJlVgZwcm9vZnMAAAUCZVjXhy4z", "height": 2701527, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CtB7rWUB8c6DCbxKVXZVmdVqGA3L82gYKRVVpJ7p1zR9 Next: 8RBfG2uJi94M48pCKJYYiCGC9TGUwvDGEB9Jup7AN1Ny Diff:
Old | New | Differences | |
---|---|---|---|
232 | 232 | ||
233 | 233 | let IdxLockWxClaimed = 6 | |
234 | 234 | ||
235 | - | func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), toBase58String(txId)], SEP) | |
235 | + | func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), match txId { | |
236 | + | case b: ByteVector => | |
237 | + | toBase58String(b) | |
238 | + | case _: Unit => | |
239 | + | "legacy" | |
240 | + | case _ => | |
241 | + | throw("Match error") | |
242 | + | }], SEP) | |
236 | 243 | ||
237 | 244 | ||
238 | 245 | func readLockParamsRecordOrFail (userAddress,txId) = split(getStringOrFail(this, keyLockParamsRecord(userAddress, txId)), SEP) | |
423 | 430 | ||
424 | 431 | ||
425 | 432 | func getVotingEmissionEpochInfo () = { | |
426 | - | let $ | |
433 | + | let $t01499515285 = { | |
427 | 434 | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi())) | |
428 | 435 | let lastFinalizedEpoch = (currentEpochUi - 1) | |
429 | 436 | if ((0 > lastFinalizedEpoch)) | |
430 | 437 | then throwErr("invalid epoch") | |
431 | 438 | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
432 | 439 | } | |
433 | - | let currentEpochUi = $ | |
434 | - | let lastFinalizedEpoch = $ | |
440 | + | let currentEpochUi = $t01499515285._1 | |
441 | + | let lastFinalizedEpoch = $t01499515285._2 | |
435 | 442 | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
436 | 443 | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
437 | 444 | } | |
464 | 471 | ||
465 | 472 | func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = { | |
466 | 473 | let userAddress = addressFromStringValue(userAddressStr) | |
467 | - | let $ | |
468 | - | let lastFinalizedEpoch = $ | |
469 | - | let currentEpochStartHeight = $ | |
470 | - | let $ | |
471 | - | let amountAssetId = $ | |
472 | - | let priceAssetId = $ | |
474 | + | let $t01597616056 = getVotingEmissionEpochInfo() | |
475 | + | let lastFinalizedEpoch = $t01597616056._1 | |
476 | + | let currentEpochStartHeight = $t01597616056._2 | |
477 | + | let $t01605916134 = getPoolAssetsByLpAssetId(lpAssetIdStr) | |
478 | + | let amountAssetId = $t01605916134._1 | |
479 | + | let priceAssetId = $t01605916134._2 | |
473 | 480 | let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch) | |
474 | 481 | let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0) | |
475 | 482 | userVote | |
486 | 493 | ||
487 | 494 | ||
488 | 495 | func getVotingResultStaked (lpAssetIdStr) = { | |
489 | - | let $ | |
490 | - | let lastFinalizedEpoch = $ | |
491 | - | let currentEpochStartHeight = $ | |
496 | + | let $t01667816758 = getVotingEmissionEpochInfo() | |
497 | + | let lastFinalizedEpoch = $t01667816758._1 | |
498 | + | let currentEpochStartHeight = $t01667816758._2 | |
492 | 499 | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
493 | 500 | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
494 | 501 | votingResultStaked | |
496 | 503 | ||
497 | 504 | ||
498 | 505 | func getVotingResultStakedIntegral (lpAssetIdStr) = { | |
499 | - | let $ | |
500 | - | let lastFinalizedEpoch = $ | |
501 | - | let currentEpochStartHeight = $ | |
506 | + | let $t01712017200 = getVotingEmissionEpochInfo() | |
507 | + | let lastFinalizedEpoch = $t01712017200._1 | |
508 | + | let currentEpochStartHeight = $t01712017200._2 | |
502 | 509 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
503 | 510 | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
504 | 511 | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight) | |
509 | 516 | ||
510 | 517 | ||
511 | 518 | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
512 | - | let $ | |
513 | - | let lastFinalizedEpoch = $ | |
514 | - | let currentEpochStartHeight = $ | |
519 | + | let $t01803718117 = getVotingEmissionEpochInfo() | |
520 | + | let lastFinalizedEpoch = $t01803718117._1 | |
521 | + | let currentEpochStartHeight = $t01803718117._2 | |
515 | 522 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
516 | 523 | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
517 | 524 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
520 | 527 | ||
521 | 528 | ||
522 | 529 | func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = { | |
523 | - | let $ | |
524 | - | let lastFinalizedEpoch = $ | |
525 | - | let currentEpochStartHeight = $ | |
530 | + | let $t01872818808 = getVotingEmissionEpochInfo() | |
531 | + | let lastFinalizedEpoch = $t01872818808._1 | |
532 | + | let currentEpochStartHeight = $t01872818808._2 | |
526 | 533 | let userAddress = addressFromStringValue(userAddressStr) | |
527 | 534 | let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr) | |
528 | 535 | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0) | |
534 | 541 | ||
535 | 542 | ||
536 | 543 | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
537 | - | let $ | |
538 | - | let lastFinalizedEpoch = $ | |
539 | - | let currentEpochStartHeight = $ | |
544 | + | let $t01959619676 = getVotingEmissionEpochInfo() | |
545 | + | let lastFinalizedEpoch = $t01959619676._1 | |
546 | + | let currentEpochStartHeight = $t01959619676._2 | |
540 | 547 | let userAddress = addressFromStringValue(userAddressStr) | |
541 | 548 | let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
542 | 549 | let actions = if ((userVoteFinalized == 0)) | |
555 | 562 | ||
556 | 563 | ||
557 | 564 | func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = { | |
558 | - | let $ | |
559 | - | let lastFinalizedEpoch = $ | |
560 | - | let currentEpochStartHeight = $ | |
565 | + | let $t02053020610 = getVotingEmissionEpochInfo() | |
566 | + | let lastFinalizedEpoch = $t02053020610._1 | |
567 | + | let currentEpochStartHeight = $t02053020610._2 | |
561 | 568 | let userAddress = addressFromStringValue(userAddressStr) | |
562 | 569 | let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
563 | 570 | let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0) | |
616 | 623 | if ((0 > userBoostEmissionIntegral)) | |
617 | 624 | then throwErr("wrong calculations") | |
618 | 625 | else { | |
619 | - | let $ | |
620 | - | let stakedVotesIntegralsActions = $ | |
621 | - | let userVoteIntegralDiff = $ | |
622 | - | let totalVotesIntegralDiff = $ | |
626 | + | let $t02415224291 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr) | |
627 | + | let stakedVotesIntegralsActions = $t02415224291._1 | |
628 | + | let userVoteIntegralDiff = $t02415224291._2 | |
629 | + | let totalVotesIntegralDiff = $t02415224291._3 | |
623 | 630 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
624 | 631 | let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0)) | |
625 | 632 | then 0 | |
702 | 709 | ||
703 | 710 | @Callable(i) | |
704 | 711 | func lockRef (duration,referrerAddress,signature) = { | |
705 | - | let $ | |
706 | - | let lockActionsResult = $ | |
707 | - | let gWxAmountStart = $ | |
712 | + | let $t02826828333 = lockActions(i, duration) | |
713 | + | let lockActionsResult = $t02826828333._1 | |
714 | + | let gWxAmountStart = $t02826828333._2 | |
708 | 715 | let referralAddress = toString(i.caller) | |
709 | 716 | let refInv = if (if ((referrerAddress == "")) | |
710 | 717 | then true | |
725 | 732 | ||
726 | 733 | @Callable(i) | |
727 | 734 | func lock (duration) = { | |
728 | - | let $ | |
729 | - | let lockActionsResult = $ | |
730 | - | let gWxAmountStart = $ | |
735 | + | let $t02879128856 = lockActions(i, duration) | |
736 | + | let lockActionsResult = $t02879128856._1 | |
737 | + | let gWxAmountStart = $t02879128856._2 | |
731 | 738 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
732 | 739 | if ((updateRefActivity == updateRefActivity)) | |
733 | 740 | then $Tuple2(lockActionsResult, unit) | |
740 | 747 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
741 | 748 | then throwErr("permissions denied") | |
742 | 749 | else { | |
743 | - | let $ | |
744 | - | let userBoostAvailable = $ | |
745 | - | let dataState = $ | |
746 | - | let debug = $ | |
750 | + | let $t02916629268 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
751 | + | let userBoostAvailable = $t02916629268._1 | |
752 | + | let dataState = $t02916629268._2 | |
753 | + | let debug = $t02916629268._3 | |
747 | 754 | $Tuple2(dataState, [userBoostAvailable]) | |
748 | 755 | } | |
749 | 756 | ||
751 | 758 | ||
752 | 759 | @Callable(i) | |
753 | 760 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
754 | - | let $ | |
755 | - | let userBoostAvailable = $ | |
756 | - | let dataState = $ | |
757 | - | let debug = $ | |
761 | + | let $t02940029501 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
762 | + | let userBoostAvailable = $t02940029501._1 | |
763 | + | let dataState = $t02940029501._2 | |
764 | + | let debug = $t02940029501._3 | |
758 | 765 | $Tuple2(nil, [userBoostAvailable, debug]) | |
759 | 766 | } | |
760 | 767 | ||
764 | 771 | func unlock (userAddressStr,txIdStr,amount) = { | |
765 | 772 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
766 | 773 | let txId = fromBase58String(txIdStr) | |
767 | - | let userRecordArray = readLockParamsRecordOrFail(userAddress, txId) | |
774 | + | let userRecordArray = readLockParamsRecordOrFail(userAddress, if ((txIdStr == "")) | |
775 | + | then txId | |
776 | + | else unit) | |
768 | 777 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
769 | 778 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
770 | 779 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let SCALE8 = 8 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let POOLWEIGHTMULT = MULT8 | |
11 | 11 | ||
12 | 12 | let contractFilename = "boosting.ride" | |
13 | 13 | ||
14 | 14 | let SCALE18 = 18 | |
15 | 15 | ||
16 | 16 | let MULT18 = 1000000000000000000 | |
17 | 17 | ||
18 | 18 | let MULT18BI = toBigInt(MULT18) | |
19 | 19 | ||
20 | 20 | let blocksInDay = 1440 | |
21 | 21 | ||
22 | 22 | let blocksInMonth = 43800 | |
23 | 23 | ||
24 | 24 | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func throwErr (msg) = throw(wrapErr(msg)) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func abs (val) = if ((0 > val)) | |
43 | 43 | then -(val) | |
44 | 44 | else val | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func ensurePositive (v,m) = if ((v >= 0)) | |
48 | 48 | then v | |
49 | 49 | else throwErr((valueOrElse(m, "value") + " should be positive")) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(this, keyReferralsContractAddress())) | |
56 | 56 | ||
57 | 57 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
58 | 58 | ||
59 | 59 | let referralProgramNameDefault = "wxlock" | |
60 | 60 | ||
61 | 61 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
62 | 62 | ||
63 | 63 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | let IdxFactoryCfgStakingDapp = 1 | |
67 | 67 | ||
68 | 68 | let IdxFactoryCfgBoostingDapp = 2 | |
69 | 69 | ||
70 | 70 | let IdxFactoryCfgIdoDapp = 3 | |
71 | 71 | ||
72 | 72 | let IdxFactoryCfgTeamDapp = 4 | |
73 | 73 | ||
74 | 74 | let IdxFactoryCfgEmissionDapp = 5 | |
75 | 75 | ||
76 | 76 | let IdxFactoryCfgRestDapp = 6 | |
77 | 77 | ||
78 | 78 | let IdxFactoryCfgSlippageDapp = 7 | |
79 | 79 | ||
80 | 80 | let IdxFactoryCfgDaoDapp = 8 | |
81 | 81 | ||
82 | 82 | let IdxFactoryCfgMarketingDapp = 9 | |
83 | 83 | ||
84 | 84 | let IdxFactoryCfgGwxRewardDapp = 10 | |
85 | 85 | ||
86 | 86 | let IdxFactoryCfgBirdsDapp = 11 | |
87 | 87 | ||
88 | 88 | func keyFactoryCfg () = "%s__factoryConfig" | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func keyBoostingV2LastUpdateHeight () = "%s%s__boostingV2__startBlock" | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keyBoostingV2Integral () = "%s%s__boostingV2__integral" | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func keyNextPergetIntOrDefault () = "%s__nextPeriod" | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | let IdxCfgAssetId = 1 | |
152 | 152 | ||
153 | 153 | let IdxCfgMinLockAmount = 2 | |
154 | 154 | ||
155 | 155 | let IdxCfgMinLockDuration = 3 | |
156 | 156 | ||
157 | 157 | let IdxCfgMaxLockDuration = 4 | |
158 | 158 | ||
159 | 159 | let IdxCfgMathContract = 5 | |
160 | 160 | ||
161 | 161 | func keyConfig () = "%s__config" | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func readConfigArrayOrFail () = split(getStringOrFail(this, keyConfig()), SEP) | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | let cfgArray = readConfigArrayOrFail() | |
168 | 168 | ||
169 | 169 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
170 | 170 | ||
171 | 171 | let minLockAmount = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockAmount]), wrapErr("invalid min lock amount")) | |
172 | 172 | ||
173 | 173 | let minLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockDuration]), wrapErr("invalid min lock duration")) | |
174 | 174 | ||
175 | 175 | let maxLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMaxLockDuration]), wrapErr("invalid max lock duration")) | |
176 | 176 | ||
177 | 177 | let mathContract = valueOrErrorMessage(addressFromString(cfgArray[IdxCfgMathContract]), wrapErr("invalid math contract address")) | |
178 | 178 | ||
179 | 179 | func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d%s", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP) | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract) | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
186 | 186 | case s: String => | |
187 | 187 | addressFromStringValue(s) | |
188 | 188 | case _ => | |
189 | 189 | this | |
190 | 190 | } | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | func managerPublicKeyOrUnit () = { | |
194 | 194 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
195 | 195 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
196 | 196 | case s: String => | |
197 | 197 | fromBase58String(s) | |
198 | 198 | case _: Unit => | |
199 | 199 | unit | |
200 | 200 | case _ => | |
201 | 201 | throw("Match error") | |
202 | 202 | } | |
203 | 203 | } | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | func mustManager (i) = { | |
207 | 207 | let pd = throwErr("Permission denied") | |
208 | 208 | match managerPublicKeyOrUnit() { | |
209 | 209 | case pk: ByteVector => | |
210 | 210 | if ((i.callerPublicKey == pk)) | |
211 | 211 | then true | |
212 | 212 | else pd | |
213 | 213 | case _: Unit => | |
214 | 214 | if ((i.caller == this)) | |
215 | 215 | then true | |
216 | 216 | else pd | |
217 | 217 | case _ => | |
218 | 218 | throw("Match error") | |
219 | 219 | } | |
220 | 220 | } | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | let IdxLockAmount = 1 | |
224 | 224 | ||
225 | 225 | let IdxLockStart = 2 | |
226 | 226 | ||
227 | 227 | let IdxLockDuration = 3 | |
228 | 228 | ||
229 | 229 | let IdxLockLastUpdateTimestamp = 4 | |
230 | 230 | ||
231 | 231 | let IdxLockGwxAmount = 5 | |
232 | 232 | ||
233 | 233 | let IdxLockWxClaimed = 6 | |
234 | 234 | ||
235 | - | func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), toBase58String(txId)], SEP) | |
235 | + | func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), match txId { | |
236 | + | case b: ByteVector => | |
237 | + | toBase58String(b) | |
238 | + | case _: Unit => | |
239 | + | "legacy" | |
240 | + | case _ => | |
241 | + | throw("Match error") | |
242 | + | }], SEP) | |
236 | 243 | ||
237 | 244 | ||
238 | 245 | func readLockParamsRecordOrFail (userAddress,txId) = split(getStringOrFail(this, keyLockParamsRecord(userAddress, txId)), SEP) | |
239 | 246 | ||
240 | 247 | ||
241 | 248 | func keyUserGwxAmountTotal (userAddress) = makeString(["%s%s__gwxAmountTotal", toString(userAddress)], SEP) | |
242 | 249 | ||
243 | 250 | ||
244 | 251 | func formatLockParamsRecord (amount,start,duration,gwxAmount,wxClaimed) = makeString(["%d%d%d%d%d%d%d", toString(amount), toString(start), toString(duration), toString(lastBlock.timestamp), toString(gwxAmount), toString(wxClaimed)], SEP) | |
245 | 252 | ||
246 | 253 | ||
247 | 254 | func keyNextUserNum () = "%s__nextUserNum" | |
248 | 255 | ||
249 | 256 | ||
250 | 257 | func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP) | |
251 | 258 | ||
252 | 259 | ||
253 | 260 | func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP) | |
254 | 261 | ||
255 | 262 | ||
256 | 263 | func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked" | |
257 | 264 | ||
258 | 265 | ||
259 | 266 | func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks" | |
260 | 267 | ||
261 | 268 | ||
262 | 269 | func keyStatsLocksCount () = "%s%s__stats__locksCount" | |
263 | 270 | ||
264 | 271 | ||
265 | 272 | func keyStatsUsersCount () = "%s%s__stats__activeUsersCount" | |
266 | 273 | ||
267 | 274 | ||
268 | 275 | func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum)], SEP) | |
269 | 276 | ||
270 | 277 | ||
271 | 278 | func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum), lpAssetId], SEP) | |
272 | 279 | ||
273 | 280 | ||
274 | 281 | func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", toString(userNum)], SEP) | |
275 | 282 | ||
276 | 283 | ||
277 | 284 | func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total" | |
278 | 285 | ||
279 | 286 | ||
280 | 287 | func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", toString(userNum)], SEP) | |
281 | 288 | ||
282 | 289 | ||
283 | 290 | func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", toString(userNum)], SEP) | |
284 | 291 | ||
285 | 292 | ||
286 | 293 | func keyGwxTotal () = "%s%s__gwx__total" | |
287 | 294 | ||
288 | 295 | ||
289 | 296 | func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
290 | 297 | ||
291 | 298 | ||
292 | 299 | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP) | |
293 | 300 | ||
294 | 301 | ||
295 | 302 | func keyCurrentEpochUi () = makeString(["%s", "currentEpochUi"], SEP) | |
296 | 303 | ||
297 | 304 | ||
298 | 305 | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP) | |
299 | 306 | ||
300 | 307 | ||
301 | 308 | func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP) | |
302 | 309 | ||
303 | 310 | ||
304 | 311 | func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP) | |
305 | 312 | ||
306 | 313 | ||
307 | 314 | func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
308 | 315 | ||
309 | 316 | ||
310 | 317 | func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
311 | 318 | ||
312 | 319 | ||
313 | 320 | func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
314 | 321 | ||
315 | 322 | ||
316 | 323 | func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
317 | 324 | ||
318 | 325 | ||
319 | 326 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP) | |
320 | 327 | ||
321 | 328 | ||
322 | 329 | let factoryContract = readFactoryAddressOrFail() | |
323 | 330 | ||
324 | 331 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
325 | 332 | ||
326 | 333 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
327 | 334 | ||
328 | 335 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
329 | 336 | ||
330 | 337 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
331 | 338 | ||
332 | 339 | 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")) | |
333 | 340 | ||
334 | 341 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
335 | 342 | ||
336 | 343 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
337 | 344 | ||
338 | 345 | let keyVotingEmissionRateContract = makeString(["%s", "votingEmissionRateContract"], SEP) | |
339 | 346 | ||
340 | 347 | let boostCoeff = { | |
341 | 348 | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
342 | 349 | if ($isInstanceOf(@, "Int")) | |
343 | 350 | then @ | |
344 | 351 | else throw(($getType(@) + " couldn't be cast to Int")) | |
345 | 352 | } | |
346 | 353 | ||
347 | 354 | func userNumberByAddressOrFail (userAddress) = match getString(this, keyUser2NumMapping(toString(userAddress))) { | |
348 | 355 | case s: String => | |
349 | 356 | valueOrErrorMessage(parseInt(s), wrapErr("invalid user number")) | |
350 | 357 | case _: Unit => | |
351 | 358 | throwErr("invalid user") | |
352 | 359 | case _ => | |
353 | 360 | throw("Match error") | |
354 | 361 | } | |
355 | 362 | ||
356 | 363 | ||
357 | 364 | func getGwxAmountTotal () = valueOrElse(getInteger(this, keyGwxTotal()), 0) | |
358 | 365 | ||
359 | 366 | ||
360 | 367 | func getLockedGwxAmount (userAddress) = { | |
361 | 368 | let functionName = "getLockedGwxAmount" | |
362 | 369 | let votingEmissionRateContract = valueOrErrorMessage( match getString(votingEmissionContract, keyVotingEmissionRateContract) { | |
363 | 370 | case _: Unit => | |
364 | 371 | unit | |
365 | 372 | case s: String => | |
366 | 373 | addressFromString(s) | |
367 | 374 | case _ => | |
368 | 375 | throw("Match error") | |
369 | 376 | }, wrapErr("invalid voting emission rate address")) | |
370 | 377 | let lockedVotingEmissionRate = { | |
371 | 378 | let @ = invoke(votingEmissionContract, functionName, [toString(userAddress)], nil) | |
372 | 379 | if ($isInstanceOf(@, "Int")) | |
373 | 380 | then @ | |
374 | 381 | else throw(($getType(@) + " couldn't be cast to Int")) | |
375 | 382 | } | |
376 | 383 | let lockedVotingEmission = { | |
377 | 384 | let @ = invoke(votingEmissionRateContract, functionName, [toString(userAddress)], nil) | |
378 | 385 | if ($isInstanceOf(@, "Int")) | |
379 | 386 | then @ | |
380 | 387 | else throw(($getType(@) + " couldn't be cast to Int")) | |
381 | 388 | } | |
382 | 389 | let locked = max([lockedVotingEmissionRate, lockedVotingEmission]) | |
383 | 390 | locked | |
384 | 391 | } | |
385 | 392 | ||
386 | 393 | ||
387 | 394 | func HistoryEntry (type,user,amount,lockStart,duration,gwxAmount,i) = { | |
388 | 395 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
389 | 396 | let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(gwxAmount)], SEP) | |
390 | 397 | StringEntry(historyKEY, historyDATA) | |
391 | 398 | } | |
392 | 399 | ||
393 | 400 | ||
394 | 401 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
395 | 402 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
396 | 403 | let locksCountKEY = keyStatsLocksCount() | |
397 | 404 | let usersCountKEY = keyStatsUsersCount() | |
398 | 405 | let totalAmountKEY = keyLockParamTotalAmount() | |
399 | 406 | let locksDurationSumInBlocks = getIntOrZero(this, locksDurationSumInBlocksKEY) | |
400 | 407 | let locksCount = getIntOrZero(this, locksCountKEY) | |
401 | 408 | let usersCount = getIntOrZero(this, usersCountKEY) | |
402 | 409 | let totalAmount = getIntOrZero(this, totalAmountKEY) | |
403 | 410 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
404 | 411 | } | |
405 | 412 | ||
406 | 413 | ||
407 | 414 | func LockParamsEntry (userAddress,txId,amount,start,duration,gwxAmount,wxClaimed) = [StringEntry(keyLockParamsRecord(userAddress, txId), formatLockParamsRecord(amount, start, duration, gwxAmount, wxClaimed))] | |
408 | 415 | ||
409 | 416 | ||
410 | 417 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
411 | 418 | then throwErr("only one payment is allowed") | |
412 | 419 | else if ((size(i.payments) == 0)) | |
413 | 420 | then 0 | |
414 | 421 | else { | |
415 | 422 | let pmt = i.payments[0] | |
416 | 423 | if ((value(pmt.assetId) != expectedAssetId)) | |
417 | 424 | then throwErr("invalid asset id in payment") | |
418 | 425 | else pmt.amount | |
419 | 426 | } | |
420 | 427 | ||
421 | 428 | ||
422 | 429 | func getUserGwxAmountTotal (userAddress) = valueOrElse(getInteger(this, keyUserGwxAmountTotal(userAddress)), 0) | |
423 | 430 | ||
424 | 431 | ||
425 | 432 | func getVotingEmissionEpochInfo () = { | |
426 | - | let $ | |
433 | + | let $t01499515285 = { | |
427 | 434 | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi())) | |
428 | 435 | let lastFinalizedEpoch = (currentEpochUi - 1) | |
429 | 436 | if ((0 > lastFinalizedEpoch)) | |
430 | 437 | then throwErr("invalid epoch") | |
431 | 438 | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
432 | 439 | } | |
433 | - | let currentEpochUi = $ | |
434 | - | let lastFinalizedEpoch = $ | |
440 | + | let currentEpochUi = $t01499515285._1 | |
441 | + | let lastFinalizedEpoch = $t01499515285._2 | |
435 | 442 | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
436 | 443 | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
437 | 444 | } | |
438 | 445 | ||
439 | 446 | ||
440 | 447 | func getPoolAssetsByLpAssetId (lpAssetIdStr) = { | |
441 | 448 | let idxAmountAssetId = 4 | |
442 | 449 | let idxPriceAssetId = 5 | |
443 | 450 | let poolCfg = { | |
444 | 451 | let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil) | |
445 | 452 | if ($isInstanceOf(@, "List[Any]")) | |
446 | 453 | then @ | |
447 | 454 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
448 | 455 | } | |
449 | 456 | let amountAssetId = { | |
450 | 457 | let @ = poolCfg[idxAmountAssetId] | |
451 | 458 | if ($isInstanceOf(@, "String")) | |
452 | 459 | then @ | |
453 | 460 | else throw(($getType(@) + " couldn't be cast to String")) | |
454 | 461 | } | |
455 | 462 | let priceAssetId = { | |
456 | 463 | let @ = poolCfg[idxPriceAssetId] | |
457 | 464 | if ($isInstanceOf(@, "String")) | |
458 | 465 | then @ | |
459 | 466 | else throw(($getType(@) + " couldn't be cast to String")) | |
460 | 467 | } | |
461 | 468 | $Tuple2(amountAssetId, priceAssetId) | |
462 | 469 | } | |
463 | 470 | ||
464 | 471 | ||
465 | 472 | func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = { | |
466 | 473 | let userAddress = addressFromStringValue(userAddressStr) | |
467 | - | let $ | |
468 | - | let lastFinalizedEpoch = $ | |
469 | - | let currentEpochStartHeight = $ | |
470 | - | let $ | |
471 | - | let amountAssetId = $ | |
472 | - | let priceAssetId = $ | |
474 | + | let $t01597616056 = getVotingEmissionEpochInfo() | |
475 | + | let lastFinalizedEpoch = $t01597616056._1 | |
476 | + | let currentEpochStartHeight = $t01597616056._2 | |
477 | + | let $t01605916134 = getPoolAssetsByLpAssetId(lpAssetIdStr) | |
478 | + | let amountAssetId = $t01605916134._1 | |
479 | + | let priceAssetId = $t01605916134._2 | |
473 | 480 | let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch) | |
474 | 481 | let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0) | |
475 | 482 | userVote | |
476 | 483 | } | |
477 | 484 | ||
478 | 485 | ||
479 | 486 | func getUserVoteStaked (lpAssetIdStr,userAddressStr) = { | |
480 | 487 | let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
481 | 488 | let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
482 | 489 | if ((stakedByUser == 0)) | |
483 | 490 | then 0 | |
484 | 491 | else userVote | |
485 | 492 | } | |
486 | 493 | ||
487 | 494 | ||
488 | 495 | func getVotingResultStaked (lpAssetIdStr) = { | |
489 | - | let $ | |
490 | - | let lastFinalizedEpoch = $ | |
491 | - | let currentEpochStartHeight = $ | |
496 | + | let $t01667816758 = getVotingEmissionEpochInfo() | |
497 | + | let lastFinalizedEpoch = $t01667816758._1 | |
498 | + | let currentEpochStartHeight = $t01667816758._2 | |
492 | 499 | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
493 | 500 | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
494 | 501 | votingResultStaked | |
495 | 502 | } | |
496 | 503 | ||
497 | 504 | ||
498 | 505 | func getVotingResultStakedIntegral (lpAssetIdStr) = { | |
499 | - | let $ | |
500 | - | let lastFinalizedEpoch = $ | |
501 | - | let currentEpochStartHeight = $ | |
506 | + | let $t01712017200 = getVotingEmissionEpochInfo() | |
507 | + | let lastFinalizedEpoch = $t01712017200._1 | |
508 | + | let currentEpochStartHeight = $t01712017200._2 | |
502 | 509 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
503 | 510 | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
504 | 511 | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight) | |
505 | 512 | let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight) | |
506 | 513 | let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev) | |
507 | 514 | votingResultStakedIntegral | |
508 | 515 | } | |
509 | 516 | ||
510 | 517 | ||
511 | 518 | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
512 | - | let $ | |
513 | - | let lastFinalizedEpoch = $ | |
514 | - | let currentEpochStartHeight = $ | |
519 | + | let $t01803718117 = getVotingEmissionEpochInfo() | |
520 | + | let lastFinalizedEpoch = $t01803718117._1 | |
521 | + | let currentEpochStartHeight = $t01803718117._2 | |
515 | 522 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
516 | 523 | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
517 | 524 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
518 | 525 | [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch), height), IntegerEntry(keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedIntegral)] | |
519 | 526 | } | |
520 | 527 | ||
521 | 528 | ||
522 | 529 | func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = { | |
523 | - | let $ | |
524 | - | let lastFinalizedEpoch = $ | |
525 | - | let currentEpochStartHeight = $ | |
530 | + | let $t01872818808 = getVotingEmissionEpochInfo() | |
531 | + | let lastFinalizedEpoch = $t01872818808._1 | |
532 | + | let currentEpochStartHeight = $t01872818808._2 | |
526 | 533 | let userAddress = addressFromStringValue(userAddressStr) | |
527 | 534 | let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr) | |
528 | 535 | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0) | |
529 | 536 | let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight) | |
530 | 537 | let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight) | |
531 | 538 | let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev) | |
532 | 539 | userVoteStakedIntegral | |
533 | 540 | } | |
534 | 541 | ||
535 | 542 | ||
536 | 543 | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
537 | - | let $ | |
538 | - | let lastFinalizedEpoch = $ | |
539 | - | let currentEpochStartHeight = $ | |
544 | + | let $t01959619676 = getVotingEmissionEpochInfo() | |
545 | + | let lastFinalizedEpoch = $t01959619676._1 | |
546 | + | let currentEpochStartHeight = $t01959619676._2 | |
540 | 547 | let userAddress = addressFromStringValue(userAddressStr) | |
541 | 548 | let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
542 | 549 | let actions = if ((userVoteFinalized == 0)) | |
543 | 550 | then nil | |
544 | 551 | else { | |
545 | 552 | let stakedVoteDelta = if (edge) | |
546 | 553 | then userVoteFinalized | |
547 | 554 | else -(userVoteFinalized) | |
548 | 555 | let votingResultActions = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta) | |
549 | 556 | let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr) | |
550 | 557 | let voteActions = [IntegerEntry(keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch), height), IntegerEntry(keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch), userVoteStakedIntegral)] | |
551 | 558 | (votingResultActions ++ voteActions) | |
552 | 559 | } | |
553 | 560 | actions | |
554 | 561 | } | |
555 | 562 | ||
556 | 563 | ||
557 | 564 | func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = { | |
558 | - | let $ | |
559 | - | let lastFinalizedEpoch = $ | |
560 | - | let currentEpochStartHeight = $ | |
565 | + | let $t02053020610 = getVotingEmissionEpochInfo() | |
566 | + | let lastFinalizedEpoch = $t02053020610._1 | |
567 | + | let currentEpochStartHeight = $t02053020610._2 | |
561 | 568 | let userAddress = addressFromStringValue(userAddressStr) | |
562 | 569 | let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
563 | 570 | let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0) | |
564 | 571 | let votingResultStakedIntegralLastKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
565 | 572 | let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralLastKey), 0) | |
566 | 573 | let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr) | |
567 | 574 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
568 | 575 | let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast) | |
569 | 576 | let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast) | |
570 | 577 | $Tuple3([IntegerEntry(userVoteStakedIntegralLastKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralLastKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff) | |
571 | 578 | } | |
572 | 579 | ||
573 | 580 | ||
574 | 581 | func refreshBoostEmissionIntegral () = { | |
575 | 582 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
576 | 583 | let boostingV2LastUpdateHeightOption = getInteger(this, keyBoostingV2LastUpdateHeight()) | |
577 | 584 | let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral()) | |
578 | 585 | let emissionEnd = getIntOrFail(emissionContract, keyEmissionEndBlock()) | |
579 | 586 | let h = if ((height > emissionEnd)) | |
580 | 587 | then emissionEnd | |
581 | 588 | else height | |
582 | 589 | let dh = match boostingV2LastUpdateHeightOption { | |
583 | 590 | case lastUpdateHeight: Int => | |
584 | 591 | max([(h - lastUpdateHeight), 0]) | |
585 | 592 | case _: Unit => | |
586 | 593 | 0 | |
587 | 594 | case _ => | |
588 | 595 | throw("Match error") | |
589 | 596 | } | |
590 | 597 | let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff) | |
591 | 598 | let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0) | |
592 | 599 | let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev) | |
593 | 600 | $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral) | |
594 | 601 | } | |
595 | 602 | ||
596 | 603 | ||
597 | 604 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
598 | 605 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
599 | 606 | let userNum = userNumberByAddressOrFail(userAddress) | |
600 | 607 | if ((userNum == userNum)) | |
601 | 608 | then { | |
602 | 609 | let EMPTYSTR = "empty" | |
603 | 610 | let poolWeight = if ((lpAssetIdStr != EMPTYSTR)) | |
604 | 611 | then { | |
605 | 612 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
606 | 613 | getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
607 | 614 | } | |
608 | 615 | else if (readOnly) | |
609 | 616 | then 0 | |
610 | 617 | else throwErr(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
611 | 618 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNum, lpAssetIdStr) | |
612 | 619 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
613 | 620 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), getIntOrZero(this, userBoostEmissionLastIntegralKEY)) | |
614 | 621 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
615 | 622 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
616 | 623 | if ((0 > userBoostEmissionIntegral)) | |
617 | 624 | then throwErr("wrong calculations") | |
618 | 625 | else { | |
619 | - | let $ | |
620 | - | let stakedVotesIntegralsActions = $ | |
621 | - | let userVoteIntegralDiff = $ | |
622 | - | let totalVotesIntegralDiff = $ | |
626 | + | let $t02415224291 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr) | |
627 | + | let stakedVotesIntegralsActions = $t02415224291._1 | |
628 | + | let userVoteIntegralDiff = $t02415224291._2 | |
629 | + | let totalVotesIntegralDiff = $t02415224291._3 | |
623 | 630 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
624 | 631 | let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0)) | |
625 | 632 | then 0 | |
626 | 633 | else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff) | |
627 | 634 | let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions) | |
628 | 635 | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":") | |
629 | 636 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
630 | 637 | } | |
631 | 638 | } | |
632 | 639 | else throw("Strict value is not equal to itself.") | |
633 | 640 | } | |
634 | 641 | ||
635 | 642 | ||
636 | 643 | func lockActions (i,durationMonths) = { | |
637 | 644 | let durationMonthsAllowed = [1, 3, 6, 12, 24, 48] | |
638 | 645 | if (!(containsElement(durationMonthsAllowed, durationMonths))) | |
639 | 646 | then throwErr("invalid duration") | |
640 | 647 | else { | |
641 | 648 | let duration = (durationMonths * blocksInMonth) | |
642 | 649 | let assetIdStr = toBase58String(assetId) | |
643 | 650 | if ((size(i.payments) != 1)) | |
644 | 651 | then throwErr("invalid payment - exact one payment must be attached") | |
645 | 652 | else { | |
646 | 653 | let pmt = i.payments[0] | |
647 | 654 | let pmtAmount = pmt.amount | |
648 | 655 | if ((assetId != value(pmt.assetId))) | |
649 | 656 | then throwErr((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
650 | 657 | else { | |
651 | 658 | let nextUserNumKEY = keyNextUserNum() | |
652 | 659 | let userAddress = i.caller | |
653 | 660 | let userAddressStr = toString(userAddress) | |
654 | 661 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
655 | 662 | let userNumStr = if (userIsExisting) | |
656 | 663 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
657 | 664 | else toString(getIntOrFail(this, nextUserNumKEY)) | |
658 | 665 | let userNum = parseIntValue(userNumStr) | |
659 | 666 | let lockStart = height | |
660 | 667 | if (if ((minLockAmount > pmtAmount)) | |
661 | 668 | then (userAddress != lpStakingPoolsContract) | |
662 | 669 | else false) | |
663 | 670 | then throwErr(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
664 | 671 | else if ((minLockDuration > duration)) | |
665 | 672 | then throwErr(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
666 | 673 | else if ((duration > maxLockDuration)) | |
667 | 674 | then throwErr(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
668 | 675 | else { | |
669 | 676 | let coeffX8 = fraction(duration, MULT8, maxLockDuration) | |
670 | 677 | let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8) | |
671 | 678 | let gwxAmountTotal = getGwxAmountTotal() | |
672 | 679 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
673 | 680 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
674 | 681 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
675 | 682 | let gwxRewardInv = invoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil) | |
676 | 683 | if ((gwxRewardInv == gwxRewardInv)) | |
677 | 684 | then { | |
678 | 685 | let arr = if (userIsExisting) | |
679 | 686 | then nil | |
680 | 687 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
681 | 688 | $Tuple2(((((arr ++ LockParamsEntry(userAddress, i.transactionId, pmtAmount, lockStart, duration, gWxAmountStart, 0)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
682 | 689 | then 0 | |
683 | 690 | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, gWxAmountStart, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyGwxTotal(), (gwxAmountTotal + gWxAmountStart)), IntegerEntry(keyUserGwxAmountTotal(userAddress), (userGwxAmountTotal + gWxAmountStart))]), gWxAmountStart) | |
684 | 691 | } | |
685 | 692 | else throw("Strict value is not equal to itself.") | |
686 | 693 | } | |
687 | 694 | } | |
688 | 695 | } | |
689 | 696 | } | |
690 | 697 | } | |
691 | 698 | ||
692 | 699 | ||
693 | 700 | @Callable(i) | |
694 | 701 | func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = { | |
695 | 702 | let checkCaller = mustManager(i) | |
696 | 703 | if ((checkCaller == checkCaller)) | |
697 | 704 | then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0)) | |
698 | 705 | else throw("Strict value is not equal to itself.") | |
699 | 706 | } | |
700 | 707 | ||
701 | 708 | ||
702 | 709 | ||
703 | 710 | @Callable(i) | |
704 | 711 | func lockRef (duration,referrerAddress,signature) = { | |
705 | - | let $ | |
706 | - | let lockActionsResult = $ | |
707 | - | let gWxAmountStart = $ | |
712 | + | let $t02826828333 = lockActions(i, duration) | |
713 | + | let lockActionsResult = $t02826828333._1 | |
714 | + | let gWxAmountStart = $t02826828333._2 | |
708 | 715 | let referralAddress = toString(i.caller) | |
709 | 716 | let refInv = if (if ((referrerAddress == "")) | |
710 | 717 | then true | |
711 | 718 | else (signature == base58'')) | |
712 | 719 | then unit | |
713 | 720 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
714 | 721 | if ((refInv == refInv)) | |
715 | 722 | then { | |
716 | 723 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
717 | 724 | if ((updateRefActivity == updateRefActivity)) | |
718 | 725 | then $Tuple2(lockActionsResult, unit) | |
719 | 726 | else throw("Strict value is not equal to itself.") | |
720 | 727 | } | |
721 | 728 | else throw("Strict value is not equal to itself.") | |
722 | 729 | } | |
723 | 730 | ||
724 | 731 | ||
725 | 732 | ||
726 | 733 | @Callable(i) | |
727 | 734 | func lock (duration) = { | |
728 | - | let $ | |
729 | - | let lockActionsResult = $ | |
730 | - | let gWxAmountStart = $ | |
735 | + | let $t02879128856 = lockActions(i, duration) | |
736 | + | let lockActionsResult = $t02879128856._1 | |
737 | + | let gWxAmountStart = $t02879128856._2 | |
731 | 738 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
732 | 739 | if ((updateRefActivity == updateRefActivity)) | |
733 | 740 | then $Tuple2(lockActionsResult, unit) | |
734 | 741 | else throw("Strict value is not equal to itself.") | |
735 | 742 | } | |
736 | 743 | ||
737 | 744 | ||
738 | 745 | ||
739 | 746 | @Callable(i) | |
740 | 747 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
741 | 748 | then throwErr("permissions denied") | |
742 | 749 | else { | |
743 | - | let $ | |
744 | - | let userBoostAvailable = $ | |
745 | - | let dataState = $ | |
746 | - | let debug = $ | |
750 | + | let $t02916629268 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
751 | + | let userBoostAvailable = $t02916629268._1 | |
752 | + | let dataState = $t02916629268._2 | |
753 | + | let debug = $t02916629268._3 | |
747 | 754 | $Tuple2(dataState, [userBoostAvailable]) | |
748 | 755 | } | |
749 | 756 | ||
750 | 757 | ||
751 | 758 | ||
752 | 759 | @Callable(i) | |
753 | 760 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
754 | - | let $ | |
755 | - | let userBoostAvailable = $ | |
756 | - | let dataState = $ | |
757 | - | let debug = $ | |
761 | + | let $t02940029501 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
762 | + | let userBoostAvailable = $t02940029501._1 | |
763 | + | let dataState = $t02940029501._2 | |
764 | + | let debug = $t02940029501._3 | |
758 | 765 | $Tuple2(nil, [userBoostAvailable, debug]) | |
759 | 766 | } | |
760 | 767 | ||
761 | 768 | ||
762 | 769 | ||
763 | 770 | @Callable(i) | |
764 | 771 | func unlock (userAddressStr,txIdStr,amount) = { | |
765 | 772 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
766 | 773 | let txId = fromBase58String(txIdStr) | |
767 | - | let userRecordArray = readLockParamsRecordOrFail(userAddress, txId) | |
774 | + | let userRecordArray = readLockParamsRecordOrFail(userAddress, if ((txIdStr == "")) | |
775 | + | then txId | |
776 | + | else unit) | |
768 | 777 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
769 | 778 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
770 | 779 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
771 | 780 | let lockEnd = (lockStart + lockDuration) | |
772 | 781 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
773 | 782 | let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount]) | |
774 | 783 | let t = ((height - lockStart) / blocksInDay) | |
775 | 784 | let exponent = fraction(toBigInt(t), (toBigInt((8 * blocksInDay)) * MULT18BI), toBigInt(lockDuration)) | |
776 | 785 | let wxWithdrawable = if ((height > lockEnd)) | |
777 | 786 | then (userAmount - wxClaimed) | |
778 | 787 | else toInt(fraction(toBigInt(userAmount), (MULT18BI - pow(toBigInt(5), 1, exponent, SCALE18, SCALE18, DOWN)), MULT18BI)) | |
779 | 788 | if ((amount > wxWithdrawable)) | |
780 | 789 | then throwErr(("maximum amount to unlock: " + toString(wxWithdrawable))) | |
781 | 790 | else { | |
782 | 791 | let gwxBurned = max([amount, fraction((t * blocksInDay), userAmount, maxLockDuration)]) | |
783 | 792 | let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining") | |
784 | 793 | let lockedGwxAmount = getLockedGwxAmount(userAddress) | |
785 | 794 | if ((lockedGwxAmount > gwxRemaining)) | |
786 | 795 | then throwErr(("locked gwx amount: " + toString(lockedGwxAmount))) | |
787 | 796 | else if ((0 >= userAmount)) | |
788 | 797 | then throwErr("nothing to unlock") | |
789 | 798 | else { | |
790 | 799 | let gwxAmountTotal = getGwxAmountTotal() | |
791 | 800 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
792 | 801 | let gwxRewardInv = invoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil) | |
793 | 802 | if ((gwxRewardInv == gwxRewardInv)) | |
794 | 803 | then ((((LockParamsEntry(userAddress, txId, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + amount)) ++ StatsEntry(-(userAmount), 0, 0, -1)) :+ HistoryEntry("unlock", userAddressStr, userAmount, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, userAmount, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotal"))]) | |
795 | 804 | else throw("Strict value is not equal to itself.") | |
796 | 805 | } | |
797 | 806 | } | |
798 | 807 | } | |
799 | 808 | ||
800 | 809 | ||
801 | 810 | ||
802 | 811 | @Callable(i) | |
803 | 812 | func gwxUserInfoREADONLY (userAddressStr) = { | |
804 | 813 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
805 | 814 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
806 | 815 | $Tuple2(nil, [gwxAmount]) | |
807 | 816 | } | |
808 | 817 | ||
809 | 818 | ||
810 | 819 | ||
811 | 820 | @Callable(i) | |
812 | 821 | func userMaxDurationREADONLY (userAddressStr) = $Tuple2(nil, $Tuple2("increaseLock", maxLockDuration)) | |
813 | 822 | ||
814 | 823 | ||
815 | 824 | ||
816 | 825 | @Callable(i) | |
817 | 826 | func getUserGwxAmountAtHeightREADONLY (userAddressStr,targetHeight) = { | |
818 | 827 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
819 | 828 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
820 | 829 | $Tuple2(nil, gwxAmount) | |
821 | 830 | } | |
822 | 831 | ||
823 | 832 | ||
824 | 833 | ||
825 | 834 | @Callable(i) | |
826 | 835 | func getUserGwxAmount (userAddressStr) = { | |
827 | 836 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
828 | 837 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
829 | 838 | $Tuple2(nil, gwxAmount) | |
830 | 839 | } | |
831 | 840 | ||
832 | 841 | ||
833 | 842 | ||
834 | 843 | @Callable(i) | |
835 | 844 | func getGwxTotalREADONLY () = $Tuple2(nil, getGwxAmountTotal()) | |
836 | 845 | ||
837 | 846 | ||
838 | 847 | ||
839 | 848 | @Callable(i) | |
840 | 849 | func onBoostEmissionUpdate () = { | |
841 | 850 | let checkCaller = if ((i.caller == emissionContract)) | |
842 | 851 | then true | |
843 | 852 | else mustManager(i) | |
844 | 853 | if ((checkCaller == checkCaller)) | |
845 | 854 | then refreshBoostEmissionIntegral() | |
846 | 855 | else throw("Strict value is not equal to itself.") | |
847 | 856 | } | |
848 | 857 | ||
849 | 858 | ||
850 | 859 | ||
851 | 860 | @Callable(i) | |
852 | 861 | func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = { | |
853 | 862 | let checkCaller = if ((i.caller == stakingContract)) | |
854 | 863 | then true | |
855 | 864 | else mustManager(i) | |
856 | 865 | if ((checkCaller == checkCaller)) | |
857 | 866 | then { | |
858 | 867 | let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge) | |
859 | 868 | $Tuple2(actions, unit) | |
860 | 869 | } | |
861 | 870 | else throw("Strict value is not equal to itself.") | |
862 | 871 | } | |
863 | 872 | ||
864 | 873 | ||
865 | 874 | ||
866 | 875 | @Callable(i) | |
867 | 876 | func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr)) | |
868 | 877 | ||
869 | 878 | ||
870 | 879 | ||
871 | 880 | @Callable(i) | |
872 | 881 | func getVotingResultStakedIntegralREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStakedIntegral(lpAssetIdStr)) | |
873 | 882 | ||
874 | 883 | ||
875 | 884 | ||
876 | 885 | @Callable(i) | |
877 | 886 | func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr)) | |
878 | 887 | ||
879 | 888 | ||
880 | 889 | ||
881 | 890 | @Callable(i) | |
882 | 891 | func getUserVoteStakedIntegralREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)) | |
883 | 892 | ||
884 | 893 | ||
885 | 894 | @Verifier(tx) | |
886 | 895 | func verify () = { | |
887 | 896 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
888 | 897 | case pk: ByteVector => | |
889 | 898 | pk | |
890 | 899 | case _: Unit => | |
891 | 900 | tx.senderPublicKey | |
892 | 901 | case _ => | |
893 | 902 | throw("Match error") | |
894 | 903 | } | |
895 | 904 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
896 | 905 | } | |
897 | 906 |
github/deemru/w8io/169f3d6 112.01 ms ◑