tx · AGsP8Ym1mk848FFLDZKoFojG7dBg2ztABQjkqkxEP2uM

3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy:  -0.02300000 Waves

2023.03.14 10:06 [2489384] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves

{ "type": 13, "id": "AGsP8Ym1mk848FFLDZKoFojG7dBg2ztABQjkqkxEP2uM", "fee": 2300000, "feeAssetId": null, "timestamp": 1678777584503, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "3Bs7neZfbNkMrvLE5R85hm3cAnJMWNrkwzDnGP5YKhTyn7a199Q7T1LdoSk29NhN88jGgSkTF2ZWotjnEiB2pxg7" ], "script": "base64:BgLAJggCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIDCgEIEgQKAggBEgASAwoBCBIAIgNTRVAiBlNDQUxFOCIFTVVMVDgiDlBPT0xXRUlHSFRNVUxUIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIgRzdHJmIgdhZGRyZXNzIgNrZXkiA2lveiIDaW9kIgpkZWZhdWx0VmFsIgNpb2YiA2FicyIDdmFsIgNhYWwiByRtYXRjaDAiCnZhbEFueUx5c3QiAmFpIgZ2YWxJbnQiG2tleVJlZmVycmFsc0NvbnRyYWN0QWRkcmVzcyIecmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzT3JGYWlsIhZrZXlSZWZlcnJhbFByb2dyYW1OYW1lIhpyZWZlcnJhbFByb2dyYW1OYW1lRGVmYXVsdCITcmVmZXJyYWxQcm9ncmFtTmFtZSIRa2V5RmFjdG9yeUFkZHJlc3MiGElkeEZhY3RvcnlDZmdTdGFraW5nRGFwcCIZSWR4RmFjdG9yeUNmZ0Jvb3N0aW5nRGFwcCIUSWR4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MwIAgkBC0RlbGV0ZUVudHJ5AQkBAmFnAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJldwECZXgABAJleQQBcgkBAmFDAAMJAAECBQFyAgpCeXRlVmVjdG9yBAJhSQUBcgUCYUkDCQABAgUBcgIEVW5pdAgFAmV3D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJldwlib2R5Qnl0ZXMJAJEDAggFAmV3BnByb29mcwAABQJlecET4hE=", "height": 2489384, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FzV24NVEjjqLnb7UqqJizKNRYBRrZELS3FnsSSHSfCUQ Next: 9nADWe8u2wXQ4GtPDijPpNWMpf89X1wkAox3R9brWmHt 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"
145139
146140
147141 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
283277 func keyStatsUsersCount () = "%s%s__stats__activeUsersCount"
284278
285279
286-func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum], SEP)
280+func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastInt", userNum], SEP)
287281
288282
289-func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum, lpAssetId], SEP)
283+func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastInt", userNum, lpAssetId], SEP)
290284
291285
292286 func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP)
319313
320314 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"))
321315
322-let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
323-
324-let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
325-
326-let boostCoeff = {
327- let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
328- if ($isInstanceOf(@, "Int"))
329- then @
330- else throw(($getType(@) + " couldn't be cast to Int"))
331- }
332-
333316 func getTotalCachedGwx (correct) = {
317+ let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
318+ let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
334319 let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
335320 let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
336321 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
416401 func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height)
417402
418403
419-func getVotingEmissionEpochInfo () = {
420- let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
421- let $t01515015438 = {
422- let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
423- let lastFinalizedEpoch = (currentEpochUi - 1)
424- if ((0 > lastFinalizedEpoch))
425- then throwErr("invalid epoch")
426- else $Tuple2(currentEpochUi, lastFinalizedEpoch)
427- }
428- let currentEpochUi = $t01515015438._1
429- let lastFinalizedEpoch = $t01515015438._2
430- func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
431-
432- let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
433- $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
434- }
435-
436-
437-func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
438- let idxAmountAssetId = 4
439- let idxPriceAssetId = 5
440- let poolCfg = {
441- let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
442- if ($isInstanceOf(@, "List[Any]"))
443- then @
444- else throw(($getType(@) + " couldn't be cast to List[Any]"))
445- }
446- let amountAssetId = {
447- let @ = poolCfg[idxAmountAssetId]
448- if ($isInstanceOf(@, "String"))
449- then @
450- else throw(($getType(@) + " couldn't be cast to String"))
451- }
452- let priceAssetId = {
453- let @ = poolCfg[idxPriceAssetId]
454- if ($isInstanceOf(@, "String"))
455- then @
456- else throw(($getType(@) + " couldn't be cast to String"))
457- }
458- $Tuple2(amountAssetId, priceAssetId)
459- }
460-
461-
462-func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
463-
464-
465-func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
466-
467-
468-func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
469-
470-
471-func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
472-
473-
474-func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
475-
476-
477-func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
478-
479-
480-func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
481-
482-
483-func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
484-
485-
486-func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
487-
488-
489-func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
490- let userAddress = addressFromStringValue(userAddressStr)
491- let $t01822818308 = getVotingEmissionEpochInfo()
492- let lastFinalizedEpoch = $t01822818308._1
493- let currentEpochStartHeight = $t01822818308._2
494- let $t01831118386 = getPoolAssetsByLpAssetId(lpAssetIdStr)
495- let amountAssetId = $t01831118386._1
496- let priceAssetId = $t01831118386._2
497- let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
498- let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
499- userVote
500- }
501-
502-
503-func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
504- let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
505- let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
506- if ((stakedByUser == 0))
507- then 0
508- else userVote
509- }
510-
511-
512-func getVotingResultStaked (lpAssetIdStr) = {
513- let $t01893019010 = getVotingEmissionEpochInfo()
514- let lastFinalizedEpoch = $t01893019010._1
515- let currentEpochStartHeight = $t01893019010._2
516- let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
517- let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
518- votingResultStaked
519- }
520-
521-
522-func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
523- let $t01953119611 = getVotingEmissionEpochInfo()
524- let lastFinalizedEpoch = $t01953119611._1
525- let currentEpochStartHeight = $t01953119611._2
526- let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
527- let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
528- let votingResultStakedIntegralKey = keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)
529- let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
530- let votingResultLastUpdateHeightKey = keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)
531- let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, votingResultLastUpdateHeightKey), currentEpochStartHeight)
532- let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
533- let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
534- $Tuple2([IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(votingResultLastUpdateHeightKey, height), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], votingResultStakedIntegral)
535- }
536-
537-
538-func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
539- let $t02081120891 = getVotingEmissionEpochInfo()
540- let lastFinalizedEpoch = $t02081120891._1
541- let currentEpochStartHeight = $t02081120891._2
542- let userAddress = addressFromStringValue(userAddressStr)
543- let idxAmountAssetId = 4
544- let idxPriceAssetId = 5
545- let poolCfg = {
546- let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
547- if ($isInstanceOf(@, "List[Any]"))
548- then @
549- else throw(($getType(@) + " couldn't be cast to List[Any]"))
550- }
551- let amountAssetId = {
552- let @ = poolCfg[idxAmountAssetId]
553- if ($isInstanceOf(@, "String"))
554- then @
555- else throw(($getType(@) + " couldn't be cast to String"))
556- }
557- let priceAssetId = {
558- let @ = poolCfg[idxPriceAssetId]
559- if ($isInstanceOf(@, "String"))
560- then @
561- else throw(($getType(@) + " couldn't be cast to String"))
562- }
563- let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
564- let actions = if ((userVote == 0))
565- then nil
566- else {
567- let stakedVoteDelta = if (edge)
568- then userVote
569- else -(userVote)
570- let $t02149621615 = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
571- let votingResultActions = $t02149621615._1
572- let votingResultStakedIntegral = $t02149621615._2
573- let userVoteStaked = if (edge)
574- then 0
575- else userVote
576- let userVoteStakedIntegralKey = keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)
577- let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
578- let userVoteStakedLastUpdateHeightKey = keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)
579- let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, userVoteStakedLastUpdateHeightKey), currentEpochStartHeight)
580- let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
581- let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
582- let voteActions = [IntegerEntry(userVoteStakedLastUpdateHeightKey, height), IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral)]
583- (votingResultActions ++ voteActions)
584- }
585- actions
586- }
587-
588-
589-func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
590- let $t02260722687 = getVotingEmissionEpochInfo()
591- let lastFinalizedEpoch = $t02260722687._1
592- let currentEpochStartHeight = $t02260722687._2
593- let userAddress = addressFromStringValue(userAddressStr)
594- let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
595- let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
596- let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
597- let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
598- let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
599- let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
600- let userVoteStakedIntegralKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
601- let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
602- let votingResultStakedIntegralKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
603- let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
604- let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
605- let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
606- let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
607- let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
608- let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
609- let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
610- $Tuple3([IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
611- }
612-
613-
614-func refreshBoostEmissionIntegral () = {
615- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
616- let boostingV2LastUpdateHeightOption = getInteger(emissionContract, keyBoostingV2LastUpdateHeight())
617- let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
618- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
619- let h = if ((height > emissionEnd))
620- then emissionEnd
621- else height
622- let dh = match boostingV2LastUpdateHeightOption {
623- case lastUpdateHeight: Int =>
624- max([(h - lastUpdateHeight), 0])
625- case _: Unit =>
626- 0
627- case _ =>
628- throw("Match error")
629- }
630- let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
631- let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
632- let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
633- $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
634- }
635-
636-
637404 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
638- let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
639- if ((userRecordOption == unit))
405+ let EMPTY = "EMPTY"
406+ let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
407+ if ((userRecordOrEmpty == EMPTY))
640408 then $Tuple3(0, nil, "userRecord::is::empty")
641409 else {
642- let userRecordArray = split(value(userRecordOption), SEP)
410+ let userRecordArray = split(userRecordOrEmpty, SEP)
643411 let userNumStr = userRecordArray[IdxLockUserNum]
412+ let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
644413 let EMPTYSTR = "empty"
645- let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
414+ let $t01539715965 = if ((lpAssetIdStr != EMPTYSTR))
646415 then {
647416 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
648- getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
417+ let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
418+ let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
419+ $Tuple2(pw0, pw1)
649420 }
650421 else if (readOnly)
651- then 0
422+ then $Tuple2(0, 0)
652423 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])
653433 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
654434 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
655435 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
656- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
436+ let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
657437 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
658- if ((0 > userBoostEmissionIntegral))
659- then throw("wrong calculations")
660- else {
661- let $t02721227351 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
662- let stakedVotesIntegralsActions = $t02721227351._1
663- let userVoteIntegralDiff = $t02721227351._2
664- let totalVotesIntegralDiff = $t02721227351._3
665- let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
666- let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
667- then 0
668- else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
669- let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
670- let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
671- $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
672- }
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+ }
673481 }
674482 }
675483
721529 let k = ai(gWxParamsResultList[0])
722530 let b = ai(gWxParamsResultList[1])
723531 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])
539+ 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)
724545 let totalCachedGwxRaw = getTotalCachedGwx(false)
725- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
726- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
727546 let arr = if (userIsExisting)
728547 then nil
729548 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
748567
749568 @Callable(i)
750569 func lockRef (duration,referrerAddress,signature) = {
751- let $t03194132006 = lockActions(i, duration)
752- let lockActionsResult = $t03194132006._1
753- let gWxAmountStart = $t03194132006._2
570+ let $t02443024495 = lockActions(i, duration)
571+ let lockActionsResult = $t02443024495._1
572+ let gWxAmountStart = $t02443024495._2
754573 let referralAddress = toString(i.caller)
755574 let refInv = if (if ((referrerAddress == ""))
756575 then true
771590
772591 @Callable(i)
773592 func lock (duration) = {
774- let $t03246432529 = lockActions(i, duration)
775- let lockActionsResult = $t03246432529._1
776- let gWxAmountStart = $t03246432529._2
593+ let $t02495325018 = lockActions(i, duration)
594+ let lockActionsResult = $t02495325018._1
595+ let gWxAmountStart = $t02495325018._2
777596 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
778597 if ((updateRefActivity == updateRefActivity))
779598 then $Tuple2(lockActionsResult, unit)
817636 let k = ai(gWxParamsResultList[0])
818637 let b = ai(gWxParamsResultList[1])
819638 let period = toString(ai(gWxParamsResultList[2]))
820- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
821- let gwxDiff = (gWxAmountStart - currUserGwx)
822- if ((0 > gwxDiff))
823- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
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")
824652 else {
825- let totalCachedGwxRaw = getTotalCachedGwx(false)
826- let totalCachedGwxCorrected = getTotalCachedGwx(true)
827- (((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))])
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+ }
828672 }
829673 }
830674 else throw("Strict value is not equal to itself.")
837681 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
838682 then throw("permissions denied")
839683 else {
840- let $t03561635718 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
841- let userBoostAvailable = $t03561635718._1
842- let dataState = $t03561635718._2
843- let debug = $t03561635718._3
684+ let $t02999930101 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
685+ let userBoostAvailable = $t02999930101._1
686+ let dataState = $t02999930101._2
687+ let debug = $t02999930101._3
844688 $Tuple2(dataState, [userBoostAvailable])
845689 }
846690
848692
849693 @Callable(i)
850694 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
851- let $t03585035951 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
852- let userBoostAvailable = $t03585035951._1
853- let dataState = $t03585035951._2
854- let debug = $t03585035951._3
695+ let $t03023330334 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
696+ let userBoostAvailable = $t03023330334._1
697+ let dataState = $t03023330334._2
698+ let debug = $t03023330334._3
855699 $Tuple2(nil, [userBoostAvailable, debug])
856700 }
857701
921765
922766
923767 @Callable(i)
924-func onBoostEmissionUpdate () = {
925- let checkCaller = if ((i.caller == emissionContract))
926- then true
927- else mustManager(i)
928- if ((checkCaller == checkCaller))
929- then refreshBoostEmissionIntegral()
930- else throw("Strict value is not equal to itself.")
931- }
932-
933-
934-
935-@Callable(i)
936-func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
937- let checkCaller = if ((i.caller == stakingContract))
938- then true
939- else mustManager(i)
940- if ((checkCaller == checkCaller))
941- then {
942- let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
943- $Tuple2(actions, unit)
944- }
945- else throw("Strict value is not equal to itself.")
946- }
947-
948-
949-
950-@Callable(i)
951-func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
952-
953-
954-
955-@Callable(i)
956-func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
957-
958-
959-
960-@Callable(i)
961768 func setManager (pendingManagerPublicKey) = {
962769 let checkCaller = mustManager(i)
963770 if ((checkCaller == checkCaller))
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"
145139
146140
147141 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
148142
149143
150144 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
151145
152146
153147 func keyNextPeriod () = "%s__nextPeriod"
154148
155149
156150 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
157151
158152
159153 let IdxCfgAssetId = 1
160154
161155 let IdxCfgMinLockAmount = 2
162156
163157 let IdxCfgMinLockDuration = 3
164158
165159 let IdxCfgMaxLockDuration = 4
166160
167161 let IdxCfgMathContract = 5
168162
169163 func keyConfig () = "%s__config"
170164
171165
172166 func readConfigArrayOrFail () = split(strf(this, keyConfig()), SEP)
173167
174168
175169 let mathContract = addressFromStringValue(readConfigArrayOrFail()[IdxCfgMathContract])
176170
177171 func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP)
178172
179173
180174 func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract)
181175
182176
183177 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
184178 case s: String =>
185179 fromBase58String(s)
186180 case _: Unit =>
187181 unit
188182 case _ =>
189183 throw("Match error")
190184 }
191185
192186
193187 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
194188 case s: String =>
195189 fromBase58String(s)
196190 case _: Unit =>
197191 unit
198192 case _ =>
199193 throw("Match error")
200194 }
201195
202196
203197 func mustManager (i) = {
204198 let pd = throw("Permission denied")
205199 match managerPublicKeyOrUnit() {
206200 case pk: ByteVector =>
207201 if ((i.callerPublicKey == pk))
208202 then true
209203 else pd
210204 case _: Unit =>
211205 if ((i.caller == this))
212206 then true
213207 else pd
214208 case _ =>
215209 throw("Match error")
216210 }
217211 }
218212
219213
220214 let IdxLockUserNum = 1
221215
222216 let IdxLockAmount = 2
223217
224218 let IdxLockStart = 3
225219
226220 let IdxLockDuration = 4
227221
228222 let IdxLockParamK = 5
229223
230224 let IdxLockParamB = 6
231225
232226 func keyLockParamsRecord (userAddress) = makeString(["%s%s__lock", userAddress], SEP)
233227
234228
235229 func readLockParamsRecordOrFail (userAddress) = split(strf(this, keyLockParamsRecord(userAddress)), SEP)
236230
237231
238232 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)
239233
240234
241235 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))
242236
243237
244238 func keyNextUserNum () = "%s__nextUserNum"
245239
246240
247241 func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP)
248242
249243
250244 func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP)
251245
252246
253247 func keyLockParamUserAmount (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "amount"], SEP)
254248
255249
256250 func keyLockParamStartBlock (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "start"], SEP)
257251
258252
259253 func keyLockParamDuration (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "duration"], SEP)
260254
261255
262256 func keyLockParamK (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "k"], SEP)
263257
264258
265259 func keyLockParamB (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "b"], SEP)
266260
267261
268262 func keyLockParamByPeriodK (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "k", period], SEP)
269263
270264
271265 func keyLockParamByPeriodB (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "b", period], SEP)
272266
273267
274268 func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked"
275269
276270
277271 func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks"
278272
279273
280274 func keyStatsLocksCount () = "%s%s__stats__locksCount"
281275
282276
283277 func keyStatsUsersCount () = "%s%s__stats__activeUsersCount"
284278
285279
286-func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum], SEP)
280+func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastInt", userNum], SEP)
287281
288282
289-func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum, lpAssetId], SEP)
283+func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastInt", userNum, lpAssetId], SEP)
290284
291285
292286 func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP)
293287
294288
295289 func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total"
296290
297291
298292 func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", userNum], SEP)
299293
300294
301295 func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", userNum], SEP)
302296
303297
304298 func keyTotalCachedGwx () = "%s%s__gwxCached__total"
305299
306300
307301 func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective"
308302
309303
310304 let factoryContract = readFactoryAddressOrFail()
311305
312306 let factoryCfg = readFactoryCfgOrFail(factoryContract)
313307
314308 let emissionContract = getEmissionAddressOrFail(factoryCfg)
315309
316310 let stakingContract = getStakingAddressOrFail(factoryCfg)
317311
318312 let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg)
319313
320314 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"))
321315
322-let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
323-
324-let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
325-
326-let boostCoeff = {
327- let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
328- if ($isInstanceOf(@, "Int"))
329- then @
330- else throw(($getType(@) + " couldn't be cast to Int"))
331- }
332-
333316 func getTotalCachedGwx (correct) = {
317+ let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
318+ let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
334319 let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
335320 let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
336321 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
337322 let targetEpochOption = getInteger(this, keyTargetEpoch)
338323 let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0)
339324 let isCorrectionActivated = if (isDefined(targetEpochOption))
340325 then (currentEpochUi >= value(targetEpochOption))
341326 else false
342327 let corrective = if (if (isCorrectionActivated)
343328 then correct
344329 else false)
345330 then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0)
346331 else 0
347332 max([0, (totalCachedGwxRaw + corrective)])
348333 }
349334
350335
351336 func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = {
352337 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
353338 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)
354339 StringEntry(historyKEY, historyDATA)
355340 }
356341
357342
358343 func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = {
359344 let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks()
360345 let locksCountKEY = keyStatsLocksCount()
361346 let usersCountKEY = keyStatsUsersCount()
362347 let totalAmountKEY = keyLockParamTotalAmount()
363348 let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY)
364349 let locksCount = ioz(this, locksCountKEY)
365350 let usersCount = ioz(this, usersCountKEY)
366351 let totalAmount = ioz(this, totalAmountKEY)
367352 [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))]
368353 }
369354
370355
371356 func calcGwxAmount (kRaw,bRaw,h) = {
372357 let SCALE = 1000
373358 (((kRaw * h) + bRaw) / SCALE)
374359 }
375360
376361
377362 func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = {
378363 let userAmountKEY = keyLockParamUserAmount(userNum)
379364 let startBlockKEY = keyLockParamStartBlock(userNum)
380365 let durationKEY = keyLockParamDuration(userNum)
381366 let kKEY = keyLockParamK(userNum)
382367 let bKEY = keyLockParamB(userNum)
383368 let kByPeriodKEY = keyLockParamByPeriodK(userNum, period)
384369 let bByPeriodKEY = keyLockParamByPeriodB(userNum, period)
385370 let gwxAmount = calcGwxAmount(k, b, height)
386371 [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))]
387372 }
388373
389374
390375 func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1))
391376 then throw("only one payment is allowed")
392377 else if ((size(i.payments) == 0))
393378 then 0
394379 else {
395380 let pmt = i.payments[0]
396381 if ((value(pmt.assetId) != expectedAssetId))
397382 then throw("invalid asset id in payment")
398383 else pmt.amount
399384 }
400385
401386
402387 func calcUserGwxAmountAtHeight (userAddress,targetHeight) = {
403388 let EMPTY = "empty"
404389 let user2NumMappingKEY = keyUser2NumMapping(userAddress)
405390 let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY)
406391 let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0)
407392 let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0)
408393 let gwxAmountCalc = calcGwxAmount(k, b, targetHeight)
409394 let gwxAmount = if ((0 > gwxAmountCalc))
410395 then 0
411396 else gwxAmountCalc
412397 gwxAmount
413398 }
414399
415400
416401 func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height)
417402
418403
419-func getVotingEmissionEpochInfo () = {
420- let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
421- let $t01515015438 = {
422- let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
423- let lastFinalizedEpoch = (currentEpochUi - 1)
424- if ((0 > lastFinalizedEpoch))
425- then throwErr("invalid epoch")
426- else $Tuple2(currentEpochUi, lastFinalizedEpoch)
427- }
428- let currentEpochUi = $t01515015438._1
429- let lastFinalizedEpoch = $t01515015438._2
430- func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
431-
432- let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
433- $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
434- }
435-
436-
437-func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
438- let idxAmountAssetId = 4
439- let idxPriceAssetId = 5
440- let poolCfg = {
441- let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
442- if ($isInstanceOf(@, "List[Any]"))
443- then @
444- else throw(($getType(@) + " couldn't be cast to List[Any]"))
445- }
446- let amountAssetId = {
447- let @ = poolCfg[idxAmountAssetId]
448- if ($isInstanceOf(@, "String"))
449- then @
450- else throw(($getType(@) + " couldn't be cast to String"))
451- }
452- let priceAssetId = {
453- let @ = poolCfg[idxPriceAssetId]
454- if ($isInstanceOf(@, "String"))
455- then @
456- else throw(($getType(@) + " couldn't be cast to String"))
457- }
458- $Tuple2(amountAssetId, priceAssetId)
459- }
460-
461-
462-func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
463-
464-
465-func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
466-
467-
468-func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
469-
470-
471-func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
472-
473-
474-func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
475-
476-
477-func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
478-
479-
480-func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
481-
482-
483-func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
484-
485-
486-func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
487-
488-
489-func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
490- let userAddress = addressFromStringValue(userAddressStr)
491- let $t01822818308 = getVotingEmissionEpochInfo()
492- let lastFinalizedEpoch = $t01822818308._1
493- let currentEpochStartHeight = $t01822818308._2
494- let $t01831118386 = getPoolAssetsByLpAssetId(lpAssetIdStr)
495- let amountAssetId = $t01831118386._1
496- let priceAssetId = $t01831118386._2
497- let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
498- let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
499- userVote
500- }
501-
502-
503-func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
504- let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
505- let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
506- if ((stakedByUser == 0))
507- then 0
508- else userVote
509- }
510-
511-
512-func getVotingResultStaked (lpAssetIdStr) = {
513- let $t01893019010 = getVotingEmissionEpochInfo()
514- let lastFinalizedEpoch = $t01893019010._1
515- let currentEpochStartHeight = $t01893019010._2
516- let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
517- let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
518- votingResultStaked
519- }
520-
521-
522-func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
523- let $t01953119611 = getVotingEmissionEpochInfo()
524- let lastFinalizedEpoch = $t01953119611._1
525- let currentEpochStartHeight = $t01953119611._2
526- let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
527- let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
528- let votingResultStakedIntegralKey = keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)
529- let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
530- let votingResultLastUpdateHeightKey = keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)
531- let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, votingResultLastUpdateHeightKey), currentEpochStartHeight)
532- let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
533- let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
534- $Tuple2([IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(votingResultLastUpdateHeightKey, height), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], votingResultStakedIntegral)
535- }
536-
537-
538-func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
539- let $t02081120891 = getVotingEmissionEpochInfo()
540- let lastFinalizedEpoch = $t02081120891._1
541- let currentEpochStartHeight = $t02081120891._2
542- let userAddress = addressFromStringValue(userAddressStr)
543- let idxAmountAssetId = 4
544- let idxPriceAssetId = 5
545- let poolCfg = {
546- let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
547- if ($isInstanceOf(@, "List[Any]"))
548- then @
549- else throw(($getType(@) + " couldn't be cast to List[Any]"))
550- }
551- let amountAssetId = {
552- let @ = poolCfg[idxAmountAssetId]
553- if ($isInstanceOf(@, "String"))
554- then @
555- else throw(($getType(@) + " couldn't be cast to String"))
556- }
557- let priceAssetId = {
558- let @ = poolCfg[idxPriceAssetId]
559- if ($isInstanceOf(@, "String"))
560- then @
561- else throw(($getType(@) + " couldn't be cast to String"))
562- }
563- let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
564- let actions = if ((userVote == 0))
565- then nil
566- else {
567- let stakedVoteDelta = if (edge)
568- then userVote
569- else -(userVote)
570- let $t02149621615 = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
571- let votingResultActions = $t02149621615._1
572- let votingResultStakedIntegral = $t02149621615._2
573- let userVoteStaked = if (edge)
574- then 0
575- else userVote
576- let userVoteStakedIntegralKey = keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)
577- let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
578- let userVoteStakedLastUpdateHeightKey = keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)
579- let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, userVoteStakedLastUpdateHeightKey), currentEpochStartHeight)
580- let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
581- let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
582- let voteActions = [IntegerEntry(userVoteStakedLastUpdateHeightKey, height), IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral)]
583- (votingResultActions ++ voteActions)
584- }
585- actions
586- }
587-
588-
589-func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
590- let $t02260722687 = getVotingEmissionEpochInfo()
591- let lastFinalizedEpoch = $t02260722687._1
592- let currentEpochStartHeight = $t02260722687._2
593- let userAddress = addressFromStringValue(userAddressStr)
594- let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
595- let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
596- let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
597- let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
598- let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
599- let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
600- let userVoteStakedIntegralKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
601- let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralKey), 0)
602- let votingResultStakedIntegralKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
603- let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralKey), 0)
604- let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
605- let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
606- let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
607- let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
608- let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
609- let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
610- $Tuple3([IntegerEntry(userVoteStakedIntegralKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
611- }
612-
613-
614-func refreshBoostEmissionIntegral () = {
615- let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent())
616- let boostingV2LastUpdateHeightOption = getInteger(emissionContract, keyBoostingV2LastUpdateHeight())
617- let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
618- let emissionEnd = iof(emissionContract, keyEmissionEndBlock())
619- let h = if ((height > emissionEnd))
620- then emissionEnd
621- else height
622- let dh = match boostingV2LastUpdateHeightOption {
623- case lastUpdateHeight: Int =>
624- max([(h - lastUpdateHeight), 0])
625- case _: Unit =>
626- 0
627- case _ =>
628- throw("Match error")
629- }
630- let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
631- let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
632- let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
633- $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
634- }
635-
636-
637404 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
638- let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
639- if ((userRecordOption == unit))
405+ let EMPTY = "EMPTY"
406+ let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
407+ if ((userRecordOrEmpty == EMPTY))
640408 then $Tuple3(0, nil, "userRecord::is::empty")
641409 else {
642- let userRecordArray = split(value(userRecordOption), SEP)
410+ let userRecordArray = split(userRecordOrEmpty, SEP)
643411 let userNumStr = userRecordArray[IdxLockUserNum]
412+ let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
644413 let EMPTYSTR = "empty"
645- let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
414+ let $t01539715965 = if ((lpAssetIdStr != EMPTYSTR))
646415 then {
647416 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
648- getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
417+ let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
418+ let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
419+ $Tuple2(pw0, pw1)
649420 }
650421 else if (readOnly)
651- then 0
422+ then $Tuple2(0, 0)
652423 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])
653433 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
654434 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
655435 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
656- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
436+ let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
657437 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
658- if ((0 > userBoostEmissionIntegral))
659- then throw("wrong calculations")
660- else {
661- let $t02721227351 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
662- let stakedVotesIntegralsActions = $t02721227351._1
663- let userVoteIntegralDiff = $t02721227351._2
664- let totalVotesIntegralDiff = $t02721227351._3
665- let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
666- let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
667- then 0
668- else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
669- let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
670- let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
671- $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
672- }
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+ }
673481 }
674482 }
675483
676484
677485 func lockActions (i,duration) = {
678486 let cfgArray = readConfigArrayOrFail()
679487 let assetIdStr = cfgArray[IdxCfgAssetId]
680488 let assetId = fromBase58String(assetIdStr)
681489 let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount])
682490 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
683491 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
684492 if ((size(i.payments) != 1))
685493 then throw("invalid payment - exact one payment must be attached")
686494 else {
687495 let pmt = i.payments[0]
688496 let pmtAmount = pmt.amount
689497 if ((assetId != value(pmt.assetId)))
690498 then throw((("invalid asset is in payment - " + assetIdStr) + " is expected"))
691499 else {
692500 let nextUserNumKEY = keyNextUserNum()
693501 let userAddressStr = toString(i.caller)
694502 let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr)))
695503 let userNumStr = if (userIsExisting)
696504 then value(getString(keyUser2NumMapping(userAddressStr)))
697505 else toString(iof(this, nextUserNumKEY))
698506 let userNum = parseIntValue(userNumStr)
699507 let lockStart = height
700508 let startBlockKEY = keyLockParamStartBlock(userNumStr)
701509 let durationKEY = keyLockParamDuration(userNumStr)
702510 let userAmountKEY = keyLockParamUserAmount(userNumStr)
703511 if (if ((minLockAmount > pmtAmount))
704512 then (i.caller != lpStakingPoolsContract)
705513 else false)
706514 then throw(("amount is less then minLockAmount=" + toString(minLockAmount)))
707515 else if ((minLockDuration > duration))
708516 then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration)))
709517 else if ((duration > maxLockDuration))
710518 then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration)))
711519 else if (if (userIsExisting)
712520 then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart)
713521 else false)
714522 then throw("there is an active lock - consider to use increaseLock")
715523 else if ((ioz(this, userAmountKEY) > 0))
716524 then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY))
717525 else {
718526 let coeffX8 = fraction(duration, MULT8, maxLockDuration)
719527 let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8)
720528 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil))
721529 let k = ai(gWxParamsResultList[0])
722530 let b = ai(gWxParamsResultList[1])
723531 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])
539+ 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)
724545 let totalCachedGwxRaw = getTotalCachedGwx(false)
725- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
726- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
727546 let arr = if (userIsExisting)
728547 then nil
729548 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
730549 $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting)
731550 then 0
732551 else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart)
733552 }
734553 }
735554 }
736555 }
737556
738557
739558 @Callable(i)
740559 func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = {
741560 let checkCaller = mustManager(i)
742561 if ((checkCaller == checkCaller))
743562 then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0))
744563 else throw("Strict value is not equal to itself.")
745564 }
746565
747566
748567
749568 @Callable(i)
750569 func lockRef (duration,referrerAddress,signature) = {
751- let $t03194132006 = lockActions(i, duration)
752- let lockActionsResult = $t03194132006._1
753- let gWxAmountStart = $t03194132006._2
570+ let $t02443024495 = lockActions(i, duration)
571+ let lockActionsResult = $t02443024495._1
572+ let gWxAmountStart = $t02443024495._2
754573 let referralAddress = toString(i.caller)
755574 let refInv = if (if ((referrerAddress == ""))
756575 then true
757576 else (signature == base58''))
758577 then unit
759578 else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil)
760579 if ((refInv == refInv))
761580 then {
762581 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
763582 if ((updateRefActivity == updateRefActivity))
764583 then $Tuple2(lockActionsResult, unit)
765584 else throw("Strict value is not equal to itself.")
766585 }
767586 else throw("Strict value is not equal to itself.")
768587 }
769588
770589
771590
772591 @Callable(i)
773592 func lock (duration) = {
774- let $t03246432529 = lockActions(i, duration)
775- let lockActionsResult = $t03246432529._1
776- let gWxAmountStart = $t03246432529._2
593+ let $t02495325018 = lockActions(i, duration)
594+ let lockActionsResult = $t02495325018._1
595+ let gWxAmountStart = $t02495325018._2
777596 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
778597 if ((updateRefActivity == updateRefActivity))
779598 then $Tuple2(lockActionsResult, unit)
780599 else throw("Strict value is not equal to itself.")
781600 }
782601
783602
784603
785604 @Callable(i)
786605 func increaseLock (deltaDuration) = {
787606 let cfgArray = readConfigArrayOrFail()
788607 let assetIdStr = cfgArray[IdxCfgAssetId]
789608 let assetId = fromBase58String(assetIdStr)
790609 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
791610 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
792611 let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId)
793612 let userAddressStr = toString(i.caller)
794613 let userRecordArray = readLockParamsRecordOrFail(userAddressStr)
795614 let userNumStr = userRecordArray[IdxLockUserNum]
796615 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
797616 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
798617 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
799618 let lockEnd = (lockStart + lockDuration)
800619 let remainingDuration = max([(lockEnd - height), 0])
801620 let userAmountNew = (userAmount + pmtAmount)
802621 let lockDurationNew = (remainingDuration + deltaDuration)
803622 if ((0 > deltaDuration))
804623 then throw("duration is less then zero")
805624 else if ((minLockDuration > lockDurationNew))
806625 then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration)))
807626 else if ((lockDurationNew > maxLockDuration))
808627 then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration)))
809628 else {
810629 let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration)
811630 let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8)
812631 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
813632 if ((updateRefActivity == updateRefActivity))
814633 then {
815634 let lockStartNew = height
816635 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil))
817636 let k = ai(gWxParamsResultList[0])
818637 let b = ai(gWxParamsResultList[1])
819638 let period = toString(ai(gWxParamsResultList[2]))
820- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
821- let gwxDiff = (gWxAmountStart - currUserGwx)
822- if ((0 > gwxDiff))
823- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
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")
824652 else {
825- let totalCachedGwxRaw = getTotalCachedGwx(false)
826- let totalCachedGwxCorrected = getTotalCachedGwx(true)
827- (((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))])
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+ }
828672 }
829673 }
830674 else throw("Strict value is not equal to itself.")
831675 }
832676 }
833677
834678
835679
836680 @Callable(i)
837681 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
838682 then throw("permissions denied")
839683 else {
840- let $t03561635718 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
841- let userBoostAvailable = $t03561635718._1
842- let dataState = $t03561635718._2
843- let debug = $t03561635718._3
684+ let $t02999930101 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
685+ let userBoostAvailable = $t02999930101._1
686+ let dataState = $t02999930101._2
687+ let debug = $t02999930101._3
844688 $Tuple2(dataState, [userBoostAvailable])
845689 }
846690
847691
848692
849693 @Callable(i)
850694 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
851- let $t03585035951 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
852- let userBoostAvailable = $t03585035951._1
853- let dataState = $t03585035951._2
854- let debug = $t03585035951._3
695+ let $t03023330334 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
696+ let userBoostAvailable = $t03023330334._1
697+ let dataState = $t03023330334._2
698+ let debug = $t03023330334._3
855699 $Tuple2(nil, [userBoostAvailable, debug])
856700 }
857701
858702
859703
860704 @Callable(i)
861705 func unlock (userAddress) = {
862706 let userRecordArray = readLockParamsRecordOrFail(userAddress)
863707 let userNumStr = userRecordArray[IdxLockUserNum]
864708 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
865709 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
866710 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
867711 let lockEnd = (lockStart + lockDuration)
868712 let cfgArray = readConfigArrayOrFail()
869713 let assetId = fromBase58String(cfgArray[IdxCfgAssetId])
870714 if ((lockEnd >= height))
871715 then throw((("wait " + toString(lockEnd)) + " to unlock"))
872716 else if ((0 >= userAmount))
873717 then throw("nothing to unlock")
874718 else {
875719 let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0)
876720 (((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))
877721 }
878722 }
879723
880724
881725
882726 @Callable(i)
883727 func gwxUserInfoREADONLY (userAddress) = {
884728 let gwxAmount = calcCurrentGwxAmount(userAddress)
885729 $Tuple2(nil, [gwxAmount])
886730 }
887731
888732
889733
890734 @Callable(i)
891735 func userMaxDurationREADONLY (userAddressStr) = {
892736 let cfgArray = readConfigArrayOrFail()
893737 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
894738 let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
895739 if ((userRecordOption == unit))
896740 then $Tuple2(nil, $Tuple2("lock", maxLockDuration))
897741 else {
898742 let userRecordArray = split(value(userRecordOption), SEP)
899743 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
900744 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
901745 let lockEnd = (lockStart + lockDuration)
902746 let remainingDuration = max([(lockEnd - height), 0])
903747 let maxDeltaDuration = (maxLockDuration - remainingDuration)
904748 $Tuple2(nil, $Tuple2("increaseLock", maxDeltaDuration))
905749 }
906750 }
907751
908752
909753
910754 @Callable(i)
911755 func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = {
912756 let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight)
913757 $Tuple2(nil, gwxAmount)
914758 }
915759
916760
917761
918762 @Callable(i)
919763 func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true))
920764
921765
922766
923767 @Callable(i)
924-func onBoostEmissionUpdate () = {
925- let checkCaller = if ((i.caller == emissionContract))
926- then true
927- else mustManager(i)
928- if ((checkCaller == checkCaller))
929- then refreshBoostEmissionIntegral()
930- else throw("Strict value is not equal to itself.")
931- }
932-
933-
934-
935-@Callable(i)
936-func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
937- let checkCaller = if ((i.caller == stakingContract))
938- then true
939- else mustManager(i)
940- if ((checkCaller == checkCaller))
941- then {
942- let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
943- $Tuple2(actions, unit)
944- }
945- else throw("Strict value is not equal to itself.")
946- }
947-
948-
949-
950-@Callable(i)
951-func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
952-
953-
954-
955-@Callable(i)
956-func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
957-
958-
959-
960-@Callable(i)
961768 func setManager (pendingManagerPublicKey) = {
962769 let checkCaller = mustManager(i)
963770 if ((checkCaller == checkCaller))
964771 then {
965772 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
966773 if ((checkManagerPublicKey == checkManagerPublicKey))
967774 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
968775 else throw("Strict value is not equal to itself.")
969776 }
970777 else throw("Strict value is not equal to itself.")
971778 }
972779
973780
974781
975782 @Callable(i)
976783 func confirmManager () = {
977784 let pm = pendingManagerPublicKeyOrUnit()
978785 let hasPM = if (isDefined(pm))
979786 then true
980787 else throw("No pending manager")
981788 if ((hasPM == hasPM))
982789 then {
983790 let checkPM = if ((i.callerPublicKey == value(pm)))
984791 then true
985792 else throw("You are not pending manager")
986793 if ((checkPM == checkPM))
987794 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
988795 else throw("Strict value is not equal to itself.")
989796 }
990797 else throw("Strict value is not equal to itself.")
991798 }
992799
993800
994801 @Verifier(tx)
995802 func verify () = {
996803 let targetPublicKey = match managerPublicKeyOrUnit() {
997804 case pk: ByteVector =>
998805 pk
999806 case _: Unit =>
1000807 tx.senderPublicKey
1001808 case _ =>
1002809 throw("Match error")
1003810 }
1004811 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
1005812 }
1006813

github/deemru/w8io/026f985 
114.09 ms