tx · 9Za78K3bfkzVWXaQKQrYtXcW7px1VidJ6D4uqWUues9t 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.02400000 Waves 2023.03.22 14:28 [2501163] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "9Za78K3bfkzVWXaQKQrYtXcW7px1VidJ6D4uqWUues9t", "fee": 2400000, "feeAssetId": null, "timestamp": 1679484568433, "version": 2, "chainId": 84, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "2KhFwYTrPsUdmAmSxLrRvUVeaWSPcDykpMgveDPo7CvBhmuRTVbwZYiSFEKDZtemVJvUL7KDDTn98ybEyeyrXUdK" ], "script": "base64:BgKfIAgCEgMKAQgSAwoBCBIDCgEIEgASABIDCgEIEgQKAggBEgYKBAIBAgISAwoBCBIDCgEIEgUKAwgIBBIGCgQBGAgYEgQKAhgIEgQKAggIEgQKAggIEgMKAQgSBAoCCAgiBlNDQUxFOCIFTVVMVDgiB1NDQUxFMTgiBk1VTFQxOCIDU0VQIg5QT09MV0VJR0hUTVVMVCIKemVyb0JpZ0ludCIJb25lQmlnSW50Igd3cmFwRXJyIgNtc2ciCHRocm93RXJyIglhc0FueUxpc3QiA3ZhbCIHJG1hdGNoMCIKdmFsQW55THlzdCIFYXNJbnQiBnZhbEludCIIYXNTdHJpbmciBnZhbFN0ciIMYXNCeXRlVmVjdG9yIgZ2YWxCaW4iD2dldFN0cmluZ09yRmFpbCIHYWRkcmVzcyIDa2V5IhhnZXRTdHJpbmdCeUFkZHJlc3NPckZhaWwiDGdldEludE9yWmVybyIPZ2V0SW50T3JEZWZhdWx0IgpkZWZhdWx0VmFsIgxnZXRJbnRPckZhaWwiGWdldEJpZ0ludEZyb21TdHJpbmdPclplcm8iHGdldEJpZ0ludEZyb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bGYuAmNsAQ5vbk1vZGlmeVdlaWdodAICYXQCYngDCQECIT0CCAUCY2wGY2FsbGVyBQJhWAkAAgECEnBlcm1pc3Npb25zIGRlbmllZAQCZEEJAQJidwMFAmF0BQJieAAABAJidQgFAmRBAl8xBAJiVwgFAmRBAl8yBAJiWAgFAmRBAl8zBQJiVwECZEIBAmRDAAQCZEQEAW4JAQJjaAADCQABAgUBbgIKQnl0ZVZlY3RvcgQCY24FAW4FAmNuAwkAAQIFAW4CBFVuaXQIBQJkQg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCZEIJYm9keUJ5dGVzCQCRAwIIBQJkQgZwcm9vZnMAAAUCZESGQCHD", "height": 2501163, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 81u6qPoJ8XVSpirSgLxZA66xiRiv5Q74QcSGGZWej4YY Next: 9JxSMqnTF4K1xVJVvHAD427YC3xQQwH68cGvbpzc5J7m 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) | |
425 | 418 | case _ => | |
426 | 419 | throw("Match error") | |
427 | 420 | } | |
421 | + | ||
422 | + | ||
423 | + | func stakeActions (i,lpAssetId,poolAddress,userAddress,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 refreshStakedVote = if ((stakedByUser == 0)) | |
431 | + | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, true], nil) | |
432 | + | else unit | |
433 | + | if ((refreshStakedVote == refreshStakedVote)) | |
434 | + | then { | |
435 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
436 | + | let $t01810718224 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
437 | + | let wxToClaimUserNew = $t01810718224._1 | |
438 | + | let integralSTATE = $t01810718224._2 | |
439 | + | let debug = $t01810718224._3 | |
440 | + | let listName = getUsersListName(lpAssetIdStr) | |
441 | + | let listActions = if (containsNode(listName, userAddressStr)) | |
442 | + | then nil | |
443 | + | else insertNodeActions(listName, userAddressStr) | |
444 | + | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
445 | + | } | |
446 | + | else throw("Strict value is not equal to itself.") | |
447 | + | } | |
428 | 448 | ||
429 | 449 | ||
430 | 450 | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
530 | 550 | let lpAssetIdStr = toBase58String(lpAssetId) | |
531 | 551 | let amount = pmt.amount | |
532 | 552 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
533 | - | let callerStr = toString(i.caller) | |
534 | - | let userAddressStr = if ((callerStr == poolAddressStr)) | |
535 | - | then toString(i.originCaller) | |
536 | - | else callerStr | |
537 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
538 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
539 | - | 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.") | |
553 | + | let poolAddress = addressFromStringValue(poolAddressStr) | |
554 | + | let userAddress = if ((i.caller == poolAddress)) | |
555 | + | then i.originCaller | |
556 | + | else i.caller | |
557 | + | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
558 | + | } | |
559 | + | ||
560 | + | ||
561 | + | ||
562 | + | @Callable(i) | |
563 | + | func stakeFor (userAddressStr) = if ((size(i.payments) != 1)) | |
564 | + | then throw("invalid payment - exact one payment must be attached") | |
565 | + | else { | |
566 | + | let pmt = i.payments[0] | |
567 | + | let lpAssetId = value(pmt.assetId) | |
568 | + | let lpAssetIdStr = toBase58String(lpAssetId) | |
569 | + | let amount = pmt.amount | |
570 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
571 | + | let poolAddress = addressFromStringValue(poolAddressStr) | |
572 | + | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
573 | + | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
557 | 574 | } | |
558 | 575 | ||
559 | 576 | ||
625 | 642 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
626 | 643 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
627 | 644 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
628 | - | let $ | |
629 | - | let wxToClaimUserNew = $ | |
630 | - | let integralSTATE = $ | |
631 | - | let debug = $ | |
645 | + | let $t02618626298 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
646 | + | let wxToClaimUserNew = $t02618626298._1 | |
647 | + | let integralSTATE = $t02618626298._2 | |
648 | + | let debug = $t02618626298._3 | |
632 | 649 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
633 | 650 | if ((zeroBigInt >= availableToClaim)) | |
634 | 651 | then if (throwIfNothingToClaim) | |
637 | 654 | else { | |
638 | 655 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
639 | 656 | let minRewardPart = availableToClaim | |
640 | - | let boostRewardPart = min([(minRewardPart * toBigInt( | |
657 | + | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
641 | 658 | let totalReward = (minRewardPart + boostRewardPart) | |
642 | 659 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
643 | 660 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
670 | 687 | }, SEP) | |
671 | 688 | let unclaimed = info[3] | |
672 | 689 | 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)) | |
690 | + | let res = (resAcc :+ makeString(["%d%d", unclaimed, claimed], SEP)) | |
680 | 691 | let inv = { | |
681 | 692 | let @ = invoke(this, "claimWxBulkInternalREADONLY", [(currentIter + 1), lpAssetIds, userAddressStr, res], nil) | |
682 | 693 | if ($isInstanceOf(@, "List[Any]")) | |
717 | 728 | else (height - emissionStartBlock) | |
718 | 729 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
719 | 730 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
720 | - | let $ | |
721 | - | let wxToClaimUserNew = $ | |
722 | - | let integralSTATE = $ | |
723 | - | let debug = $ | |
731 | + | let $t03010730219 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
732 | + | let wxToClaimUserNew = $t03010730219._1 | |
733 | + | let integralSTATE = $t03010730219._2 | |
734 | + | let debug = $t03010730219._3 | |
724 | 735 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
725 | 736 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
726 | 737 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
727 | 738 | let boostDebug = asString(boostInvResult[1]) | |
728 | 739 | let minRewardPart = availableToClaim | |
729 | - | let boostRewardPart = min([(minRewardPart * toBigInt( | |
740 | + | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
730 | 741 | let totalReward = (minRewardPart + boostRewardPart) | |
731 | 742 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
732 | 743 | } | |
796 | 807 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
797 | 808 | then throw("permissions denied") | |
798 | 809 | else { | |
799 | - | let $ | |
800 | - | let wxPerLpIntegralNew = $ | |
801 | - | let poolIntegralSTATE = $ | |
802 | - | let poolDEBUG = $ | |
810 | + | let $t03282532935 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
811 | + | let wxPerLpIntegralNew = $t03282532935._1 | |
812 | + | let poolIntegralSTATE = $t03282532935._2 | |
813 | + | let poolDEBUG = $t03282532935._3 | |
803 | 814 | poolIntegralSTATE | |
804 | 815 | } | |
805 | 816 |
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 | } | |
421 | + | ||
422 | + | ||
423 | + | func stakeActions (i,lpAssetId,poolAddress,userAddress,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 refreshStakedVote = if ((stakedByUser == 0)) | |
431 | + | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, true], nil) | |
432 | + | else unit | |
433 | + | if ((refreshStakedVote == refreshStakedVote)) | |
434 | + | then { | |
435 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
436 | + | let $t01810718224 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
437 | + | let wxToClaimUserNew = $t01810718224._1 | |
438 | + | let integralSTATE = $t01810718224._2 | |
439 | + | let debug = $t01810718224._3 | |
440 | + | let listName = getUsersListName(lpAssetIdStr) | |
441 | + | let listActions = if (containsNode(listName, userAddressStr)) | |
442 | + | then nil | |
443 | + | else insertNodeActions(listName, userAddressStr) | |
444 | + | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
445 | + | } | |
446 | + | else throw("Strict value is not equal to itself.") | |
447 | + | } | |
428 | 448 | ||
429 | 449 | ||
430 | 450 | func unstakeActions (i,lpAssetId,poolAddress,userAddress,lpAssetRecipientAddress,amount) = { | |
431 | 451 | let userAddressStr = toString(userAddress) | |
432 | 452 | let lpAssetIdStr = toBase58String(lpAssetId) | |
433 | 453 | let poolAddressStr = toString(poolAddress) | |
434 | 454 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
435 | 455 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
436 | 456 | let stakedByUser = readStaked(stakedByUserKEY) | |
437 | 457 | let stakedTotal = readStaked(stakedTotalKEY) | |
438 | 458 | let integralSTATE = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))._2 | |
439 | 459 | let listName = getUsersListName(lpAssetIdStr) | |
440 | 460 | let listActions = if (if (containsNode(listName, userAddressStr)) | |
441 | 461 | then (amount == stakedByUser) | |
442 | 462 | else false) | |
443 | 463 | then deleteNodeActions(listName, userAddressStr) | |
444 | 464 | else nil | |
445 | 465 | let refreshStakedVote = if ((amount == stakedByUser)) | |
446 | 466 | then invoke(boostingContract, "onStakedVoteUpdate", [lpAssetIdStr, userAddressStr, false], nil) | |
447 | 467 | else unit | |
448 | 468 | if ((refreshStakedVote == refreshStakedVote)) | |
449 | 469 | then { | |
450 | 470 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)) | |
451 | 471 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)._1 | |
452 | 472 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
453 | 473 | let throwIfNothingToClaim = true | |
454 | 474 | let r = if ((availableToClaim > zeroBigInt)) | |
455 | 475 | then invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
456 | 476 | else unit | |
457 | 477 | if ((r == r)) | |
458 | 478 | then if ((amount > stakedByUser)) | |
459 | 479 | then throw(((((((("passed amount=" + toString(amount)) + " is greater than available=") + toString(stakedByUser)) + ". lpAssetId=") + lpAssetIdStr) + ". stakedByUserKEY=") + stakedByUserKEY)) | |
460 | 480 | else (([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(lpAssetRecipientAddress, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
461 | 481 | else throw("Strict value is not equal to itself.") | |
462 | 482 | } | |
463 | 483 | else throw("Strict value is not equal to itself.") | |
464 | 484 | } | |
465 | 485 | ||
466 | 486 | ||
467 | 487 | @Callable(i) | |
468 | 488 | func constructor (factoryAddressStr) = { | |
469 | 489 | let checkCaller = mustManager(i) | |
470 | 490 | if ((checkCaller == checkCaller)) | |
471 | 491 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
472 | 492 | else throw("Strict value is not equal to itself.") | |
473 | 493 | } | |
474 | 494 | ||
475 | 495 | ||
476 | 496 | ||
477 | 497 | @Callable(i) | |
478 | 498 | func constructorV2 (votingEmissionContract) = { | |
479 | 499 | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
480 | 500 | then true | |
481 | 501 | else "invalid voting emission contract address"] | |
482 | 502 | if ((cheks == cheks)) | |
483 | 503 | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
484 | 504 | else throw("Strict value is not equal to itself.") | |
485 | 505 | } | |
486 | 506 | ||
487 | 507 | ||
488 | 508 | ||
489 | 509 | @Callable(i) | |
490 | 510 | func setManager (pendingManagerPublicKey) = { | |
491 | 511 | let checkCaller = mustManager(i) | |
492 | 512 | if ((checkCaller == checkCaller)) | |
493 | 513 | then { | |
494 | 514 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
495 | 515 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
496 | 516 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
497 | 517 | else throw("Strict value is not equal to itself.") | |
498 | 518 | } | |
499 | 519 | else throw("Strict value is not equal to itself.") | |
500 | 520 | } | |
501 | 521 | ||
502 | 522 | ||
503 | 523 | ||
504 | 524 | @Callable(i) | |
505 | 525 | func confirmManager () = { | |
506 | 526 | let pm = pendingManagerPublicKeyOrUnit() | |
507 | 527 | let hasPM = if (isDefined(pm)) | |
508 | 528 | then true | |
509 | 529 | else throw("No pending manager") | |
510 | 530 | if ((hasPM == hasPM)) | |
511 | 531 | then { | |
512 | 532 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
513 | 533 | then true | |
514 | 534 | else throw("You are not pending manager") | |
515 | 535 | if ((checkPM == checkPM)) | |
516 | 536 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
517 | 537 | else throw("Strict value is not equal to itself.") | |
518 | 538 | } | |
519 | 539 | else throw("Strict value is not equal to itself.") | |
520 | 540 | } | |
521 | 541 | ||
522 | 542 | ||
523 | 543 | ||
524 | 544 | @Callable(i) | |
525 | 545 | func stake () = if ((size(i.payments) != 1)) | |
526 | 546 | then throw("invalid payment - exact one payment must be attached") | |
527 | 547 | else { | |
528 | 548 | let pmt = i.payments[0] | |
529 | 549 | let lpAssetId = value(pmt.assetId) | |
530 | 550 | let lpAssetIdStr = toBase58String(lpAssetId) | |
531 | 551 | let amount = pmt.amount | |
532 | 552 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
533 | - | let callerStr = toString(i.caller) | |
534 | - | let userAddressStr = if ((callerStr == poolAddressStr)) | |
535 | - | then toString(i.originCaller) | |
536 | - | else callerStr | |
537 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
538 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
539 | - | 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.") | |
553 | + | let poolAddress = addressFromStringValue(poolAddressStr) | |
554 | + | let userAddress = if ((i.caller == poolAddress)) | |
555 | + | then i.originCaller | |
556 | + | else i.caller | |
557 | + | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
558 | + | } | |
559 | + | ||
560 | + | ||
561 | + | ||
562 | + | @Callable(i) | |
563 | + | func stakeFor (userAddressStr) = if ((size(i.payments) != 1)) | |
564 | + | then throw("invalid payment - exact one payment must be attached") | |
565 | + | else { | |
566 | + | let pmt = i.payments[0] | |
567 | + | let lpAssetId = value(pmt.assetId) | |
568 | + | let lpAssetIdStr = toBase58String(lpAssetId) | |
569 | + | let amount = pmt.amount | |
570 | + | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
571 | + | let poolAddress = addressFromStringValue(poolAddressStr) | |
572 | + | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
573 | + | stakeActions(i, lpAssetId, poolAddress, userAddress, amount) | |
557 | 574 | } | |
558 | 575 | ||
559 | 576 | ||
560 | 577 | ||
561 | 578 | @Callable(i) | |
562 | 579 | func unstake (lpAssetIdStr,amount) = { | |
563 | 580 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
564 | 581 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
565 | 582 | let poolAddress = addressFromStringValue(poolAddressStr) | |
566 | 583 | let poolAddon = valueOrElse(getString(poolAddress, keyAddonAddr()), poolAddressStr) | |
567 | 584 | let callerStr = toString(i.caller) | |
568 | 585 | let userAddress = if (if ((callerStr == poolAddressStr)) | |
569 | 586 | then true | |
570 | 587 | else (callerStr == poolAddon)) | |
571 | 588 | then i.originCaller | |
572 | 589 | else i.caller | |
573 | 590 | let lpAssetRecipientAddress = i.caller | |
574 | 591 | unstakeActions(i, lpAssetId, poolAddress, userAddress, lpAssetRecipientAddress, amount) | |
575 | 592 | } | |
576 | 593 | ||
577 | 594 | ||
578 | 595 | ||
579 | 596 | @Callable(i) | |
580 | 597 | func unstakeINTERNAL (lpAssetId,amount,userAddress,lpAssetRecipientAddress) = { | |
581 | 598 | let lpAssetIdStr = toBase58String(lpAssetId) | |
582 | 599 | let poolAddress = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))) | |
583 | 600 | let checkCaller = if ((i.caller == poolAddress)) | |
584 | 601 | then true | |
585 | 602 | else permissionDeniedError | |
586 | 603 | if ((checkCaller == checkCaller)) | |
587 | 604 | then unstakeActions(i, lpAssetId, poolAddress, Address(userAddress), Address(lpAssetRecipientAddress), amount) | |
588 | 605 | else throw("Strict value is not equal to itself.") | |
589 | 606 | } | |
590 | 607 | ||
591 | 608 | ||
592 | 609 | ||
593 | 610 | @Callable(i) | |
594 | 611 | func claimWx (lpAssetIdStr) = { | |
595 | 612 | let userAddressStr = toString(i.caller) | |
596 | 613 | let throwIfNothingToClaim = true | |
597 | 614 | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
598 | 615 | $Tuple2(nil, result) | |
599 | 616 | } | |
600 | 617 | ||
601 | 618 | ||
602 | 619 | ||
603 | 620 | @Callable(i) | |
604 | 621 | func claimWxDoNotThrow (lpAssetIdStr) = { | |
605 | 622 | let userAddressStr = toString(i.caller) | |
606 | 623 | let throwIfNothingToClaim = false | |
607 | 624 | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr, throwIfNothingToClaim], nil) | |
608 | 625 | $Tuple2(nil, result) | |
609 | 626 | } | |
610 | 627 | ||
611 | 628 | ||
612 | 629 | ||
613 | 630 | @Callable(i) | |
614 | 631 | func claimWxINTERNAL (lpAssetIdStr,userAddressStr,throwIfNothingToClaim) = { | |
615 | 632 | let checkCaller = mustThis(i) | |
616 | 633 | if ((checkCaller == checkCaller)) | |
617 | 634 | then { | |
618 | 635 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
619 | 636 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
620 | 637 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
621 | 638 | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
622 | 639 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
623 | 640 | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
624 | 641 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
625 | 642 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
626 | 643 | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
627 | 644 | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
628 | - | let $ | |
629 | - | let wxToClaimUserNew = $ | |
630 | - | let integralSTATE = $ | |
631 | - | let debug = $ | |
645 | + | let $t02618626298 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
646 | + | let wxToClaimUserNew = $t02618626298._1 | |
647 | + | let integralSTATE = $t02618626298._2 | |
648 | + | let debug = $t02618626298._3 | |
632 | 649 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
633 | 650 | if ((zeroBigInt >= availableToClaim)) | |
634 | 651 | then if (throwIfNothingToClaim) | |
635 | 652 | then throw("nothing to claim") | |
636 | 653 | else $Tuple2(nil, 0) | |
637 | 654 | else { | |
638 | 655 | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
639 | 656 | let minRewardPart = availableToClaim | |
640 | - | let boostRewardPart = min([(minRewardPart * toBigInt( | |
657 | + | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
641 | 658 | let totalReward = (minRewardPart + boostRewardPart) | |
642 | 659 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
643 | 660 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
644 | 661 | if ((emitBoost == emitBoost)) | |
645 | 662 | then { | |
646 | 663 | let claimedByUserValue = ((claimedByUser + minRewardPart) + boostRewardPart) | |
647 | 664 | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
648 | 665 | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserBoostReward + boostRewardPart) | |
649 | 666 | let claimedTotalPlusAvailableToClaim = (claimedTotal + availableToClaim) | |
650 | 667 | $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 | 668 | } | |
652 | 669 | else throw("Strict value is not equal to itself.") | |
653 | 670 | } | |
654 | 671 | } | |
655 | 672 | else throw("Strict value is not equal to itself.") | |
656 | 673 | } | |
657 | 674 | ||
658 | 675 | ||
659 | 676 | ||
660 | 677 | @Callable(i) | |
661 | 678 | func claimWxBulkInternalREADONLY (currentIter,lpAssetIds,userAddressStr,resAcc) = if ((currentIter == size(lpAssetIds))) | |
662 | 679 | then $Tuple2(nil, resAcc) | |
663 | 680 | else { | |
664 | 681 | let lpAssetId = lpAssetIds[currentIter] | |
665 | 682 | let info = split({ | |
666 | 683 | let @ = invoke(this, "claimWxREADONLY", [lpAssetId, userAddressStr], nil) | |
667 | 684 | if ($isInstanceOf(@, "String")) | |
668 | 685 | then @ | |
669 | 686 | else throw(($getType(@) + " couldn't be cast to String")) | |
670 | 687 | }, SEP) | |
671 | 688 | let unclaimed = info[3] | |
672 | 689 | 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)) | |
690 | + | let res = (resAcc :+ makeString(["%d%d", unclaimed, claimed], SEP)) | |
680 | 691 | let inv = { | |
681 | 692 | let @ = invoke(this, "claimWxBulkInternalREADONLY", [(currentIter + 1), lpAssetIds, userAddressStr, res], nil) | |
682 | 693 | if ($isInstanceOf(@, "List[Any]")) | |
683 | 694 | then @ | |
684 | 695 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
685 | 696 | } | |
686 | 697 | if ((inv == inv)) | |
687 | 698 | then $Tuple2(nil, inv) | |
688 | 699 | else throw("Strict value is not equal to itself.") | |
689 | 700 | } | |
690 | 701 | ||
691 | 702 | ||
692 | 703 | ||
693 | 704 | @Callable(i) | |
694 | 705 | func claimWxBulkREADONLY (lpAssetIds,userAddressStr) = { | |
695 | 706 | let res = invoke(this, "claimWxBulkInternalREADONLY", [0, lpAssetIds, userAddressStr, nil], nil) | |
696 | 707 | $Tuple2(nil, res) | |
697 | 708 | } | |
698 | 709 | ||
699 | 710 | ||
700 | 711 | ||
701 | 712 | @Callable(i) | |
702 | 713 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
703 | 714 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
704 | 715 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
705 | 716 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
706 | 717 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
707 | 718 | let stakedByUser = readStaked(stakedByUserKEY) | |
708 | 719 | let stakedTotal = readStaked(stakedTotalKEY) | |
709 | 720 | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
710 | 721 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
711 | 722 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
712 | 723 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
713 | 724 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
714 | 725 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
715 | 726 | let passedBlocks = if ((emissionStartBlock > height)) | |
716 | 727 | then 0 | |
717 | 728 | else (height - emissionStartBlock) | |
718 | 729 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
719 | 730 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
720 | - | let $ | |
721 | - | let wxToClaimUserNew = $ | |
722 | - | let integralSTATE = $ | |
723 | - | let debug = $ | |
731 | + | let $t03010730219 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
732 | + | let wxToClaimUserNew = $t03010730219._1 | |
733 | + | let integralSTATE = $t03010730219._2 | |
734 | + | let debug = $t03010730219._3 | |
724 | 735 | let availableToClaim = max([(wxToClaimUserNew - claimedByUserMinReward), zeroBigInt]) | |
725 | 736 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
726 | 737 | let wxAmountBoostTotal = max([asInt(boostInvResult[0]), 0]) | |
727 | 738 | let boostDebug = asString(boostInvResult[1]) | |
728 | 739 | let minRewardPart = availableToClaim | |
729 | - | let boostRewardPart = min([(minRewardPart * toBigInt( | |
740 | + | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
730 | 741 | let totalReward = (minRewardPart + boostRewardPart) | |
731 | 742 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), "soon"], SEP)) | |
732 | 743 | } | |
733 | 744 | ||
734 | 745 | ||
735 | 746 | ||
736 | 747 | @Callable(i) | |
737 | 748 | func stakedByUserREADONLY (lpAssetIdStr,userAddressStr) = { | |
738 | 749 | let stakedByUser = valueOrElse(getInteger(keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
739 | 750 | $Tuple2(nil, stakedByUser) | |
740 | 751 | } | |
741 | 752 | ||
742 | 753 | ||
743 | 754 | ||
744 | 755 | @Callable(i) | |
745 | 756 | func usersListTraversal (lpAssetId) = { | |
746 | 757 | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
747 | 758 | then true | |
748 | 759 | else mustManager(i) | |
749 | 760 | if ((checkCaller == checkCaller)) | |
750 | 761 | then { | |
751 | 762 | let listName = getUsersListName(lpAssetId) | |
752 | 763 | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
753 | 764 | let headOrUnit = getString(keyListHead(listName)) | |
754 | 765 | match userOrUnit { | |
755 | 766 | case _: Unit => | |
756 | 767 | match headOrUnit { | |
757 | 768 | case _: Unit => | |
758 | 769 | $Tuple2(nil, false) | |
759 | 770 | case head: String => | |
760 | 771 | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
761 | 772 | case _ => | |
762 | 773 | throw("Match error") | |
763 | 774 | } | |
764 | 775 | case userAddress: String => | |
765 | 776 | let claimedByUserMinReward = getBigIntFromStringOrZero(this, keyClaimedByUserMinReward(lpAssetId, userAddress)) | |
766 | 777 | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
767 | 778 | let wxToClaimUserNew = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0)._1 | |
768 | 779 | let availableToClaim = (wxToClaimUserNew - claimedByUserMinReward) | |
769 | 780 | let throwIfNothingToClaim = true | |
770 | 781 | let r = if ((availableToClaim > zeroBigInt)) | |
771 | 782 | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress, throwIfNothingToClaim], nil) | |
772 | 783 | else unit | |
773 | 784 | if ((r == r)) | |
774 | 785 | then { | |
775 | 786 | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
776 | 787 | match nextUserOrUnit { | |
777 | 788 | case _: Unit => | |
778 | 789 | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
779 | 790 | case nextUser: String => | |
780 | 791 | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
781 | 792 | case _ => | |
782 | 793 | throw("Match error") | |
783 | 794 | } | |
784 | 795 | } | |
785 | 796 | else throw("Strict value is not equal to itself.") | |
786 | 797 | case _ => | |
787 | 798 | throw("Match error") | |
788 | 799 | } | |
789 | 800 | } | |
790 | 801 | else throw("Strict value is not equal to itself.") | |
791 | 802 | } | |
792 | 803 | ||
793 | 804 | ||
794 | 805 | ||
795 | 806 | @Callable(i) | |
796 | 807 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
797 | 808 | then throw("permissions denied") | |
798 | 809 | else { | |
799 | - | let $ | |
800 | - | let wxPerLpIntegralNew = $ | |
801 | - | let poolIntegralSTATE = $ | |
802 | - | let poolDEBUG = $ | |
810 | + | let $t03282532935 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
811 | + | let wxPerLpIntegralNew = $t03282532935._1 | |
812 | + | let poolIntegralSTATE = $t03282532935._2 | |
813 | + | let poolDEBUG = $t03282532935._3 | |
803 | 814 | poolIntegralSTATE | |
804 | 815 | } | |
805 | 816 | ||
806 | 817 | ||
807 | 818 | @Verifier(tx) | |
808 | 819 | func verify () = { | |
809 | 820 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
810 | 821 | case pk: ByteVector => | |
811 | 822 | pk | |
812 | 823 | case _: Unit => | |
813 | 824 | tx.senderPublicKey | |
814 | 825 | case _ => | |
815 | 826 | throw("Match error") | |
816 | 827 | } | |
817 | 828 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
818 | 829 | } | |
819 | 830 |
github/deemru/w8io/026f985 89.99 ms ◑