tx · EhrxZMR8DBwz6KJvD8G2Mg9bT8i5LCAWaoKFRNxycYn3 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02500000 Waves 2023.08.21 11:39 [2720160] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "EhrxZMR8DBwz6KJvD8G2Mg9bT8i5LCAWaoKFRNxycYn3", "fee": 2500000, "feeAssetId": null, "timestamp": 1692607275568, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "5azYKeNrrJAh8zWi2insULssph9FM5NAwxnZUDQ79SAZCSVhuFbkDeKV4KBhAez6VFbvz3gNXH41EmgffTCWzmK" ], "script": "base64:BgLNLAgCEgUKAwEIAhIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIDCgEIEgQKAggBEgMKAQgSABIAEgUKAwgIBBIDCgEIEgMKAQgSBAoCCAgSBAoCCAgiA1NFUCIGU0NBTEU4IgVNVUxUOCIOUE9PTFdFSUdIVE1VTFQiEGNvbnRyYWN0RmlsZW5hbWUiB1NDQUxFMTgiBk1VTFQxOCIITVVMVDE4QkkiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIHYWRkcmVzcyIDa2V5IgxnZXRJbnRPclplcm8iD2dldEludE9yRGVmYXVsdCIKZGVmYXVsdFZhbCIMZ2V0SW50T3JGYWlsIgNhYnMiA3ZhbCIOZW5zdXJlUG9zaXRpdmUiAXYiAW0iG2tleVJlZmVycmFsc0NvbnRyYWN0QWRkcmVzcyIecmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzT3JGYWlsIhZrZXlSZWZlcnJhbFByb2dyYW1OYW1lIhpyZWZlcnJhbFByb2dyYW1OYW1lRGVmYXVsdCITcmVmZXJyYWxQcm9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b3RlRmluYWxpemVkUkVBRE9OTFkCAmJDAmJLCQCUCgIFA25pbAkBAmNLAgUCYkMFAmJLAmFLASFnZXRVc2VyVm90ZVN0YWtlZEludGVncmFsUkVBRE9OTFkCAmJDAmJLCQCUCgIFA25pbAkBAmRmAgUCYkMFAmJLAQJlUAECZVEABAJlUgQCYUYJAQJhSAADCQABAgUCYUYCCkJ5dGVWZWN0b3IEAmFNBQJhRgUCYU0DCQABAgUCYUYCBFVuaXQIBQJlUA9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCZVAJYm9keUJ5dGVzCQCRAwIIBQJlUAZwcm9vZnMAAAUCZVK0yiKK", "height": 2720160, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9DQJJgWJFS9psM54dnDAvcEjMfZfgwwbHeRL2GnLgSEo Next: 9kSVPccAqNy6i9voTV2RoB6ELgB2DmFQWXPrxzTjnspa Diff:
Old | New | Differences | |
---|---|---|---|
667 | 667 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
668 | 668 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
669 | 669 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
670 | - | let gwxRewardInv = | |
670 | + | let gwxRewardInv = invoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes, userNum], nil) | |
671 | 671 | if ((gwxRewardInv == gwxRewardInv)) | |
672 | 672 | then { | |
673 | 673 | let arr = if (userIsExisting) | |
702 | 702 | ||
703 | 703 | @Callable(i) | |
704 | 704 | func lockRef (duration,referrerAddress,signature) = { | |
705 | - | let $ | |
706 | - | let lockActionsResult = $ | |
707 | - | let gWxAmountStart = $ | |
705 | + | let $t02810028165 = lockActions(i, duration) | |
706 | + | let lockActionsResult = $t02810028165._1 | |
707 | + | let gWxAmountStart = $t02810028165._2 | |
708 | 708 | let referralAddress = toString(i.caller) | |
709 | 709 | let refInv = if (if ((referrerAddress == "")) | |
710 | 710 | then true | |
725 | 725 | ||
726 | 726 | @Callable(i) | |
727 | 727 | func lock (duration) = { | |
728 | - | let $ | |
729 | - | let lockActionsResult = $ | |
730 | - | let gWxAmountStart = $ | |
728 | + | let $t02862328688 = lockActions(i, duration) | |
729 | + | let lockActionsResult = $t02862328688._1 | |
730 | + | let gWxAmountStart = $t02862328688._2 | |
731 | 731 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
732 | 732 | if ((updateRefActivity == updateRefActivity)) | |
733 | 733 | then $Tuple2(lockActionsResult, unit) | |
740 | 740 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
741 | 741 | then throwErr("permissions denied") | |
742 | 742 | else { | |
743 | - | let $ | |
744 | - | let userBoostAvailable = $ | |
745 | - | let dataState = $ | |
746 | - | let debug = $ | |
743 | + | let $t02899829100 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
744 | + | let userBoostAvailable = $t02899829100._1 | |
745 | + | let dataState = $t02899829100._2 | |
746 | + | let debug = $t02899829100._3 | |
747 | 747 | $Tuple2(dataState, [userBoostAvailable]) | |
748 | 748 | } | |
749 | 749 | ||
751 | 751 | ||
752 | 752 | @Callable(i) | |
753 | 753 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
754 | - | let $ | |
755 | - | let userBoostAvailable = $ | |
756 | - | let dataState = $ | |
757 | - | let debug = $ | |
754 | + | let $t02923229333 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
755 | + | let userBoostAvailable = $t02923229333._1 | |
756 | + | let dataState = $t02923229333._2 | |
757 | + | let debug = $t02923229333._3 | |
758 | 758 | $Tuple2(nil, [userBoostAvailable, debug]) | |
759 | 759 | } | |
760 | 760 | ||
789 | 789 | then throwErr(("locked gwx amount: " + toString(lockedGwxAmount))) | |
790 | 790 | else { | |
791 | 791 | let userNum = parseIntValue(valueOrErrorMessage(getString(keyUser2NumMapping(userAddressStr)), wrapErr("invalid user number"))) | |
792 | - | let gwxRewardInv = | |
792 | + | let gwxRewardInv = invoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes, userNum], nil) | |
793 | 793 | if ((gwxRewardInv == gwxRewardInv)) | |
794 | 794 | then ((((LockParamsEntry(userAddress, txIdOption, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + wxWithdrawable)) ++ StatsEntry(-(wxWithdrawable), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, wxWithdrawable, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, wxWithdrawable, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), userGwxAmountTotalNew)]) | |
795 | 795 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let SCALE8 = 8 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let POOLWEIGHTMULT = MULT8 | |
11 | 11 | ||
12 | 12 | let contractFilename = "boosting.ride" | |
13 | 13 | ||
14 | 14 | let SCALE18 = 18 | |
15 | 15 | ||
16 | 16 | let MULT18 = 1000000000000000000 | |
17 | 17 | ||
18 | 18 | let MULT18BI = toBigInt(MULT18) | |
19 | 19 | ||
20 | 20 | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func throwErr (msg) = throw(wrapErr(msg)) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func abs (val) = if ((0 > val)) | |
39 | 39 | then -(val) | |
40 | 40 | else val | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func ensurePositive (v,m) = if ((v >= 0)) | |
44 | 44 | then v | |
45 | 45 | else throwErr((valueOrElse(m, "value") + " should be positive")) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(this, keyReferralsContractAddress())) | |
52 | 52 | ||
53 | 53 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
54 | 54 | ||
55 | 55 | let referralProgramNameDefault = "wxlock" | |
56 | 56 | ||
57 | 57 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
58 | 58 | ||
59 | 59 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | let IdxFactoryCfgStakingDapp = 1 | |
63 | 63 | ||
64 | 64 | let IdxFactoryCfgBoostingDapp = 2 | |
65 | 65 | ||
66 | 66 | let IdxFactoryCfgIdoDapp = 3 | |
67 | 67 | ||
68 | 68 | let IdxFactoryCfgTeamDapp = 4 | |
69 | 69 | ||
70 | 70 | let IdxFactoryCfgEmissionDapp = 5 | |
71 | 71 | ||
72 | 72 | let IdxFactoryCfgRestDapp = 6 | |
73 | 73 | ||
74 | 74 | let IdxFactoryCfgSlippageDapp = 7 | |
75 | 75 | ||
76 | 76 | let IdxFactoryCfgDaoDapp = 8 | |
77 | 77 | ||
78 | 78 | let IdxFactoryCfgMarketingDapp = 9 | |
79 | 79 | ||
80 | 80 | let IdxFactoryCfgGwxRewardDapp = 10 | |
81 | 81 | ||
82 | 82 | let IdxFactoryCfgBirdsDapp = 11 | |
83 | 83 | ||
84 | 84 | func keyFactoryCfg () = "%s__factoryConfig" | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func keyBoostingV2LastUpdateHeight () = "%s%s__boostingV2__startBlock" | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func keyBoostingV2Integral () = "%s%s__boostingV2__integral" | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | let IdxCfgAssetId = 1 | |
142 | 142 | ||
143 | 143 | let IdxCfgMinLockAmount = 2 | |
144 | 144 | ||
145 | 145 | let IdxCfgMinLockDuration = 3 | |
146 | 146 | ||
147 | 147 | let IdxCfgMaxLockDuration = 4 | |
148 | 148 | ||
149 | 149 | let IdxCfgMathContract = 5 | |
150 | 150 | ||
151 | 151 | let IdxCfgBlocksInPeriod = 6 | |
152 | 152 | ||
153 | 153 | let IdxCfgLockStepBlocks = 7 | |
154 | 154 | ||
155 | 155 | func keyConfig () = "%s__config" | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func readConfigArrayOrFail () = split(getStringOrFail(this, keyConfig()), SEP) | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | let cfgArray = readConfigArrayOrFail() | |
162 | 162 | ||
163 | 163 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
164 | 164 | ||
165 | 165 | let minLockAmount = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockAmount]), wrapErr("invalid min lock amount")) | |
166 | 166 | ||
167 | 167 | let minLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockDuration]), wrapErr("invalid min lock duration")) | |
168 | 168 | ||
169 | 169 | let maxLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMaxLockDuration]), wrapErr("invalid max lock duration")) | |
170 | 170 | ||
171 | 171 | let mathContract = valueOrErrorMessage(addressFromString(cfgArray[IdxCfgMathContract]), wrapErr("invalid math contract address")) | |
172 | 172 | ||
173 | 173 | let blocksInPeriod = valueOrErrorMessage(parseInt(cfgArray[IdxCfgBlocksInPeriod]), wrapErr("invalid blocks in period")) | |
174 | 174 | ||
175 | 175 | let lockStepBlocks = valueOrErrorMessage(parseInt(cfgArray[IdxCfgLockStepBlocks]), wrapErr("invalid lock step blocks")) | |
176 | 176 | ||
177 | 177 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
178 | 178 | case s: String => | |
179 | 179 | addressFromStringValue(s) | |
180 | 180 | case _ => | |
181 | 181 | this | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func managerPublicKeyOrUnit () = { | |
186 | 186 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
187 | 187 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
188 | 188 | case s: String => | |
189 | 189 | fromBase58String(s) | |
190 | 190 | case _: Unit => | |
191 | 191 | unit | |
192 | 192 | case _ => | |
193 | 193 | throw("Match error") | |
194 | 194 | } | |
195 | 195 | } | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func mustManager (i) = { | |
199 | 199 | let pd = throwErr("Permission denied") | |
200 | 200 | match managerPublicKeyOrUnit() { | |
201 | 201 | case pk: ByteVector => | |
202 | 202 | if ((i.callerPublicKey == pk)) | |
203 | 203 | then true | |
204 | 204 | else pd | |
205 | 205 | case _: Unit => | |
206 | 206 | if ((i.caller == this)) | |
207 | 207 | then true | |
208 | 208 | else pd | |
209 | 209 | case _ => | |
210 | 210 | throw("Match error") | |
211 | 211 | } | |
212 | 212 | } | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | let IdxLockAmount = 1 | |
216 | 216 | ||
217 | 217 | let IdxLockStart = 2 | |
218 | 218 | ||
219 | 219 | let IdxLockDuration = 3 | |
220 | 220 | ||
221 | 221 | let IdxLockLastUpdateTimestamp = 4 | |
222 | 222 | ||
223 | 223 | let IdxLockGwxAmount = 5 | |
224 | 224 | ||
225 | 225 | let IdxLockWxClaimed = 6 | |
226 | 226 | ||
227 | 227 | func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), match txId { | |
228 | 228 | case b: ByteVector => | |
229 | 229 | toBase58String(b) | |
230 | 230 | case _: Unit => | |
231 | 231 | "legacy" | |
232 | 232 | case _ => | |
233 | 233 | throw("Match error") | |
234 | 234 | }], SEP) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func readLockParamsRecordOrFail (userAddress,txId) = split(getStringOrFail(this, keyLockParamsRecord(userAddress, txId)), SEP) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | func keyUserGwxAmountTotal (userAddress) = makeString(["%s%s__gwxAmountTotal", toString(userAddress)], SEP) | |
241 | 241 | ||
242 | 242 | ||
243 | 243 | func formatLockParamsRecord (amount,start,duration,gwxAmount,wxClaimed) = makeString(["%d%d%d%d%d%d", toString(amount), toString(start), toString(duration), toString(lastBlock.timestamp), toString(gwxAmount), toString(wxClaimed)], SEP) | |
244 | 244 | ||
245 | 245 | ||
246 | 246 | func keyNextUserNum () = "%s__nextUserNum" | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP) | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP) | |
253 | 253 | ||
254 | 254 | ||
255 | 255 | func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked" | |
256 | 256 | ||
257 | 257 | ||
258 | 258 | func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks" | |
259 | 259 | ||
260 | 260 | ||
261 | 261 | func keyStatsLocksCount () = "%s%s__stats__locksCount" | |
262 | 262 | ||
263 | 263 | ||
264 | 264 | func keyStatsUsersCount () = "%s%s__stats__activeUsersCount" | |
265 | 265 | ||
266 | 266 | ||
267 | 267 | func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum)], SEP) | |
268 | 268 | ||
269 | 269 | ||
270 | 270 | func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum), lpAssetId], SEP) | |
271 | 271 | ||
272 | 272 | ||
273 | 273 | func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", toString(userNum)], SEP) | |
274 | 274 | ||
275 | 275 | ||
276 | 276 | func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total" | |
277 | 277 | ||
278 | 278 | ||
279 | 279 | func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", toString(userNum)], SEP) | |
280 | 280 | ||
281 | 281 | ||
282 | 282 | func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", toString(userNum)], SEP) | |
283 | 283 | ||
284 | 284 | ||
285 | 285 | func keyGwxTotal () = "%s%s__gwx__total" | |
286 | 286 | ||
287 | 287 | ||
288 | 288 | func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP) | |
292 | 292 | ||
293 | 293 | ||
294 | 294 | func keyCurrentEpochUi () = makeString(["%s", "currentEpochUi"], SEP) | |
295 | 295 | ||
296 | 296 | ||
297 | 297 | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP) | |
298 | 298 | ||
299 | 299 | ||
300 | 300 | func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP) | |
301 | 301 | ||
302 | 302 | ||
303 | 303 | func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP) | |
304 | 304 | ||
305 | 305 | ||
306 | 306 | func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
307 | 307 | ||
308 | 308 | ||
309 | 309 | func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
310 | 310 | ||
311 | 311 | ||
312 | 312 | func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
313 | 313 | ||
314 | 314 | ||
315 | 315 | func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
316 | 316 | ||
317 | 317 | ||
318 | 318 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP) | |
319 | 319 | ||
320 | 320 | ||
321 | 321 | let factoryContract = readFactoryAddressOrFail() | |
322 | 322 | ||
323 | 323 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
324 | 324 | ||
325 | 325 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
326 | 326 | ||
327 | 327 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
328 | 328 | ||
329 | 329 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
330 | 330 | ||
331 | 331 | 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")) | |
332 | 332 | ||
333 | 333 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
334 | 334 | ||
335 | 335 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
336 | 336 | ||
337 | 337 | let keyVotingEmissionRateContract = makeString(["%s", "votingEmissionRateContract"], SEP) | |
338 | 338 | ||
339 | 339 | let boostCoeff = { | |
340 | 340 | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
341 | 341 | if ($isInstanceOf(@, "Int")) | |
342 | 342 | then @ | |
343 | 343 | else throw(($getType(@) + " couldn't be cast to Int")) | |
344 | 344 | } | |
345 | 345 | ||
346 | 346 | func userNumberByAddressOrFail (userAddress) = match getString(this, keyUser2NumMapping(toString(userAddress))) { | |
347 | 347 | case s: String => | |
348 | 348 | valueOrErrorMessage(parseInt(s), wrapErr("invalid user number")) | |
349 | 349 | case _: Unit => | |
350 | 350 | throwErr("invalid user") | |
351 | 351 | case _ => | |
352 | 352 | throw("Match error") | |
353 | 353 | } | |
354 | 354 | ||
355 | 355 | ||
356 | 356 | func getGwxAmountTotal () = valueOrElse(getInteger(this, keyGwxTotal()), 0) | |
357 | 357 | ||
358 | 358 | ||
359 | 359 | func getLockedGwxAmount (userAddress) = { | |
360 | 360 | let functionName = "getLockedGwxAmount" | |
361 | 361 | let votingEmissionRateContract = valueOrErrorMessage( match getString(votingEmissionContract, keyVotingEmissionRateContract) { | |
362 | 362 | case _: Unit => | |
363 | 363 | unit | |
364 | 364 | case s: String => | |
365 | 365 | addressFromString(s) | |
366 | 366 | case _ => | |
367 | 367 | throw("Match error") | |
368 | 368 | }, wrapErr("invalid voting emission rate address")) | |
369 | 369 | let lockedVotingEmissionRate = { | |
370 | 370 | let @ = invoke(votingEmissionContract, functionName, [toString(userAddress)], nil) | |
371 | 371 | if ($isInstanceOf(@, "Int")) | |
372 | 372 | then @ | |
373 | 373 | else throw(($getType(@) + " couldn't be cast to Int")) | |
374 | 374 | } | |
375 | 375 | let lockedVotingEmission = { | |
376 | 376 | let @ = invoke(votingEmissionRateContract, functionName, [toString(userAddress)], nil) | |
377 | 377 | if ($isInstanceOf(@, "Int")) | |
378 | 378 | then @ | |
379 | 379 | else throw(($getType(@) + " couldn't be cast to Int")) | |
380 | 380 | } | |
381 | 381 | let locked = max([lockedVotingEmissionRate, lockedVotingEmission]) | |
382 | 382 | locked | |
383 | 383 | } | |
384 | 384 | ||
385 | 385 | ||
386 | 386 | func HistoryEntry (type,user,amount,lockStart,duration,gwxAmount,i) = { | |
387 | 387 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
388 | 388 | let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(gwxAmount)], SEP) | |
389 | 389 | StringEntry(historyKEY, historyDATA) | |
390 | 390 | } | |
391 | 391 | ||
392 | 392 | ||
393 | 393 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
394 | 394 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
395 | 395 | let locksCountKEY = keyStatsLocksCount() | |
396 | 396 | let usersCountKEY = keyStatsUsersCount() | |
397 | 397 | let totalAmountKEY = keyLockParamTotalAmount() | |
398 | 398 | let locksDurationSumInBlocks = getIntOrZero(this, locksDurationSumInBlocksKEY) | |
399 | 399 | let locksCount = getIntOrZero(this, locksCountKEY) | |
400 | 400 | let usersCount = getIntOrZero(this, usersCountKEY) | |
401 | 401 | let totalAmount = getIntOrZero(this, totalAmountKEY) | |
402 | 402 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
403 | 403 | } | |
404 | 404 | ||
405 | 405 | ||
406 | 406 | func LockParamsEntry (userAddress,txId,amount,start,duration,gwxAmount,wxClaimed) = [StringEntry(keyLockParamsRecord(userAddress, txId), formatLockParamsRecord(amount, start, duration, gwxAmount, wxClaimed))] | |
407 | 407 | ||
408 | 408 | ||
409 | 409 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
410 | 410 | then throwErr("only one payment is allowed") | |
411 | 411 | else if ((size(i.payments) == 0)) | |
412 | 412 | then 0 | |
413 | 413 | else { | |
414 | 414 | let pmt = i.payments[0] | |
415 | 415 | if ((value(pmt.assetId) != expectedAssetId)) | |
416 | 416 | then throwErr("invalid asset id in payment") | |
417 | 417 | else pmt.amount | |
418 | 418 | } | |
419 | 419 | ||
420 | 420 | ||
421 | 421 | func getUserGwxAmountTotal (userAddress) = valueOrElse(getInteger(this, keyUserGwxAmountTotal(userAddress)), 0) | |
422 | 422 | ||
423 | 423 | ||
424 | 424 | func getVotingEmissionEpochInfo () = { | |
425 | 425 | let $t01449314783 = { | |
426 | 426 | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi())) | |
427 | 427 | let lastFinalizedEpoch = (currentEpochUi - 1) | |
428 | 428 | if ((0 > lastFinalizedEpoch)) | |
429 | 429 | then throwErr("invalid epoch") | |
430 | 430 | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
431 | 431 | } | |
432 | 432 | let currentEpochUi = $t01449314783._1 | |
433 | 433 | let lastFinalizedEpoch = $t01449314783._2 | |
434 | 434 | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
435 | 435 | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
436 | 436 | } | |
437 | 437 | ||
438 | 438 | ||
439 | 439 | func getPoolAssetsByLpAssetId (lpAssetIdStr) = { | |
440 | 440 | let idxAmountAssetId = 4 | |
441 | 441 | let idxPriceAssetId = 5 | |
442 | 442 | let poolCfg = { | |
443 | 443 | let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil) | |
444 | 444 | if ($isInstanceOf(@, "List[Any]")) | |
445 | 445 | then @ | |
446 | 446 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
447 | 447 | } | |
448 | 448 | let amountAssetId = { | |
449 | 449 | let @ = poolCfg[idxAmountAssetId] | |
450 | 450 | if ($isInstanceOf(@, "String")) | |
451 | 451 | then @ | |
452 | 452 | else throw(($getType(@) + " couldn't be cast to String")) | |
453 | 453 | } | |
454 | 454 | let priceAssetId = { | |
455 | 455 | let @ = poolCfg[idxPriceAssetId] | |
456 | 456 | if ($isInstanceOf(@, "String")) | |
457 | 457 | then @ | |
458 | 458 | else throw(($getType(@) + " couldn't be cast to String")) | |
459 | 459 | } | |
460 | 460 | $Tuple2(amountAssetId, priceAssetId) | |
461 | 461 | } | |
462 | 462 | ||
463 | 463 | ||
464 | 464 | func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = { | |
465 | 465 | let userAddress = addressFromStringValue(userAddressStr) | |
466 | 466 | let $t01547415554 = getVotingEmissionEpochInfo() | |
467 | 467 | let lastFinalizedEpoch = $t01547415554._1 | |
468 | 468 | let currentEpochStartHeight = $t01547415554._2 | |
469 | 469 | let $t01555715632 = getPoolAssetsByLpAssetId(lpAssetIdStr) | |
470 | 470 | let amountAssetId = $t01555715632._1 | |
471 | 471 | let priceAssetId = $t01555715632._2 | |
472 | 472 | let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch) | |
473 | 473 | let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0) | |
474 | 474 | userVote | |
475 | 475 | } | |
476 | 476 | ||
477 | 477 | ||
478 | 478 | func getUserVoteStaked (lpAssetIdStr,userAddressStr) = { | |
479 | 479 | let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
480 | 480 | let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
481 | 481 | if ((stakedByUser == 0)) | |
482 | 482 | then 0 | |
483 | 483 | else userVote | |
484 | 484 | } | |
485 | 485 | ||
486 | 486 | ||
487 | 487 | func getVotingResultStaked (lpAssetIdStr) = { | |
488 | 488 | let $t01617616256 = getVotingEmissionEpochInfo() | |
489 | 489 | let lastFinalizedEpoch = $t01617616256._1 | |
490 | 490 | let currentEpochStartHeight = $t01617616256._2 | |
491 | 491 | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
492 | 492 | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
493 | 493 | votingResultStaked | |
494 | 494 | } | |
495 | 495 | ||
496 | 496 | ||
497 | 497 | func getVotingResultStakedIntegral (lpAssetIdStr) = { | |
498 | 498 | let $t01661816698 = getVotingEmissionEpochInfo() | |
499 | 499 | let lastFinalizedEpoch = $t01661816698._1 | |
500 | 500 | let currentEpochStartHeight = $t01661816698._2 | |
501 | 501 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
502 | 502 | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
503 | 503 | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight) | |
504 | 504 | let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight) | |
505 | 505 | let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev) | |
506 | 506 | votingResultStakedIntegral | |
507 | 507 | } | |
508 | 508 | ||
509 | 509 | ||
510 | 510 | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
511 | 511 | let $t01753517615 = getVotingEmissionEpochInfo() | |
512 | 512 | let lastFinalizedEpoch = $t01753517615._1 | |
513 | 513 | let currentEpochStartHeight = $t01753517615._2 | |
514 | 514 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
515 | 515 | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
516 | 516 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
517 | 517 | [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch), height), IntegerEntry(keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedIntegral)] | |
518 | 518 | } | |
519 | 519 | ||
520 | 520 | ||
521 | 521 | func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = { | |
522 | 522 | let $t01822618306 = getVotingEmissionEpochInfo() | |
523 | 523 | let lastFinalizedEpoch = $t01822618306._1 | |
524 | 524 | let currentEpochStartHeight = $t01822618306._2 | |
525 | 525 | let userAddress = addressFromStringValue(userAddressStr) | |
526 | 526 | let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr) | |
527 | 527 | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0) | |
528 | 528 | let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight) | |
529 | 529 | let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight) | |
530 | 530 | let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev) | |
531 | 531 | userVoteStakedIntegral | |
532 | 532 | } | |
533 | 533 | ||
534 | 534 | ||
535 | 535 | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
536 | 536 | let $t01909419174 = getVotingEmissionEpochInfo() | |
537 | 537 | let lastFinalizedEpoch = $t01909419174._1 | |
538 | 538 | let currentEpochStartHeight = $t01909419174._2 | |
539 | 539 | let userAddress = addressFromStringValue(userAddressStr) | |
540 | 540 | let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
541 | 541 | let actions = if ((userVoteFinalized == 0)) | |
542 | 542 | then nil | |
543 | 543 | else { | |
544 | 544 | let stakedVoteDelta = if (edge) | |
545 | 545 | then userVoteFinalized | |
546 | 546 | else -(userVoteFinalized) | |
547 | 547 | let votingResultActions = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta) | |
548 | 548 | let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr) | |
549 | 549 | let voteActions = [IntegerEntry(keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch), height), IntegerEntry(keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch), userVoteStakedIntegral)] | |
550 | 550 | (votingResultActions ++ voteActions) | |
551 | 551 | } | |
552 | 552 | actions | |
553 | 553 | } | |
554 | 554 | ||
555 | 555 | ||
556 | 556 | func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = { | |
557 | 557 | let $t02002820108 = getVotingEmissionEpochInfo() | |
558 | 558 | let lastFinalizedEpoch = $t02002820108._1 | |
559 | 559 | let currentEpochStartHeight = $t02002820108._2 | |
560 | 560 | let userAddress = addressFromStringValue(userAddressStr) | |
561 | 561 | let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
562 | 562 | let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0) | |
563 | 563 | let votingResultStakedIntegralLastKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
564 | 564 | let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralLastKey), 0) | |
565 | 565 | let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr) | |
566 | 566 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
567 | 567 | let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast) | |
568 | 568 | let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast) | |
569 | 569 | $Tuple3([IntegerEntry(userVoteStakedIntegralLastKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralLastKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff) | |
570 | 570 | } | |
571 | 571 | ||
572 | 572 | ||
573 | 573 | func refreshBoostEmissionIntegral () = { | |
574 | 574 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
575 | 575 | let boostingV2LastUpdateHeightOption = getInteger(this, keyBoostingV2LastUpdateHeight()) | |
576 | 576 | let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral()) | |
577 | 577 | let emissionEnd = getIntOrFail(emissionContract, keyEmissionEndBlock()) | |
578 | 578 | let h = if ((height > emissionEnd)) | |
579 | 579 | then emissionEnd | |
580 | 580 | else height | |
581 | 581 | let dh = match boostingV2LastUpdateHeightOption { | |
582 | 582 | case lastUpdateHeight: Int => | |
583 | 583 | max([(h - lastUpdateHeight), 0]) | |
584 | 584 | case _: Unit => | |
585 | 585 | 0 | |
586 | 586 | case _ => | |
587 | 587 | throw("Match error") | |
588 | 588 | } | |
589 | 589 | let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff) | |
590 | 590 | let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0) | |
591 | 591 | let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev) | |
592 | 592 | $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral) | |
593 | 593 | } | |
594 | 594 | ||
595 | 595 | ||
596 | 596 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
597 | 597 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
598 | 598 | let userNum = userNumberByAddressOrFail(userAddress) | |
599 | 599 | if ((userNum == userNum)) | |
600 | 600 | then { | |
601 | 601 | let EMPTYSTR = "empty" | |
602 | 602 | let poolWeight = if ((lpAssetIdStr != EMPTYSTR)) | |
603 | 603 | then { | |
604 | 604 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
605 | 605 | getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
606 | 606 | } | |
607 | 607 | else if (readOnly) | |
608 | 608 | then 0 | |
609 | 609 | else throwErr(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
610 | 610 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNum, lpAssetIdStr) | |
611 | 611 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
612 | 612 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), getIntOrZero(this, userBoostEmissionLastIntegralKEY)) | |
613 | 613 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
614 | 614 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
615 | 615 | if ((0 > userBoostEmissionIntegral)) | |
616 | 616 | then throwErr("wrong calculations") | |
617 | 617 | else { | |
618 | 618 | let $t02365023789 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr) | |
619 | 619 | let stakedVotesIntegralsActions = $t02365023789._1 | |
620 | 620 | let userVoteIntegralDiff = $t02365023789._2 | |
621 | 621 | let totalVotesIntegralDiff = $t02365023789._3 | |
622 | 622 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
623 | 623 | let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0)) | |
624 | 624 | then 0 | |
625 | 625 | else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff) | |
626 | 626 | let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions) | |
627 | 627 | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":") | |
628 | 628 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
629 | 629 | } | |
630 | 630 | } | |
631 | 631 | else throw("Strict value is not equal to itself.") | |
632 | 632 | } | |
633 | 633 | ||
634 | 634 | ||
635 | 635 | func lockActions (i,duration) = { | |
636 | 636 | let assetIdStr = toBase58String(assetId) | |
637 | 637 | if ((size(i.payments) != 1)) | |
638 | 638 | then throwErr("invalid payment - exact one payment must be attached") | |
639 | 639 | else { | |
640 | 640 | let pmt = i.payments[0] | |
641 | 641 | let pmtAmount = pmt.amount | |
642 | 642 | if ((assetId != value(pmt.assetId))) | |
643 | 643 | then throwErr((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
644 | 644 | else { | |
645 | 645 | let nextUserNumKEY = keyNextUserNum() | |
646 | 646 | let userAddress = i.caller | |
647 | 647 | let userAddressStr = toString(userAddress) | |
648 | 648 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
649 | 649 | let userNumStr = if (userIsExisting) | |
650 | 650 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
651 | 651 | else toString(getIntOrFail(this, nextUserNumKEY)) | |
652 | 652 | let userNum = parseIntValue(userNumStr) | |
653 | 653 | let lockStart = height | |
654 | 654 | if (if ((minLockAmount > pmtAmount)) | |
655 | 655 | then (userAddress != lpStakingPoolsContract) | |
656 | 656 | else false) | |
657 | 657 | then throwErr(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
658 | 658 | else if ((minLockDuration > duration)) | |
659 | 659 | then throwErr(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
660 | 660 | else if ((duration > maxLockDuration)) | |
661 | 661 | then throwErr(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
662 | 662 | else if (((duration % lockStepBlocks) != 0)) | |
663 | 663 | then throwErr(("duration must be multiple of lockStepBlocks=" + toString(lockStepBlocks))) | |
664 | 664 | else { | |
665 | 665 | let gWxAmountStart = fraction(pmtAmount, duration, maxLockDuration) | |
666 | 666 | let gwxAmountTotal = getGwxAmountTotal() | |
667 | 667 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
668 | 668 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
669 | 669 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
670 | - | let gwxRewardInv = | |
670 | + | let gwxRewardInv = invoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes, userNum], nil) | |
671 | 671 | if ((gwxRewardInv == gwxRewardInv)) | |
672 | 672 | then { | |
673 | 673 | let arr = if (userIsExisting) | |
674 | 674 | then nil | |
675 | 675 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
676 | 676 | $Tuple2(((((arr ++ LockParamsEntry(userAddress, i.transactionId, pmtAmount, lockStart, duration, gWxAmountStart, 0)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
677 | 677 | then 0 | |
678 | 678 | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, gWxAmountStart, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyGwxTotal(), (gwxAmountTotal + gWxAmountStart)), IntegerEntry(keyUserGwxAmountTotal(userAddress), (userGwxAmountTotal + gWxAmountStart))]), gWxAmountStart) | |
679 | 679 | } | |
680 | 680 | else throw("Strict value is not equal to itself.") | |
681 | 681 | } | |
682 | 682 | } | |
683 | 683 | } | |
684 | 684 | } | |
685 | 685 | ||
686 | 686 | ||
687 | 687 | func getWxWithdrawable (userAddress,txIdOption) = { | |
688 | 688 | let userRecordArray = readLockParamsRecordOrFail(userAddress, txIdOption) | |
689 | 689 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
690 | 690 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
691 | 691 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
692 | 692 | let lockEnd = (lockStart + lockDuration) | |
693 | 693 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
694 | 694 | let t = ((height - lockStart) / blocksInPeriod) | |
695 | 695 | let exponent = fraction(toBigInt(t), (toBigInt((8 * blocksInPeriod)) * MULT18BI), toBigInt(lockDuration)) | |
696 | 696 | let wxWithdrawable = if ((height > lockEnd)) | |
697 | 697 | then userAmount | |
698 | 698 | else (toInt(fraction(toBigInt(userAmount), (MULT18BI - pow(toBigInt(5), 1, exponent, SCALE18, SCALE18, DOWN)), MULT18BI)) - wxClaimed) | |
699 | 699 | wxWithdrawable | |
700 | 700 | } | |
701 | 701 | ||
702 | 702 | ||
703 | 703 | @Callable(i) | |
704 | 704 | func lockRef (duration,referrerAddress,signature) = { | |
705 | - | let $ | |
706 | - | let lockActionsResult = $ | |
707 | - | let gWxAmountStart = $ | |
705 | + | let $t02810028165 = lockActions(i, duration) | |
706 | + | let lockActionsResult = $t02810028165._1 | |
707 | + | let gWxAmountStart = $t02810028165._2 | |
708 | 708 | let referralAddress = toString(i.caller) | |
709 | 709 | let refInv = if (if ((referrerAddress == "")) | |
710 | 710 | then true | |
711 | 711 | else (signature == base58'')) | |
712 | 712 | then unit | |
713 | 713 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
714 | 714 | if ((refInv == refInv)) | |
715 | 715 | then { | |
716 | 716 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
717 | 717 | if ((updateRefActivity == updateRefActivity)) | |
718 | 718 | then $Tuple2(lockActionsResult, unit) | |
719 | 719 | else throw("Strict value is not equal to itself.") | |
720 | 720 | } | |
721 | 721 | else throw("Strict value is not equal to itself.") | |
722 | 722 | } | |
723 | 723 | ||
724 | 724 | ||
725 | 725 | ||
726 | 726 | @Callable(i) | |
727 | 727 | func lock (duration) = { | |
728 | - | let $ | |
729 | - | let lockActionsResult = $ | |
730 | - | let gWxAmountStart = $ | |
728 | + | let $t02862328688 = lockActions(i, duration) | |
729 | + | let lockActionsResult = $t02862328688._1 | |
730 | + | let gWxAmountStart = $t02862328688._2 | |
731 | 731 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
732 | 732 | if ((updateRefActivity == updateRefActivity)) | |
733 | 733 | then $Tuple2(lockActionsResult, unit) | |
734 | 734 | else throw("Strict value is not equal to itself.") | |
735 | 735 | } | |
736 | 736 | ||
737 | 737 | ||
738 | 738 | ||
739 | 739 | @Callable(i) | |
740 | 740 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
741 | 741 | then throwErr("permissions denied") | |
742 | 742 | else { | |
743 | - | let $ | |
744 | - | let userBoostAvailable = $ | |
745 | - | let dataState = $ | |
746 | - | let debug = $ | |
743 | + | let $t02899829100 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
744 | + | let userBoostAvailable = $t02899829100._1 | |
745 | + | let dataState = $t02899829100._2 | |
746 | + | let debug = $t02899829100._3 | |
747 | 747 | $Tuple2(dataState, [userBoostAvailable]) | |
748 | 748 | } | |
749 | 749 | ||
750 | 750 | ||
751 | 751 | ||
752 | 752 | @Callable(i) | |
753 | 753 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
754 | - | let $ | |
755 | - | let userBoostAvailable = $ | |
756 | - | let dataState = $ | |
757 | - | let debug = $ | |
754 | + | let $t02923229333 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
755 | + | let userBoostAvailable = $t02923229333._1 | |
756 | + | let dataState = $t02923229333._2 | |
757 | + | let debug = $t02923229333._3 | |
758 | 758 | $Tuple2(nil, [userBoostAvailable, debug]) | |
759 | 759 | } | |
760 | 760 | ||
761 | 761 | ||
762 | 762 | ||
763 | 763 | @Callable(i) | |
764 | 764 | func unlock (txIdStr) = { | |
765 | 765 | let userAddress = i.caller | |
766 | 766 | let userAddressStr = toString(userAddress) | |
767 | 767 | let txIdOption = if ((txIdStr == "")) | |
768 | 768 | then unit | |
769 | 769 | else fromBase58String(txIdStr) | |
770 | 770 | let userRecordArray = readLockParamsRecordOrFail(userAddress, txIdOption) | |
771 | 771 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
772 | 772 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
773 | 773 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
774 | 774 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
775 | 775 | let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount]) | |
776 | 776 | let t = ((height - lockStart) / blocksInPeriod) | |
777 | 777 | let wxWithdrawable = getWxWithdrawable(userAddress, txIdOption) | |
778 | 778 | let gWxAmountStart = fraction(userAmount, lockDuration, maxLockDuration) | |
779 | 779 | let gwxBurned = min([fraction((t * blocksInPeriod), gWxAmountStart, maxLockDuration), gwxAmount]) | |
780 | 780 | let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining") | |
781 | 781 | let lockedGwxAmount = getLockedGwxAmount(userAddress) | |
782 | 782 | if ((0 >= userAmount)) | |
783 | 783 | then throwErr("nothing to unlock") | |
784 | 784 | else { | |
785 | 785 | let gwxAmountTotal = getGwxAmountTotal() | |
786 | 786 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
787 | 787 | let userGwxAmountTotalNew = ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotalNew") | |
788 | 788 | if ((lockedGwxAmount > userGwxAmountTotalNew)) | |
789 | 789 | then throwErr(("locked gwx amount: " + toString(lockedGwxAmount))) | |
790 | 790 | else { | |
791 | 791 | let userNum = parseIntValue(valueOrErrorMessage(getString(keyUser2NumMapping(userAddressStr)), wrapErr("invalid user number"))) | |
792 | - | let gwxRewardInv = | |
792 | + | let gwxRewardInv = invoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes, userNum], nil) | |
793 | 793 | if ((gwxRewardInv == gwxRewardInv)) | |
794 | 794 | then ((((LockParamsEntry(userAddress, txIdOption, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + wxWithdrawable)) ++ StatsEntry(-(wxWithdrawable), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, wxWithdrawable, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, wxWithdrawable, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), userGwxAmountTotalNew)]) | |
795 | 795 | else throw("Strict value is not equal to itself.") | |
796 | 796 | } | |
797 | 797 | } | |
798 | 798 | } | |
799 | 799 | ||
800 | 800 | ||
801 | 801 | ||
802 | 802 | @Callable(i) | |
803 | 803 | func gwxUserInfoREADONLY (userAddressStr) = { | |
804 | 804 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
805 | 805 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
806 | 806 | $Tuple2(nil, [gwxAmount]) | |
807 | 807 | } | |
808 | 808 | ||
809 | 809 | ||
810 | 810 | ||
811 | 811 | @Callable(i) | |
812 | 812 | func userMaxDurationREADONLY (userAddressStr) = $Tuple2(nil, $Tuple2("lock", maxLockDuration)) | |
813 | 813 | ||
814 | 814 | ||
815 | 815 | ||
816 | 816 | @Callable(i) | |
817 | 817 | func getUserGwxAmountAtHeightREADONLY (userAddressStr,targetHeight) = { | |
818 | 818 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
819 | 819 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
820 | 820 | $Tuple2(nil, gwxAmount) | |
821 | 821 | } | |
822 | 822 | ||
823 | 823 | ||
824 | 824 | ||
825 | 825 | @Callable(i) | |
826 | 826 | func getUserGwxAmount (userAddressStr) = { | |
827 | 827 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
828 | 828 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
829 | 829 | $Tuple2(nil, gwxAmount) | |
830 | 830 | } | |
831 | 831 | ||
832 | 832 | ||
833 | 833 | ||
834 | 834 | @Callable(i) | |
835 | 835 | func getGwxTotalREADONLY () = $Tuple2(nil, getGwxAmountTotal()) | |
836 | 836 | ||
837 | 837 | ||
838 | 838 | ||
839 | 839 | @Callable(i) | |
840 | 840 | func onBoostEmissionUpdate () = { | |
841 | 841 | let checkCaller = if ((i.caller == emissionContract)) | |
842 | 842 | then true | |
843 | 843 | else mustManager(i) | |
844 | 844 | if ((checkCaller == checkCaller)) | |
845 | 845 | then refreshBoostEmissionIntegral() | |
846 | 846 | else throw("Strict value is not equal to itself.") | |
847 | 847 | } | |
848 | 848 | ||
849 | 849 | ||
850 | 850 | ||
851 | 851 | @Callable(i) | |
852 | 852 | func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = { | |
853 | 853 | let checkCaller = if ((i.caller == stakingContract)) | |
854 | 854 | then true | |
855 | 855 | else mustManager(i) | |
856 | 856 | if ((checkCaller == checkCaller)) | |
857 | 857 | then { | |
858 | 858 | let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge) | |
859 | 859 | $Tuple2(actions, unit) | |
860 | 860 | } | |
861 | 861 | else throw("Strict value is not equal to itself.") | |
862 | 862 | } | |
863 | 863 | ||
864 | 864 | ||
865 | 865 | ||
866 | 866 | @Callable(i) | |
867 | 867 | func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr)) | |
868 | 868 | ||
869 | 869 | ||
870 | 870 | ||
871 | 871 | @Callable(i) | |
872 | 872 | func getVotingResultStakedIntegralREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStakedIntegral(lpAssetIdStr)) | |
873 | 873 | ||
874 | 874 | ||
875 | 875 | ||
876 | 876 | @Callable(i) | |
877 | 877 | func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr)) | |
878 | 878 | ||
879 | 879 | ||
880 | 880 | ||
881 | 881 | @Callable(i) | |
882 | 882 | func getUserVoteStakedIntegralREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)) | |
883 | 883 | ||
884 | 884 | ||
885 | 885 | @Verifier(tx) | |
886 | 886 | func verify () = { | |
887 | 887 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
888 | 888 | case pk: ByteVector => | |
889 | 889 | pk | |
890 | 890 | case _: Unit => | |
891 | 891 | tx.senderPublicKey | |
892 | 892 | case _ => | |
893 | 893 | throw("Match error") | |
894 | 894 | } | |
895 | 895 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
896 | 896 | } | |
897 | 897 |
github/deemru/w8io/026f985 93.61 ms ◑