tx · FrmrX26juBRC6YB1Q4YFgRADYaRda8jQKgHKhw9yxZS4

3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy:  -0.02700000 Waves

2023.03.24 14:02 [2504001] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves

{ "type": 13, "id": "FrmrX26juBRC6YB1Q4YFgRADYaRda8jQKgHKhw9yxZS4", "fee": 2700000, "feeAssetId": null, "timestamp": 1679655764629, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "5a2yAPkrGUgVVaRJmo5ktbJjVCps6VLYeYHjc4qG8EXWH1T5X42CzSUjv6yo9e93PWkHQxXgXWwNMs8EqNJB5Q8T" ], "script": "base64:BgLFLggCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIDCgEIEgQKAggBEgASBQoDCAgEEgMKAQgSAwoBCBIAIgNTRVAiBlNDQUxFOCIFTVVMVDgiDlBPT0xXRUlHSFRNVUxUIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIgRzdHJmIgdhZGRyZXNzIgNrZXkiA2lveiIDaW9kIgpkZWZhdWx0VmFsIgNpb2YiA2FicyIDdmFsIgNhYWwiByRtYXRjaDAiCnZhbEFueUx5c3QiAmFpIgZ2YWxJbnQiG2tleVJlZmVycmFsc0NvbnRyYWN0QWRkcmVzcyIecmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzT3JGYWlsIhZrZXlSZWZlcnJhbFByb2dyYW1OYW1lIhpyZWZlcnJhbFByb2dyYW1OYW1lRGVmYXVsdCITcmVmZXJyYWxQcm9ncmFtTmFtZSIRa2V5RmFjdG9yeUFkZHJlc3MiGElkeEZhY3RvcnlDZmdTdGFraW5nRGFwcCIZSWR4RmFjdG9yeUNmZ0Jvb3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GYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAmFHAQ5jb25maXJtTWFuYWdlcgAEAmZvCQECYUUABAJmcAMJAQlpc0RlZmluZWQBBQJmbwYJAAIBAhJObyBwZW5kaW5nIG1hbmFnZXIDCQAAAgUCZnAFAmZwBAJmcQMJAAACCAUCYUcPY2FsbGVyUHVibGljS2V5CQEFdmFsdWUBBQJmbwYJAAIBAhtZb3UgYXJlIG5vdCBwZW5kaW5nIG1hbmFnZXIDCQAAAgUCZnEFAmZxCQDMCAIJAQtTdHJpbmdFbnRyeQIJAQJhZgAJANgEAQkBBXZhbHVlAQUCZm8JAMwIAgkBC0RlbGV0ZUVudHJ5AQkBAmFnAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJmcgECZnMABAJmdAQBcgkBAmFDAAMJAAECBQFyAgpCeXRlVmVjdG9yBAJhSQUBcgUCYUkDCQABAgUBcgIEVW5pdAgFAmZyD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJmcglib2R5Qnl0ZXMJAJEDAggFAmZyBnByb29mcwAABQJmdE9BJr0=", "height": 2504001, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HmqUuJtKVNmf5ixrkJB3h5DM5xWvWZXH81sWF61bE8XL Next: 7B4BJQ9ihYXCgDa9mmhZUBXr85d1mxT1rRuNQyCNYk6a 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)
307301 func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective"
308302
309303
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-
343304 let factoryContract = readFactoryAddressOrFail()
344305
345306 let factoryCfg = readFactoryCfgOrFail(factoryContract)
356317
357318 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
358319
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-
366320 func getTotalCachedGwx (correct) = {
367- let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi())
321+ let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
322+ let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
368323 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
369324 let targetEpochOption = getInteger(this, keyTargetEpoch)
370325 let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0)
449404
450405
451406 func getVotingEmissionEpochInfo () = {
452- let $t01719017480 = {
453- let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi()))
407+ let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
408+ let $t01492815216 = {
409+ let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
454410 let lastFinalizedEpoch = (currentEpochUi - 1)
455411 if ((0 > lastFinalizedEpoch))
456412 then throwErr("invalid epoch")
457413 else $Tuple2(currentEpochUi, lastFinalizedEpoch)
458414 }
459- let currentEpochUi = $t01719017480._1
460- let lastFinalizedEpoch = $t01719017480._2
415+ let currentEpochUi = $t01492815216._1
416+ let lastFinalizedEpoch = $t01492815216._2
417+ func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
418+
461419 let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
462420 $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
463421 }
464422
465423
466-func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
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)
467473 let idxAmountAssetId = 4
468474 let idxPriceAssetId = 5
469475 let poolCfg = {
470- let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil)
476+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
471477 if ($isInstanceOf(@, "List[Any]"))
472478 then @
473479 else throw(($getType(@) + " couldn't be cast to List[Any]"))
484490 then @
485491 else throw(($getType(@) + " couldn't be cast to String"))
486492 }
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))
493+ let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
494+ let actions = if ((userVote == 0))
569495 then nil
570496 else {
571497 let stakedVoteDelta = if (edge)
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)]
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)]
577513 (votingResultActions ++ voteActions)
578514 }
579515 actions
580516 }
581517
582518
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-
623519 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
624- let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
625- if ((userRecordOption == unit))
520+ let EMPTY = "EMPTY"
521+ let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
522+ if ((userRecordOrEmpty == EMPTY))
626523 then $Tuple3(0, nil, "userRecord::is::empty")
627524 else {
628- let userRecordArray = split(value(userRecordOption), SEP)
525+ let userRecordArray = split(userRecordOrEmpty, SEP)
629526 let userNumStr = userRecordArray[IdxLockUserNum]
527+ let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
630528 let EMPTYSTR = "empty"
631- let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
529+ let $t02106521633 = if ((lpAssetIdStr != EMPTYSTR))
632530 then {
633531 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
634- getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
532+ let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
533+ let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
534+ $Tuple2(pw0, pw1)
635535 }
636536 else if (readOnly)
637- then 0
537+ then $Tuple2(0, 0)
638538 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])
639548 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
640549 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
641550 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
642- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
551+ let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
643552 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
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- }
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+ }
659596 }
660597 }
661598
707644 let k = ai(gWxParamsResultList[0])
708645 let b = ai(gWxParamsResultList[1])
709646 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])
654+ 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)
710660 let totalCachedGwxRaw = getTotalCachedGwx(false)
711- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
712- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
713661 let arr = if (userIsExisting)
714662 then nil
715663 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
734682
735683 @Callable(i)
736684 func lockRef (duration,referrerAddress,signature) = {
737- let $t03113531200 = lockActions(i, duration)
738- let lockActionsResult = $t03113531200._1
739- let gWxAmountStart = $t03113531200._2
685+ let $t03009830163 = lockActions(i, duration)
686+ let lockActionsResult = $t03009830163._1
687+ let gWxAmountStart = $t03009830163._2
740688 let referralAddress = toString(i.caller)
741689 let refInv = if (if ((referrerAddress == ""))
742690 then true
757705
758706 @Callable(i)
759707 func lock (duration) = {
760- let $t03165831723 = lockActions(i, duration)
761- let lockActionsResult = $t03165831723._1
762- let gWxAmountStart = $t03165831723._2
708+ let $t03062130686 = lockActions(i, duration)
709+ let lockActionsResult = $t03062130686._1
710+ let gWxAmountStart = $t03062130686._2
763711 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
764712 if ((updateRefActivity == updateRefActivity))
765713 then $Tuple2(lockActionsResult, unit)
803751 let k = ai(gWxParamsResultList[0])
804752 let b = ai(gWxParamsResultList[1])
805753 let period = toString(ai(gWxParamsResultList[2]))
806- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
807- let gwxDiff = (gWxAmountStart - currUserGwx)
808- if ((0 > gwxDiff))
809- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
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")
810767 else {
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))])
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+ }
814787 }
815788 }
816789 else throw("Strict value is not equal to itself.")
823796 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
824797 then throw("permissions denied")
825798 else {
826- let $t03481034912 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
827- let userBoostAvailable = $t03481034912._1
828- let dataState = $t03481034912._2
829- let debug = $t03481034912._3
799+ let $t03566735769 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
800+ let userBoostAvailable = $t03566735769._1
801+ let dataState = $t03566735769._2
802+ let debug = $t03566735769._3
830803 $Tuple2(dataState, [userBoostAvailable])
831804 }
832805
834807
835808 @Callable(i)
836809 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
837- let $t03504435145 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
838- let userBoostAvailable = $t03504435145._1
839- let dataState = $t03504435145._2
840- let debug = $t03504435145._3
810+ let $t03590136002 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
811+ let userBoostAvailable = $t03590136002._1
812+ let dataState = $t03590136002._2
813+ let debug = $t03590136002._3
841814 $Tuple2(nil, [userBoostAvailable, debug])
842815 }
843816
907880
908881
909882 @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)
922883 func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
923884 let checkCaller = if ((i.caller == stakingContract))
924885 then true
935896
936897 @Callable(i)
937898 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))
953899
954900
955901
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
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-
343304 let factoryContract = readFactoryAddressOrFail()
344305
345306 let factoryCfg = readFactoryCfgOrFail(factoryContract)
346307
347308 let emissionContract = getEmissionAddressOrFail(factoryCfg)
348309
349310 let stakingContract = getStakingAddressOrFail(factoryCfg)
350311
351312 let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg)
352313
353314 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"))
354315
355316 let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
356317
357318 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
358319
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-
366320 func getTotalCachedGwx (correct) = {
367- let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi())
321+ let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
322+ let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi)
368323 let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP)
369324 let targetEpochOption = getInteger(this, keyTargetEpoch)
370325 let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0)
371326 let isCorrectionActivated = if (isDefined(targetEpochOption))
372327 then (currentEpochUi >= value(targetEpochOption))
373328 else false
374329 let corrective = if (if (isCorrectionActivated)
375330 then correct
376331 else false)
377332 then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0)
378333 else 0
379334 max([0, (totalCachedGwxRaw + corrective)])
380335 }
381336
382337
383338 func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = {
384339 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
385340 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)
386341 StringEntry(historyKEY, historyDATA)
387342 }
388343
389344
390345 func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = {
391346 let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks()
392347 let locksCountKEY = keyStatsLocksCount()
393348 let usersCountKEY = keyStatsUsersCount()
394349 let totalAmountKEY = keyLockParamTotalAmount()
395350 let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY)
396351 let locksCount = ioz(this, locksCountKEY)
397352 let usersCount = ioz(this, usersCountKEY)
398353 let totalAmount = ioz(this, totalAmountKEY)
399354 [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))]
400355 }
401356
402357
403358 func calcGwxAmount (kRaw,bRaw,h) = {
404359 let SCALE = 1000
405360 (((kRaw * h) + bRaw) / SCALE)
406361 }
407362
408363
409364 func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = {
410365 let userAmountKEY = keyLockParamUserAmount(userNum)
411366 let startBlockKEY = keyLockParamStartBlock(userNum)
412367 let durationKEY = keyLockParamDuration(userNum)
413368 let kKEY = keyLockParamK(userNum)
414369 let bKEY = keyLockParamB(userNum)
415370 let kByPeriodKEY = keyLockParamByPeriodK(userNum, period)
416371 let bByPeriodKEY = keyLockParamByPeriodB(userNum, period)
417372 let gwxAmount = calcGwxAmount(k, b, height)
418373 [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))]
419374 }
420375
421376
422377 func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1))
423378 then throw("only one payment is allowed")
424379 else if ((size(i.payments) == 0))
425380 then 0
426381 else {
427382 let pmt = i.payments[0]
428383 if ((value(pmt.assetId) != expectedAssetId))
429384 then throw("invalid asset id in payment")
430385 else pmt.amount
431386 }
432387
433388
434389 func calcUserGwxAmountAtHeight (userAddress,targetHeight) = {
435390 let EMPTY = "empty"
436391 let user2NumMappingKEY = keyUser2NumMapping(userAddress)
437392 let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY)
438393 let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0)
439394 let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0)
440395 let gwxAmountCalc = calcGwxAmount(k, b, targetHeight)
441396 let gwxAmount = if ((0 > gwxAmountCalc))
442397 then 0
443398 else gwxAmountCalc
444399 gwxAmount
445400 }
446401
447402
448403 func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height)
449404
450405
451406 func getVotingEmissionEpochInfo () = {
452- let $t01719017480 = {
453- let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi()))
407+ let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP)
408+ let $t01492815216 = {
409+ let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi))
454410 let lastFinalizedEpoch = (currentEpochUi - 1)
455411 if ((0 > lastFinalizedEpoch))
456412 then throwErr("invalid epoch")
457413 else $Tuple2(currentEpochUi, lastFinalizedEpoch)
458414 }
459- let currentEpochUi = $t01719017480._1
460- let lastFinalizedEpoch = $t01719017480._2
415+ let currentEpochUi = $t01492815216._1
416+ let lastFinalizedEpoch = $t01492815216._2
417+ func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
418+
461419 let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
462420 $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
463421 }
464422
465423
466-func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
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)
467473 let idxAmountAssetId = 4
468474 let idxPriceAssetId = 5
469475 let poolCfg = {
470- let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil)
476+ let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil)
471477 if ($isInstanceOf(@, "List[Any]"))
472478 then @
473479 else throw(($getType(@) + " couldn't be cast to List[Any]"))
474480 }
475481 let amountAssetId = {
476482 let @ = poolCfg[idxAmountAssetId]
477483 if ($isInstanceOf(@, "String"))
478484 then @
479485 else throw(($getType(@) + " couldn't be cast to String"))
480486 }
481487 let priceAssetId = {
482488 let @ = poolCfg[idxPriceAssetId]
483489 if ($isInstanceOf(@, "String"))
484490 then @
485491 else throw(($getType(@) + " couldn't be cast to String"))
486492 }
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))
493+ let userVote = valueOrElse(getInteger(votingEmissionContract, keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)), 0)
494+ let actions = if ((userVote == 0))
569495 then nil
570496 else {
571497 let stakedVoteDelta = if (edge)
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)]
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)]
577513 (votingResultActions ++ voteActions)
578514 }
579515 actions
580516 }
581517
582518
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-
623519 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
624- let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
625- if ((userRecordOption == unit))
520+ let EMPTY = "EMPTY"
521+ let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY)
522+ if ((userRecordOrEmpty == EMPTY))
626523 then $Tuple3(0, nil, "userRecord::is::empty")
627524 else {
628- let userRecordArray = split(value(userRecordOption), SEP)
525+ let userRecordArray = split(userRecordOrEmpty, SEP)
629526 let userNumStr = userRecordArray[IdxLockUserNum]
527+ let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0)
630528 let EMPTYSTR = "empty"
631- let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
529+ let $t02106521633 = if ((lpAssetIdStr != EMPTYSTR))
632530 then {
633531 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
634- getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
532+ let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
533+ let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1)
534+ $Tuple2(pw0, pw1)
635535 }
636536 else if (readOnly)
637- then 0
537+ then $Tuple2(0, 0)
638538 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])
639548 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr)
640549 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
641550 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY))
642- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
551+ let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3)
643552 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
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- }
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+ }
659596 }
660597 }
661598
662599
663600 func lockActions (i,duration) = {
664601 let cfgArray = readConfigArrayOrFail()
665602 let assetIdStr = cfgArray[IdxCfgAssetId]
666603 let assetId = fromBase58String(assetIdStr)
667604 let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount])
668605 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
669606 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
670607 if ((size(i.payments) != 1))
671608 then throw("invalid payment - exact one payment must be attached")
672609 else {
673610 let pmt = i.payments[0]
674611 let pmtAmount = pmt.amount
675612 if ((assetId != value(pmt.assetId)))
676613 then throw((("invalid asset is in payment - " + assetIdStr) + " is expected"))
677614 else {
678615 let nextUserNumKEY = keyNextUserNum()
679616 let userAddressStr = toString(i.caller)
680617 let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr)))
681618 let userNumStr = if (userIsExisting)
682619 then value(getString(keyUser2NumMapping(userAddressStr)))
683620 else toString(iof(this, nextUserNumKEY))
684621 let userNum = parseIntValue(userNumStr)
685622 let lockStart = height
686623 let startBlockKEY = keyLockParamStartBlock(userNumStr)
687624 let durationKEY = keyLockParamDuration(userNumStr)
688625 let userAmountKEY = keyLockParamUserAmount(userNumStr)
689626 if (if ((minLockAmount > pmtAmount))
690627 then (i.caller != lpStakingPoolsContract)
691628 else false)
692629 then throw(("amount is less then minLockAmount=" + toString(minLockAmount)))
693630 else if ((minLockDuration > duration))
694631 then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration)))
695632 else if ((duration > maxLockDuration))
696633 then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration)))
697634 else if (if (userIsExisting)
698635 then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart)
699636 else false)
700637 then throw("there is an active lock - consider to use increaseLock")
701638 else if ((ioz(this, userAmountKEY) > 0))
702639 then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY))
703640 else {
704641 let coeffX8 = fraction(duration, MULT8, maxLockDuration)
705642 let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8)
706643 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil))
707644 let k = ai(gWxParamsResultList[0])
708645 let b = ai(gWxParamsResultList[1])
709646 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])
654+ 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)
710660 let totalCachedGwxRaw = getTotalCachedGwx(false)
711- let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr)
712- let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
713661 let arr = if (userIsExisting)
714662 then nil
715663 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
716664 $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting)
717665 then 0
718666 else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart)
719667 }
720668 }
721669 }
722670 }
723671
724672
725673 @Callable(i)
726674 func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = {
727675 let checkCaller = mustManager(i)
728676 if ((checkCaller == checkCaller))
729677 then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0))
730678 else throw("Strict value is not equal to itself.")
731679 }
732680
733681
734682
735683 @Callable(i)
736684 func lockRef (duration,referrerAddress,signature) = {
737- let $t03113531200 = lockActions(i, duration)
738- let lockActionsResult = $t03113531200._1
739- let gWxAmountStart = $t03113531200._2
685+ let $t03009830163 = lockActions(i, duration)
686+ let lockActionsResult = $t03009830163._1
687+ let gWxAmountStart = $t03009830163._2
740688 let referralAddress = toString(i.caller)
741689 let refInv = if (if ((referrerAddress == ""))
742690 then true
743691 else (signature == base58''))
744692 then unit
745693 else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil)
746694 if ((refInv == refInv))
747695 then {
748696 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
749697 if ((updateRefActivity == updateRefActivity))
750698 then $Tuple2(lockActionsResult, unit)
751699 else throw("Strict value is not equal to itself.")
752700 }
753701 else throw("Strict value is not equal to itself.")
754702 }
755703
756704
757705
758706 @Callable(i)
759707 func lock (duration) = {
760- let $t03165831723 = lockActions(i, duration)
761- let lockActionsResult = $t03165831723._1
762- let gWxAmountStart = $t03165831723._2
708+ let $t03062130686 = lockActions(i, duration)
709+ let lockActionsResult = $t03062130686._1
710+ let gWxAmountStart = $t03062130686._2
763711 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
764712 if ((updateRefActivity == updateRefActivity))
765713 then $Tuple2(lockActionsResult, unit)
766714 else throw("Strict value is not equal to itself.")
767715 }
768716
769717
770718
771719 @Callable(i)
772720 func increaseLock (deltaDuration) = {
773721 let cfgArray = readConfigArrayOrFail()
774722 let assetIdStr = cfgArray[IdxCfgAssetId]
775723 let assetId = fromBase58String(assetIdStr)
776724 let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration])
777725 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
778726 let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId)
779727 let userAddressStr = toString(i.caller)
780728 let userRecordArray = readLockParamsRecordOrFail(userAddressStr)
781729 let userNumStr = userRecordArray[IdxLockUserNum]
782730 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
783731 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
784732 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
785733 let lockEnd = (lockStart + lockDuration)
786734 let remainingDuration = max([(lockEnd - height), 0])
787735 let userAmountNew = (userAmount + pmtAmount)
788736 let lockDurationNew = (remainingDuration + deltaDuration)
789737 if ((0 > deltaDuration))
790738 then throw("duration is less then zero")
791739 else if ((minLockDuration > lockDurationNew))
792740 then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration)))
793741 else if ((lockDurationNew > maxLockDuration))
794742 then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration)))
795743 else {
796744 let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration)
797745 let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8)
798746 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
799747 if ((updateRefActivity == updateRefActivity))
800748 then {
801749 let lockStartNew = height
802750 let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil))
803751 let k = ai(gWxParamsResultList[0])
804752 let b = ai(gWxParamsResultList[1])
805753 let period = toString(ai(gWxParamsResultList[2]))
806- let currUserGwx = calcCurrentGwxAmount(userAddressStr)
807- let gwxDiff = (gWxAmountStart - currUserGwx)
808- if ((0 > gwxDiff))
809- then throw(("gwxDiff is less then 0: " + toString(gwxDiff)))
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")
810767 else {
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))])
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+ }
814787 }
815788 }
816789 else throw("Strict value is not equal to itself.")
817790 }
818791 }
819792
820793
821794
822795 @Callable(i)
823796 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
824797 then throw("permissions denied")
825798 else {
826- let $t03481034912 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
827- let userBoostAvailable = $t03481034912._1
828- let dataState = $t03481034912._2
829- let debug = $t03481034912._3
799+ let $t03566735769 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
800+ let userBoostAvailable = $t03566735769._1
801+ let dataState = $t03566735769._2
802+ let debug = $t03566735769._3
830803 $Tuple2(dataState, [userBoostAvailable])
831804 }
832805
833806
834807
835808 @Callable(i)
836809 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
837- let $t03504435145 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
838- let userBoostAvailable = $t03504435145._1
839- let dataState = $t03504435145._2
840- let debug = $t03504435145._3
810+ let $t03590136002 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
811+ let userBoostAvailable = $t03590136002._1
812+ let dataState = $t03590136002._2
813+ let debug = $t03590136002._3
841814 $Tuple2(nil, [userBoostAvailable, debug])
842815 }
843816
844817
845818
846819 @Callable(i)
847820 func unlock (userAddress) = {
848821 let userRecordArray = readLockParamsRecordOrFail(userAddress)
849822 let userNumStr = userRecordArray[IdxLockUserNum]
850823 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
851824 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
852825 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
853826 let lockEnd = (lockStart + lockDuration)
854827 let cfgArray = readConfigArrayOrFail()
855828 let assetId = fromBase58String(cfgArray[IdxCfgAssetId])
856829 if ((lockEnd >= height))
857830 then throw((("wait " + toString(lockEnd)) + " to unlock"))
858831 else if ((0 >= userAmount))
859832 then throw("nothing to unlock")
860833 else {
861834 let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0)
862835 (((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))
863836 }
864837 }
865838
866839
867840
868841 @Callable(i)
869842 func gwxUserInfoREADONLY (userAddress) = {
870843 let gwxAmount = calcCurrentGwxAmount(userAddress)
871844 $Tuple2(nil, [gwxAmount])
872845 }
873846
874847
875848
876849 @Callable(i)
877850 func userMaxDurationREADONLY (userAddressStr) = {
878851 let cfgArray = readConfigArrayOrFail()
879852 let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration])
880853 let userRecordOption = getString(this, keyLockParamsRecord(userAddressStr))
881854 if ((userRecordOption == unit))
882855 then $Tuple2(nil, $Tuple2("lock", maxLockDuration))
883856 else {
884857 let userRecordArray = split(value(userRecordOption), SEP)
885858 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
886859 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
887860 let lockEnd = (lockStart + lockDuration)
888861 let remainingDuration = max([(lockEnd - height), 0])
889862 let maxDeltaDuration = (maxLockDuration - remainingDuration)
890863 $Tuple2(nil, $Tuple2("increaseLock", maxDeltaDuration))
891864 }
892865 }
893866
894867
895868
896869 @Callable(i)
897870 func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = {
898871 let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight)
899872 $Tuple2(nil, gwxAmount)
900873 }
901874
902875
903876
904877 @Callable(i)
905878 func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true))
906879
907880
908881
909882 @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)
922883 func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
923884 let checkCaller = if ((i.caller == stakingContract))
924885 then true
925886 else mustManager(i)
926887 if ((checkCaller == checkCaller))
927888 then {
928889 let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
929890 $Tuple2(actions, unit)
930891 }
931892 else throw("Strict value is not equal to itself.")
932893 }
933894
934895
935896
936897 @Callable(i)
937898 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))
953899
954900
955901
956902 @Callable(i)
957903 func setManager (pendingManagerPublicKey) = {
958904 let checkCaller = mustManager(i)
959905 if ((checkCaller == checkCaller))
960906 then {
961907 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
962908 if ((checkManagerPublicKey == checkManagerPublicKey))
963909 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
964910 else throw("Strict value is not equal to itself.")
965911 }
966912 else throw("Strict value is not equal to itself.")
967913 }
968914
969915
970916
971917 @Callable(i)
972918 func confirmManager () = {
973919 let pm = pendingManagerPublicKeyOrUnit()
974920 let hasPM = if (isDefined(pm))
975921 then true
976922 else throw("No pending manager")
977923 if ((hasPM == hasPM))
978924 then {
979925 let checkPM = if ((i.callerPublicKey == value(pm)))
980926 then true
981927 else throw("You are not pending manager")
982928 if ((checkPM == checkPM))
983929 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
984930 else throw("Strict value is not equal to itself.")
985931 }
986932 else throw("Strict value is not equal to itself.")
987933 }
988934
989935
990936 @Verifier(tx)
991937 func verify () = {
992938 let targetPublicKey = match managerPublicKeyOrUnit() {
993939 case pk: ByteVector =>
994940 pk
995941 case _: Unit =>
996942 tx.senderPublicKey
997943 case _ =>
998944 throw("Match error")
999945 }
1000946 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
1001947 }
1002948

github/deemru/w8io/026f985 
113.43 ms