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