tx · J6oafqUARy7qQB7wD7UspwYNwJYcB9oTkwCwm889Y3Pk

3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy:  -0.02700000 Waves

2023.03.06 11:02 [2477962] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves

{ "type": 13, "id": "J6oafqUARy7qQB7wD7UspwYNwJYcB9oTkwCwm889Y3Pk", "fee": 2700000, "feeAssetId": null, "timestamp": 1678089791593, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "3XRDTCJnWKxiyjmtek8sbTSYFPty4miioWTiVUg1P5oWCAJN4fqk5nmFqQgzWbPN59CqPpYtH4LHMSjc6zf6wx1C" ], "script": "base64:BgKWLwgCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIECgIIARIAEgASBQoDCAgEEgMKAQgSBAoCCAgSAwoBCBIAIgNTRVAiBlNDQUxFOCIFTVVMVDgiDlBPT0xXRUlHSFRNVUxUIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIgRzdHJmIgdhZGRyZXNzIgNrZXkiA2lveiIDaW9kIgpkZWZhdWx0VmFsIgNpb2YiA2FicyIDdmFsIgNhYWwiByRtYXRjaDAiCnZhbEFueUx5c3QiAmFpIgZ2YWxJbnQiG2tleVJlZmVycmFsc0NvbnRyYWN0QWRkcmVzcyIecmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzT3JGYWlsIhZrZXlSZWZlcnJhbFByb2dyYW1OYW1lIhpyZWZlcnJhbFByb2dyYW1OYW1lRGVmYXVsdCITcmVmZXJyYWxQcm9ncmFtTmFtZSIRa2V5RmFjdG9yeUFkZHJlc3MiGElkeEZhY3RvcnlDZmdTdGFraW5nRGFwcCIZSWR4RmFjdG9yeUNmZ0Jvb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FJARxnZXRVc2VyVm90ZUZpbmFsaXplZFJFQURPTkxZAgJjUgJkZwkAlAoCBQNuaWwJAQJkaAIFAmNSBQJkZwJhSQEKc2V0TWFuYWdlcgECZmwEAmVPCQECYUgBBQJhSQMJAAACBQJlTwUCZU8EAmZtCQDZBAEFAmZsAwkAAAIFAmZtBQJmbQkAzAgCCQELU3RyaW5nRW50cnkCCQECYWcABQJmbAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAmFJAQ5jb25maXJtTWFuYWdlcgAEAmZuCQECYUcABAJmbwMJAQlpc0RlZmluZWQBBQJmbgYJAAIBAhJObyBwZW5kaW5nIG1hbmFnZXIDCQAAAgUCZm8FAmZvBAJmcAMJAAACCAUCYUkPY2FsbGVyUHVibGljS2V5CQEFdmFsdWUBBQJmbgYJAAIBAhtZb3UgYXJlIG5vdCBwZW5kaW5nIG1hbmFnZXIDCQAAAgUCZnAFAmZwCQDMCAIJAQtTdHJpbmdFbnRyeQIJAQJhZgAJANgEAQkBBXZhbHVlAQUCZm4JAMwIAgkBC0RlbGV0ZUVudHJ5AQkBAmFnAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJmcQECZnIABAJmcwQBcgkBAmFFAAMJAAECBQFyAgpCeXRlVmVjdG9yBAJhSwUBcgUCYUsDCQABAgUBcgIEVW5pdAgFAmZxD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJmcQlib2R5Qnl0ZXMJAJEDAggFAmZxBnByb29mcwAABQJmc/AtCbE=", "height": 2477962, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CQzU9r9DqQ5WQeJEyU33WSZvCsjCxJSSHZBUL2RdE8Up Next: Hkej6GwbU1AoCSa3oQtbstngyajtZyhmVKoMnHVRGKLx Diff:
OldNewDifferences
136136
137137
138138 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
139+
140+
141+func keyBoostingV2LastUpdateHeight () = "%s%s__boostingV2__startBlock"
142+
143+
144+func keyBoostingV2Integral () = "%s%s__boostingV2__integral"
139145
140146
141147 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
277283 func keyStatsUsersCount () = "%s%s__stats__activeUsersCount"
278284
279285
280-func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastInt", userNum], SEP)
286+func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum], SEP)
281287
282288
283-func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastInt", userNum, lpAssetId], SEP)
289+func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum, lpAssetId], SEP)
284290
285291
286292 func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP)
311317
312318 let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg)
313319
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"))
320+let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
321+
322+let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
323+
324+let boostCoeff = {
325+ let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
326+ if ($isInstanceOf(@, "Int"))
327+ then @
328+ else throw(($getType(@) + " couldn't be cast to Int"))
329+ }
315330
316331 func getTotalCachedGwx (correct) = {
317- let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
318- let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
319332 let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
320333 let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
321334 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
401414 func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height)
402415
403416
417+func getVotingEmissionEpochInfo () = {
418+ let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
419+ let $t01483815126 = {
420+ let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
421+ let lastFinalizedEpoch = (currentEpochUi - 1)
422+ if ((0 > lastFinalizedEpoch))
423+ then throwErr("invalid epoch")
424+ else $Tuple2(currentEpochUi, lastFinalizedEpoch)
425+ }
426+ let currentEpochUi = $t01483815126._1
427+ let lastFinalizedEpoch = $t01483815126._2
428+ func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
429+
430+ let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
431+ $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
432+ }
433+
434+
435+func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
436+ let idxAmountAssetId = 4
437+ let idxPriceAssetId = 5
438+ let poolCfg = {
439+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
440+ if ($isInstanceOf(@, "List[Any]"))
441+ then @
442+ else throw(($getType(@) + " couldn't be cast to List[Any]"))
443+ }
444+ let amountAssetId = {
445+ let @ = poolCfg[idxAmountAssetId]
446+ if ($isInstanceOf(@, "String"))
447+ then @
448+ else throw(($getType(@) + " couldn't be cast to String"))
449+ }
450+ let priceAssetId = {
451+ let @ = poolCfg[idxPriceAssetId]
452+ if ($isInstanceOf(@, "String"))
453+ then @
454+ else throw(($getType(@) + " couldn't be cast to String"))
455+ }
456+ $Tuple2(amountAssetId, priceAssetId)
457+ }
458+
459+
460+func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
461+
462+
463+func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
464+
465+
466+func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
467+
468+
469+func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
470+
471+
472+func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
473+
474+
475+func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
476+
477+
478+func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
479+
480+
481+func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralsLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
482+
483+
484+func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
485+
486+
487+func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
488+ let userAddress = addressFromStringValue(userAddressStr)
489+ let $t01791717997 = getVotingEmissionEpochInfo()
490+ let lastFinalizedEpoch = $t01791717997._1
491+ let currentEpochStartHeight = $t01791717997._2
492+ let $t01800018075 = getPoolAssetsByLpAssetId(lpAssetIdStr)
493+ let amountAssetId = $t01800018075._1
494+ let priceAssetId = $t01800018075._2
495+ let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
496+ let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
497+ userVote
498+ }
499+
500+
501+func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
502+ let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
503+ let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
504+ if ((stakedByUser == 0))
505+ then 0
506+ else userVote
507+ }
508+
509+
510+func getVotingResultStaked (lpAssetIdStr) = {
511+ let $t01861918699 = getVotingEmissionEpochInfo()
512+ let lastFinalizedEpoch = $t01861918699._1
513+ let currentEpochStartHeight = $t01861918699._2
514+ let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
515+ let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
516+ votingResultStaked
517+ }
518+
519+
520+func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
521+ let $t01922019300 = getVotingEmissionEpochInfo()
522+ let lastFinalizedEpoch = $t01922019300._1
523+ let currentEpochStartHeight = $t01922019300._2
524+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
525+ let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
526+ let votingResultStakedIntegralKey = keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)
527+ let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
528+ let votingResultLastUpdateHeightKey = keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)
529+ let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, votingResultLastUpdateHeightKey), currentEpochStartHeight)
530+ let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
531+ let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
532+ $Tuple2([IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(votingResultLastUpdateHeightKey, height), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], votingResultStakedIntegral)
533+ }
534+
535+
536+func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
537+ let $t02050020580 = getVotingEmissionEpochInfo()
538+ let lastFinalizedEpoch = $t02050020580._1
539+ let currentEpochStartHeight = $t02050020580._2
540+ let userAddress = addressFromStringValue(userAddressStr)
541+ let idxAmountAssetId = 4
542+ let idxPriceAssetId = 5
543+ let poolCfg = {
544+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
545+ if ($isInstanceOf(@, "List[Any]"))
546+ then @
547+ else throw(($getType(@) + " couldn't be cast to List[Any]"))
548+ }
549+ let amountAssetId = {
550+ let @ = poolCfg[idxAmountAssetId]
551+ if ($isInstanceOf(@, "String"))
552+ then @
553+ else throw(($getType(@) + " couldn't be cast to String"))
554+ }
555+ let priceAssetId = {
556+ let @ = poolCfg[idxPriceAssetId]
557+ if ($isInstanceOf(@, "String"))
558+ then @
559+ else throw(($getType(@) + " couldn't be cast to String"))
560+ }
561+ let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
562+ let actions = if ((userVote == 0))
563+ then nil
564+ else {
565+ let stakedVoteDelta = if (edge)
566+ then userVote
567+ else -(userVote)
568+ let $t02118521304 = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
569+ let votingResultActions = $t02118521304._1
570+ let votingResultStakedIntegral = $t02118521304._2
571+ let userVoteStaked = if (edge)
572+ then 0
573+ else userVote
574+ let userVoteStakedIntegralKey = keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)
575+ let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
576+ let userVoteStakedLastUpdateHeightKey = keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)
577+ let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, userVoteStakedLastUpdateHeightKey), currentEpochStartHeight)
578+ let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
579+ let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
580+ let voteActions = [IntegerEntry(userVoteStakedLastUpdateHeightKey, height), IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral)]
581+ (votingResultActions ++ voteActions)
582+ }
583+ actions
584+ }
585+
586+
587+func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
588+ let $t02229622376 = getVotingEmissionEpochInfo()
589+ let lastFinalizedEpoch = $t02229622376._1
590+ let currentEpochStartHeight = $t02229622376._2
591+ let userAddress = addressFromStringValue(userAddressStr)
592+ let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
593+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
594+ let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
595+ let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
596+ let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
597+ let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
598+ let userVoteStakedIntegralKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
599+ let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
600+ let votingResultStakedIntegralKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
601+ let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
602+ let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
603+ let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
604+ let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
605+ let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
606+ let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
607+ let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
608+ $Tuple3([IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
609+ }
610+
611+
612+func refreshBoostEmissionIntegral () = {
613+ let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
614+ let boostingV2LastUpdateHeightOption = getInteger(this, keyBoostingV2LastUpdateHeight())
615+ let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
616+ let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
617+ let h = if ((height > emissionEnd))
618+ then emissionEnd
619+ else height
620+ let dh = match boostingV2LastUpdateHeightOption {
621+ case lastUpdateHeight: Int =>
622+ max([(h - lastUpdateHeight), 0])
623+ case _: Unit =>
624+ 0
625+ case _ =>
626+ throw("Match error")
627+ }
628+ let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
629+ let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
630+ let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
631+ $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
632+ }
633+
634+
404635 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
405- let EMPTY = "EMPTY"
406- let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
407- if ((userRecordOrEmpty == EMPTY))
636+ let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
637+ if ((userRecordOption == unit))
408638 then $Tuple3(0, nil, "userRecord::is::empty")
409639 else {
410- let userRecordArray = split(userRecordOrEmpty, SEP)
640+ let userRecordArray = split(value(userRecordOption), SEP)
411641 let userNumStr = userRecordArray[IdxLockUserNum]
412- let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
413642 let EMPTYSTR = "empty"
414- let $t01539715965 = if ((lpAssetIdStr != EMPTYSTR))
643+ let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
415644 then {
416645 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
417- let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
418- let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
419- $Tuple2(pw0, pw1)
646+ getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
420647 }
421648 else if (readOnly)
422- then $Tuple2(0, 0)
649+ then 0
423650 else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr))
424- let poolWeight0 = $t01539715965._1
425- let poolWeight1 = $t01539715965._2
426- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
427- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
428- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
429- let h = if ((height > emissionEnd))
430- then emissionEnd
431- else height
432- let dh = max([(h - emissionStart), 0])
433651 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
434652 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
435653 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
436- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
654+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
437655 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
438- let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock))
439- let uLastH = (h - udh)
440- let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0])
441- let udh1 = ((h - uLastH) - udh0)
442- if (if (if ((0 > uLastH))
443- then true
444- else (0 > udh1))
445- then true
446- else (abs(((udh0 + udh1) - udh)) >= 1))
447- then throw(((((((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1)) + " lpAssetId=") + lpAssetIdStr) + " userAddress=") + userAddressStr))
448- else if ((0 > userBoostEmissionIntegral))
449- then throw("wrong calculations")
450- else {
451- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
452- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
453- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
454- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
455- let totalCachedGwxCorrected = getTotalCachedGwx(true)
456- let userCurrGwx = calcCurrentGwxAmount(userAddressStr)
457- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
458- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
459- let userBoostEmissionIntegral0 = if ((udh == 0))
460- then 0
461- else fraction(userBoostEmissionIntegral, udh0, udh)
462- let userBoostEmissionIntegral1 = if ((udh == 0))
463- then 0
464- else fraction(userBoostEmissionIntegral, udh1, udh)
465- let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT)
466- let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT)
467- let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0))
468- then 0
469- else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected)
470- let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0))
471- then 0
472- else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected)
473- let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1)
474- let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr)
475- let userBoostClaimed = ioz(this, userBoostClaimedKEY)
476- let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed)
477- let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)]
478- 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- $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
480- }
656+ if ((0 > userBoostEmissionIntegral))
657+ then throw("wrong calculations")
658+ else {
659+ let $t02688927028 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
660+ let stakedVotesIntegralsActions = $t02688927028._1
661+ let userVoteIntegralDiff = $t02688927028._2
662+ let totalVotesIntegralDiff = $t02688927028._3
663+ let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
664+ let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
665+ then 0
666+ else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
667+ let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
668+ let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
669+ $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
670+ }
481671 }
482672 }
483673
508698 let startBlockKEY = keyLockParamStartBlock(userNumStr)
509699 let durationKEY = keyLockParamDuration(userNumStr)
510700 let userAmountKEY = keyLockParamUserAmount(userNumStr)
511- if (if ((minLockAmount > pmtAmount))
512- then (i.caller != lpStakingPoolsContract)
513- else false)
701+ if ((minLockAmount > pmtAmount))
514702 then throw(("amount is less then minLockAmount=" + toString(minLockAmount)))
515703 else if ((minLockDuration > duration))
516704 then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration)))
529717 let k = ai(gWxParamsResultList[0])
530718 let b = ai(gWxParamsResultList[1])
531719 let period = toString(ai(gWxParamsResultList[2]))
532- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
533- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
534- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
535- let h = if ((height > emissionEnd))
536- then emissionEnd
537- else height
538- let dh = max([(h - emissionStart), 0])
720+ let totalCachedGwxRaw = getTotalCachedGwx(false)
539721 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
540- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
541- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
542- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
543- let userMaxBoostInt = ((gWxAmountStart * duration) / 2)
544- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
545- let totalCachedGwxRaw = getTotalCachedGwx(false)
722+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
546723 let arr = if (userIsExisting)
547724 then nil
548725 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
567744
568745 @Callable(i)
569746 func lockRef (duration,referrerAddress,signature) = {
570- let $t02443024495 = lockActions(i, duration)
571- let lockActionsResult = $t02443024495._1
572- let gWxAmountStart = $t02443024495._2
747+ let $t03157831643 = lockActions(i, duration)
748+ let lockActionsResult = $t03157831643._1
749+ let gWxAmountStart = $t03157831643._2
573750 let referralAddress = toString(i.caller)
574751 let refInv = if (if ((referrerAddress == ""))
575752 then true
590767
591768 @Callable(i)
592769 func lock (duration) = {
593- let $t02495325018 = lockActions(i, duration)
594- let lockActionsResult = $t02495325018._1
595- let gWxAmountStart = $t02495325018._2
770+ let $t03210132166 = lockActions(i, duration)
771+ let lockActionsResult = $t03210132166._1
772+ let gWxAmountStart = $t03210132166._2
596773 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
597774 if ((updateRefActivity == updateRefActivity))
598775 then $Tuple2(lockActionsResult, unit)
636813 let k = ai(gWxParamsResultList[0])
637814 let b = ai(gWxParamsResultList[1])
638815 let period = toString(ai(gWxParamsResultList[2]))
639- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
640- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
641- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
642- let h = if ((height > emissionEnd))
643- then emissionEnd
644- else height
645- let dh = max([(h - emissionStart), 0])
646- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
647- let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY)
648- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
649- let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
650- if ((0 > userBoostEmissionIntegral))
651- then throw("wrong calculations")
816+ let currUserGwx = calcCurrentGwxAmount(userAddressStr)
817+ let gwxDiff = (gWxAmountStart - currUserGwx)
818+ if ((0 > gwxDiff))
819+ then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
652820 else {
653- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
654- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
655- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
656- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
657- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
658- let gwxDiff = (gWxAmountStart - currUserGwx)
659- if ((0 > gwxDiff))
660- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
661- else {
662- let totalCachedGwxRaw = getTotalCachedGwx(false)
663- let totalCachedGwxCorrected = getTotalCachedGwx(true)
664- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
665- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
666- let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected)
667- let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2)
668- let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2)
669- let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt)
670- (((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- }
821+ let totalCachedGwxRaw = getTotalCachedGwx(false)
822+ let totalCachedGwxCorrected = getTotalCachedGwx(true)
823+ (((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))])
672824 }
673825 }
674826 else throw("Strict value is not equal to itself.")
681833 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
682834 then throw("permissions denied")
683835 else {
684- let $t02999930101 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
685- let userBoostAvailable = $t02999930101._1
686- let dataState = $t02999930101._2
687- let debug = $t02999930101._3
836+ let $t03525335355 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
837+ let userBoostAvailable = $t03525335355._1
838+ let dataState = $t03525335355._2
839+ let debug = $t03525335355._3
688840 $Tuple2(dataState, [userBoostAvailable])
689841 }
690842
692844
693845 @Callable(i)
694846 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
695- let $t03023330334 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
696- let userBoostAvailable = $t03023330334._1
697- let dataState = $t03023330334._2
698- let debug = $t03023330334._3
847+ let $t03548735588 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
848+ let userBoostAvailable = $t03548735588._1
849+ let dataState = $t03548735588._2
850+ let debug = $t03548735588._3
699851 $Tuple2(nil, [userBoostAvailable, debug])
700852 }
701853
732884
733885
734886 @Callable(i)
735-func userMaxDurationREADONLY (userAddressStr) = {
736- let cfgArray = readConfigArrayOrFail()
737- let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
738- let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
739- if ((userRecordOption == unit))
740- then $Tuple2(nil, $Tuple2("lock", maxLockDuration))
741- else {
742- let userRecordArray = split(value(userRecordOption), SEP)
743- let lockStart = parseIntValue(userRecordArray[IdxLockStart])
744- let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
745- let lockEnd = (lockStart + lockDuration)
746- let remainingDuration = max([(lockEnd - height), 0])
747- let maxDeltaDuration = (maxLockDuration - remainingDuration)
748- $Tuple2(nil, $Tuple2("increaseLock", maxDeltaDuration))
749- }
750- }
751-
752-
753-
754-@Callable(i)
755887 func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = {
756888 let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight)
757889 $Tuple2(nil, gwxAmount)
761893
762894 @Callable(i)
763895 func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true))
896+
897+
898+
899+@Callable(i)
900+func onBoostEmissionUpdate () = {
901+ let checkCaller = if ((i.caller == emissionContract))
902+ then true
903+ else mustManager(i)
904+ if ((checkCaller == checkCaller))
905+ then refreshBoostEmissionIntegral()
906+ else throw("Strict value is not equal to itself.")
907+ }
908+
909+
910+
911+@Callable(i)
912+func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
913+ let checkCaller = if ((i.caller == stakingContract))
914+ then true
915+ else mustManager(i)
916+ if ((checkCaller == checkCaller))
917+ then {
918+ let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
919+ $Tuple2(nil, unit)
920+ }
921+ else throw("Strict value is not equal to itself.")
922+ }
923+
924+
925+
926+@Callable(i)
927+func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
928+
929+
930+
931+@Callable(i)
932+func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
764933
765934
766935
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let SCALE8 = 8
77
88 let MULT8 = 100000000
99
1010 let POOLWEIGHTMULT = MULT8
1111
1212 func wrapErr (msg) = makeString(["boosting.ride:", msg], " ")
1313
1414
1515 func throwErr (msg) = throw(wrapErr(msg))
1616
1717
1818 func strf (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined"))
1919
2020
2121 func ioz (address,key) = valueOrElse(getInteger(address, key), 0)
2222
2323
2424 func iod (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal)
2525
2626
2727 func iof (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined"))
2828
2929
3030 func abs (val) = if ((0 > val))
3131 then -(val)
3232 else val
3333
3434
3535 func aal (val) = match val {
3636 case valAnyLyst: List[Any] =>
3737 valAnyLyst
3838 case _ =>
3939 throw("fail to cast into List[Any]")
4040 }
4141
4242
4343 func ai (val) = match val {
4444 case valInt: Int =>
4545 valInt
4646 case _ =>
4747 throw("fail to cast into Int")
4848 }
4949
5050
5151 func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP)
5252
5353
5454 let referralsContractAddressOrFail = addressFromStringValue(strf(this, keyReferralsContractAddress()))
5555
5656 let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP)
5757
5858 let referralProgramNameDefault = "wxlock"
5959
6060 let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault)
6161
6262 func keyFactoryAddress () = "%s%s__config__factoryAddress"
6363
6464
6565 let IdxFactoryCfgStakingDapp = 1
6666
6767 let IdxFactoryCfgBoostingDapp = 2
6868
6969 let IdxFactoryCfgIdoDapp = 3
7070
7171 let IdxFactoryCfgTeamDapp = 4
7272
7373 let IdxFactoryCfgEmissionDapp = 5
7474
7575 let IdxFactoryCfgRestDapp = 6
7676
7777 let IdxFactoryCfgSlippageDapp = 7
7878
7979 let IdxFactoryCfgDaoDapp = 8
8080
8181 let IdxFactoryCfgMarketingDapp = 9
8282
8383 let IdxFactoryCfgGwxRewardDapp = 10
8484
8585 let IdxFactoryCfgBirdsDapp = 11
8686
8787 func keyFactoryCfg () = "%s__factoryConfig"
8888
8989
9090 func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
9191
9292
9393 func keyFactoryLpList () = "%s__lpTokensList"
9494
9595
9696 func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
9797
9898
9999 func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
100100
101101
102102 func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num))
103103
104104
105105 func readFactoryAddressOrFail () = addressFromStringValue(strf(this, keyFactoryAddress()))
106106
107107
108108 func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
109109
110110
111111 func readFactoryCfgOrFail (factory) = split(strf(factory, keyFactoryCfg()), SEP)
112112
113113
114114 func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
115115
116116
117117 func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
118118
119119
120120 func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
121121
122122
123123 func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
124124
125125
126126 func keyManagerPublicKey () = "%s__managerPublicKey"
127127
128128
129129 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
130130
131131
132132 func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
133133
134134
135135 func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
136136
137137
138138 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
139+
140+
141+func keyBoostingV2LastUpdateHeight () = "%s%s__boostingV2__startBlock"
142+
143+
144+func keyBoostingV2Integral () = "%s%s__boostingV2__integral"
139145
140146
141147 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
142148
143149
144150 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
145151
146152
147153 func keyNextPeriod () = "%s__nextPeriod"
148154
149155
150156 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
151157
152158
153159 let IdxCfgAssetId = 1
154160
155161 let IdxCfgMinLockAmount = 2
156162
157163 let IdxCfgMinLockDuration = 3
158164
159165 let IdxCfgMaxLockDuration = 4
160166
161167 let IdxCfgMathContract = 5
162168
163169 func keyConfig () = "%s__config"
164170
165171
166172 func readConfigArrayOrFail () = split(strf(this, keyConfig()), SEP)
167173
168174
169175 let mathContract = addressFromStringValue(readConfigArrayOrFail()[IdxCfgMathContract])
170176
171177 func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP)
172178
173179
174180 func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract)
175181
176182
177183 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
178184 case s: String =>
179185 fromBase58String(s)
180186 case _: Unit =>
181187 unit
182188 case _ =>
183189 throw("Match error")
184190 }
185191
186192
187193 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
188194 case s: String =>
189195 fromBase58String(s)
190196 case _: Unit =>
191197 unit
192198 case _ =>
193199 throw("Match error")
194200 }
195201
196202
197203 func mustManager (i) = {
198204 let pd = throw("Permission denied")
199205 match managerPublicKeyOrUnit() {
200206 case pk: ByteVector =>
201207 if ((i.callerPublicKey == pk))
202208 then true
203209 else pd
204210 case _: Unit =>
205211 if ((i.caller == this))
206212 then true
207213 else pd
208214 case _ =>
209215 throw("Match error")
210216 }
211217 }
212218
213219
214220 let IdxLockUserNum = 1
215221
216222 let IdxLockAmount = 2
217223
218224 let IdxLockStart = 3
219225
220226 let IdxLockDuration = 4
221227
222228 let IdxLockParamK = 5
223229
224230 let IdxLockParamB = 6
225231
226232 func keyLockParamsRecord (userAddress) = makeString(["%s%s__lock", userAddress], SEP)
227233
228234
229235 func readLockParamsRecordOrFail (userAddress) = split(strf(this, keyLockParamsRecord(userAddress)), SEP)
230236
231237
232238 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)
233239
234240
235241 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))
236242
237243
238244 func keyNextUserNum () = "%s__nextUserNum"
239245
240246
241247 func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP)
242248
243249
244250 func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP)
245251
246252
247253 func keyLockParamUserAmount (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "amount"], SEP)
248254
249255
250256 func keyLockParamStartBlock (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "start"], SEP)
251257
252258
253259 func keyLockParamDuration (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "duration"], SEP)
254260
255261
256262 func keyLockParamK (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "k"], SEP)
257263
258264
259265 func keyLockParamB (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "b"], SEP)
260266
261267
262268 func keyLockParamByPeriodK (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "k", period], SEP)
263269
264270
265271 func keyLockParamByPeriodB (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "b", period], SEP)
266272
267273
268274 func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked"
269275
270276
271277 func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks"
272278
273279
274280 func keyStatsLocksCount () = "%s%s__stats__locksCount"
275281
276282
277283 func keyStatsUsersCount () = "%s%s__stats__activeUsersCount"
278284
279285
280-func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastInt", userNum], SEP)
286+func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum], SEP)
281287
282288
283-func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastInt", userNum, lpAssetId], SEP)
289+func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum, lpAssetId], SEP)
284290
285291
286292 func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP)
287293
288294
289295 func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total"
290296
291297
292298 func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", userNum], SEP)
293299
294300
295301 func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", userNum], SEP)
296302
297303
298304 func keyTotalCachedGwx () = "%s%s__gwxCached__total"
299305
300306
301307 func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective"
302308
303309
304310 let factoryContract = readFactoryAddressOrFail()
305311
306312 let factoryCfg = readFactoryCfgOrFail(factoryContract)
307313
308314 let emissionContract = getEmissionAddressOrFail(factoryCfg)
309315
310316 let stakingContract = getStakingAddressOrFail(factoryCfg)
311317
312318 let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg)
313319
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"))
320+let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
321+
322+let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
323+
324+let boostCoeff = {
325+ let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
326+ if ($isInstanceOf(@, "Int"))
327+ then @
328+ else throw(($getType(@) + " couldn't be cast to Int"))
329+ }
315330
316331 func getTotalCachedGwx (correct) = {
317- let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
318- let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
319332 let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
320333 let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
321334 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
322335 let targetEpochOption = getInteger(this, keyTargetEpoch)
323336 let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0)
324337 let isCorrectionActivated = if (isDefined(targetEpochOption))
325338 then (currentEpochUi >= value(targetEpochOption))
326339 else false
327340 let corrective = if (if (isCorrectionActivated)
328341 then correct
329342 else false)
330343 then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0)
331344 else 0
332345 max([0, (totalCachedGwxRaw + corrective)])
333346 }
334347
335348
336349 func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = {
337350 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
338351 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)
339352 StringEntry(historyKEY, historyDATA)
340353 }
341354
342355
343356 func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = {
344357 let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks()
345358 let locksCountKEY = keyStatsLocksCount()
346359 let usersCountKEY = keyStatsUsersCount()
347360 let totalAmountKEY = keyLockParamTotalAmount()
348361 let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY)
349362 let locksCount = ioz(this, locksCountKEY)
350363 let usersCount = ioz(this, usersCountKEY)
351364 let totalAmount = ioz(this, totalAmountKEY)
352365 [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))]
353366 }
354367
355368
356369 func calcGwxAmount (kRaw,bRaw,h) = {
357370 let SCALE = 1000
358371 (((kRaw * h) + bRaw) / SCALE)
359372 }
360373
361374
362375 func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = {
363376 let userAmountKEY = keyLockParamUserAmount(userNum)
364377 let startBlockKEY = keyLockParamStartBlock(userNum)
365378 let durationKEY = keyLockParamDuration(userNum)
366379 let kKEY = keyLockParamK(userNum)
367380 let bKEY = keyLockParamB(userNum)
368381 let kByPeriodKEY = keyLockParamByPeriodK(userNum, period)
369382 let bByPeriodKEY = keyLockParamByPeriodB(userNum, period)
370383 let gwxAmount = calcGwxAmount(k, b, height)
371384 [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))]
372385 }
373386
374387
375388 func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1))
376389 then throw("only one payment is allowed")
377390 else if ((size(i.payments) == 0))
378391 then 0
379392 else {
380393 let pmt = i.payments[0]
381394 if ((value(pmt.assetId) != expectedAssetId))
382395 then throw("invalid asset id in payment")
383396 else pmt.amount
384397 }
385398
386399
387400 func calcUserGwxAmountAtHeight (userAddress,targetHeight) = {
388401 let EMPTY = "empty"
389402 let user2NumMappingKEY = keyUser2NumMapping(userAddress)
390403 let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY)
391404 let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0)
392405 let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0)
393406 let gwxAmountCalc = calcGwxAmount(k, b, targetHeight)
394407 let gwxAmount = if ((0 > gwxAmountCalc))
395408 then 0
396409 else gwxAmountCalc
397410 gwxAmount
398411 }
399412
400413
401414 func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height)
402415
403416
417+func getVotingEmissionEpochInfo () = {
418+ let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
419+ let $t01483815126 = {
420+ let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
421+ let lastFinalizedEpoch = (currentEpochUi - 1)
422+ if ((0 > lastFinalizedEpoch))
423+ then throwErr("invalid epoch")
424+ else $Tuple2(currentEpochUi, lastFinalizedEpoch)
425+ }
426+ let currentEpochUi = $t01483815126._1
427+ let lastFinalizedEpoch = $t01483815126._2
428+ func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
429+
430+ let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
431+ $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
432+ }
433+
434+
435+func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
436+ let idxAmountAssetId = 4
437+ let idxPriceAssetId = 5
438+ let poolCfg = {
439+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
440+ if ($isInstanceOf(@, "List[Any]"))
441+ then @
442+ else throw(($getType(@) + " couldn't be cast to List[Any]"))
443+ }
444+ let amountAssetId = {
445+ let @ = poolCfg[idxAmountAssetId]
446+ if ($isInstanceOf(@, "String"))
447+ then @
448+ else throw(($getType(@) + " couldn't be cast to String"))
449+ }
450+ let priceAssetId = {
451+ let @ = poolCfg[idxPriceAssetId]
452+ if ($isInstanceOf(@, "String"))
453+ then @
454+ else throw(($getType(@) + " couldn't be cast to String"))
455+ }
456+ $Tuple2(amountAssetId, priceAssetId)
457+ }
458+
459+
460+func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
461+
462+
463+func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
464+
465+
466+func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
467+
468+
469+func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
470+
471+
472+func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
473+
474+
475+func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
476+
477+
478+func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
479+
480+
481+func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralsLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
482+
483+
484+func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
485+
486+
487+func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
488+ let userAddress = addressFromStringValue(userAddressStr)
489+ let $t01791717997 = getVotingEmissionEpochInfo()
490+ let lastFinalizedEpoch = $t01791717997._1
491+ let currentEpochStartHeight = $t01791717997._2
492+ let $t01800018075 = getPoolAssetsByLpAssetId(lpAssetIdStr)
493+ let amountAssetId = $t01800018075._1
494+ let priceAssetId = $t01800018075._2
495+ let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
496+ let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
497+ userVote
498+ }
499+
500+
501+func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
502+ let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
503+ let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
504+ if ((stakedByUser == 0))
505+ then 0
506+ else userVote
507+ }
508+
509+
510+func getVotingResultStaked (lpAssetIdStr) = {
511+ let $t01861918699 = getVotingEmissionEpochInfo()
512+ let lastFinalizedEpoch = $t01861918699._1
513+ let currentEpochStartHeight = $t01861918699._2
514+ let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
515+ let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
516+ votingResultStaked
517+ }
518+
519+
520+func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
521+ let $t01922019300 = getVotingEmissionEpochInfo()
522+ let lastFinalizedEpoch = $t01922019300._1
523+ let currentEpochStartHeight = $t01922019300._2
524+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
525+ let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
526+ let votingResultStakedIntegralKey = keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)
527+ let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
528+ let votingResultLastUpdateHeightKey = keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)
529+ let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, votingResultLastUpdateHeightKey), currentEpochStartHeight)
530+ let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
531+ let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
532+ $Tuple2([IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(votingResultLastUpdateHeightKey, height), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], votingResultStakedIntegral)
533+ }
534+
535+
536+func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
537+ let $t02050020580 = getVotingEmissionEpochInfo()
538+ let lastFinalizedEpoch = $t02050020580._1
539+ let currentEpochStartHeight = $t02050020580._2
540+ let userAddress = addressFromStringValue(userAddressStr)
541+ let idxAmountAssetId = 4
542+ let idxPriceAssetId = 5
543+ let poolCfg = {
544+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
545+ if ($isInstanceOf(@, "List[Any]"))
546+ then @
547+ else throw(($getType(@) + " couldn't be cast to List[Any]"))
548+ }
549+ let amountAssetId = {
550+ let @ = poolCfg[idxAmountAssetId]
551+ if ($isInstanceOf(@, "String"))
552+ then @
553+ else throw(($getType(@) + " couldn't be cast to String"))
554+ }
555+ let priceAssetId = {
556+ let @ = poolCfg[idxPriceAssetId]
557+ if ($isInstanceOf(@, "String"))
558+ then @
559+ else throw(($getType(@) + " couldn't be cast to String"))
560+ }
561+ let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
562+ let actions = if ((userVote == 0))
563+ then nil
564+ else {
565+ let stakedVoteDelta = if (edge)
566+ then userVote
567+ else -(userVote)
568+ let $t02118521304 = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
569+ let votingResultActions = $t02118521304._1
570+ let votingResultStakedIntegral = $t02118521304._2
571+ let userVoteStaked = if (edge)
572+ then 0
573+ else userVote
574+ let userVoteStakedIntegralKey = keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)
575+ let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
576+ let userVoteStakedLastUpdateHeightKey = keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)
577+ let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, userVoteStakedLastUpdateHeightKey), currentEpochStartHeight)
578+ let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
579+ let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
580+ let voteActions = [IntegerEntry(userVoteStakedLastUpdateHeightKey, height), IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral)]
581+ (votingResultActions ++ voteActions)
582+ }
583+ actions
584+ }
585+
586+
587+func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
588+ let $t02229622376 = getVotingEmissionEpochInfo()
589+ let lastFinalizedEpoch = $t02229622376._1
590+ let currentEpochStartHeight = $t02229622376._2
591+ let userAddress = addressFromStringValue(userAddressStr)
592+ let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
593+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
594+ let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
595+ let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
596+ let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
597+ let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
598+ let userVoteStakedIntegralKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
599+ let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
600+ let votingResultStakedIntegralKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
601+ let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
602+ let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
603+ let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
604+ let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
605+ let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
606+ let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
607+ let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
608+ $Tuple3([IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
609+ }
610+
611+
612+func refreshBoostEmissionIntegral () = {
613+ let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
614+ let boostingV2LastUpdateHeightOption = getInteger(this, keyBoostingV2LastUpdateHeight())
615+ let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
616+ let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
617+ let h = if ((height > emissionEnd))
618+ then emissionEnd
619+ else height
620+ let dh = match boostingV2LastUpdateHeightOption {
621+ case lastUpdateHeight: Int =>
622+ max([(h - lastUpdateHeight), 0])
623+ case _: Unit =>
624+ 0
625+ case _ =>
626+ throw("Match error")
627+ }
628+ let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
629+ let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
630+ let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
631+ $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
632+ }
633+
634+
404635 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
405- let EMPTY = "EMPTY"
406- let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
407- if ((userRecordOrEmpty == EMPTY))
636+ let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
637+ if ((userRecordOption == unit))
408638 then $Tuple3(0, nil, "userRecord::is::empty")
409639 else {
410- let userRecordArray = split(userRecordOrEmpty, SEP)
640+ let userRecordArray = split(value(userRecordOption), SEP)
411641 let userNumStr = userRecordArray[IdxLockUserNum]
412- let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
413642 let EMPTYSTR = "empty"
414- let $t01539715965 = if ((lpAssetIdStr != EMPTYSTR))
643+ let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
415644 then {
416645 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
417- let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
418- let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
419- $Tuple2(pw0, pw1)
646+ getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
420647 }
421648 else if (readOnly)
422- then $Tuple2(0, 0)
649+ then 0
423650 else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr))
424- let poolWeight0 = $t01539715965._1
425- let poolWeight1 = $t01539715965._2
426- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
427- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
428- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
429- let h = if ((height > emissionEnd))
430- then emissionEnd
431- else height
432- let dh = max([(h - emissionStart), 0])
433651 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
434652 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
435653 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
436- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
654+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
437655 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
438- let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock))
439- let uLastH = (h - udh)
440- let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0])
441- let udh1 = ((h - uLastH) - udh0)
442- if (if (if ((0 > uLastH))
443- then true
444- else (0 > udh1))
445- then true
446- else (abs(((udh0 + udh1) - udh)) >= 1))
447- then throw(((((((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1)) + " lpAssetId=") + lpAssetIdStr) + " userAddress=") + userAddressStr))
448- else if ((0 > userBoostEmissionIntegral))
449- then throw("wrong calculations")
450- else {
451- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
452- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
453- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
454- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
455- let totalCachedGwxCorrected = getTotalCachedGwx(true)
456- let userCurrGwx = calcCurrentGwxAmount(userAddressStr)
457- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
458- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
459- let userBoostEmissionIntegral0 = if ((udh == 0))
460- then 0
461- else fraction(userBoostEmissionIntegral, udh0, udh)
462- let userBoostEmissionIntegral1 = if ((udh == 0))
463- then 0
464- else fraction(userBoostEmissionIntegral, udh1, udh)
465- let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT)
466- let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT)
467- let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0))
468- then 0
469- else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected)
470- let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0))
471- then 0
472- else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected)
473- let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1)
474- let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr)
475- let userBoostClaimed = ioz(this, userBoostClaimedKEY)
476- let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed)
477- let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)]
478- 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- $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
480- }
656+ if ((0 > userBoostEmissionIntegral))
657+ then throw("wrong calculations")
658+ else {
659+ let $t02688927028 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
660+ let stakedVotesIntegralsActions = $t02688927028._1
661+ let userVoteIntegralDiff = $t02688927028._2
662+ let totalVotesIntegralDiff = $t02688927028._3
663+ let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
664+ let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
665+ then 0
666+ else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
667+ let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
668+ let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
669+ $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
670+ }
481671 }
482672 }
483673
484674
485675 func lockActions (i,duration) = {
486676 let cfgArray = readConfigArrayOrFail()
487677 let assetIdStr = cfgArray[IdxCfgAssetId]
488678 let assetId = fromBase58String(assetIdStr)
489679 let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount])
490680 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
491681 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
492682 if ((size(i.payments) != 1))
493683 then throw("invalid payment - exact one payment must be attached")
494684 else {
495685 let pmt = i.payments[0]
496686 let pmtAmount = pmt.amount
497687 if ((assetId != value(pmt.assetId)))
498688 then throw((("invalid asset is in payment - " + assetIdStr) + " is expected"))
499689 else {
500690 let nextUserNumKEY = keyNextUserNum()
501691 let userAddressStr = toString(i.caller)
502692 let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr)))
503693 let userNumStr = if (userIsExisting)
504694 then value(getString(keyUser2NumMapping(userAddressStr)))
505695 else toString(iof(this, nextUserNumKEY))
506696 let userNum = parseIntValue(userNumStr)
507697 let lockStart = height
508698 let startBlockKEY = keyLockParamStartBlock(userNumStr)
509699 let durationKEY = keyLockParamDuration(userNumStr)
510700 let userAmountKEY = keyLockParamUserAmount(userNumStr)
511- if (if ((minLockAmount > pmtAmount))
512- then (i.caller != lpStakingPoolsContract)
513- else false)
701+ if ((minLockAmount > pmtAmount))
514702 then throw(("amount is less then minLockAmount=" + toString(minLockAmount)))
515703 else if ((minLockDuration > duration))
516704 then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration)))
517705 else if ((duration > maxLockDuration))
518706 then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration)))
519707 else if (if (userIsExisting)
520708 then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart)
521709 else false)
522710 then throw("there is an active lock - consider to use increaseLock")
523711 else if ((ioz(this, userAmountKEY) > 0))
524712 then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY))
525713 else {
526714 let coeffX8 = fraction(duration, MULT8, maxLockDuration)
527715 let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8)
528716 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil))
529717 let k = ai(gWxParamsResultList[0])
530718 let b = ai(gWxParamsResultList[1])
531719 let period = toString(ai(gWxParamsResultList[2]))
532- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
533- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
534- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
535- let h = if ((height > emissionEnd))
536- then emissionEnd
537- else height
538- let dh = max([(h - emissionStart), 0])
720+ let totalCachedGwxRaw = getTotalCachedGwx(false)
539721 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
540- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
541- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
542- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
543- let userMaxBoostInt = ((gWxAmountStart * duration) / 2)
544- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
545- let totalCachedGwxRaw = getTotalCachedGwx(false)
722+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
546723 let arr = if (userIsExisting)
547724 then nil
548725 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
549726 $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting)
550727 then 0
551728 else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart)
552729 }
553730 }
554731 }
555732 }
556733
557734
558735 @Callable(i)
559736 func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = {
560737 let checkCaller = mustManager(i)
561738 if ((checkCaller == checkCaller))
562739 then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0))
563740 else throw("Strict value is not equal to itself.")
564741 }
565742
566743
567744
568745 @Callable(i)
569746 func lockRef (duration,referrerAddress,signature) = {
570- let $t02443024495 = lockActions(i, duration)
571- let lockActionsResult = $t02443024495._1
572- let gWxAmountStart = $t02443024495._2
747+ let $t03157831643 = lockActions(i, duration)
748+ let lockActionsResult = $t03157831643._1
749+ let gWxAmountStart = $t03157831643._2
573750 let referralAddress = toString(i.caller)
574751 let refInv = if (if ((referrerAddress == ""))
575752 then true
576753 else (signature == base58''))
577754 then unit
578755 else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil)
579756 if ((refInv == refInv))
580757 then {
581758 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
582759 if ((updateRefActivity == updateRefActivity))
583760 then $Tuple2(lockActionsResult, unit)
584761 else throw("Strict value is not equal to itself.")
585762 }
586763 else throw("Strict value is not equal to itself.")
587764 }
588765
589766
590767
591768 @Callable(i)
592769 func lock (duration) = {
593- let $t02495325018 = lockActions(i, duration)
594- let lockActionsResult = $t02495325018._1
595- let gWxAmountStart = $t02495325018._2
770+ let $t03210132166 = lockActions(i, duration)
771+ let lockActionsResult = $t03210132166._1
772+ let gWxAmountStart = $t03210132166._2
596773 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
597774 if ((updateRefActivity == updateRefActivity))
598775 then $Tuple2(lockActionsResult, unit)
599776 else throw("Strict value is not equal to itself.")
600777 }
601778
602779
603780
604781 @Callable(i)
605782 func increaseLock (deltaDuration) = {
606783 let cfgArray = readConfigArrayOrFail()
607784 let assetIdStr = cfgArray[IdxCfgAssetId]
608785 let assetId = fromBase58String(assetIdStr)
609786 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
610787 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
611788 let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId)
612789 let userAddressStr = toString(i.caller)
613790 let userRecordArray = readLockParamsRecordOrFail(userAddressStr)
614791 let userNumStr = userRecordArray[IdxLockUserNum]
615792 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
616793 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
617794 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
618795 let lockEnd = (lockStart + lockDuration)
619796 let remainingDuration = max([(lockEnd - height), 0])
620797 let userAmountNew = (userAmount + pmtAmount)
621798 let lockDurationNew = (remainingDuration + deltaDuration)
622799 if ((0 > deltaDuration))
623800 then throw("duration is less then zero")
624801 else if ((minLockDuration > lockDurationNew))
625802 then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration)))
626803 else if ((lockDurationNew > maxLockDuration))
627804 then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration)))
628805 else {
629806 let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration)
630807 let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8)
631808 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
632809 if ((updateRefActivity == updateRefActivity))
633810 then {
634811 let lockStartNew = height
635812 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil))
636813 let k = ai(gWxParamsResultList[0])
637814 let b = ai(gWxParamsResultList[1])
638815 let period = toString(ai(gWxParamsResultList[2]))
639- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
640- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
641- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
642- let h = if ((height > emissionEnd))
643- then emissionEnd
644- else height
645- let dh = max([(h - emissionStart), 0])
646- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
647- let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY)
648- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
649- let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
650- if ((0 > userBoostEmissionIntegral))
651- then throw("wrong calculations")
816+ let currUserGwx = calcCurrentGwxAmount(userAddressStr)
817+ let gwxDiff = (gWxAmountStart - currUserGwx)
818+ if ((0 > gwxDiff))
819+ then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
652820 else {
653- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
654- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
655- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
656- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
657- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
658- let gwxDiff = (gWxAmountStart - currUserGwx)
659- if ((0 > gwxDiff))
660- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
661- else {
662- let totalCachedGwxRaw = getTotalCachedGwx(false)
663- let totalCachedGwxCorrected = getTotalCachedGwx(true)
664- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
665- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
666- let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected)
667- let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2)
668- let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2)
669- let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt)
670- (((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- }
821+ let totalCachedGwxRaw = getTotalCachedGwx(false)
822+ let totalCachedGwxCorrected = getTotalCachedGwx(true)
823+ (((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))])
672824 }
673825 }
674826 else throw("Strict value is not equal to itself.")
675827 }
676828 }
677829
678830
679831
680832 @Callable(i)
681833 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
682834 then throw("permissions denied")
683835 else {
684- let $t02999930101 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
685- let userBoostAvailable = $t02999930101._1
686- let dataState = $t02999930101._2
687- let debug = $t02999930101._3
836+ let $t03525335355 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
837+ let userBoostAvailable = $t03525335355._1
838+ let dataState = $t03525335355._2
839+ let debug = $t03525335355._3
688840 $Tuple2(dataState, [userBoostAvailable])
689841 }
690842
691843
692844
693845 @Callable(i)
694846 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
695- let $t03023330334 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
696- let userBoostAvailable = $t03023330334._1
697- let dataState = $t03023330334._2
698- let debug = $t03023330334._3
847+ let $t03548735588 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
848+ let userBoostAvailable = $t03548735588._1
849+ let dataState = $t03548735588._2
850+ let debug = $t03548735588._3
699851 $Tuple2(nil, [userBoostAvailable, debug])
700852 }
701853
702854
703855
704856 @Callable(i)
705857 func unlock (userAddress) = {
706858 let userRecordArray = readLockParamsRecordOrFail(userAddress)
707859 let userNumStr = userRecordArray[IdxLockUserNum]
708860 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
709861 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
710862 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
711863 let lockEnd = (lockStart + lockDuration)
712864 let cfgArray = readConfigArrayOrFail()
713865 let assetId = fromBase58String(cfgArray[IdxCfgAssetId])
714866 if ((lockEnd >= height))
715867 then throw((("wait " + toString(lockEnd)) + " to unlock"))
716868 else if ((0 >= userAmount))
717869 then throw("nothing to unlock")
718870 else {
719871 let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0)
720872 (((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))
721873 }
722874 }
723875
724876
725877
726878 @Callable(i)
727879 func gwxUserInfoREADONLY (userAddress) = {
728880 let gwxAmount = calcCurrentGwxAmount(userAddress)
729881 $Tuple2(nil, [gwxAmount])
730882 }
731883
732884
733885
734886 @Callable(i)
735-func userMaxDurationREADONLY (userAddressStr) = {
736- let cfgArray = readConfigArrayOrFail()
737- let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
738- let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
739- if ((userRecordOption == unit))
740- then $Tuple2(nil, $Tuple2("lock", maxLockDuration))
741- else {
742- let userRecordArray = split(value(userRecordOption), SEP)
743- let lockStart = parseIntValue(userRecordArray[IdxLockStart])
744- let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
745- let lockEnd = (lockStart + lockDuration)
746- let remainingDuration = max([(lockEnd - height), 0])
747- let maxDeltaDuration = (maxLockDuration - remainingDuration)
748- $Tuple2(nil, $Tuple2("increaseLock", maxDeltaDuration))
749- }
750- }
751-
752-
753-
754-@Callable(i)
755887 func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = {
756888 let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight)
757889 $Tuple2(nil, gwxAmount)
758890 }
759891
760892
761893
762894 @Callable(i)
763895 func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true))
896+
897+
898+
899+@Callable(i)
900+func onBoostEmissionUpdate () = {
901+ let checkCaller = if ((i.caller == emissionContract))
902+ then true
903+ else mustManager(i)
904+ if ((checkCaller == checkCaller))
905+ then refreshBoostEmissionIntegral()
906+ else throw("Strict value is not equal to itself.")
907+ }
908+
909+
910+
911+@Callable(i)
912+func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
913+ let checkCaller = if ((i.caller == stakingContract))
914+ then true
915+ else mustManager(i)
916+ if ((checkCaller == checkCaller))
917+ then {
918+ let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
919+ $Tuple2(nil, unit)
920+ }
921+ else throw("Strict value is not equal to itself.")
922+ }
923+
924+
925+
926+@Callable(i)
927+func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
928+
929+
930+
931+@Callable(i)
932+func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
764933
765934
766935
767936 @Callable(i)
768937 func setManager (pendingManagerPublicKey) = {
769938 let checkCaller = mustManager(i)
770939 if ((checkCaller == checkCaller))
771940 then {
772941 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
773942 if ((checkManagerPublicKey == checkManagerPublicKey))
774943 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
775944 else throw("Strict value is not equal to itself.")
776945 }
777946 else throw("Strict value is not equal to itself.")
778947 }
779948
780949
781950
782951 @Callable(i)
783952 func confirmManager () = {
784953 let pm = pendingManagerPublicKeyOrUnit()
785954 let hasPM = if (isDefined(pm))
786955 then true
787956 else throw("No pending manager")
788957 if ((hasPM == hasPM))
789958 then {
790959 let checkPM = if ((i.callerPublicKey == value(pm)))
791960 then true
792961 else throw("You are not pending manager")
793962 if ((checkPM == checkPM))
794963 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
795964 else throw("Strict value is not equal to itself.")
796965 }
797966 else throw("Strict value is not equal to itself.")
798967 }
799968
800969
801970 @Verifier(tx)
802971 func verify () = {
803972 let targetPublicKey = match managerPublicKeyOrUnit() {
804973 case pk: ByteVector =>
805974 pk
806975 case _: Unit =>
807976 tx.senderPublicKey
808977 case _ =>
809978 throw("Match error")
810979 }
811980 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
812981 }
813982

github/deemru/w8io/026f985 
193.04 ms