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