tx · 9nADWe8u2wXQ4GtPDijPpNWMpf89X1wkAox3R9brWmHt 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02700000 Waves 2023.03.14 11:14 [2489455] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "9nADWe8u2wXQ4GtPDijPpNWMpf89X1wkAox3R9brWmHt", "fee": 2700000, "feeAssetId": null, "timestamp": 1678781676723, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "4aWesSDuRQW9GLU6CKXuJjxyqsNnknQT7qrsc5tuagoa3XiAJyRp4ervY78Fc1i5TJ5EFGbSrnQLwLrp2ujQ77ER" ], "script": "base64:BgLFLggCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIDCgEIEgQKAggBEgASBQoDCAgEEgMKAQgSAwoBCBIAIgNTRVAiBlNDQUxFOCIFTVVMVDgiDlBPT0xXRUlHSFRNVUxUIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIgRzdHJmIgdhZGRyZXNzIgNrZXkiA2lveiIDaW9kIgpkZWZhdWx0VmFsIgNpb2YiA2FicyIDdmFsIgNhYWwiByRtYXRjaDAiCnZhbEFueUx5c3QiAmFpIgZ2YWxJbnQiG2tleVJlZmVycmFsc0NvbnRyYWN0QWRkcmVzcyIecmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzT3JGYWlsIhZrZXlSZWZlcnJhbFByb2dyYW1OYW1lIhpyZWZlcnJhbFByb2dyYW1OYW1lRGVmYXVsdCITcmVmZXJyYWxQcm9ncmFtTmFtZSIRa2V5RmFjdG9yeUFkZHJlc3MiGElkeEZhY3RvcnlDZmdTdGFraW5nRGFwcCIZSWR4RmFjdG9yeUNmZ0Jvb3N0a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CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAmFHAQ5jb25maXJtTWFuYWdlcgAEAmZvCQECYUUABAJmcAMJAQlpc0RlZmluZWQBBQJmbwYJAAIBAhJObyBwZW5kaW5nIG1hbmFnZXIDCQAAAgUCZnAFAmZwBAJmcQMJAAACCAUCYUcPY2FsbGVyUHVibGljS2V5CQEFdmFsdWUBBQJmbwYJAAIBAhtZb3UgYXJlIG5vdCBwZW5kaW5nIG1hbmFnZXIDCQAAAgUCZnEFAmZxCQDMCAIJAQtTdHJpbmdFbnRyeQIJAQJhZgAJANgEAQkBBXZhbHVlAQUCZm8JAMwIAgkBC0RlbGV0ZUVudHJ5AQkBAmFnAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJmcgECZnMABAJmdAQBcgkBAmFDAAMJAAECBQFyAgpCeXRlVmVjdG9yBAJhSQUBcgUCYUkDCQABAgUBcgIEVW5pdAgFAmZyD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJmcglib2R5Qnl0ZXMJAJEDAggFAmZyBnByb29mcwAABQJmdE9BJr0=", "height": 2489455, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AGsP8Ym1mk848FFLDZKoFojG7dBg2ztABQjkqkxEP2uM Next: HCqH1ALyE3k84QSBFxu2vysBY51EDpBdXLS5LCWmoGnf Diff:
Old | New | Differences | |
---|---|---|---|
313 | 313 | ||
314 | 314 | 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")) | |
315 | 315 | ||
316 | + | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
317 | + | ||
318 | + | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
319 | + | ||
316 | 320 | func getTotalCachedGwx (correct) = { | |
317 | - | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
318 | - | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
319 | 321 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
320 | 322 | let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi) | |
321 | 323 | let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP) | |
401 | 403 | func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height) | |
402 | 404 | ||
403 | 405 | ||
406 | + | func getVotingEmissionEpochInfo () = { | |
407 | + | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
408 | + | let $t01492815216 = { | |
409 | + | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi)) | |
410 | + | let lastFinalizedEpoch = (currentEpochUi - 1) | |
411 | + | if ((0 > lastFinalizedEpoch)) | |
412 | + | then throwErr("invalid epoch") | |
413 | + | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
414 | + | } | |
415 | + | let currentEpochUi = $t01492815216._1 | |
416 | + | let lastFinalizedEpoch = $t01492815216._2 | |
417 | + | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP) | |
418 | + | ||
419 | + | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
420 | + | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
421 | + | } | |
422 | + | ||
423 | + | ||
424 | + | func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
425 | + | ||
426 | + | ||
427 | + | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP) | |
428 | + | ||
429 | + | ||
430 | + | func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP) | |
431 | + | ||
432 | + | ||
433 | + | func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP) | |
434 | + | ||
435 | + | ||
436 | + | func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
437 | + | ||
438 | + | ||
439 | + | func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
440 | + | ||
441 | + | ||
442 | + | func getVotingResultStaked (lpAssetIdStr) = { | |
443 | + | let $t01690116981 = getVotingEmissionEpochInfo() | |
444 | + | let lastFinalizedEpoch = $t01690116981._1 | |
445 | + | let currentEpochStartHeight = $t01690116981._2 | |
446 | + | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
447 | + | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
448 | + | votingResultStaked | |
449 | + | } | |
450 | + | ||
451 | + | ||
452 | + | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
453 | + | let $t01750217582 = getVotingEmissionEpochInfo() | |
454 | + | let lastFinalizedEpoch = $t01750217582._1 | |
455 | + | let currentEpochStartHeight = $t01750217582._2 | |
456 | + | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
457 | + | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
458 | + | let votingResultStakedIntegralKey = keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch) | |
459 | + | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0) | |
460 | + | let votingResultLastUpdateHeightKey = keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch) | |
461 | + | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, votingResultLastUpdateHeightKey), currentEpochStartHeight) | |
462 | + | let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight) | |
463 | + | let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev) | |
464 | + | $Tuple2([IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(votingResultLastUpdateHeightKey, height), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], votingResultStakedIntegral) | |
465 | + | } | |
466 | + | ||
467 | + | ||
468 | + | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
469 | + | let $t01878218862 = getVotingEmissionEpochInfo() | |
470 | + | let lastFinalizedEpoch = $t01878218862._1 | |
471 | + | let currentEpochStartHeight = $t01878218862._2 | |
472 | + | let userAddress = addressFromStringValue(userAddressStr) | |
473 | + | let idxAmountAssetId = 4 | |
474 | + | let idxPriceAssetId = 5 | |
475 | + | let poolCfg = { | |
476 | + | let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil) | |
477 | + | if ($isInstanceOf(@, "List[Any]")) | |
478 | + | then @ | |
479 | + | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
480 | + | } | |
481 | + | let amountAssetId = { | |
482 | + | let @ = poolCfg[idxAmountAssetId] | |
483 | + | if ($isInstanceOf(@, "String")) | |
484 | + | then @ | |
485 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
486 | + | } | |
487 | + | let priceAssetId = { | |
488 | + | let @ = poolCfg[idxPriceAssetId] | |
489 | + | if ($isInstanceOf(@, "String")) | |
490 | + | then @ | |
491 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
492 | + | } | |
493 | + | let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0) | |
494 | + | let actions = if ((userVote == 0)) | |
495 | + | then nil | |
496 | + | else { | |
497 | + | let stakedVoteDelta = if (edge) | |
498 | + | then userVote | |
499 | + | else -(userVote) | |
500 | + | let $t01946719586 = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta) | |
501 | + | let votingResultActions = $t01946719586._1 | |
502 | + | let votingResultStakedIntegral = $t01946719586._2 | |
503 | + | let userVoteStaked = if (edge) | |
504 | + | then 0 | |
505 | + | else userVote | |
506 | + | let userVoteStakedIntegralKey = keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
507 | + | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0) | |
508 | + | let userVoteStakedLastUpdateHeightKey = keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
509 | + | let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, userVoteStakedLastUpdateHeightKey), currentEpochStartHeight) | |
510 | + | let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight) | |
511 | + | let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev) | |
512 | + | let voteActions = [IntegerEntry(userVoteStakedLastUpdateHeightKey, height), IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral)] | |
513 | + | (votingResultActions ++ voteActions) | |
514 | + | } | |
515 | + | actions | |
516 | + | } | |
517 | + | ||
518 | + | ||
404 | 519 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
405 | 520 | let EMPTY = "EMPTY" | |
406 | 521 | let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY) | |
411 | 526 | let userNumStr = userRecordArray[IdxLockUserNum] | |
412 | 527 | let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0) | |
413 | 528 | let EMPTYSTR = "empty" | |
414 | - | let $ | |
529 | + | let $t02106521633 = if ((lpAssetIdStr != EMPTYSTR)) | |
415 | 530 | then { | |
416 | 531 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
417 | 532 | let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
421 | 536 | else if (readOnly) | |
422 | 537 | then $Tuple2(0, 0) | |
423 | 538 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
424 | - | let poolWeight0 = $ | |
425 | - | let poolWeight1 = $ | |
539 | + | let poolWeight0 = $t02106521633._1 | |
540 | + | let poolWeight1 = $t02106521633._2 | |
426 | 541 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
427 | 542 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
428 | 543 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
567 | 682 | ||
568 | 683 | @Callable(i) | |
569 | 684 | func lockRef (duration,referrerAddress,signature) = { | |
570 | - | let $ | |
571 | - | let lockActionsResult = $ | |
572 | - | let gWxAmountStart = $ | |
685 | + | let $t03009830163 = lockActions(i, duration) | |
686 | + | let lockActionsResult = $t03009830163._1 | |
687 | + | let gWxAmountStart = $t03009830163._2 | |
573 | 688 | let referralAddress = toString(i.caller) | |
574 | 689 | let refInv = if (if ((referrerAddress == "")) | |
575 | 690 | then true | |
590 | 705 | ||
591 | 706 | @Callable(i) | |
592 | 707 | func lock (duration) = { | |
593 | - | let $ | |
594 | - | let lockActionsResult = $ | |
595 | - | let gWxAmountStart = $ | |
708 | + | let $t03062130686 = lockActions(i, duration) | |
709 | + | let lockActionsResult = $t03062130686._1 | |
710 | + | let gWxAmountStart = $t03062130686._2 | |
596 | 711 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
597 | 712 | if ((updateRefActivity == updateRefActivity)) | |
598 | 713 | then $Tuple2(lockActionsResult, unit) | |
681 | 796 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
682 | 797 | then throw("permissions denied") | |
683 | 798 | else { | |
684 | - | let $ | |
685 | - | let userBoostAvailable = $ | |
686 | - | let dataState = $ | |
687 | - | let debug = $ | |
799 | + | let $t03566735769 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
800 | + | let userBoostAvailable = $t03566735769._1 | |
801 | + | let dataState = $t03566735769._2 | |
802 | + | let debug = $t03566735769._3 | |
688 | 803 | $Tuple2(dataState, [userBoostAvailable]) | |
689 | 804 | } | |
690 | 805 | ||
692 | 807 | ||
693 | 808 | @Callable(i) | |
694 | 809 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
695 | - | let $ | |
696 | - | let userBoostAvailable = $ | |
697 | - | let dataState = $ | |
698 | - | let debug = $ | |
810 | + | let $t03590136002 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
811 | + | let userBoostAvailable = $t03590136002._1 | |
812 | + | let dataState = $t03590136002._2 | |
813 | + | let debug = $t03590136002._3 | |
699 | 814 | $Tuple2(nil, [userBoostAvailable, debug]) | |
700 | 815 | } | |
701 | 816 | ||
765 | 880 | ||
766 | 881 | ||
767 | 882 | @Callable(i) | |
883 | + | func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = { | |
884 | + | let checkCaller = if ((i.caller == stakingContract)) | |
885 | + | then true | |
886 | + | else mustManager(i) | |
887 | + | if ((checkCaller == checkCaller)) | |
888 | + | then { | |
889 | + | let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge) | |
890 | + | $Tuple2(actions, unit) | |
891 | + | } | |
892 | + | else throw("Strict value is not equal to itself.") | |
893 | + | } | |
894 | + | ||
895 | + | ||
896 | + | ||
897 | + | @Callable(i) | |
898 | + | func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr)) | |
899 | + | ||
900 | + | ||
901 | + | ||
902 | + | @Callable(i) | |
768 | 903 | func setManager (pendingManagerPublicKey) = { | |
769 | 904 | let checkCaller = mustManager(i) | |
770 | 905 | if ((checkCaller == checkCaller)) |
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 | func wrapErr (msg) = makeString(["boosting.ride:", msg], " ") | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func throwErr (msg) = throw(wrapErr(msg)) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func strf (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func ioz (address,key) = valueOrElse(getInteger(address, key), 0) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func iod (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func iof (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func abs (val) = if ((0 > val)) | |
31 | 31 | then -(val) | |
32 | 32 | else val | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func aal (val) = match val { | |
36 | 36 | case valAnyLyst: List[Any] => | |
37 | 37 | valAnyLyst | |
38 | 38 | case _ => | |
39 | 39 | throw("fail to cast into List[Any]") | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func ai (val) = match val { | |
44 | 44 | case valInt: Int => | |
45 | 45 | valInt | |
46 | 46 | case _ => | |
47 | 47 | throw("fail to cast into Int") | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | let referralsContractAddressOrFail = addressFromStringValue(strf(this, keyReferralsContractAddress())) | |
55 | 55 | ||
56 | 56 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
57 | 57 | ||
58 | 58 | let referralProgramNameDefault = "wxlock" | |
59 | 59 | ||
60 | 60 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
61 | 61 | ||
62 | 62 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | let IdxFactoryCfgStakingDapp = 1 | |
66 | 66 | ||
67 | 67 | let IdxFactoryCfgBoostingDapp = 2 | |
68 | 68 | ||
69 | 69 | let IdxFactoryCfgIdoDapp = 3 | |
70 | 70 | ||
71 | 71 | let IdxFactoryCfgTeamDapp = 4 | |
72 | 72 | ||
73 | 73 | let IdxFactoryCfgEmissionDapp = 5 | |
74 | 74 | ||
75 | 75 | let IdxFactoryCfgRestDapp = 6 | |
76 | 76 | ||
77 | 77 | let IdxFactoryCfgSlippageDapp = 7 | |
78 | 78 | ||
79 | 79 | let IdxFactoryCfgDaoDapp = 8 | |
80 | 80 | ||
81 | 81 | let IdxFactoryCfgMarketingDapp = 9 | |
82 | 82 | ||
83 | 83 | let IdxFactoryCfgGwxRewardDapp = 10 | |
84 | 84 | ||
85 | 85 | let IdxFactoryCfgBirdsDapp = 11 | |
86 | 86 | ||
87 | 87 | func keyFactoryCfg () = "%s__factoryConfig" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyFactoryLpList () = "%s__lpTokensList" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func readFactoryAddressOrFail () = addressFromStringValue(strf(this, keyFactoryAddress())) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func readFactoryCfgOrFail (factory) = split(strf(factory, keyFactoryCfg()), SEP) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func keyNextPeriod () = "%s__nextPeriod" | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | let IdxCfgAssetId = 1 | |
154 | 154 | ||
155 | 155 | let IdxCfgMinLockAmount = 2 | |
156 | 156 | ||
157 | 157 | let IdxCfgMinLockDuration = 3 | |
158 | 158 | ||
159 | 159 | let IdxCfgMaxLockDuration = 4 | |
160 | 160 | ||
161 | 161 | let IdxCfgMathContract = 5 | |
162 | 162 | ||
163 | 163 | func keyConfig () = "%s__config" | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func readConfigArrayOrFail () = split(strf(this, keyConfig()), SEP) | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | let mathContract = addressFromStringValue(readConfigArrayOrFail()[IdxCfgMathContract]) | |
170 | 170 | ||
171 | 171 | func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
178 | 178 | case s: String => | |
179 | 179 | fromBase58String(s) | |
180 | 180 | case _: Unit => | |
181 | 181 | unit | |
182 | 182 | case _ => | |
183 | 183 | throw("Match error") | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
188 | 188 | case s: String => | |
189 | 189 | fromBase58String(s) | |
190 | 190 | case _: Unit => | |
191 | 191 | unit | |
192 | 192 | case _ => | |
193 | 193 | throw("Match error") | |
194 | 194 | } | |
195 | 195 | ||
196 | 196 | ||
197 | 197 | func mustManager (i) = { | |
198 | 198 | let pd = throw("Permission denied") | |
199 | 199 | match managerPublicKeyOrUnit() { | |
200 | 200 | case pk: ByteVector => | |
201 | 201 | if ((i.callerPublicKey == pk)) | |
202 | 202 | then true | |
203 | 203 | else pd | |
204 | 204 | case _: Unit => | |
205 | 205 | if ((i.caller == this)) | |
206 | 206 | then true | |
207 | 207 | else pd | |
208 | 208 | case _ => | |
209 | 209 | throw("Match error") | |
210 | 210 | } | |
211 | 211 | } | |
212 | 212 | ||
213 | 213 | ||
214 | 214 | let IdxLockUserNum = 1 | |
215 | 215 | ||
216 | 216 | let IdxLockAmount = 2 | |
217 | 217 | ||
218 | 218 | let IdxLockStart = 3 | |
219 | 219 | ||
220 | 220 | let IdxLockDuration = 4 | |
221 | 221 | ||
222 | 222 | let IdxLockParamK = 5 | |
223 | 223 | ||
224 | 224 | let IdxLockParamB = 6 | |
225 | 225 | ||
226 | 226 | func keyLockParamsRecord (userAddress) = makeString(["%s%s__lock", userAddress], SEP) | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | func readLockParamsRecordOrFail (userAddress) = split(strf(this, keyLockParamsRecord(userAddress)), SEP) | |
230 | 230 | ||
231 | 231 | ||
232 | 232 | func formatLockParamsRecordS (userNum,amount,start,duration,paramK,paramB,lastUpdTimestamp,gwxAmount) = makeString(["%d%d%d%d%d%d%d%d", userNum, amount, start, duration, paramK, paramB, lastUpdTimestamp, gwxAmount], SEP) | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | func formatLockParamsRecord (userNum,amount,start,duration,paramK,paramB,gwxAmount) = formatLockParamsRecordS(userNum, toString(amount), toString(start), toString(duration), toString(paramK), toString(paramB), toString(lastBlock.timestamp), toString(gwxAmount)) | |
236 | 236 | ||
237 | 237 | ||
238 | 238 | func keyNextUserNum () = "%s__nextUserNum" | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP) | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP) | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | func keyLockParamUserAmount (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "amount"], SEP) | |
248 | 248 | ||
249 | 249 | ||
250 | 250 | func keyLockParamStartBlock (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "start"], SEP) | |
251 | 251 | ||
252 | 252 | ||
253 | 253 | func keyLockParamDuration (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "duration"], SEP) | |
254 | 254 | ||
255 | 255 | ||
256 | 256 | func keyLockParamK (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "k"], SEP) | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | func keyLockParamB (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "b"], SEP) | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | func keyLockParamByPeriodK (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "k", period], SEP) | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func keyLockParamByPeriodB (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "b", period], SEP) | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked" | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks" | |
272 | 272 | ||
273 | 273 | ||
274 | 274 | func keyStatsLocksCount () = "%s%s__stats__locksCount" | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | func keyStatsUsersCount () = "%s%s__stats__activeUsersCount" | |
278 | 278 | ||
279 | 279 | ||
280 | 280 | func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastInt", userNum], SEP) | |
281 | 281 | ||
282 | 282 | ||
283 | 283 | func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastInt", userNum, lpAssetId], SEP) | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP) | |
287 | 287 | ||
288 | 288 | ||
289 | 289 | func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total" | |
290 | 290 | ||
291 | 291 | ||
292 | 292 | func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", userNum], SEP) | |
293 | 293 | ||
294 | 294 | ||
295 | 295 | func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", userNum], SEP) | |
296 | 296 | ||
297 | 297 | ||
298 | 298 | func keyTotalCachedGwx () = "%s%s__gwxCached__total" | |
299 | 299 | ||
300 | 300 | ||
301 | 301 | func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective" | |
302 | 302 | ||
303 | 303 | ||
304 | 304 | let factoryContract = readFactoryAddressOrFail() | |
305 | 305 | ||
306 | 306 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
307 | 307 | ||
308 | 308 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
309 | 309 | ||
310 | 310 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
311 | 311 | ||
312 | 312 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
313 | 313 | ||
314 | 314 | 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")) | |
315 | 315 | ||
316 | + | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
317 | + | ||
318 | + | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
319 | + | ||
316 | 320 | func getTotalCachedGwx (correct) = { | |
317 | - | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
318 | - | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
319 | 321 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
320 | 322 | let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi) | |
321 | 323 | let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP) | |
322 | 324 | let targetEpochOption = getInteger(this, keyTargetEpoch) | |
323 | 325 | let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0) | |
324 | 326 | let isCorrectionActivated = if (isDefined(targetEpochOption)) | |
325 | 327 | then (currentEpochUi >= value(targetEpochOption)) | |
326 | 328 | else false | |
327 | 329 | let corrective = if (if (isCorrectionActivated) | |
328 | 330 | then correct | |
329 | 331 | else false) | |
330 | 332 | then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0) | |
331 | 333 | else 0 | |
332 | 334 | max([0, (totalCachedGwxRaw + corrective)]) | |
333 | 335 | } | |
334 | 336 | ||
335 | 337 | ||
336 | 338 | func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = { | |
337 | 339 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
338 | 340 | let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(k), toString(b)], SEP) | |
339 | 341 | StringEntry(historyKEY, historyDATA) | |
340 | 342 | } | |
341 | 343 | ||
342 | 344 | ||
343 | 345 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
344 | 346 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
345 | 347 | let locksCountKEY = keyStatsLocksCount() | |
346 | 348 | let usersCountKEY = keyStatsUsersCount() | |
347 | 349 | let totalAmountKEY = keyLockParamTotalAmount() | |
348 | 350 | let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY) | |
349 | 351 | let locksCount = ioz(this, locksCountKEY) | |
350 | 352 | let usersCount = ioz(this, usersCountKEY) | |
351 | 353 | let totalAmount = ioz(this, totalAmountKEY) | |
352 | 354 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
353 | 355 | } | |
354 | 356 | ||
355 | 357 | ||
356 | 358 | func calcGwxAmount (kRaw,bRaw,h) = { | |
357 | 359 | let SCALE = 1000 | |
358 | 360 | (((kRaw * h) + bRaw) / SCALE) | |
359 | 361 | } | |
360 | 362 | ||
361 | 363 | ||
362 | 364 | func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = { | |
363 | 365 | let userAmountKEY = keyLockParamUserAmount(userNum) | |
364 | 366 | let startBlockKEY = keyLockParamStartBlock(userNum) | |
365 | 367 | let durationKEY = keyLockParamDuration(userNum) | |
366 | 368 | let kKEY = keyLockParamK(userNum) | |
367 | 369 | let bKEY = keyLockParamB(userNum) | |
368 | 370 | let kByPeriodKEY = keyLockParamByPeriodK(userNum, period) | |
369 | 371 | let bByPeriodKEY = keyLockParamByPeriodB(userNum, period) | |
370 | 372 | let gwxAmount = calcGwxAmount(k, b, height) | |
371 | 373 | [IntegerEntry(userAmountKEY, amount), IntegerEntry(startBlockKEY, start), IntegerEntry(durationKEY, duration), IntegerEntry(kKEY, k), IntegerEntry(bKEY, b), IntegerEntry(kByPeriodKEY, k), IntegerEntry(bByPeriodKEY, b), StringEntry(keyLockParamsRecord(userAddress), formatLockParamsRecord(userNum, amount, start, duration, k, b, gwxAmount))] | |
372 | 374 | } | |
373 | 375 | ||
374 | 376 | ||
375 | 377 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
376 | 378 | then throw("only one payment is allowed") | |
377 | 379 | else if ((size(i.payments) == 0)) | |
378 | 380 | then 0 | |
379 | 381 | else { | |
380 | 382 | let pmt = i.payments[0] | |
381 | 383 | if ((value(pmt.assetId) != expectedAssetId)) | |
382 | 384 | then throw("invalid asset id in payment") | |
383 | 385 | else pmt.amount | |
384 | 386 | } | |
385 | 387 | ||
386 | 388 | ||
387 | 389 | func calcUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
388 | 390 | let EMPTY = "empty" | |
389 | 391 | let user2NumMappingKEY = keyUser2NumMapping(userAddress) | |
390 | 392 | let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY) | |
391 | 393 | let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0) | |
392 | 394 | let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0) | |
393 | 395 | let gwxAmountCalc = calcGwxAmount(k, b, targetHeight) | |
394 | 396 | let gwxAmount = if ((0 > gwxAmountCalc)) | |
395 | 397 | then 0 | |
396 | 398 | else gwxAmountCalc | |
397 | 399 | gwxAmount | |
398 | 400 | } | |
399 | 401 | ||
400 | 402 | ||
401 | 403 | func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height) | |
402 | 404 | ||
403 | 405 | ||
406 | + | func getVotingEmissionEpochInfo () = { | |
407 | + | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
408 | + | let $t01492815216 = { | |
409 | + | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi)) | |
410 | + | let lastFinalizedEpoch = (currentEpochUi - 1) | |
411 | + | if ((0 > lastFinalizedEpoch)) | |
412 | + | then throwErr("invalid epoch") | |
413 | + | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
414 | + | } | |
415 | + | let currentEpochUi = $t01492815216._1 | |
416 | + | let lastFinalizedEpoch = $t01492815216._2 | |
417 | + | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP) | |
418 | + | ||
419 | + | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
420 | + | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
421 | + | } | |
422 | + | ||
423 | + | ||
424 | + | func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
425 | + | ||
426 | + | ||
427 | + | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP) | |
428 | + | ||
429 | + | ||
430 | + | func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP) | |
431 | + | ||
432 | + | ||
433 | + | func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP) | |
434 | + | ||
435 | + | ||
436 | + | func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
437 | + | ||
438 | + | ||
439 | + | func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
440 | + | ||
441 | + | ||
442 | + | func getVotingResultStaked (lpAssetIdStr) = { | |
443 | + | let $t01690116981 = getVotingEmissionEpochInfo() | |
444 | + | let lastFinalizedEpoch = $t01690116981._1 | |
445 | + | let currentEpochStartHeight = $t01690116981._2 | |
446 | + | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
447 | + | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
448 | + | votingResultStaked | |
449 | + | } | |
450 | + | ||
451 | + | ||
452 | + | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
453 | + | let $t01750217582 = getVotingEmissionEpochInfo() | |
454 | + | let lastFinalizedEpoch = $t01750217582._1 | |
455 | + | let currentEpochStartHeight = $t01750217582._2 | |
456 | + | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
457 | + | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
458 | + | let votingResultStakedIntegralKey = keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch) | |
459 | + | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0) | |
460 | + | let votingResultLastUpdateHeightKey = keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch) | |
461 | + | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, votingResultLastUpdateHeightKey), currentEpochStartHeight) | |
462 | + | let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight) | |
463 | + | let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev) | |
464 | + | $Tuple2([IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(votingResultLastUpdateHeightKey, height), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], votingResultStakedIntegral) | |
465 | + | } | |
466 | + | ||
467 | + | ||
468 | + | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
469 | + | let $t01878218862 = getVotingEmissionEpochInfo() | |
470 | + | let lastFinalizedEpoch = $t01878218862._1 | |
471 | + | let currentEpochStartHeight = $t01878218862._2 | |
472 | + | let userAddress = addressFromStringValue(userAddressStr) | |
473 | + | let idxAmountAssetId = 4 | |
474 | + | let idxPriceAssetId = 5 | |
475 | + | let poolCfg = { | |
476 | + | let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil) | |
477 | + | if ($isInstanceOf(@, "List[Any]")) | |
478 | + | then @ | |
479 | + | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
480 | + | } | |
481 | + | let amountAssetId = { | |
482 | + | let @ = poolCfg[idxAmountAssetId] | |
483 | + | if ($isInstanceOf(@, "String")) | |
484 | + | then @ | |
485 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
486 | + | } | |
487 | + | let priceAssetId = { | |
488 | + | let @ = poolCfg[idxPriceAssetId] | |
489 | + | if ($isInstanceOf(@, "String")) | |
490 | + | then @ | |
491 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
492 | + | } | |
493 | + | let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0) | |
494 | + | let actions = if ((userVote == 0)) | |
495 | + | then nil | |
496 | + | else { | |
497 | + | let stakedVoteDelta = if (edge) | |
498 | + | then userVote | |
499 | + | else -(userVote) | |
500 | + | let $t01946719586 = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta) | |
501 | + | let votingResultActions = $t01946719586._1 | |
502 | + | let votingResultStakedIntegral = $t01946719586._2 | |
503 | + | let userVoteStaked = if (edge) | |
504 | + | then 0 | |
505 | + | else userVote | |
506 | + | let userVoteStakedIntegralKey = keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
507 | + | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0) | |
508 | + | let userVoteStakedLastUpdateHeightKey = keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
509 | + | let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, userVoteStakedLastUpdateHeightKey), currentEpochStartHeight) | |
510 | + | let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight) | |
511 | + | let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev) | |
512 | + | let voteActions = [IntegerEntry(userVoteStakedLastUpdateHeightKey, height), IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral)] | |
513 | + | (votingResultActions ++ voteActions) | |
514 | + | } | |
515 | + | actions | |
516 | + | } | |
517 | + | ||
518 | + | ||
404 | 519 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
405 | 520 | let EMPTY = "EMPTY" | |
406 | 521 | let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY) | |
407 | 522 | if ((userRecordOrEmpty == EMPTY)) | |
408 | 523 | then $Tuple3(0, nil, "userRecord::is::empty") | |
409 | 524 | else { | |
410 | 525 | let userRecordArray = split(userRecordOrEmpty, SEP) | |
411 | 526 | let userNumStr = userRecordArray[IdxLockUserNum] | |
412 | 527 | let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0) | |
413 | 528 | let EMPTYSTR = "empty" | |
414 | - | let $ | |
529 | + | let $t02106521633 = if ((lpAssetIdStr != EMPTYSTR)) | |
415 | 530 | then { | |
416 | 531 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
417 | 532 | let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
418 | 533 | let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1) | |
419 | 534 | $Tuple2(pw0, pw1) | |
420 | 535 | } | |
421 | 536 | else if (readOnly) | |
422 | 537 | then $Tuple2(0, 0) | |
423 | 538 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
424 | - | let poolWeight0 = $ | |
425 | - | let poolWeight1 = $ | |
539 | + | let poolWeight0 = $t02106521633._1 | |
540 | + | let poolWeight1 = $t02106521633._2 | |
426 | 541 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
427 | 542 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
428 | 543 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
429 | 544 | let h = if ((height > emissionEnd)) | |
430 | 545 | then emissionEnd | |
431 | 546 | else height | |
432 | 547 | let dh = max([(h - emissionStart), 0]) | |
433 | 548 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr) | |
434 | 549 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
435 | 550 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY)) | |
436 | 551 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
437 | 552 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
438 | 553 | let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock)) | |
439 | 554 | let uLastH = (h - udh) | |
440 | 555 | let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0]) | |
441 | 556 | let udh1 = ((h - uLastH) - udh0) | |
442 | 557 | if (if (if ((0 > uLastH)) | |
443 | 558 | then true | |
444 | 559 | else (0 > udh1)) | |
445 | 560 | then true | |
446 | 561 | else (abs(((udh0 + udh1) - udh)) >= 1)) | |
447 | 562 | then throw(((((((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1)) + " lpAssetId=") + lpAssetIdStr) + " userAddress=") + userAddressStr)) | |
448 | 563 | else if ((0 > userBoostEmissionIntegral)) | |
449 | 564 | then throw("wrong calculations") | |
450 | 565 | else { | |
451 | 566 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
452 | 567 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
453 | 568 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
454 | 569 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
455 | 570 | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
456 | 571 | let userCurrGwx = calcCurrentGwxAmount(userAddressStr) | |
457 | 572 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
458 | 573 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
459 | 574 | let userBoostEmissionIntegral0 = if ((udh == 0)) | |
460 | 575 | then 0 | |
461 | 576 | else fraction(userBoostEmissionIntegral, udh0, udh) | |
462 | 577 | let userBoostEmissionIntegral1 = if ((udh == 0)) | |
463 | 578 | then 0 | |
464 | 579 | else fraction(userBoostEmissionIntegral, udh1, udh) | |
465 | 580 | let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT) | |
466 | 581 | let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT) | |
467 | 582 | let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0)) | |
468 | 583 | then 0 | |
469 | 584 | else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected) | |
470 | 585 | let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0)) | |
471 | 586 | then 0 | |
472 | 587 | else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected) | |
473 | 588 | let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1) | |
474 | 589 | let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr) | |
475 | 590 | let userBoostClaimed = ioz(this, userBoostClaimedKEY) | |
476 | 591 | let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed) | |
477 | 592 | let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] | |
478 | 593 | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(userBoostClaimed), toString(userBoostAvailable), toString(poolWeight0), toString(poolWeight1), toString(h), toString(udh), toString(uLastH), toString(udh0), toString(udh1), toString(userCurrGwx), toString(totalCachedGwxCorrected)], ":") | |
479 | 594 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
480 | 595 | } | |
481 | 596 | } | |
482 | 597 | } | |
483 | 598 | ||
484 | 599 | ||
485 | 600 | func lockActions (i,duration) = { | |
486 | 601 | let cfgArray = readConfigArrayOrFail() | |
487 | 602 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
488 | 603 | let assetId = fromBase58String(assetIdStr) | |
489 | 604 | let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount]) | |
490 | 605 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
491 | 606 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
492 | 607 | if ((size(i.payments) != 1)) | |
493 | 608 | then throw("invalid payment - exact one payment must be attached") | |
494 | 609 | else { | |
495 | 610 | let pmt = i.payments[0] | |
496 | 611 | let pmtAmount = pmt.amount | |
497 | 612 | if ((assetId != value(pmt.assetId))) | |
498 | 613 | then throw((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
499 | 614 | else { | |
500 | 615 | let nextUserNumKEY = keyNextUserNum() | |
501 | 616 | let userAddressStr = toString(i.caller) | |
502 | 617 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
503 | 618 | let userNumStr = if (userIsExisting) | |
504 | 619 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
505 | 620 | else toString(iof(this, nextUserNumKEY)) | |
506 | 621 | let userNum = parseIntValue(userNumStr) | |
507 | 622 | let lockStart = height | |
508 | 623 | let startBlockKEY = keyLockParamStartBlock(userNumStr) | |
509 | 624 | let durationKEY = keyLockParamDuration(userNumStr) | |
510 | 625 | let userAmountKEY = keyLockParamUserAmount(userNumStr) | |
511 | 626 | if (if ((minLockAmount > pmtAmount)) | |
512 | 627 | then (i.caller != lpStakingPoolsContract) | |
513 | 628 | else false) | |
514 | 629 | then throw(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
515 | 630 | else if ((minLockDuration > duration)) | |
516 | 631 | then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
517 | 632 | else if ((duration > maxLockDuration)) | |
518 | 633 | then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
519 | 634 | else if (if (userIsExisting) | |
520 | 635 | then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart) | |
521 | 636 | else false) | |
522 | 637 | then throw("there is an active lock - consider to use increaseLock") | |
523 | 638 | else if ((ioz(this, userAmountKEY) > 0)) | |
524 | 639 | then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY)) | |
525 | 640 | else { | |
526 | 641 | let coeffX8 = fraction(duration, MULT8, maxLockDuration) | |
527 | 642 | let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8) | |
528 | 643 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil)) | |
529 | 644 | let k = ai(gWxParamsResultList[0]) | |
530 | 645 | let b = ai(gWxParamsResultList[1]) | |
531 | 646 | let period = toString(ai(gWxParamsResultList[2])) | |
532 | 647 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
533 | 648 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
534 | 649 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
535 | 650 | let h = if ((height > emissionEnd)) | |
536 | 651 | then emissionEnd | |
537 | 652 | else height | |
538 | 653 | let dh = max([(h - emissionStart), 0]) | |
539 | 654 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
540 | 655 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
541 | 656 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
542 | 657 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
543 | 658 | let userMaxBoostInt = ((gWxAmountStart * duration) / 2) | |
544 | 659 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
545 | 660 | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
546 | 661 | let arr = if (userIsExisting) | |
547 | 662 | then nil | |
548 | 663 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
549 | 664 | $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
550 | 665 | then 0 | |
551 | 666 | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart) | |
552 | 667 | } | |
553 | 668 | } | |
554 | 669 | } | |
555 | 670 | } | |
556 | 671 | ||
557 | 672 | ||
558 | 673 | @Callable(i) | |
559 | 674 | func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = { | |
560 | 675 | let checkCaller = mustManager(i) | |
561 | 676 | if ((checkCaller == checkCaller)) | |
562 | 677 | then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0)) | |
563 | 678 | else throw("Strict value is not equal to itself.") | |
564 | 679 | } | |
565 | 680 | ||
566 | 681 | ||
567 | 682 | ||
568 | 683 | @Callable(i) | |
569 | 684 | func lockRef (duration,referrerAddress,signature) = { | |
570 | - | let $ | |
571 | - | let lockActionsResult = $ | |
572 | - | let gWxAmountStart = $ | |
685 | + | let $t03009830163 = lockActions(i, duration) | |
686 | + | let lockActionsResult = $t03009830163._1 | |
687 | + | let gWxAmountStart = $t03009830163._2 | |
573 | 688 | let referralAddress = toString(i.caller) | |
574 | 689 | let refInv = if (if ((referrerAddress == "")) | |
575 | 690 | then true | |
576 | 691 | else (signature == base58'')) | |
577 | 692 | then unit | |
578 | 693 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
579 | 694 | if ((refInv == refInv)) | |
580 | 695 | then { | |
581 | 696 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
582 | 697 | if ((updateRefActivity == updateRefActivity)) | |
583 | 698 | then $Tuple2(lockActionsResult, unit) | |
584 | 699 | else throw("Strict value is not equal to itself.") | |
585 | 700 | } | |
586 | 701 | else throw("Strict value is not equal to itself.") | |
587 | 702 | } | |
588 | 703 | ||
589 | 704 | ||
590 | 705 | ||
591 | 706 | @Callable(i) | |
592 | 707 | func lock (duration) = { | |
593 | - | let $ | |
594 | - | let lockActionsResult = $ | |
595 | - | let gWxAmountStart = $ | |
708 | + | let $t03062130686 = lockActions(i, duration) | |
709 | + | let lockActionsResult = $t03062130686._1 | |
710 | + | let gWxAmountStart = $t03062130686._2 | |
596 | 711 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
597 | 712 | if ((updateRefActivity == updateRefActivity)) | |
598 | 713 | then $Tuple2(lockActionsResult, unit) | |
599 | 714 | else throw("Strict value is not equal to itself.") | |
600 | 715 | } | |
601 | 716 | ||
602 | 717 | ||
603 | 718 | ||
604 | 719 | @Callable(i) | |
605 | 720 | func increaseLock (deltaDuration) = { | |
606 | 721 | let cfgArray = readConfigArrayOrFail() | |
607 | 722 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
608 | 723 | let assetId = fromBase58String(assetIdStr) | |
609 | 724 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
610 | 725 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
611 | 726 | let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId) | |
612 | 727 | let userAddressStr = toString(i.caller) | |
613 | 728 | let userRecordArray = readLockParamsRecordOrFail(userAddressStr) | |
614 | 729 | let userNumStr = userRecordArray[IdxLockUserNum] | |
615 | 730 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
616 | 731 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
617 | 732 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
618 | 733 | let lockEnd = (lockStart + lockDuration) | |
619 | 734 | let remainingDuration = max([(lockEnd - height), 0]) | |
620 | 735 | let userAmountNew = (userAmount + pmtAmount) | |
621 | 736 | let lockDurationNew = (remainingDuration + deltaDuration) | |
622 | 737 | if ((0 > deltaDuration)) | |
623 | 738 | then throw("duration is less then zero") | |
624 | 739 | else if ((minLockDuration > lockDurationNew)) | |
625 | 740 | then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration))) | |
626 | 741 | else if ((lockDurationNew > maxLockDuration)) | |
627 | 742 | then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
628 | 743 | else { | |
629 | 744 | let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration) | |
630 | 745 | let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8) | |
631 | 746 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
632 | 747 | if ((updateRefActivity == updateRefActivity)) | |
633 | 748 | then { | |
634 | 749 | let lockStartNew = height | |
635 | 750 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil)) | |
636 | 751 | let k = ai(gWxParamsResultList[0]) | |
637 | 752 | let b = ai(gWxParamsResultList[1]) | |
638 | 753 | let period = toString(ai(gWxParamsResultList[2])) | |
639 | 754 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
640 | 755 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
641 | 756 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
642 | 757 | let h = if ((height > emissionEnd)) | |
643 | 758 | then emissionEnd | |
644 | 759 | else height | |
645 | 760 | let dh = max([(h - emissionStart), 0]) | |
646 | 761 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
647 | 762 | let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY) | |
648 | 763 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
649 | 764 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
650 | 765 | if ((0 > userBoostEmissionIntegral)) | |
651 | 766 | then throw("wrong calculations") | |
652 | 767 | else { | |
653 | 768 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
654 | 769 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
655 | 770 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
656 | 771 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
657 | 772 | let currUserGwx = calcCurrentGwxAmount(userAddressStr) | |
658 | 773 | let gwxDiff = (gWxAmountStart - currUserGwx) | |
659 | 774 | if ((0 > gwxDiff)) | |
660 | 775 | then throw(("gwxDiff is less then 0: " + toString(gwxDiff))) | |
661 | 776 | else { | |
662 | 777 | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
663 | 778 | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
664 | 779 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
665 | 780 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
666 | 781 | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected) | |
667 | 782 | let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2) | |
668 | 783 | let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2) | |
669 | 784 | let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt) | |
670 | 785 | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gwxDiff))]) | |
671 | 786 | } | |
672 | 787 | } | |
673 | 788 | } | |
674 | 789 | else throw("Strict value is not equal to itself.") | |
675 | 790 | } | |
676 | 791 | } | |
677 | 792 | ||
678 | 793 | ||
679 | 794 | ||
680 | 795 | @Callable(i) | |
681 | 796 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
682 | 797 | then throw("permissions denied") | |
683 | 798 | else { | |
684 | - | let $ | |
685 | - | let userBoostAvailable = $ | |
686 | - | let dataState = $ | |
687 | - | let debug = $ | |
799 | + | let $t03566735769 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
800 | + | let userBoostAvailable = $t03566735769._1 | |
801 | + | let dataState = $t03566735769._2 | |
802 | + | let debug = $t03566735769._3 | |
688 | 803 | $Tuple2(dataState, [userBoostAvailable]) | |
689 | 804 | } | |
690 | 805 | ||
691 | 806 | ||
692 | 807 | ||
693 | 808 | @Callable(i) | |
694 | 809 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
695 | - | let $ | |
696 | - | let userBoostAvailable = $ | |
697 | - | let dataState = $ | |
698 | - | let debug = $ | |
810 | + | let $t03590136002 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
811 | + | let userBoostAvailable = $t03590136002._1 | |
812 | + | let dataState = $t03590136002._2 | |
813 | + | let debug = $t03590136002._3 | |
699 | 814 | $Tuple2(nil, [userBoostAvailable, debug]) | |
700 | 815 | } | |
701 | 816 | ||
702 | 817 | ||
703 | 818 | ||
704 | 819 | @Callable(i) | |
705 | 820 | func unlock (userAddress) = { | |
706 | 821 | let userRecordArray = readLockParamsRecordOrFail(userAddress) | |
707 | 822 | let userNumStr = userRecordArray[IdxLockUserNum] | |
708 | 823 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
709 | 824 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
710 | 825 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
711 | 826 | let lockEnd = (lockStart + lockDuration) | |
712 | 827 | let cfgArray = readConfigArrayOrFail() | |
713 | 828 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
714 | 829 | if ((lockEnd >= height)) | |
715 | 830 | then throw((("wait " + toString(lockEnd)) + " to unlock")) | |
716 | 831 | else if ((0 >= userAmount)) | |
717 | 832 | then throw("nothing to unlock") | |
718 | 833 | else { | |
719 | 834 | let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0) | |
720 | 835 | (((LockParamsEntry(userAddress, userNumStr, 0, lockStart, lockDuration, 0, 0, toString(period)) ++ StatsEntry(-(userAmount), 0, 0, -1)) :+ HistoryEntry("unlock", userAddress, userAmount, lockStart, lockDuration, 0, 0, i)) :+ ScriptTransfer(addressFromStringValue(userAddress), userAmount, assetId)) | |
721 | 836 | } | |
722 | 837 | } | |
723 | 838 | ||
724 | 839 | ||
725 | 840 | ||
726 | 841 | @Callable(i) | |
727 | 842 | func gwxUserInfoREADONLY (userAddress) = { | |
728 | 843 | let gwxAmount = calcCurrentGwxAmount(userAddress) | |
729 | 844 | $Tuple2(nil, [gwxAmount]) | |
730 | 845 | } | |
731 | 846 | ||
732 | 847 | ||
733 | 848 | ||
734 | 849 | @Callable(i) | |
735 | 850 | func userMaxDurationREADONLY (userAddressStr) = { | |
736 | 851 | let cfgArray = readConfigArrayOrFail() | |
737 | 852 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
738 | 853 | let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr)) | |
739 | 854 | if ((userRecordOption == unit)) | |
740 | 855 | then $Tuple2(nil, $Tuple2("lock", maxLockDuration)) | |
741 | 856 | else { | |
742 | 857 | let userRecordArray = split(value(userRecordOption), SEP) | |
743 | 858 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
744 | 859 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
745 | 860 | let lockEnd = (lockStart + lockDuration) | |
746 | 861 | let remainingDuration = max([(lockEnd - height), 0]) | |
747 | 862 | let maxDeltaDuration = (maxLockDuration - remainingDuration) | |
748 | 863 | $Tuple2(nil, $Tuple2("increaseLock", maxDeltaDuration)) | |
749 | 864 | } | |
750 | 865 | } | |
751 | 866 | ||
752 | 867 | ||
753 | 868 | ||
754 | 869 | @Callable(i) | |
755 | 870 | func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = { | |
756 | 871 | let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight) | |
757 | 872 | $Tuple2(nil, gwxAmount) | |
758 | 873 | } | |
759 | 874 | ||
760 | 875 | ||
761 | 876 | ||
762 | 877 | @Callable(i) | |
763 | 878 | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true)) | |
764 | 879 | ||
765 | 880 | ||
766 | 881 | ||
767 | 882 | @Callable(i) | |
883 | + | func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = { | |
884 | + | let checkCaller = if ((i.caller == stakingContract)) | |
885 | + | then true | |
886 | + | else mustManager(i) | |
887 | + | if ((checkCaller == checkCaller)) | |
888 | + | then { | |
889 | + | let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge) | |
890 | + | $Tuple2(actions, unit) | |
891 | + | } | |
892 | + | else throw("Strict value is not equal to itself.") | |
893 | + | } | |
894 | + | ||
895 | + | ||
896 | + | ||
897 | + | @Callable(i) | |
898 | + | func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr)) | |
899 | + | ||
900 | + | ||
901 | + | ||
902 | + | @Callable(i) | |
768 | 903 | func setManager (pendingManagerPublicKey) = { | |
769 | 904 | let checkCaller = mustManager(i) | |
770 | 905 | if ((checkCaller == checkCaller)) | |
771 | 906 | then { | |
772 | 907 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
773 | 908 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
774 | 909 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
775 | 910 | else throw("Strict value is not equal to itself.") | |
776 | 911 | } | |
777 | 912 | else throw("Strict value is not equal to itself.") | |
778 | 913 | } | |
779 | 914 | ||
780 | 915 | ||
781 | 916 | ||
782 | 917 | @Callable(i) | |
783 | 918 | func confirmManager () = { | |
784 | 919 | let pm = pendingManagerPublicKeyOrUnit() | |
785 | 920 | let hasPM = if (isDefined(pm)) | |
786 | 921 | then true | |
787 | 922 | else throw("No pending manager") | |
788 | 923 | if ((hasPM == hasPM)) | |
789 | 924 | then { | |
790 | 925 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
791 | 926 | then true | |
792 | 927 | else throw("You are not pending manager") | |
793 | 928 | if ((checkPM == checkPM)) | |
794 | 929 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
795 | 930 | else throw("Strict value is not equal to itself.") | |
796 | 931 | } | |
797 | 932 | else throw("Strict value is not equal to itself.") | |
798 | 933 | } | |
799 | 934 | ||
800 | 935 | ||
801 | 936 | @Verifier(tx) | |
802 | 937 | func verify () = { | |
803 | 938 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
804 | 939 | case pk: ByteVector => | |
805 | 940 | pk | |
806 | 941 | case _: Unit => | |
807 | 942 | tx.senderPublicKey | |
808 | 943 | case _ => | |
809 | 944 | throw("Match error") | |
810 | 945 | } | |
811 | 946 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
812 | 947 | } | |
813 | 948 |
github/deemru/w8io/026f985 89.90 ms ◑