tx · 9wdw25zHJFRAv4HbHsdQntcoacSpWEMTi5Ue4KoWDW6m 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.02200000 Waves 2023.03.06 11:07 [2477968] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "9wdw25zHJFRAv4HbHsdQntcoacSpWEMTi5Ue4KoWDW6m", "fee": 2200000, "feeAssetId": null, "timestamp": 1678090038745, "version": 2, "chainId": 84, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "21DFLgUraJxQ24aRGrN8L6rRp9Grow25UVeGM6gr6mrs72d53cKec4i4W1zQJFdh7Lyq1kESAXqovUgyZeL6s7Xf" ], "script": "base64:BgKnHwgCEgMKAQgSAwoBCBIDCgEIEgASABIECgIIARIDCgEIEgQKAggIEgYKBAEYCBgSBAoCGAgSBAoCCAgSAwoBCBIECgIICCIGU0NBTEU4IgVNVUxUMyIFTVVMVDgiB1NDQUxFMTgiBk1VTFQxOCIDU0VQIg5QT09MV0VJR0hUTVVMVCIKemVyb0JpZ0ludCIJb25lQmlnSW50Iglhc0FueUxpc3QiA3ZhbCIHJG1hdGNoMCIKdmFsQW55THlzdCIFYXNJbnQiBnZhbEludCIIYXNTdHJpbmciBnZhbFN0ciIMYXNCeXRlVmVjdG9yIgZ2YWxCaW4iD2dldFN0cmluZ09yRmFpbCIHYWRkcmVzcyIDa2V5IhhnZXRTdHJpbmdCeUFkZHJlc3NPckZhaWwiDGdldEludE9yWmVybyIPZ2V0SW50T3JEZWZhdWx0IgpkZWZhdWx0VmFsIgxnZXRJbnRPckZhaWwiGWdldEJpZ0ludEZyb21TdHJpbmdPclplcm8iHGdldEJpZ0ludEZyb21TdHJpbmdPckRlZmF1bHQiAXMiBXRvWDE4IgdvcmlnVmFsIg1vcmln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mFCBAJkcQUCZHMDCQABAgUCZHECBFVuaXQJAJQKAgkAzAgCCQELRGVsZXRlRW50cnkBCQECYmEBBQJhegUDbmlsBwMJAAECBQJkcQIGU3RyaW5nBAJkdAUCZHEJAJQKAgkAzAgCCQELU3RyaW5nRW50cnkCCQECYmEBBQJhegUCZHQFA25pbAYJAAIBAgtNYXRjaCBlcnJvcgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECC01hdGNoIGVycm9yCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAmNqAQ5vbk1vZGlmeVdlaWdodAICYXICYncDCQECIT0CCAUCY2oGY2FsbGVyBQJhVgkAAgECEnBlcm1pc3Npb25zIGRlbmllZAQCZHUJAQJidgMFAmFyBQJidwAABAJidAgFAmR1Al8xBAJiVQgFAmR1Al8yBAJiVggFAmR1Al8zBQJiVQECZHYBAmR3AAQCZHgEAWwJAQJjZgADCQABAgUBbAIKQnl0ZVZlY3RvcgQCY2wFAWwFAmNsAwkAAQIFAWwCBFVuaXQIBQJkdg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCZHYJYm9keUJ5dGVzCQCRAwIIBQJkdgZwcm9vZnMAAAUCZHiCe9vh", "height": 2477968, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DNvSMRFDobjtEsCMh7HiyYVbXfbMeNsc8TdmnjMo3Fyq Next: 2BxzSun9bdECvdFx65B5UjpGouhuFGnnfqE3JdhFLXd6 Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | + | ||
6 | + | let MULT3 = 1000 | |
5 | 7 | ||
6 | 8 | let MULT8 = 100000000 | |
7 | 9 | ||
16 | 18 | let zeroBigInt = toBigInt(0) | |
17 | 19 | ||
18 | 20 | let oneBigInt = toBigInt(1) | |
19 | - | ||
20 | - | func wrapErr (msg) = makeString(["staking.ride:", toString(this), msg], " ") | |
21 | - | ||
22 | - | ||
23 | - | func throwErr (msg) = throw(wrapErr(msg)) | |
24 | - | ||
25 | 21 | ||
26 | 22 | func asAnyList (val) = match val { | |
27 | 23 | case valAnyLyst: List[Any] => | |
245 | 241 | ||
246 | 242 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
247 | 243 | ||
248 | - | 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")) | |
244 | + | let boostCoeff = { | |
245 | + | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
246 | + | if ($isInstanceOf(@, "Int")) | |
247 | + | then @ | |
248 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
249 | + | } | |
249 | 250 | ||
250 | 251 | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
251 | 252 | ||
331 | 332 | else stakedTotal | |
332 | 333 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
333 | 334 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
334 | - | let MULT3 = 1000 | |
335 | 335 | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
336 | - | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * | |
336 | + | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * boostCoeff)) | |
337 | 337 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
338 | 338 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
339 | 339 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
357 | 357 | ||
358 | 358 | ||
359 | 359 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
360 | - | let $t01475014872 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
361 | - | let wxPerLpIntegralNew = $t01475014872._1 | |
362 | - | let poolIntegralSTATE = $t01475014872._2 | |
363 | - | let poolDEBUG = $t01475014872._3 | |
364 | - | let MULT3 = 1000 | |
360 | + | let $t01428614408 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
361 | + | let wxPerLpIntegralNew = $t01428614408._1 | |
362 | + | let poolIntegralSTATE = $t01428614408._2 | |
363 | + | let poolDEBUG = $t01428614408._3 | |
365 | 364 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
366 | 365 | let stakedByUser = readStaked(stakedByUserKEY) | |
367 | 366 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
418 | 417 | case _ => | |
419 | 418 | throw("Match error") | |
420 | 419 | } | |
421 | - | ||
422 | - | ||
423 | - | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
424 | - | let userAddressStr = toString(userAddress) | |
425 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
426 | - | let poolAddressStr = toString(poolAddress) | |
427 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
428 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
429 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
430 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
431 | - | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
432 | - | let listName = getUsersListName(lpAssetIdStr) | |
433 | - | let listActions = if (if (containsNode(listName, userAddressStr)) | |
434 | - | then (amount == stakedByUser) | |
435 | - | else false) | |
436 | - | then deleteNodeActions(listName, userAddressStr) | |
437 | - | else nil | |
438 | - | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
439 | - | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)._1 | |
440 | - | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
441 | - | let throwIfNothingToClaim = true | |
442 | - | let r = if ((availableToClaim > zeroBigInt)) | |
443 | - | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
444 | - | else unit | |
445 | - | if ((r == r)) | |
446 | - | then if ((amount > stakedByUser)) | |
447 | - | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
448 | - | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
449 | - | else throw("Strict value is not equal to itself.") | |
450 | - | } | |
451 | 420 | ||
452 | 421 | ||
453 | 422 | @Callable(i) | |
523 | 492 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
524 | 493 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 494 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $t02127621393 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
528 | - | let wxToClaimUserNew = $t02127621393._1 | |
529 | - | let integralSTATE = $t02127621393._2 | |
530 | - | let debug = $t02127621393._3 | |
531 | - | let listName = getUsersListName(lpAssetIdStr) | |
532 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | - | then nil | |
534 | - | else insertNodeActions(listName, userAddressStr) | |
535 | - | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
495 | + | let refreshStakedVote = if ((stakedByUser == 0)) | |
496 | + | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, true], nil) | |
497 | + | else unit | |
498 | + | if ((refreshStakedVote == refreshStakedVote)) | |
499 | + | then { | |
500 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
501 | + | let $t01899019107 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
502 | + | let wxToClaimUserNew = $t01899019107._1 | |
503 | + | let integralSTATE = $t01899019107._2 | |
504 | + | let debug = $t01899019107._3 | |
505 | + | let listName = getUsersListName(lpAssetIdStr) | |
506 | + | let listActions = if (containsNode(listName, userAddressStr)) | |
507 | + | then nil | |
508 | + | else insertNodeActions(listName, userAddressStr) | |
509 | + | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
510 | + | } | |
511 | + | else throw("Strict value is not equal to itself.") | |
536 | 512 | } | |
537 | 513 | ||
538 | 514 | ||
541 | 517 | func unstake (lpAssetIdStr,amount) = { | |
542 | 518 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
543 | 519 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
544 | - | let poolAddress = addressFromStringValue(poolAddressStr) | |
545 | - | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
520 | + | let poolAddon = valueOrElse(getString(addressFromStringValue(poolAddressStr), keyAddonAddr()), poolAddressStr) | |
546 | 521 | let callerStr = toString(i.caller) | |
547 | - | let | |
522 | + | let userAddressStr = if (if ((callerStr == poolAddressStr)) | |
548 | 523 | then true | |
549 | 524 | else (callerStr == poolAddon)) | |
550 | - | then i.originCaller | |
551 | - | else i.caller | |
552 | - | let lpAssetRecipientAddress = i.caller | |
553 | - | unstakeActions(i, lpAssetId, poolAddress, userAddress, lpAssetRecipientAddress, amount) | |
554 | - | } | |
555 | - | ||
556 | - | ||
557 | - | ||
558 | - | @Callable(i) | |
559 | - | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
560 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
561 | - | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
562 | - | let checkCaller = if ((i.caller == poolAddress)) | |
563 | - | then true | |
564 | - | else permissionDeniedError | |
565 | - | if ((checkCaller == checkCaller)) | |
566 | - | then unstakeActions(i, lpAssetId, poolAddress, Address(userAddress), Address(lpAssetRecipientAddress), amount) | |
525 | + | then toString(i.originCaller) | |
526 | + | else callerStr | |
527 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
528 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
529 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
530 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
531 | + | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
532 | + | let listName = getUsersListName(lpAssetIdStr) | |
533 | + | let listActions = if (if (containsNode(listName, userAddressStr)) | |
534 | + | then (amount == stakedByUser) | |
535 | + | else false) | |
536 | + | then deleteNodeActions(listName, userAddressStr) | |
537 | + | else nil | |
538 | + | let refreshStakedVote = if ((amount == stakedByUser)) | |
539 | + | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, false], nil) | |
540 | + | else unit | |
541 | + | if ((refreshStakedVote == refreshStakedVote)) | |
542 | + | then { | |
543 | + | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
544 | + | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
545 | + | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddress, 0)._1 | |
546 | + | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
547 | + | let r = if ((availableToClaim > zeroBigInt)) | |
548 | + | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
549 | + | else unit | |
550 | + | if ((r == r)) | |
551 | + | then if ((amount > stakedByUser)) | |
552 | + | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
553 | + | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
554 | + | else throw("Strict value is not equal to itself.") | |
555 | + | } | |
567 | 556 | else throw("Strict value is not equal to itself.") | |
568 | 557 | } | |
569 | 558 | ||
572 | 561 | @Callable(i) | |
573 | 562 | func claimWx (lpAssetIdStr) = { | |
574 | 563 | let userAddressStr = toString(i.caller) | |
575 | - | let throwIfNothingToClaim = true | |
576 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
564 | + | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
577 | 565 | $Tuple2(nil, result) | |
578 | 566 | } | |
579 | 567 | ||
580 | 568 | ||
581 | 569 | ||
582 | 570 | @Callable(i) | |
583 | - | func claimWxDoNotThrow (lpAssetIdStr) = { | |
584 | - | let userAddressStr = toString(i.caller) | |
585 | - | let throwIfNothingToClaim = false | |
586 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
587 | - | $Tuple2(nil, result) | |
588 | - | } | |
589 | - | ||
590 | - | ||
591 | - | ||
592 | - | @Callable(i) | |
593 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr,throwIfNothingToClaim) = { | |
571 | + | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
594 | 572 | let checkCaller = mustThis(i) | |
595 | 573 | if ((checkCaller == checkCaller)) | |
596 | 574 | then { | |
604 | 582 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
605 | 583 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
606 | 584 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
607 | - | let $ | |
608 | - | let wxToClaimUserNew = $ | |
609 | - | let integralSTATE = $ | |
610 | - | let debug = $ | |
585 | + | let $t02314423256 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
586 | + | let wxToClaimUserNew = $t02314423256._1 | |
587 | + | let integralSTATE = $t02314423256._2 | |
588 | + | let debug = $t02314423256._3 | |
611 | 589 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
612 | 590 | if ((zeroBigInt >= availableToClaim)) | |
613 | - | then if (throwIfNothingToClaim) | |
614 | - | then throw("nothing to claim") | |
615 | - | else $Tuple2(nil, 0) | |
591 | + | then throw("nothing to claim") | |
616 | 592 | else { | |
617 | 593 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
618 | 594 | let minRewardPart = availableToClaim | |
619 | - | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
620 | - | let totalReward = (minRewardPart + boostRewardPart) | |
595 | + | let boostRewardPart = min([(minRewardPart * toBigInt((boostCoeff - 1))), toBigInt(wxAmountBoostTotal)]) | |
621 | 596 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
622 | 597 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
623 | 598 | if ((emitBoost == emitBoost)) | |
626 | 601 | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
627 | 602 | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserBoostReward + boostRewardPart) | |
628 | 603 | let claimedTotalPlusAvailableToClaim = (claimedTotal + availableToClaim) | |
629 | - | ||
604 | + | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
630 | 605 | } | |
631 | 606 | else throw("Strict value is not equal to itself.") | |
632 | 607 | } | |
649 | 624 | }, SEP) | |
650 | 625 | let unclaimed = info[3] | |
651 | 626 | let claimed = info[4] | |
652 | - | let res = (resAcc :+ makeString(["%d%d", unclaimed, claimed], SEP)) | |
627 | + | let userVoteFinalized = { | |
628 | + | let @ = invoke(boostingContract, "getUserVoteFinalizedREADONLY", [lpAssetId, userAddressStr], nil) | |
629 | + | if ($isInstanceOf(@, "Int")) | |
630 | + | then @ | |
631 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
632 | + | } | |
633 | + | let res = (resAcc :+ makeString(["%d%d%d", unclaimed, claimed, toString(userVoteFinalized)], SEP)) | |
653 | 634 | let inv = { | |
654 | 635 | let @ = invoke(this, "claimWxBulkInternalREADONLY", [(currentIter + 1), lpAssetIds, userAddressStr, res], nil) | |
655 | 636 | if ($isInstanceOf(@, "List[Any]")) | |
690 | 671 | else (height - emissionStartBlock) | |
691 | 672 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
692 | 673 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
693 | - | let $ | |
694 | - | let wxToClaimUserNew = $ | |
695 | - | let integralSTATE = $ | |
696 | - | let debug = $ | |
674 | + | let $t02715327265 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
675 | + | let wxToClaimUserNew = $t02715327265._1 | |
676 | + | let integralSTATE = $t02715327265._2 | |
677 | + | let debug = $t02715327265._3 | |
697 | 678 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
698 | 679 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
699 | 680 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
700 | 681 | let boostDebug = asString(boostInvResult[1]) | |
701 | 682 | let minRewardPart = availableToClaim | |
702 | - | let boostRewardPart = min([(minRewardPart * toBigInt( | |
683 | + | let boostRewardPart = min([(minRewardPart * toBigInt((boostCoeff - 1))), toBigInt(wxAmountBoostTotal)]) | |
703 | 684 | let totalReward = (minRewardPart + boostRewardPart) | |
704 | 685 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
705 | - | } | |
706 | - | ||
707 | - | ||
708 | - | ||
709 | - | @Callable(i) | |
710 | - | func stakedByUserREADONLY (lpAssetIdStr,userAddressStr) = { | |
711 | - | let stakedByUser = valueOrElse(getInteger(keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
712 | - | $Tuple2(nil, stakedByUser) | |
713 | 686 | } | |
714 | 687 | ||
715 | 688 | ||
739 | 712 | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
740 | 713 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0)._1 | |
741 | 714 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
742 | - | let throwIfNothingToClaim = true | |
743 | 715 | let r = if ((availableToClaim > zeroBigInt)) | |
744 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress | |
716 | + | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
745 | 717 | else unit | |
746 | 718 | if ((r == r)) | |
747 | 719 | then { | |
769 | 741 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
770 | 742 | then throw("permissions denied") | |
771 | 743 | else { | |
772 | - | let $ | |
773 | - | let wxPerLpIntegralNew = $ | |
774 | - | let poolIntegralSTATE = $ | |
775 | - | let poolDEBUG = $ | |
744 | + | let $t02961629726 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
745 | + | let wxPerLpIntegralNew = $t02961629726._1 | |
746 | + | let poolIntegralSTATE = $t02961629726._2 | |
747 | + | let poolDEBUG = $t02961629726._3 | |
776 | 748 | poolIntegralSTATE | |
777 | 749 | } | |
778 | 750 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | + | ||
6 | + | let MULT3 = 1000 | |
5 | 7 | ||
6 | 8 | let MULT8 = 100000000 | |
7 | 9 | ||
8 | 10 | let SCALE18 = 18 | |
9 | 11 | ||
10 | 12 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 13 | ||
12 | 14 | let SEP = "__" | |
13 | 15 | ||
14 | 16 | let POOLWEIGHTMULT = MULT8 | |
15 | 17 | ||
16 | 18 | let zeroBigInt = toBigInt(0) | |
17 | 19 | ||
18 | 20 | let oneBigInt = toBigInt(1) | |
19 | - | ||
20 | - | func wrapErr (msg) = makeString(["staking.ride:", toString(this), msg], " ") | |
21 | - | ||
22 | - | ||
23 | - | func throwErr (msg) = throw(wrapErr(msg)) | |
24 | - | ||
25 | 21 | ||
26 | 22 | func asAnyList (val) = match val { | |
27 | 23 | case valAnyLyst: List[Any] => | |
28 | 24 | valAnyLyst | |
29 | 25 | case _ => | |
30 | 26 | throw("fail to cast into List[Any]") | |
31 | 27 | } | |
32 | 28 | ||
33 | 29 | ||
34 | 30 | func asInt (val) = match val { | |
35 | 31 | case valInt: Int => | |
36 | 32 | valInt | |
37 | 33 | case _ => | |
38 | 34 | throw("fail to cast into Int") | |
39 | 35 | } | |
40 | 36 | ||
41 | 37 | ||
42 | 38 | func asString (val) = match val { | |
43 | 39 | case valStr: String => | |
44 | 40 | valStr | |
45 | 41 | case _ => | |
46 | 42 | throw("fail to cast into Int") | |
47 | 43 | } | |
48 | 44 | ||
49 | 45 | ||
50 | 46 | func asByteVector (val) = match val { | |
51 | 47 | case valBin: ByteVector => | |
52 | 48 | valBin | |
53 | 49 | case _ => | |
54 | 50 | throw("fail to cast into Int") | |
55 | 51 | } | |
56 | 52 | ||
57 | 53 | ||
58 | 54 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
59 | 55 | ||
60 | 56 | ||
61 | 57 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
62 | 58 | ||
63 | 59 | ||
64 | 60 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
65 | 61 | ||
66 | 62 | ||
67 | 63 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
68 | 64 | ||
69 | 65 | ||
70 | 66 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
71 | 67 | ||
72 | 68 | ||
73 | 69 | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
74 | 70 | ||
75 | 71 | ||
76 | 72 | func getBigIntFromStringOrDefault (address,key,defaultVal) = match getString(address, key) { | |
77 | 73 | case s: String => | |
78 | 74 | value(parseBigInt(s)) | |
79 | 75 | case _: Unit => | |
80 | 76 | defaultVal | |
81 | 77 | case _ => | |
82 | 78 | throw("Match error") | |
83 | 79 | } | |
84 | 80 | ||
85 | 81 | ||
86 | 82 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
87 | 83 | ||
88 | 84 | ||
89 | 85 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
90 | 86 | ||
91 | 87 | ||
92 | 88 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
93 | 89 | ||
94 | 90 | ||
95 | 91 | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
96 | 92 | ||
97 | 93 | ||
98 | 94 | let IdxFactoryCfgStakingDapp = 1 | |
99 | 95 | ||
100 | 96 | let IdxFactoryCfgBoostingDapp = 2 | |
101 | 97 | ||
102 | 98 | let IdxFactoryCfgIdoDapp = 3 | |
103 | 99 | ||
104 | 100 | let IdxFactoryCfgTeamDapp = 4 | |
105 | 101 | ||
106 | 102 | let IdxFactoryCfgEmissionDapp = 5 | |
107 | 103 | ||
108 | 104 | let IdxFactoryCfgRestDapp = 6 | |
109 | 105 | ||
110 | 106 | let IdxFactoryCfgSlippageDapp = 7 | |
111 | 107 | ||
112 | 108 | func keyFactoryCfg () = "%s__factoryConfig" | |
113 | 109 | ||
114 | 110 | ||
115 | 111 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
116 | 112 | ||
117 | 113 | ||
118 | 114 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
119 | 115 | ||
120 | 116 | ||
121 | 117 | func keyStablePoolAddonAddr () = "%s__stablePoolAddonAddr" | |
122 | 118 | ||
123 | 119 | ||
124 | 120 | func keyAddonAddr () = "%s__addonAddr" | |
125 | 121 | ||
126 | 122 | ||
127 | 123 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
128 | 124 | ||
129 | 125 | ||
130 | 126 | func keyFactoryLpList () = "%s__lpTokensList" | |
131 | 127 | ||
132 | 128 | ||
133 | 129 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
134 | 130 | ||
135 | 131 | ||
136 | 132 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
137 | 133 | ||
138 | 134 | ||
139 | 135 | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
140 | 136 | ||
141 | 137 | ||
142 | 138 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
143 | 139 | ||
144 | 140 | ||
145 | 141 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
146 | 142 | ||
147 | 143 | ||
148 | 144 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
149 | 145 | ||
150 | 146 | ||
151 | 147 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
152 | 148 | ||
153 | 149 | ||
154 | 150 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
155 | 151 | ||
156 | 152 | ||
157 | 153 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
158 | 154 | ||
159 | 155 | ||
160 | 156 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
161 | 157 | ||
162 | 158 | ||
163 | 159 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
164 | 160 | ||
165 | 161 | ||
166 | 162 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
167 | 163 | ||
168 | 164 | ||
169 | 165 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
170 | 166 | ||
171 | 167 | ||
172 | 168 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
173 | 169 | ||
174 | 170 | ||
175 | 171 | func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
176 | 172 | ||
177 | 173 | ||
178 | 174 | func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP) | |
179 | 175 | ||
180 | 176 | ||
181 | 177 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
182 | 178 | ||
183 | 179 | ||
184 | 180 | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed__total", lpAssetIdStr], SEP) | |
185 | 181 | ||
186 | 182 | ||
187 | 183 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
188 | 184 | ||
189 | 185 | ||
190 | 186 | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
191 | 187 | ||
192 | 188 | ||
193 | 189 | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
194 | 190 | ||
195 | 191 | ||
196 | 192 | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
197 | 193 | ||
198 | 194 | ||
199 | 195 | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
200 | 196 | ||
201 | 197 | ||
202 | 198 | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
203 | 199 | ||
204 | 200 | ||
205 | 201 | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
206 | 202 | ||
207 | 203 | ||
208 | 204 | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
209 | 205 | ||
210 | 206 | ||
211 | 207 | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
212 | 208 | ||
213 | 209 | ||
214 | 210 | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
215 | 211 | ||
216 | 212 | ||
217 | 213 | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
218 | 214 | ||
219 | 215 | ||
220 | 216 | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
221 | 217 | ||
222 | 218 | ||
223 | 219 | func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP) | |
224 | 220 | ||
225 | 221 | ||
226 | 222 | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
227 | 223 | ||
228 | 224 | ||
229 | 225 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
230 | 226 | ||
231 | 227 | ||
232 | 228 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
233 | 229 | ||
234 | 230 | ||
235 | 231 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
236 | 232 | ||
237 | 233 | ||
238 | 234 | let factoryAddress = getStringOrFail(this, keyFactoryAddress()) | |
239 | 235 | ||
240 | 236 | let factoryContract = addressFromStringValue(factoryAddress) | |
241 | 237 | ||
242 | 238 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
243 | 239 | ||
244 | 240 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
245 | 241 | ||
246 | 242 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
247 | 243 | ||
248 | - | 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")) | |
244 | + | let boostCoeff = { | |
245 | + | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
246 | + | if ($isInstanceOf(@, "Int")) | |
247 | + | then @ | |
248 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
249 | + | } | |
249 | 250 | ||
250 | 251 | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
251 | 252 | ||
252 | 253 | ||
253 | 254 | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
254 | 255 | ||
255 | 256 | ||
256 | 257 | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
257 | 258 | ||
258 | 259 | ||
259 | 260 | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
260 | 261 | ||
261 | 262 | ||
262 | 263 | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
263 | 264 | ||
264 | 265 | ||
265 | 266 | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
266 | 267 | ||
267 | 268 | ||
268 | 269 | func containsNode (listName,id) = { | |
269 | 270 | let headOrUnit = getString(this, keyListHead(listName)) | |
270 | 271 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
271 | 272 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
272 | 273 | if (if ((id == valueOrElse(headOrUnit, ""))) | |
273 | 274 | then true | |
274 | 275 | else (prevOrUnit != unit)) | |
275 | 276 | then true | |
276 | 277 | else (nextOrUnit != unit) | |
277 | 278 | } | |
278 | 279 | ||
279 | 280 | ||
280 | 281 | func insertNodeActions (listName,id) = { | |
281 | 282 | let headOrUnit = getString(this, keyListHead(listName)) | |
282 | 283 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
283 | 284 | let checkNode = if (!(containsNode(listName, id))) | |
284 | 285 | then true | |
285 | 286 | else throw("Node exists") | |
286 | 287 | if ((checkNode == checkNode)) | |
287 | 288 | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
288 | 289 | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
289 | 290 | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
290 | 291 | else throw("Strict value is not equal to itself.") | |
291 | 292 | } | |
292 | 293 | ||
293 | 294 | ||
294 | 295 | func deleteNodeActions (listName,id) = { | |
295 | 296 | let headOrUnit = getString(this, keyListHead(listName)) | |
296 | 297 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
297 | 298 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
298 | 299 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
299 | 300 | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
300 | 301 | then (nextOrUnit != unit) | |
301 | 302 | else false) | |
302 | 303 | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
303 | 304 | else if ((nextOrUnit != unit)) | |
304 | 305 | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
305 | 306 | else if ((prevOrUnit != unit)) | |
306 | 307 | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
307 | 308 | else if ((id == valueOrElse(headOrUnit, ""))) | |
308 | 309 | then [DeleteEntry(keyListHead(listName))] | |
309 | 310 | else throw(((("invalid node: " + listName) + ".") + id)))) | |
310 | 311 | } | |
311 | 312 | ||
312 | 313 | ||
313 | 314 | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
314 | 315 | then (stakedByUser > zeroBigInt) | |
315 | 316 | else false) | |
316 | 317 | then zeroBigInt | |
317 | 318 | else if ((stakedByUser == zeroBigInt)) | |
318 | 319 | then wxPerLpIntegralNew | |
319 | 320 | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > zeroBigInt)) | |
320 | 321 | then (stakedByUser > zeroBigInt) | |
321 | 322 | else false) | |
322 | 323 | then value(parseBigInt(getStringOrFail(this, wxPerLpIntegralUserLastKEY))) | |
323 | 324 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
324 | 325 | ||
325 | 326 | ||
326 | 327 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
327 | 328 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
328 | 329 | let stakedTotal = toBigInt(readStaked(stakedTotalKEY)) | |
329 | 330 | let nonZeroStakedTotal = if ((stakedTotal == zeroBigInt)) | |
330 | 331 | then oneBigInt | |
331 | 332 | else stakedTotal | |
332 | 333 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
333 | 334 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
334 | - | let MULT3 = 1000 | |
335 | 335 | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
336 | - | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * | |
336 | + | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * boostCoeff)) | |
337 | 337 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
338 | 338 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
339 | 339 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
340 | 340 | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
341 | 341 | let wxPerLpIntegral = getBigIntFromStringOrZero(this, wxPerLpIntegralKEY) | |
342 | 342 | let wxPerLpOrZeroX3 = 0 | |
343 | 343 | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
344 | 344 | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
345 | 345 | then toBigInt(wxPerLpOrZeroX3) | |
346 | 346 | else fraction(toBigInt(poolWxEmissionPerBlockX3), toBigInt(MULT8), nonZeroStakedTotal) | |
347 | 347 | let stakedTotalNew = (stakedTotal + toBigInt(lpDeltaAmount)) | |
348 | 348 | let nonZeroStakedTotalNew = if ((stakedTotalNew == zeroBigInt)) | |
349 | 349 | then oneBigInt | |
350 | 350 | else stakedTotalNew | |
351 | 351 | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
352 | 352 | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
353 | 353 | let wxPerLpIntegralLastUpdHeightNew = height | |
354 | 354 | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
355 | 355 | $Tuple3(wxPerLpIntegralNew, [StringEntry(wxPerLpIntegralKEY, toString(wxPerLpIntegralNew)), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), StringEntry(wxPerLpKEY, toString(wxPerLpX3New))], debug) | |
356 | 356 | } | |
357 | 357 | ||
358 | 358 | ||
359 | 359 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
360 | - | let $t01475014872 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
361 | - | let wxPerLpIntegralNew = $t01475014872._1 | |
362 | - | let poolIntegralSTATE = $t01475014872._2 | |
363 | - | let poolDEBUG = $t01475014872._3 | |
364 | - | let MULT3 = 1000 | |
360 | + | let $t01428614408 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
361 | + | let wxPerLpIntegralNew = $t01428614408._1 | |
362 | + | let poolIntegralSTATE = $t01428614408._2 | |
363 | + | let poolDEBUG = $t01428614408._3 | |
365 | 364 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
366 | 365 | let stakedByUser = readStaked(stakedByUserKEY) | |
367 | 366 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
368 | 367 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
369 | 368 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
370 | 369 | let wxToClaimUser = getBigIntFromStringOrZero(this, wxToClaimUserKEY) | |
371 | 370 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
372 | 371 | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(toBigInt(stakedByUser), toBigInt(wxPerLpIntegralUserLastUpdHeightOrZero), wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
373 | 372 | let MULT11 = (MULT8 * MULT3) | |
374 | 373 | let wxToClaimUserNew = max([(wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))), zeroBigInt]) | |
375 | 374 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
376 | 375 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
377 | 376 | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
378 | 377 | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [StringEntry(wxToClaimUserKEY, toString(wxToClaimUserNew)), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), StringEntry(wxPerLpIntegralUserLastKEY, toString(wxPerLpIntegralUserLastNew))]), debug) | |
379 | 378 | } | |
380 | 379 | ||
381 | 380 | ||
382 | 381 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
383 | 382 | case s: String => | |
384 | 383 | fromBase58String(s) | |
385 | 384 | case _: Unit => | |
386 | 385 | unit | |
387 | 386 | case _ => | |
388 | 387 | throw("Match error") | |
389 | 388 | } | |
390 | 389 | ||
391 | 390 | ||
392 | 391 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
393 | 392 | case s: String => | |
394 | 393 | fromBase58String(s) | |
395 | 394 | case _: Unit => | |
396 | 395 | unit | |
397 | 396 | case _ => | |
398 | 397 | throw("Match error") | |
399 | 398 | } | |
400 | 399 | ||
401 | 400 | ||
402 | 401 | let permissionDeniedError = throw("Permission denied") | |
403 | 402 | ||
404 | 403 | func mustThis (i) = if ((i.caller == this)) | |
405 | 404 | then true | |
406 | 405 | else permissionDeniedError | |
407 | 406 | ||
408 | 407 | ||
409 | 408 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
410 | 409 | case pk: ByteVector => | |
411 | 410 | if ((i.callerPublicKey == pk)) | |
412 | 411 | then true | |
413 | 412 | else permissionDeniedError | |
414 | 413 | case _: Unit => | |
415 | 414 | if ((i.caller == this)) | |
416 | 415 | then true | |
417 | 416 | else permissionDeniedError | |
418 | 417 | case _ => | |
419 | 418 | throw("Match error") | |
420 | 419 | } | |
421 | - | ||
422 | - | ||
423 | - | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
424 | - | let userAddressStr = toString(userAddress) | |
425 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
426 | - | let poolAddressStr = toString(poolAddress) | |
427 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
428 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
429 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
430 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
431 | - | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
432 | - | let listName = getUsersListName(lpAssetIdStr) | |
433 | - | let listActions = if (if (containsNode(listName, userAddressStr)) | |
434 | - | then (amount == stakedByUser) | |
435 | - | else false) | |
436 | - | then deleteNodeActions(listName, userAddressStr) | |
437 | - | else nil | |
438 | - | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
439 | - | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)._1 | |
440 | - | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
441 | - | let throwIfNothingToClaim = true | |
442 | - | let r = if ((availableToClaim > zeroBigInt)) | |
443 | - | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
444 | - | else unit | |
445 | - | if ((r == r)) | |
446 | - | then if ((amount > stakedByUser)) | |
447 | - | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
448 | - | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
449 | - | else throw("Strict value is not equal to itself.") | |
450 | - | } | |
451 | 420 | ||
452 | 421 | ||
453 | 422 | @Callable(i) | |
454 | 423 | func constructor (factoryAddressStr) = { | |
455 | 424 | let checkCaller = mustManager(i) | |
456 | 425 | if ((checkCaller == checkCaller)) | |
457 | 426 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
458 | 427 | else throw("Strict value is not equal to itself.") | |
459 | 428 | } | |
460 | 429 | ||
461 | 430 | ||
462 | 431 | ||
463 | 432 | @Callable(i) | |
464 | 433 | func constructorV2 (votingEmissionContract) = { | |
465 | 434 | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
466 | 435 | then true | |
467 | 436 | else "invalid voting emission contract address"] | |
468 | 437 | if ((cheks == cheks)) | |
469 | 438 | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
470 | 439 | else throw("Strict value is not equal to itself.") | |
471 | 440 | } | |
472 | 441 | ||
473 | 442 | ||
474 | 443 | ||
475 | 444 | @Callable(i) | |
476 | 445 | func setManager (pendingManagerPublicKey) = { | |
477 | 446 | let checkCaller = mustManager(i) | |
478 | 447 | if ((checkCaller == checkCaller)) | |
479 | 448 | then { | |
480 | 449 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
481 | 450 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
482 | 451 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
483 | 452 | else throw("Strict value is not equal to itself.") | |
484 | 453 | } | |
485 | 454 | else throw("Strict value is not equal to itself.") | |
486 | 455 | } | |
487 | 456 | ||
488 | 457 | ||
489 | 458 | ||
490 | 459 | @Callable(i) | |
491 | 460 | func confirmManager () = { | |
492 | 461 | let pm = pendingManagerPublicKeyOrUnit() | |
493 | 462 | let hasPM = if (isDefined(pm)) | |
494 | 463 | then true | |
495 | 464 | else throw("No pending manager") | |
496 | 465 | if ((hasPM == hasPM)) | |
497 | 466 | then { | |
498 | 467 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
499 | 468 | then true | |
500 | 469 | else throw("You are not pending manager") | |
501 | 470 | if ((checkPM == checkPM)) | |
502 | 471 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
503 | 472 | else throw("Strict value is not equal to itself.") | |
504 | 473 | } | |
505 | 474 | else throw("Strict value is not equal to itself.") | |
506 | 475 | } | |
507 | 476 | ||
508 | 477 | ||
509 | 478 | ||
510 | 479 | @Callable(i) | |
511 | 480 | func stake () = if ((size(i.payments) != 1)) | |
512 | 481 | then throw("invalid payment - exact one payment must be attached") | |
513 | 482 | else { | |
514 | 483 | let pmt = i.payments[0] | |
515 | 484 | let lpAssetId = value(pmt.assetId) | |
516 | 485 | let lpAssetIdStr = toBase58String(lpAssetId) | |
517 | 486 | let amount = pmt.amount | |
518 | 487 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
519 | 488 | let callerStr = toString(i.caller) | |
520 | 489 | let userAddressStr = if ((callerStr == poolAddressStr)) | |
521 | 490 | then toString(i.originCaller) | |
522 | 491 | else callerStr | |
523 | 492 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
524 | 493 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 494 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $t02127621393 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
528 | - | let wxToClaimUserNew = $t02127621393._1 | |
529 | - | let integralSTATE = $t02127621393._2 | |
530 | - | let debug = $t02127621393._3 | |
531 | - | let listName = getUsersListName(lpAssetIdStr) | |
532 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | - | then nil | |
534 | - | else insertNodeActions(listName, userAddressStr) | |
535 | - | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
495 | + | let refreshStakedVote = if ((stakedByUser == 0)) | |
496 | + | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, true], nil) | |
497 | + | else unit | |
498 | + | if ((refreshStakedVote == refreshStakedVote)) | |
499 | + | then { | |
500 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
501 | + | let $t01899019107 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
502 | + | let wxToClaimUserNew = $t01899019107._1 | |
503 | + | let integralSTATE = $t01899019107._2 | |
504 | + | let debug = $t01899019107._3 | |
505 | + | let listName = getUsersListName(lpAssetIdStr) | |
506 | + | let listActions = if (containsNode(listName, userAddressStr)) | |
507 | + | then nil | |
508 | + | else insertNodeActions(listName, userAddressStr) | |
509 | + | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
510 | + | } | |
511 | + | else throw("Strict value is not equal to itself.") | |
536 | 512 | } | |
537 | 513 | ||
538 | 514 | ||
539 | 515 | ||
540 | 516 | @Callable(i) | |
541 | 517 | func unstake (lpAssetIdStr,amount) = { | |
542 | 518 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
543 | 519 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
544 | - | let poolAddress = addressFromStringValue(poolAddressStr) | |
545 | - | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
520 | + | let poolAddon = valueOrElse(getString(addressFromStringValue(poolAddressStr), keyAddonAddr()), poolAddressStr) | |
546 | 521 | let callerStr = toString(i.caller) | |
547 | - | let | |
522 | + | let userAddressStr = if (if ((callerStr == poolAddressStr)) | |
548 | 523 | then true | |
549 | 524 | else (callerStr == poolAddon)) | |
550 | - | then i.originCaller | |
551 | - | else i.caller | |
552 | - | let lpAssetRecipientAddress = i.caller | |
553 | - | unstakeActions(i, lpAssetId, poolAddress, userAddress, lpAssetRecipientAddress, amount) | |
554 | - | } | |
555 | - | ||
556 | - | ||
557 | - | ||
558 | - | @Callable(i) | |
559 | - | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
560 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
561 | - | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
562 | - | let checkCaller = if ((i.caller == poolAddress)) | |
563 | - | then true | |
564 | - | else permissionDeniedError | |
565 | - | if ((checkCaller == checkCaller)) | |
566 | - | then unstakeActions(i, lpAssetId, poolAddress, Address(userAddress), Address(lpAssetRecipientAddress), amount) | |
525 | + | then toString(i.originCaller) | |
526 | + | else callerStr | |
527 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
528 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
529 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
530 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
531 | + | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
532 | + | let listName = getUsersListName(lpAssetIdStr) | |
533 | + | let listActions = if (if (containsNode(listName, userAddressStr)) | |
534 | + | then (amount == stakedByUser) | |
535 | + | else false) | |
536 | + | then deleteNodeActions(listName, userAddressStr) | |
537 | + | else nil | |
538 | + | let refreshStakedVote = if ((amount == stakedByUser)) | |
539 | + | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, false], nil) | |
540 | + | else unit | |
541 | + | if ((refreshStakedVote == refreshStakedVote)) | |
542 | + | then { | |
543 | + | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
544 | + | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
545 | + | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddress, 0)._1 | |
546 | + | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
547 | + | let r = if ((availableToClaim > zeroBigInt)) | |
548 | + | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
549 | + | else unit | |
550 | + | if ((r == r)) | |
551 | + | then if ((amount > stakedByUser)) | |
552 | + | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
553 | + | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
554 | + | else throw("Strict value is not equal to itself.") | |
555 | + | } | |
567 | 556 | else throw("Strict value is not equal to itself.") | |
568 | 557 | } | |
569 | 558 | ||
570 | 559 | ||
571 | 560 | ||
572 | 561 | @Callable(i) | |
573 | 562 | func claimWx (lpAssetIdStr) = { | |
574 | 563 | let userAddressStr = toString(i.caller) | |
575 | - | let throwIfNothingToClaim = true | |
576 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
564 | + | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
577 | 565 | $Tuple2(nil, result) | |
578 | 566 | } | |
579 | 567 | ||
580 | 568 | ||
581 | 569 | ||
582 | 570 | @Callable(i) | |
583 | - | func claimWxDoNotThrow (lpAssetIdStr) = { | |
584 | - | let userAddressStr = toString(i.caller) | |
585 | - | let throwIfNothingToClaim = false | |
586 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
587 | - | $Tuple2(nil, result) | |
588 | - | } | |
589 | - | ||
590 | - | ||
591 | - | ||
592 | - | @Callable(i) | |
593 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr,throwIfNothingToClaim) = { | |
571 | + | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
594 | 572 | let checkCaller = mustThis(i) | |
595 | 573 | if ((checkCaller == checkCaller)) | |
596 | 574 | then { | |
597 | 575 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
598 | 576 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
599 | 577 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
600 | 578 | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
601 | 579 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
602 | 580 | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
603 | 581 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
604 | 582 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
605 | 583 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
606 | 584 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
607 | - | let $ | |
608 | - | let wxToClaimUserNew = $ | |
609 | - | let integralSTATE = $ | |
610 | - | let debug = $ | |
585 | + | let $t02314423256 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
586 | + | let wxToClaimUserNew = $t02314423256._1 | |
587 | + | let integralSTATE = $t02314423256._2 | |
588 | + | let debug = $t02314423256._3 | |
611 | 589 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
612 | 590 | if ((zeroBigInt >= availableToClaim)) | |
613 | - | then if (throwIfNothingToClaim) | |
614 | - | then throw("nothing to claim") | |
615 | - | else $Tuple2(nil, 0) | |
591 | + | then throw("nothing to claim") | |
616 | 592 | else { | |
617 | 593 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
618 | 594 | let minRewardPart = availableToClaim | |
619 | - | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
620 | - | let totalReward = (minRewardPart + boostRewardPart) | |
595 | + | let boostRewardPart = min([(minRewardPart * toBigInt((boostCoeff - 1))), toBigInt(wxAmountBoostTotal)]) | |
621 | 596 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
622 | 597 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
623 | 598 | if ((emitBoost == emitBoost)) | |
624 | 599 | then { | |
625 | 600 | let claimedByUserValue = ((claimedByUser + minRewardPart) + boostRewardPart) | |
626 | 601 | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
627 | 602 | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserBoostReward + boostRewardPart) | |
628 | 603 | let claimedTotalPlusAvailableToClaim = (claimedTotal + availableToClaim) | |
629 | - | ||
604 | + | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
630 | 605 | } | |
631 | 606 | else throw("Strict value is not equal to itself.") | |
632 | 607 | } | |
633 | 608 | } | |
634 | 609 | else throw("Strict value is not equal to itself.") | |
635 | 610 | } | |
636 | 611 | ||
637 | 612 | ||
638 | 613 | ||
639 | 614 | @Callable(i) | |
640 | 615 | func claimWxBulkInternalREADONLY (currentIter,lpAssetIds,userAddressStr,resAcc) = if ((currentIter == size(lpAssetIds))) | |
641 | 616 | then $Tuple2(nil, resAcc) | |
642 | 617 | else { | |
643 | 618 | let lpAssetId = lpAssetIds[currentIter] | |
644 | 619 | let info = split({ | |
645 | 620 | let @ = invoke(this, "claimWxREADONLY", [lpAssetId, userAddressStr], nil) | |
646 | 621 | if ($isInstanceOf(@, "String")) | |
647 | 622 | then @ | |
648 | 623 | else throw(($getType(@) + " couldn't be cast to String")) | |
649 | 624 | }, SEP) | |
650 | 625 | let unclaimed = info[3] | |
651 | 626 | let claimed = info[4] | |
652 | - | let res = (resAcc :+ makeString(["%d%d", unclaimed, claimed], SEP)) | |
627 | + | let userVoteFinalized = { | |
628 | + | let @ = invoke(boostingContract, "getUserVoteFinalizedREADONLY", [lpAssetId, userAddressStr], nil) | |
629 | + | if ($isInstanceOf(@, "Int")) | |
630 | + | then @ | |
631 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
632 | + | } | |
633 | + | let res = (resAcc :+ makeString(["%d%d%d", unclaimed, claimed, toString(userVoteFinalized)], SEP)) | |
653 | 634 | let inv = { | |
654 | 635 | let @ = invoke(this, "claimWxBulkInternalREADONLY", [(currentIter + 1), lpAssetIds, userAddressStr, res], nil) | |
655 | 636 | if ($isInstanceOf(@, "List[Any]")) | |
656 | 637 | then @ | |
657 | 638 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
658 | 639 | } | |
659 | 640 | if ((inv == inv)) | |
660 | 641 | then $Tuple2(nil, inv) | |
661 | 642 | else throw("Strict value is not equal to itself.") | |
662 | 643 | } | |
663 | 644 | ||
664 | 645 | ||
665 | 646 | ||
666 | 647 | @Callable(i) | |
667 | 648 | func claimWxBulkREADONLY (lpAssetIds,userAddressStr) = { | |
668 | 649 | let res = invoke(this, "claimWxBulkInternalREADONLY", [0, lpAssetIds, userAddressStr, nil], nil) | |
669 | 650 | $Tuple2(nil, res) | |
670 | 651 | } | |
671 | 652 | ||
672 | 653 | ||
673 | 654 | ||
674 | 655 | @Callable(i) | |
675 | 656 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
676 | 657 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
677 | 658 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
678 | 659 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
679 | 660 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
680 | 661 | let stakedByUser = readStaked(stakedByUserKEY) | |
681 | 662 | let stakedTotal = readStaked(stakedTotalKEY) | |
682 | 663 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
683 | 664 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
684 | 665 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
685 | 666 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
686 | 667 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
687 | 668 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
688 | 669 | let passedBlocks = if ((emissionStartBlock > height)) | |
689 | 670 | then 0 | |
690 | 671 | else (height - emissionStartBlock) | |
691 | 672 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
692 | 673 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
693 | - | let $ | |
694 | - | let wxToClaimUserNew = $ | |
695 | - | let integralSTATE = $ | |
696 | - | let debug = $ | |
674 | + | let $t02715327265 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
675 | + | let wxToClaimUserNew = $t02715327265._1 | |
676 | + | let integralSTATE = $t02715327265._2 | |
677 | + | let debug = $t02715327265._3 | |
697 | 678 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
698 | 679 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
699 | 680 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
700 | 681 | let boostDebug = asString(boostInvResult[1]) | |
701 | 682 | let minRewardPart = availableToClaim | |
702 | - | let boostRewardPart = min([(minRewardPart * toBigInt( | |
683 | + | let boostRewardPart = min([(minRewardPart * toBigInt((boostCoeff - 1))), toBigInt(wxAmountBoostTotal)]) | |
703 | 684 | let totalReward = (minRewardPart + boostRewardPart) | |
704 | 685 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
705 | - | } | |
706 | - | ||
707 | - | ||
708 | - | ||
709 | - | @Callable(i) | |
710 | - | func stakedByUserREADONLY (lpAssetIdStr,userAddressStr) = { | |
711 | - | let stakedByUser = valueOrElse(getInteger(keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
712 | - | $Tuple2(nil, stakedByUser) | |
713 | 686 | } | |
714 | 687 | ||
715 | 688 | ||
716 | 689 | ||
717 | 690 | @Callable(i) | |
718 | 691 | func usersListTraversal (lpAssetId) = { | |
719 | 692 | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
720 | 693 | then true | |
721 | 694 | else mustManager(i) | |
722 | 695 | if ((checkCaller == checkCaller)) | |
723 | 696 | then { | |
724 | 697 | let listName = getUsersListName(lpAssetId) | |
725 | 698 | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
726 | 699 | let headOrUnit = getString(keyListHead(listName)) | |
727 | 700 | match userOrUnit { | |
728 | 701 | case _: Unit => | |
729 | 702 | match headOrUnit { | |
730 | 703 | case _: Unit => | |
731 | 704 | $Tuple2(nil, false) | |
732 | 705 | case head: String => | |
733 | 706 | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
734 | 707 | case _ => | |
735 | 708 | throw("Match error") | |
736 | 709 | } | |
737 | 710 | case userAddress: String => | |
738 | 711 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetId, userAddress)) | |
739 | 712 | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
740 | 713 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0)._1 | |
741 | 714 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
742 | - | let throwIfNothingToClaim = true | |
743 | 715 | let r = if ((availableToClaim > zeroBigInt)) | |
744 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress | |
716 | + | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
745 | 717 | else unit | |
746 | 718 | if ((r == r)) | |
747 | 719 | then { | |
748 | 720 | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
749 | 721 | match nextUserOrUnit { | |
750 | 722 | case _: Unit => | |
751 | 723 | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
752 | 724 | case nextUser: String => | |
753 | 725 | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
754 | 726 | case _ => | |
755 | 727 | throw("Match error") | |
756 | 728 | } | |
757 | 729 | } | |
758 | 730 | else throw("Strict value is not equal to itself.") | |
759 | 731 | case _ => | |
760 | 732 | throw("Match error") | |
761 | 733 | } | |
762 | 734 | } | |
763 | 735 | else throw("Strict value is not equal to itself.") | |
764 | 736 | } | |
765 | 737 | ||
766 | 738 | ||
767 | 739 | ||
768 | 740 | @Callable(i) | |
769 | 741 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
770 | 742 | then throw("permissions denied") | |
771 | 743 | else { | |
772 | - | let $ | |
773 | - | let wxPerLpIntegralNew = $ | |
774 | - | let poolIntegralSTATE = $ | |
775 | - | let poolDEBUG = $ | |
744 | + | let $t02961629726 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
745 | + | let wxPerLpIntegralNew = $t02961629726._1 | |
746 | + | let poolIntegralSTATE = $t02961629726._2 | |
747 | + | let poolDEBUG = $t02961629726._3 | |
776 | 748 | poolIntegralSTATE | |
777 | 749 | } | |
778 | 750 | ||
779 | 751 | ||
780 | 752 | @Verifier(tx) | |
781 | 753 | func verify () = { | |
782 | 754 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
783 | 755 | case pk: ByteVector => | |
784 | 756 | pk | |
785 | 757 | case _: Unit => | |
786 | 758 | tx.senderPublicKey | |
787 | 759 | case _ => | |
788 | 760 | throw("Match error") | |
789 | 761 | } | |
790 | 762 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
791 | 763 | } | |
792 | 764 |
github/deemru/w8io/026f985 88.17 ms ◑