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