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