tx · 7B4BJQ9ihYXCgDa9mmhZUBXr85d1mxT1rRuNQyCNYk6a

3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy:  -0.02700000 Waves

2023.03.24 14:58 [2504059] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves

{ "type": 13, "id": "7B4BJQ9ihYXCgDa9mmhZUBXr85d1mxT1rRuNQyCNYk6a", "fee": 2700000, "feeAssetId": null, "timestamp": 1679659133757, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "5w7XEtN4rkAmr2yFXMQRC4zWJi4khhemz7mPv3PHV8ihMCwTHtUpsxrTXGjTCay5hEGdN8t7oUaQzKKZdFqmtGy7" ], "script": "base64:BgLwLwgCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIDCgEIEgQKAggBEgASABIFCgMICAQSAwoBCBIDCgEIEgQKAggIEgQKAggIEgMKAQgSACIDU0VQIgZTQ0FMRTgiBU1VTFQ4Ig5QT09MV0VJR0hUTVVMVCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIEc3RyZiIHYWRkcmVzcyIDa2V5IgNpb3oiA2lvZCIKZGVmYXVsdFZhbCIDaW9mIgNhYnMiA3ZhbCIDYWFsIgckbWF0Y2gwIgp2YWxBbnlMeXN0IgJhaSIGdmFsSW50IhtrZXlSZWZlcnJhbHNDb250cmFjdEFkZHJlc3MiHnJlZmVycmFsc0NvbnRyYWN0QWRkcmVzc09yRmFpbCIWa2V5UmVmZXJyYWxQcm9ncmFtTmFtZSIacmVmZXJyYWxQcm9ncmFtTmFtZURlZmF1bHQiE3JlZmVycmFsUHJvZ3JhbU5hbWUiEWtleUZhY3RvcnlBZGRyZXNzIhhJZHhGYWN0b3J5Q2ZnU3Rha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RTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAmZ1AQJmdgAEAmZ3BAFyCQECYUUAAwkAAQIFAXICCkJ5dGVWZWN0b3IEAmFLBQFyBQJhSwMJAAECBQFyAgRVbml0CAUCZnUPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmZ1CWJvZHlCeXRlcwkAkQMCCAUCZnUGcHJvb2ZzAAAFAmZ3t3Tp4A==", "height": 2504059, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FrmrX26juBRC6YB1Q4YFgRADYaRda8jQKgHKhw9yxZS4 Next: RstxjT3A62mftuWWm7EP7AU1SbwQNdj9X6DRhbcaBkr 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)
301307 func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective"
302308
303309
310+func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
311+
312+
313+func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
314+
315+
316+func keyCurrentEpochUi () = makeString(["%s", "currentEpochUi"], SEP)
317+
318+
319+func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
320+
321+
322+func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
323+
324+
325+func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
326+
327+
328+func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
329+
330+
331+func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
332+
333+
334+func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
335+
336+
337+func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
338+
339+
340+func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
341+
342+
304343 let factoryContract = readFactoryAddressOrFail()
305344
306345 let factoryCfg = readFactoryCfgOrFail(factoryContract)
317356
318357 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
319358
359+let boostCoeff = {
360+ let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
361+ if ($isInstanceOf(@, "Int"))
362+ then @
363+ else throw(($getType(@) + " couldn't be cast to Int"))
364+ }
365+
320366 func getTotalCachedGwx (correct) = {
321- let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
322- let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
367+ let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi())
323368 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
324369 let targetEpochOption = getInteger(this, keyTargetEpoch)
325370 let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0)
404449
405450
406451 func getVotingEmissionEpochInfo () = {
407- let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
408- let $t01492815216 = {
409- let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
452+ let $t01719017480 = {
453+ let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi()))
410454 let lastFinalizedEpoch = (currentEpochUi - 1)
411455 if ((0 > lastFinalizedEpoch))
412456 then throwErr("invalid epoch")
413457 else $Tuple2(currentEpochUi, lastFinalizedEpoch)
414458 }
415- let currentEpochUi = $t01492815216._1
416- let lastFinalizedEpoch = $t01492815216._2
417- func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
418-
459+ let currentEpochUi = $t01719017480._1
460+ let lastFinalizedEpoch = $t01719017480._2
419461 let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
420462 $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
421463 }
422464
423465
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)
466+func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
473467 let idxAmountAssetId = 4
474468 let idxPriceAssetId = 5
475469 let poolCfg = {
476- let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
470+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil)
477471 if ($isInstanceOf(@, "List[Any]"))
478472 then @
479473 else throw(($getType(@) + " couldn't be cast to List[Any]"))
490484 then @
491485 else throw(($getType(@) + " couldn't be cast to String"))
492486 }
493- let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
494- let actions = if ((userVote == 0))
487+ $Tuple2(amountAssetId, priceAssetId)
488+ }
489+
490+
491+func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
492+ let userAddress = addressFromStringValue(userAddressStr)
493+ let $t01817118251 = getVotingEmissionEpochInfo()
494+ let lastFinalizedEpoch = $t01817118251._1
495+ let currentEpochStartHeight = $t01817118251._2
496+ let $t01825418329 = getPoolAssetsByLpAssetId(lpAssetIdStr)
497+ let amountAssetId = $t01825418329._1
498+ let priceAssetId = $t01825418329._2
499+ let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
500+ let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
501+ userVote
502+ }
503+
504+
505+func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
506+ let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
507+ let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
508+ if ((stakedByUser == 0))
509+ then 0
510+ else userVote
511+ }
512+
513+
514+func getVotingResultStaked (lpAssetIdStr) = {
515+ let $t01887318953 = getVotingEmissionEpochInfo()
516+ let lastFinalizedEpoch = $t01887318953._1
517+ let currentEpochStartHeight = $t01887318953._2
518+ let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
519+ let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
520+ votingResultStaked
521+ }
522+
523+
524+func getVotingResultStakedIntegral (lpAssetIdStr) = {
525+ let $t01931519395 = getVotingEmissionEpochInfo()
526+ let lastFinalizedEpoch = $t01931519395._1
527+ let currentEpochStartHeight = $t01931519395._2
528+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
529+ let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
530+ let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
531+ let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
532+ let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
533+ votingResultStakedIntegral
534+ }
535+
536+
537+func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
538+ let $t02023220312 = getVotingEmissionEpochInfo()
539+ let lastFinalizedEpoch = $t02023220312._1
540+ let currentEpochStartHeight = $t02023220312._2
541+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
542+ let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
543+ let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr)
544+[IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch), height), IntegerEntry(keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedIntegral)]
545+ }
546+
547+
548+func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = {
549+ let $t02092321003 = getVotingEmissionEpochInfo()
550+ let lastFinalizedEpoch = $t02092321003._1
551+ let currentEpochStartHeight = $t02092321003._2
552+ let userAddress = addressFromStringValue(userAddressStr)
553+ let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
554+ let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
555+ let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
556+ let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
557+ let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
558+ userVoteStakedIntegral
559+ }
560+
561+
562+func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
563+ let $t02179121871 = getVotingEmissionEpochInfo()
564+ let lastFinalizedEpoch = $t02179121871._1
565+ let currentEpochStartHeight = $t02179121871._2
566+ let userAddress = addressFromStringValue(userAddressStr)
567+ let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
568+ let actions = if ((userVoteFinalized == 0))
495569 then nil
496570 else {
497571 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)]
572+ then userVoteFinalized
573+ else -(userVoteFinalized)
574+ let votingResultActions = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
575+ let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)
576+ let voteActions = [IntegerEntry(keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch), height), IntegerEntry(keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch), userVoteStakedIntegral)]
513577 (votingResultActions ++ voteActions)
514578 }
515579 actions
516580 }
517581
518582
583+func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
584+ let $t02272522805 = getVotingEmissionEpochInfo()
585+ let lastFinalizedEpoch = $t02272522805._1
586+ let currentEpochStartHeight = $t02272522805._2
587+ let userAddress = addressFromStringValue(userAddressStr)
588+ let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
589+ let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0)
590+ let votingResultStakedIntegralLastKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
591+ let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralLastKey), 0)
592+ let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)
593+ let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr)
594+ let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
595+ let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
596+ $Tuple3([IntegerEntry(userVoteStakedIntegralLastKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralLastKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
597+ }
598+
599+
600+func refreshBoostEmissionIntegral () = {
601+ let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
602+ let boostingV2LastUpdateHeightOption = getInteger(emissionContract, keyBoostingV2LastUpdateHeight())
603+ let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
604+ let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
605+ let h = if ((height > emissionEnd))
606+ then emissionEnd
607+ else height
608+ let dh = match boostingV2LastUpdateHeightOption {
609+ case lastUpdateHeight: Int =>
610+ max([(h - lastUpdateHeight), 0])
611+ case _: Unit =>
612+ 0
613+ case _ =>
614+ throw("Match error")
615+ }
616+ let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
617+ let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
618+ let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
619+ $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
620+ }
621+
622+
519623 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
520- let EMPTY = "EMPTY"
521- let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
522- if ((userRecordOrEmpty == EMPTY))
624+ let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
625+ if ((userRecordOption == unit))
523626 then $Tuple3(0, nil, "userRecord::is::empty")
524627 else {
525- let userRecordArray = split(userRecordOrEmpty, SEP)
628+ let userRecordArray = split(value(userRecordOption), SEP)
526629 let userNumStr = userRecordArray[IdxLockUserNum]
527- let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
528630 let EMPTYSTR = "empty"
529- let $t02106521633 = if ((lpAssetIdStr != EMPTYSTR))
631+ let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
530632 then {
531633 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
532- let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
533- let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
534- $Tuple2(pw0, pw1)
634+ getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
535635 }
536636 else if (readOnly)
537- then $Tuple2(0, 0)
637+ then 0
538638 else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr))
539- let poolWeight0 = $t02106521633._1
540- let poolWeight1 = $t02106521633._2
541- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
542- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
543- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
544- let h = if ((height > emissionEnd))
545- then emissionEnd
546- else height
547- let dh = max([(h - emissionStart), 0])
548639 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
549640 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
550641 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
551- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
642+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
552643 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
553- let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock))
554- let uLastH = (h - udh)
555- let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0])
556- let udh1 = ((h - uLastH) - udh0)
557- if (if (if ((0 > uLastH))
558- then true
559- else (0 > udh1))
560- then true
561- else (abs(((udh0 + udh1) - udh)) >= 1))
562- then throw(((((((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1)) + " lpAssetId=") + lpAssetIdStr) + " userAddress=") + userAddressStr))
563- else if ((0 > userBoostEmissionIntegral))
564- then throw("wrong calculations")
565- else {
566- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
567- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
568- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
569- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
570- let totalCachedGwxCorrected = getTotalCachedGwx(true)
571- let userCurrGwx = calcCurrentGwxAmount(userAddressStr)
572- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
573- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
574- let userBoostEmissionIntegral0 = if ((udh == 0))
575- then 0
576- else fraction(userBoostEmissionIntegral, udh0, udh)
577- let userBoostEmissionIntegral1 = if ((udh == 0))
578- then 0
579- else fraction(userBoostEmissionIntegral, udh1, udh)
580- let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT)
581- let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT)
582- let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0))
583- then 0
584- else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected)
585- let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0))
586- then 0
587- else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected)
588- let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1)
589- let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr)
590- let userBoostClaimed = ioz(this, userBoostClaimedKEY)
591- let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed)
592- let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)]
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)], ":")
594- $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
595- }
644+ if ((0 > userBoostEmissionIntegral))
645+ then throw("wrong calculations")
646+ else {
647+ let $t02640626545 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
648+ let stakedVotesIntegralsActions = $t02640626545._1
649+ let userVoteIntegralDiff = $t02640626545._2
650+ let totalVotesIntegralDiff = $t02640626545._3
651+ let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
652+ let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
653+ then 0
654+ else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
655+ let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
656+ let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
657+ $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
658+ }
596659 }
597660 }
598661
644707 let k = ai(gWxParamsResultList[0])
645708 let b = ai(gWxParamsResultList[1])
646709 let period = toString(ai(gWxParamsResultList[2]))
647- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
648- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
649- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
650- let h = if ((height > emissionEnd))
651- then emissionEnd
652- else height
653- let dh = max([(h - emissionStart), 0])
710+ let totalCachedGwxRaw = getTotalCachedGwx(false)
654711 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
655- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
656- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
657- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
658- let userMaxBoostInt = ((gWxAmountStart * duration) / 2)
659- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
660- let totalCachedGwxRaw = getTotalCachedGwx(false)
712+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
661713 let arr = if (userIsExisting)
662714 then nil
663715 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
682734
683735 @Callable(i)
684736 func lockRef (duration,referrerAddress,signature) = {
685- let $t03009830163 = lockActions(i, duration)
686- let lockActionsResult = $t03009830163._1
687- let gWxAmountStart = $t03009830163._2
737+ let $t03113531200 = lockActions(i, duration)
738+ let lockActionsResult = $t03113531200._1
739+ let gWxAmountStart = $t03113531200._2
688740 let referralAddress = toString(i.caller)
689741 let refInv = if (if ((referrerAddress == ""))
690742 then true
705757
706758 @Callable(i)
707759 func lock (duration) = {
708- let $t03062130686 = lockActions(i, duration)
709- let lockActionsResult = $t03062130686._1
710- let gWxAmountStart = $t03062130686._2
760+ let $t03165831723 = lockActions(i, duration)
761+ let lockActionsResult = $t03165831723._1
762+ let gWxAmountStart = $t03165831723._2
711763 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
712764 if ((updateRefActivity == updateRefActivity))
713765 then $Tuple2(lockActionsResult, unit)
751803 let k = ai(gWxParamsResultList[0])
752804 let b = ai(gWxParamsResultList[1])
753805 let period = toString(ai(gWxParamsResultList[2]))
754- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
755- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
756- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
757- let h = if ((height > emissionEnd))
758- then emissionEnd
759- else height
760- let dh = max([(h - emissionStart), 0])
761- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
762- let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY)
763- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
764- let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
765- if ((0 > userBoostEmissionIntegral))
766- then throw("wrong calculations")
806+ let currUserGwx = calcCurrentGwxAmount(userAddressStr)
807+ let gwxDiff = (gWxAmountStart - currUserGwx)
808+ if ((0 > gwxDiff))
809+ then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
767810 else {
768- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
769- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
770- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
771- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
772- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
773- let gwxDiff = (gWxAmountStart - currUserGwx)
774- if ((0 > gwxDiff))
775- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
776- else {
777- let totalCachedGwxRaw = getTotalCachedGwx(false)
778- let totalCachedGwxCorrected = getTotalCachedGwx(true)
779- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
780- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
781- let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected)
782- let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2)
783- let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2)
784- let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt)
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))])
786- }
811+ let totalCachedGwxRaw = getTotalCachedGwx(false)
812+ let totalCachedGwxCorrected = getTotalCachedGwx(true)
813+ (((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))])
787814 }
788815 }
789816 else throw("Strict value is not equal to itself.")
796823 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
797824 then throw("permissions denied")
798825 else {
799- let $t03566735769 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
800- let userBoostAvailable = $t03566735769._1
801- let dataState = $t03566735769._2
802- let debug = $t03566735769._3
826+ let $t03481034912 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
827+ let userBoostAvailable = $t03481034912._1
828+ let dataState = $t03481034912._2
829+ let debug = $t03481034912._3
803830 $Tuple2(dataState, [userBoostAvailable])
804831 }
805832
807834
808835 @Callable(i)
809836 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
810- let $t03590136002 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
811- let userBoostAvailable = $t03590136002._1
812- let dataState = $t03590136002._2
813- let debug = $t03590136002._3
837+ let $t03504435145 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
838+ let userBoostAvailable = $t03504435145._1
839+ let dataState = $t03504435145._2
840+ let debug = $t03504435145._3
814841 $Tuple2(nil, [userBoostAvailable, debug])
815842 }
816843
880907
881908
882909 @Callable(i)
910+func onBoostEmissionUpdate () = {
911+ let checkCaller = if ((i.caller == emissionContract))
912+ then true
913+ else mustManager(i)
914+ if ((checkCaller == checkCaller))
915+ then refreshBoostEmissionIntegral()
916+ else throw("Strict value is not equal to itself.")
917+ }
918+
919+
920+
921+@Callable(i)
883922 func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
884923 let checkCaller = if ((i.caller == stakingContract))
885924 then true
896935
897936 @Callable(i)
898937 func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
938+
939+
940+
941+@Callable(i)
942+func getVotingResultStakedIntegralREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStakedIntegral(lpAssetIdStr))
943+
944+
945+
946+@Callable(i)
947+func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
948+
949+
950+
951+@Callable(i)
952+func getUserVoteStakedIntegralREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr))
899953
900954
901955
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
310+func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
311+
312+
313+func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
314+
315+
316+func keyCurrentEpochUi () = makeString(["%s", "currentEpochUi"], SEP)
317+
318+
319+func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
320+
321+
322+func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
323+
324+
325+func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
326+
327+
328+func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
329+
330+
331+func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
332+
333+
334+func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
335+
336+
337+func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
338+
339+
340+func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
341+
342+
304343 let factoryContract = readFactoryAddressOrFail()
305344
306345 let factoryCfg = readFactoryCfgOrFail(factoryContract)
307346
308347 let emissionContract = getEmissionAddressOrFail(factoryCfg)
309348
310349 let stakingContract = getStakingAddressOrFail(factoryCfg)
311350
312351 let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg)
313352
314353 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"))
315354
316355 let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
317356
318357 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
319358
359+let boostCoeff = {
360+ let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
361+ if ($isInstanceOf(@, "Int"))
362+ then @
363+ else throw(($getType(@) + " couldn't be cast to Int"))
364+ }
365+
320366 func getTotalCachedGwx (correct) = {
321- let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
322- let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
367+ let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi())
323368 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
324369 let targetEpochOption = getInteger(this, keyTargetEpoch)
325370 let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0)
326371 let isCorrectionActivated = if (isDefined(targetEpochOption))
327372 then (currentEpochUi >= value(targetEpochOption))
328373 else false
329374 let corrective = if (if (isCorrectionActivated)
330375 then correct
331376 else false)
332377 then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0)
333378 else 0
334379 max([0, (totalCachedGwxRaw + corrective)])
335380 }
336381
337382
338383 func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = {
339384 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
340385 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)
341386 StringEntry(historyKEY, historyDATA)
342387 }
343388
344389
345390 func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = {
346391 let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks()
347392 let locksCountKEY = keyStatsLocksCount()
348393 let usersCountKEY = keyStatsUsersCount()
349394 let totalAmountKEY = keyLockParamTotalAmount()
350395 let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY)
351396 let locksCount = ioz(this, locksCountKEY)
352397 let usersCount = ioz(this, usersCountKEY)
353398 let totalAmount = ioz(this, totalAmountKEY)
354399 [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))]
355400 }
356401
357402
358403 func calcGwxAmount (kRaw,bRaw,h) = {
359404 let SCALE = 1000
360405 (((kRaw * h) + bRaw) / SCALE)
361406 }
362407
363408
364409 func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = {
365410 let userAmountKEY = keyLockParamUserAmount(userNum)
366411 let startBlockKEY = keyLockParamStartBlock(userNum)
367412 let durationKEY = keyLockParamDuration(userNum)
368413 let kKEY = keyLockParamK(userNum)
369414 let bKEY = keyLockParamB(userNum)
370415 let kByPeriodKEY = keyLockParamByPeriodK(userNum, period)
371416 let bByPeriodKEY = keyLockParamByPeriodB(userNum, period)
372417 let gwxAmount = calcGwxAmount(k, b, height)
373418 [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))]
374419 }
375420
376421
377422 func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1))
378423 then throw("only one payment is allowed")
379424 else if ((size(i.payments) == 0))
380425 then 0
381426 else {
382427 let pmt = i.payments[0]
383428 if ((value(pmt.assetId) != expectedAssetId))
384429 then throw("invalid asset id in payment")
385430 else pmt.amount
386431 }
387432
388433
389434 func calcUserGwxAmountAtHeight (userAddress,targetHeight) = {
390435 let EMPTY = "empty"
391436 let user2NumMappingKEY = keyUser2NumMapping(userAddress)
392437 let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY)
393438 let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0)
394439 let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0)
395440 let gwxAmountCalc = calcGwxAmount(k, b, targetHeight)
396441 let gwxAmount = if ((0 > gwxAmountCalc))
397442 then 0
398443 else gwxAmountCalc
399444 gwxAmount
400445 }
401446
402447
403448 func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height)
404449
405450
406451 func getVotingEmissionEpochInfo () = {
407- let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
408- let $t01492815216 = {
409- let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
452+ let $t01719017480 = {
453+ let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi()))
410454 let lastFinalizedEpoch = (currentEpochUi - 1)
411455 if ((0 > lastFinalizedEpoch))
412456 then throwErr("invalid epoch")
413457 else $Tuple2(currentEpochUi, lastFinalizedEpoch)
414458 }
415- let currentEpochUi = $t01492815216._1
416- let lastFinalizedEpoch = $t01492815216._2
417- func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
418-
459+ let currentEpochUi = $t01719017480._1
460+ let lastFinalizedEpoch = $t01719017480._2
419461 let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
420462 $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
421463 }
422464
423465
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)
466+func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
473467 let idxAmountAssetId = 4
474468 let idxPriceAssetId = 5
475469 let poolCfg = {
476- let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
470+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil)
477471 if ($isInstanceOf(@, "List[Any]"))
478472 then @
479473 else throw(($getType(@) + " couldn't be cast to List[Any]"))
480474 }
481475 let amountAssetId = {
482476 let @ = poolCfg[idxAmountAssetId]
483477 if ($isInstanceOf(@, "String"))
484478 then @
485479 else throw(($getType(@) + " couldn't be cast to String"))
486480 }
487481 let priceAssetId = {
488482 let @ = poolCfg[idxPriceAssetId]
489483 if ($isInstanceOf(@, "String"))
490484 then @
491485 else throw(($getType(@) + " couldn't be cast to String"))
492486 }
493- let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
494- let actions = if ((userVote == 0))
487+ $Tuple2(amountAssetId, priceAssetId)
488+ }
489+
490+
491+func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
492+ let userAddress = addressFromStringValue(userAddressStr)
493+ let $t01817118251 = getVotingEmissionEpochInfo()
494+ let lastFinalizedEpoch = $t01817118251._1
495+ let currentEpochStartHeight = $t01817118251._2
496+ let $t01825418329 = getPoolAssetsByLpAssetId(lpAssetIdStr)
497+ let amountAssetId = $t01825418329._1
498+ let priceAssetId = $t01825418329._2
499+ let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
500+ let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
501+ userVote
502+ }
503+
504+
505+func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
506+ let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
507+ let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
508+ if ((stakedByUser == 0))
509+ then 0
510+ else userVote
511+ }
512+
513+
514+func getVotingResultStaked (lpAssetIdStr) = {
515+ let $t01887318953 = getVotingEmissionEpochInfo()
516+ let lastFinalizedEpoch = $t01887318953._1
517+ let currentEpochStartHeight = $t01887318953._2
518+ let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
519+ let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
520+ votingResultStaked
521+ }
522+
523+
524+func getVotingResultStakedIntegral (lpAssetIdStr) = {
525+ let $t01931519395 = getVotingEmissionEpochInfo()
526+ let lastFinalizedEpoch = $t01931519395._1
527+ let currentEpochStartHeight = $t01931519395._2
528+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
529+ let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
530+ let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
531+ let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
532+ let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
533+ votingResultStakedIntegral
534+ }
535+
536+
537+func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
538+ let $t02023220312 = getVotingEmissionEpochInfo()
539+ let lastFinalizedEpoch = $t02023220312._1
540+ let currentEpochStartHeight = $t02023220312._2
541+ let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
542+ let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
543+ let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr)
544+[IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch), height), IntegerEntry(keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedIntegral)]
545+ }
546+
547+
548+func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = {
549+ let $t02092321003 = getVotingEmissionEpochInfo()
550+ let lastFinalizedEpoch = $t02092321003._1
551+ let currentEpochStartHeight = $t02092321003._2
552+ let userAddress = addressFromStringValue(userAddressStr)
553+ let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
554+ let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
555+ let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
556+ let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
557+ let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
558+ userVoteStakedIntegral
559+ }
560+
561+
562+func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
563+ let $t02179121871 = getVotingEmissionEpochInfo()
564+ let lastFinalizedEpoch = $t02179121871._1
565+ let currentEpochStartHeight = $t02179121871._2
566+ let userAddress = addressFromStringValue(userAddressStr)
567+ let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
568+ let actions = if ((userVoteFinalized == 0))
495569 then nil
496570 else {
497571 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)]
572+ then userVoteFinalized
573+ else -(userVoteFinalized)
574+ let votingResultActions = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
575+ let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)
576+ let voteActions = [IntegerEntry(keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch), height), IntegerEntry(keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch), userVoteStakedIntegral)]
513577 (votingResultActions ++ voteActions)
514578 }
515579 actions
516580 }
517581
518582
583+func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
584+ let $t02272522805 = getVotingEmissionEpochInfo()
585+ let lastFinalizedEpoch = $t02272522805._1
586+ let currentEpochStartHeight = $t02272522805._2
587+ let userAddress = addressFromStringValue(userAddressStr)
588+ let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
589+ let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0)
590+ let votingResultStakedIntegralLastKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
591+ let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralLastKey), 0)
592+ let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)
593+ let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr)
594+ let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
595+ let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
596+ $Tuple3([IntegerEntry(userVoteStakedIntegralLastKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralLastKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
597+ }
598+
599+
600+func refreshBoostEmissionIntegral () = {
601+ let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
602+ let boostingV2LastUpdateHeightOption = getInteger(emissionContract, keyBoostingV2LastUpdateHeight())
603+ let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
604+ let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
605+ let h = if ((height > emissionEnd))
606+ then emissionEnd
607+ else height
608+ let dh = match boostingV2LastUpdateHeightOption {
609+ case lastUpdateHeight: Int =>
610+ max([(h - lastUpdateHeight), 0])
611+ case _: Unit =>
612+ 0
613+ case _ =>
614+ throw("Match error")
615+ }
616+ let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
617+ let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
618+ let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
619+ $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
620+ }
621+
622+
519623 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
520- let EMPTY = "EMPTY"
521- let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
522- if ((userRecordOrEmpty == EMPTY))
624+ let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
625+ if ((userRecordOption == unit))
523626 then $Tuple3(0, nil, "userRecord::is::empty")
524627 else {
525- let userRecordArray = split(userRecordOrEmpty, SEP)
628+ let userRecordArray = split(value(userRecordOption), SEP)
526629 let userNumStr = userRecordArray[IdxLockUserNum]
527- let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
528630 let EMPTYSTR = "empty"
529- let $t02106521633 = if ((lpAssetIdStr != EMPTYSTR))
631+ let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
530632 then {
531633 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
532- let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
533- let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
534- $Tuple2(pw0, pw1)
634+ getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
535635 }
536636 else if (readOnly)
537- then $Tuple2(0, 0)
637+ then 0
538638 else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr))
539- let poolWeight0 = $t02106521633._1
540- let poolWeight1 = $t02106521633._2
541- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
542- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
543- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
544- let h = if ((height > emissionEnd))
545- then emissionEnd
546- else height
547- let dh = max([(h - emissionStart), 0])
548639 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
549640 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
550641 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
551- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
642+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
552643 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
553- let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock))
554- let uLastH = (h - udh)
555- let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0])
556- let udh1 = ((h - uLastH) - udh0)
557- if (if (if ((0 > uLastH))
558- then true
559- else (0 > udh1))
560- then true
561- else (abs(((udh0 + udh1) - udh)) >= 1))
562- then throw(((((((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1)) + " lpAssetId=") + lpAssetIdStr) + " userAddress=") + userAddressStr))
563- else if ((0 > userBoostEmissionIntegral))
564- then throw("wrong calculations")
565- else {
566- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
567- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
568- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
569- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
570- let totalCachedGwxCorrected = getTotalCachedGwx(true)
571- let userCurrGwx = calcCurrentGwxAmount(userAddressStr)
572- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
573- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
574- let userBoostEmissionIntegral0 = if ((udh == 0))
575- then 0
576- else fraction(userBoostEmissionIntegral, udh0, udh)
577- let userBoostEmissionIntegral1 = if ((udh == 0))
578- then 0
579- else fraction(userBoostEmissionIntegral, udh1, udh)
580- let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT)
581- let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT)
582- let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0))
583- then 0
584- else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected)
585- let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0))
586- then 0
587- else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected)
588- let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1)
589- let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr)
590- let userBoostClaimed = ioz(this, userBoostClaimedKEY)
591- let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed)
592- let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)]
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)], ":")
594- $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
595- }
644+ if ((0 > userBoostEmissionIntegral))
645+ then throw("wrong calculations")
646+ else {
647+ let $t02640626545 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
648+ let stakedVotesIntegralsActions = $t02640626545._1
649+ let userVoteIntegralDiff = $t02640626545._2
650+ let totalVotesIntegralDiff = $t02640626545._3
651+ let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
652+ let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
653+ then 0
654+ else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
655+ let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
656+ let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
657+ $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
658+ }
596659 }
597660 }
598661
599662
600663 func lockActions (i,duration) = {
601664 let cfgArray = readConfigArrayOrFail()
602665 let assetIdStr = cfgArray[IdxCfgAssetId]
603666 let assetId = fromBase58String(assetIdStr)
604667 let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount])
605668 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
606669 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
607670 if ((size(i.payments) != 1))
608671 then throw("invalid payment - exact one payment must be attached")
609672 else {
610673 let pmt = i.payments[0]
611674 let pmtAmount = pmt.amount
612675 if ((assetId != value(pmt.assetId)))
613676 then throw((("invalid asset is in payment - " + assetIdStr) + " is expected"))
614677 else {
615678 let nextUserNumKEY = keyNextUserNum()
616679 let userAddressStr = toString(i.caller)
617680 let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr)))
618681 let userNumStr = if (userIsExisting)
619682 then value(getString(keyUser2NumMapping(userAddressStr)))
620683 else toString(iof(this, nextUserNumKEY))
621684 let userNum = parseIntValue(userNumStr)
622685 let lockStart = height
623686 let startBlockKEY = keyLockParamStartBlock(userNumStr)
624687 let durationKEY = keyLockParamDuration(userNumStr)
625688 let userAmountKEY = keyLockParamUserAmount(userNumStr)
626689 if (if ((minLockAmount > pmtAmount))
627690 then (i.caller != lpStakingPoolsContract)
628691 else false)
629692 then throw(("amount is less then minLockAmount=" + toString(minLockAmount)))
630693 else if ((minLockDuration > duration))
631694 then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration)))
632695 else if ((duration > maxLockDuration))
633696 then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration)))
634697 else if (if (userIsExisting)
635698 then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart)
636699 else false)
637700 then throw("there is an active lock - consider to use increaseLock")
638701 else if ((ioz(this, userAmountKEY) > 0))
639702 then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY))
640703 else {
641704 let coeffX8 = fraction(duration, MULT8, maxLockDuration)
642705 let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8)
643706 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil))
644707 let k = ai(gWxParamsResultList[0])
645708 let b = ai(gWxParamsResultList[1])
646709 let period = toString(ai(gWxParamsResultList[2]))
647- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
648- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
649- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
650- let h = if ((height > emissionEnd))
651- then emissionEnd
652- else height
653- let dh = max([(h - emissionStart), 0])
710+ let totalCachedGwxRaw = getTotalCachedGwx(false)
654711 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
655- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
656- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
657- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
658- let userMaxBoostInt = ((gWxAmountStart * duration) / 2)
659- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
660- let totalCachedGwxRaw = getTotalCachedGwx(false)
712+ let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
661713 let arr = if (userIsExisting)
662714 then nil
663715 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
664716 $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting)
665717 then 0
666718 else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart)
667719 }
668720 }
669721 }
670722 }
671723
672724
673725 @Callable(i)
674726 func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = {
675727 let checkCaller = mustManager(i)
676728 if ((checkCaller == checkCaller))
677729 then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0))
678730 else throw("Strict value is not equal to itself.")
679731 }
680732
681733
682734
683735 @Callable(i)
684736 func lockRef (duration,referrerAddress,signature) = {
685- let $t03009830163 = lockActions(i, duration)
686- let lockActionsResult = $t03009830163._1
687- let gWxAmountStart = $t03009830163._2
737+ let $t03113531200 = lockActions(i, duration)
738+ let lockActionsResult = $t03113531200._1
739+ let gWxAmountStart = $t03113531200._2
688740 let referralAddress = toString(i.caller)
689741 let refInv = if (if ((referrerAddress == ""))
690742 then true
691743 else (signature == base58''))
692744 then unit
693745 else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil)
694746 if ((refInv == refInv))
695747 then {
696748 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
697749 if ((updateRefActivity == updateRefActivity))
698750 then $Tuple2(lockActionsResult, unit)
699751 else throw("Strict value is not equal to itself.")
700752 }
701753 else throw("Strict value is not equal to itself.")
702754 }
703755
704756
705757
706758 @Callable(i)
707759 func lock (duration) = {
708- let $t03062130686 = lockActions(i, duration)
709- let lockActionsResult = $t03062130686._1
710- let gWxAmountStart = $t03062130686._2
760+ let $t03165831723 = lockActions(i, duration)
761+ let lockActionsResult = $t03165831723._1
762+ let gWxAmountStart = $t03165831723._2
711763 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
712764 if ((updateRefActivity == updateRefActivity))
713765 then $Tuple2(lockActionsResult, unit)
714766 else throw("Strict value is not equal to itself.")
715767 }
716768
717769
718770
719771 @Callable(i)
720772 func increaseLock (deltaDuration) = {
721773 let cfgArray = readConfigArrayOrFail()
722774 let assetIdStr = cfgArray[IdxCfgAssetId]
723775 let assetId = fromBase58String(assetIdStr)
724776 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
725777 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
726778 let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId)
727779 let userAddressStr = toString(i.caller)
728780 let userRecordArray = readLockParamsRecordOrFail(userAddressStr)
729781 let userNumStr = userRecordArray[IdxLockUserNum]
730782 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
731783 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
732784 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
733785 let lockEnd = (lockStart + lockDuration)
734786 let remainingDuration = max([(lockEnd - height), 0])
735787 let userAmountNew = (userAmount + pmtAmount)
736788 let lockDurationNew = (remainingDuration + deltaDuration)
737789 if ((0 > deltaDuration))
738790 then throw("duration is less then zero")
739791 else if ((minLockDuration > lockDurationNew))
740792 then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration)))
741793 else if ((lockDurationNew > maxLockDuration))
742794 then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration)))
743795 else {
744796 let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration)
745797 let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8)
746798 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
747799 if ((updateRefActivity == updateRefActivity))
748800 then {
749801 let lockStartNew = height
750802 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil))
751803 let k = ai(gWxParamsResultList[0])
752804 let b = ai(gWxParamsResultList[1])
753805 let period = toString(ai(gWxParamsResultList[2]))
754- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
755- let emissionStart = iof(emissionContract, keyEmissionStartBlock())
756- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
757- let h = if ((height > emissionEnd))
758- then emissionEnd
759- else height
760- let dh = max([(h - emissionStart), 0])
761- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
762- let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY)
763- let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
764- let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
765- if ((0 > userBoostEmissionIntegral))
766- then throw("wrong calculations")
806+ let currUserGwx = calcCurrentGwxAmount(userAddressStr)
807+ let gwxDiff = (gWxAmountStart - currUserGwx)
808+ if ((0 > gwxDiff))
809+ then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
767810 else {
768- let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr)
769- let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL()
770- let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY)
771- let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY)
772- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
773- let gwxDiff = (gWxAmountStart - currUserGwx)
774- if ((0 > gwxDiff))
775- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
776- else {
777- let totalCachedGwxRaw = getTotalCachedGwx(false)
778- let totalCachedGwxCorrected = getTotalCachedGwx(true)
779- let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr)
780- let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY)
781- let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected)
782- let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2)
783- let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2)
784- let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt)
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))])
786- }
811+ let totalCachedGwxRaw = getTotalCachedGwx(false)
812+ let totalCachedGwxCorrected = getTotalCachedGwx(true)
813+ (((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))])
787814 }
788815 }
789816 else throw("Strict value is not equal to itself.")
790817 }
791818 }
792819
793820
794821
795822 @Callable(i)
796823 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
797824 then throw("permissions denied")
798825 else {
799- let $t03566735769 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
800- let userBoostAvailable = $t03566735769._1
801- let dataState = $t03566735769._2
802- let debug = $t03566735769._3
826+ let $t03481034912 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
827+ let userBoostAvailable = $t03481034912._1
828+ let dataState = $t03481034912._2
829+ let debug = $t03481034912._3
803830 $Tuple2(dataState, [userBoostAvailable])
804831 }
805832
806833
807834
808835 @Callable(i)
809836 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
810- let $t03590136002 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
811- let userBoostAvailable = $t03590136002._1
812- let dataState = $t03590136002._2
813- let debug = $t03590136002._3
837+ let $t03504435145 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
838+ let userBoostAvailable = $t03504435145._1
839+ let dataState = $t03504435145._2
840+ let debug = $t03504435145._3
814841 $Tuple2(nil, [userBoostAvailable, debug])
815842 }
816843
817844
818845
819846 @Callable(i)
820847 func unlock (userAddress) = {
821848 let userRecordArray = readLockParamsRecordOrFail(userAddress)
822849 let userNumStr = userRecordArray[IdxLockUserNum]
823850 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
824851 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
825852 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
826853 let lockEnd = (lockStart + lockDuration)
827854 let cfgArray = readConfigArrayOrFail()
828855 let assetId = fromBase58String(cfgArray[IdxCfgAssetId])
829856 if ((lockEnd >= height))
830857 then throw((("wait " + toString(lockEnd)) + " to unlock"))
831858 else if ((0 >= userAmount))
832859 then throw("nothing to unlock")
833860 else {
834861 let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0)
835862 (((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))
836863 }
837864 }
838865
839866
840867
841868 @Callable(i)
842869 func gwxUserInfoREADONLY (userAddress) = {
843870 let gwxAmount = calcCurrentGwxAmount(userAddress)
844871 $Tuple2(nil, [gwxAmount])
845872 }
846873
847874
848875
849876 @Callable(i)
850877 func userMaxDurationREADONLY (userAddressStr) = {
851878 let cfgArray = readConfigArrayOrFail()
852879 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
853880 let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
854881 if ((userRecordOption == unit))
855882 then $Tuple2(nil, $Tuple2("lock", maxLockDuration))
856883 else {
857884 let userRecordArray = split(value(userRecordOption), SEP)
858885 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
859886 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
860887 let lockEnd = (lockStart + lockDuration)
861888 let remainingDuration = max([(lockEnd - height), 0])
862889 let maxDeltaDuration = (maxLockDuration - remainingDuration)
863890 $Tuple2(nil, $Tuple2("increaseLock", maxDeltaDuration))
864891 }
865892 }
866893
867894
868895
869896 @Callable(i)
870897 func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = {
871898 let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight)
872899 $Tuple2(nil, gwxAmount)
873900 }
874901
875902
876903
877904 @Callable(i)
878905 func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true))
879906
880907
881908
882909 @Callable(i)
910+func onBoostEmissionUpdate () = {
911+ let checkCaller = if ((i.caller == emissionContract))
912+ then true
913+ else mustManager(i)
914+ if ((checkCaller == checkCaller))
915+ then refreshBoostEmissionIntegral()
916+ else throw("Strict value is not equal to itself.")
917+ }
918+
919+
920+
921+@Callable(i)
883922 func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
884923 let checkCaller = if ((i.caller == stakingContract))
885924 then true
886925 else mustManager(i)
887926 if ((checkCaller == checkCaller))
888927 then {
889928 let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
890929 $Tuple2(actions, unit)
891930 }
892931 else throw("Strict value is not equal to itself.")
893932 }
894933
895934
896935
897936 @Callable(i)
898937 func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
938+
939+
940+
941+@Callable(i)
942+func getVotingResultStakedIntegralREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStakedIntegral(lpAssetIdStr))
943+
944+
945+
946+@Callable(i)
947+func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
948+
949+
950+
951+@Callable(i)
952+func getUserVoteStakedIntegralREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr))
899953
900954
901955
902956 @Callable(i)
903957 func setManager (pendingManagerPublicKey) = {
904958 let checkCaller = mustManager(i)
905959 if ((checkCaller == checkCaller))
906960 then {
907961 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
908962 if ((checkManagerPublicKey == checkManagerPublicKey))
909963 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
910964 else throw("Strict value is not equal to itself.")
911965 }
912966 else throw("Strict value is not equal to itself.")
913967 }
914968
915969
916970
917971 @Callable(i)
918972 func confirmManager () = {
919973 let pm = pendingManagerPublicKeyOrUnit()
920974 let hasPM = if (isDefined(pm))
921975 then true
922976 else throw("No pending manager")
923977 if ((hasPM == hasPM))
924978 then {
925979 let checkPM = if ((i.callerPublicKey == value(pm)))
926980 then true
927981 else throw("You are not pending manager")
928982 if ((checkPM == checkPM))
929983 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
930984 else throw("Strict value is not equal to itself.")
931985 }
932986 else throw("Strict value is not equal to itself.")
933987 }
934988
935989
936990 @Verifier(tx)
937991 func verify () = {
938992 let targetPublicKey = match managerPublicKeyOrUnit() {
939993 case pk: ByteVector =>
940994 pk
941995 case _: Unit =>
942996 tx.senderPublicKey
943997 case _ =>
944998 throw("Match error")
945999 }
9461000 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
9471001 }
9481002

github/deemru/w8io/026f985 
117.50 ms