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