tx · Exks2UkriPFqjRP5E8F3QS8vd8gYfCLqdJdYVVTQQwU1 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02300000 Waves 2023.02.15 15:58 [2450754] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "Exks2UkriPFqjRP5E8F3QS8vd8gYfCLqdJdYVVTQQwU1", "fee": 2300000, "feeAssetId": null, "timestamp": 1676465943347, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "5ooLQnVwA4TFt8Ea9Sftt92mwwFx63oTgM5un41rmrnUAYh41wAuBN7cxjzVDvrhJcC1XD9VJn6fW1pDCgcAGDL5" ], "script": "base64:BgKbJggCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIECgIIARIAEgMKAQgSACIDU0VQIgZTQ0FMRTgiBU1VTFQ4Ig5QT09MV0VJR0hUTVVMVCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIEc3RyZiIHYWRkcmVzcyIDa2V5IgNpb3oiA2lvZCIKZGVmYXVsdFZhbCIDaW9mIgNhYnMiA3ZhbCIDYWFsIgckbWF0Y2gwIgp2YWxBbnlMeXN0IgJhaSIGdmFsSW50IhtrZXlSZWZlcnJhbHNDb250cmFjdEFkZHJlc3MiHnJlZmVycmFsc0NvbnRyYWN0QWRkcmVzc09yRmFpbCIWa2V5UmVmZXJyYWxQcm9ncmFtTmFtZSIacmVmZXJyYWxQcm9ncmFtTmFtZURlZmF1bHQiE3JlZmVycmFsUHJvZ3JhbU5hbWUiEWtleUZhY3RvcnlBZGRyZXNzIhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiFElkeEZ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zCQCRAwIIBQJlQQZwcm9vZnMAAAUCZUMmWFT+", "height": 2450754, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2aqxbZWuHHMFndQpkSuvdwNXtU2oUhxgPx9M3XKQYnbL Next: BskLMfXpLaR9V9pDsWzAWTWriKeW8XPeQk4d2whGb51u Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let POOLWEIGHTMULT = MULT8 | |
11 | + | ||
12 | + | func wrapErr (msg) = makeString(["boosting.ride:", msg], " ") | |
13 | + | ||
14 | + | ||
15 | + | func throwErr (msg) = throw(wrapErr(msg)) | |
16 | + | ||
11 | 17 | ||
12 | 18 | func strf (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
13 | 19 | ||
405 | 411 | func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height) | |
406 | 412 | ||
407 | 413 | ||
414 | + | func getVoteInfoREADONLY (lpAssetIdStr,userAddressStr) = { | |
415 | + | let userAddress = addressFromStringValue(userAddressStr) | |
416 | + | let idxAmountAssetId = 4 | |
417 | + | let idxPriceAssetId = 5 | |
418 | + | let poolCfg = { | |
419 | + | let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil) | |
420 | + | if ($isInstanceOf(@, "List[Any]")) | |
421 | + | then @ | |
422 | + | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
423 | + | } | |
424 | + | let amountAssetId = { | |
425 | + | let @ = poolCfg[idxAmountAssetId] | |
426 | + | if ($isInstanceOf(@, "String")) | |
427 | + | then @ | |
428 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
429 | + | } | |
430 | + | let priceAssetId = { | |
431 | + | let @ = poolCfg[idxPriceAssetId] | |
432 | + | if ($isInstanceOf(@, "String")) | |
433 | + | then @ | |
434 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
435 | + | } | |
436 | + | let keyCurrentEpoch = makeString(["%s", "currentEpoch"], SEP) | |
437 | + | let lastFinalizedEpoch = { | |
438 | + | let epoch = (value(getInteger(this, keyCurrentEpoch)) - 1) | |
439 | + | if ((0 > epoch)) | |
440 | + | then throwErr("invalid epoch") | |
441 | + | else epoch | |
442 | + | } | |
443 | + | func keyVote (pool,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
444 | + | ||
445 | + | func keyVotingResult (pool,epoch) = makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(epoch)], SEP) | |
446 | + | ||
447 | + | let pool = $Tuple2(amountAssetId, priceAssetId) | |
448 | + | let userVote = valueOrElse(getInteger(this, keyVote(pool, userAddress, lastFinalizedEpoch)), 0) | |
449 | + | let poolResult = valueOrElse(getInteger(this, keyVotingResult(pool, lastFinalizedEpoch)), 0) | |
450 | + | $Tuple2(userVote, poolResult) | |
451 | + | } | |
452 | + | ||
453 | + | ||
408 | 454 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
409 | 455 | let EMPTY = "EMPTY" | |
410 | 456 | let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY) | |
443 | 489 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
444 | 490 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
445 | 491 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
446 | - | let $t01675316890 = { | |
447 | - | let @ = invoke(votingEmissionContract, "getVoteInfoREADONLY", [lpAssetIdStr, userAddressStr], nil) | |
448 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
449 | - | then @ | |
450 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
451 | - | } | |
452 | - | let userVote = $t01675316890._1 | |
453 | - | let totalVotes = $t01675316890._2 | |
492 | + | let $t01812418202 = getVoteInfoREADONLY(lpAssetIdStr, userAddressStr) | |
493 | + | let userVote = $t01812418202._1 | |
494 | + | let totalVotes = $t01812418202._2 | |
454 | 495 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
455 | 496 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
456 | 497 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
551 | 592 | ||
552 | 593 | @Callable(i) | |
553 | 594 | func lockRef (duration,referrerAddress,signature) = { | |
554 | - | let $ | |
555 | - | let lockActionsResult = $ | |
556 | - | let gWxAmountStart = $ | |
595 | + | let $t02415424219 = lockActions(i, duration) | |
596 | + | let lockActionsResult = $t02415424219._1 | |
597 | + | let gWxAmountStart = $t02415424219._2 | |
557 | 598 | let referralAddress = toString(i.caller) | |
558 | 599 | let refInv = if (if ((referrerAddress == "")) | |
559 | 600 | then true | |
574 | 615 | ||
575 | 616 | @Callable(i) | |
576 | 617 | func lock (duration) = { | |
577 | - | let $ | |
578 | - | let lockActionsResult = $ | |
579 | - | let gWxAmountStart = $ | |
618 | + | let $t02467724742 = lockActions(i, duration) | |
619 | + | let lockActionsResult = $t02467724742._1 | |
620 | + | let gWxAmountStart = $t02467724742._2 | |
580 | 621 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
581 | 622 | if ((updateRefActivity == updateRefActivity)) | |
582 | 623 | then $Tuple2(lockActionsResult, unit) | |
665 | 706 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
666 | 707 | then throw("permissions denied") | |
667 | 708 | else { | |
668 | - | let $ | |
669 | - | let userBoostAvailable = $ | |
670 | - | let dataState = $ | |
671 | - | let debug = $ | |
709 | + | let $t02972329825 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
710 | + | let userBoostAvailable = $t02972329825._1 | |
711 | + | let dataState = $t02972329825._2 | |
712 | + | let debug = $t02972329825._3 | |
672 | 713 | $Tuple2(dataState, [userBoostAvailable]) | |
673 | 714 | } | |
674 | 715 | ||
676 | 717 | ||
677 | 718 | @Callable(i) | |
678 | 719 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
679 | - | let $ | |
680 | - | let userBoostAvailable = $ | |
681 | - | let dataState = $ | |
682 | - | let debug = $ | |
720 | + | let $t02995730058 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
721 | + | let userBoostAvailable = $t02995730058._1 | |
722 | + | let dataState = $t02995730058._2 | |
723 | + | let debug = $t02995730058._3 | |
683 | 724 | $Tuple2(nil, [userBoostAvailable, debug]) | |
684 | 725 | } | |
685 | 726 |
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 | + | ||
12 | + | func wrapErr (msg) = makeString(["boosting.ride:", msg], " ") | |
13 | + | ||
14 | + | ||
15 | + | func throwErr (msg) = throw(wrapErr(msg)) | |
16 | + | ||
11 | 17 | ||
12 | 18 | func strf (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
13 | 19 | ||
14 | 20 | ||
15 | 21 | func ioz (address,key) = valueOrElse(getInteger(address, key), 0) | |
16 | 22 | ||
17 | 23 | ||
18 | 24 | func iod (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
19 | 25 | ||
20 | 26 | ||
21 | 27 | func iof (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
22 | 28 | ||
23 | 29 | ||
24 | 30 | func abs (val) = if ((0 > val)) | |
25 | 31 | then -(val) | |
26 | 32 | else val | |
27 | 33 | ||
28 | 34 | ||
29 | 35 | func aal (val) = match val { | |
30 | 36 | case valAnyLyst: List[Any] => | |
31 | 37 | valAnyLyst | |
32 | 38 | case _ => | |
33 | 39 | throw("fail to cast into List[Any]") | |
34 | 40 | } | |
35 | 41 | ||
36 | 42 | ||
37 | 43 | func ai (val) = match val { | |
38 | 44 | case valInt: Int => | |
39 | 45 | valInt | |
40 | 46 | case _ => | |
41 | 47 | throw("fail to cast into Int") | |
42 | 48 | } | |
43 | 49 | ||
44 | 50 | ||
45 | 51 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
46 | 52 | ||
47 | 53 | ||
48 | 54 | let referralsContractAddressOrFail = addressFromStringValue(strf(this, keyReferralsContractAddress())) | |
49 | 55 | ||
50 | 56 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
51 | 57 | ||
52 | 58 | let referralProgramNameDefault = "wxlock" | |
53 | 59 | ||
54 | 60 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
55 | 61 | ||
56 | 62 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
57 | 63 | ||
58 | 64 | ||
59 | 65 | let IdxFactoryCfgStakingDapp = 1 | |
60 | 66 | ||
61 | 67 | let IdxFactoryCfgBoostingDapp = 2 | |
62 | 68 | ||
63 | 69 | let IdxFactoryCfgIdoDapp = 3 | |
64 | 70 | ||
65 | 71 | let IdxFactoryCfgTeamDapp = 4 | |
66 | 72 | ||
67 | 73 | let IdxFactoryCfgEmissionDapp = 5 | |
68 | 74 | ||
69 | 75 | let IdxFactoryCfgRestDapp = 6 | |
70 | 76 | ||
71 | 77 | let IdxFactoryCfgSlippageDapp = 7 | |
72 | 78 | ||
73 | 79 | let IdxFactoryCfgDaoDapp = 8 | |
74 | 80 | ||
75 | 81 | let IdxFactoryCfgMarketingDapp = 9 | |
76 | 82 | ||
77 | 83 | let IdxFactoryCfgGwxRewardDapp = 10 | |
78 | 84 | ||
79 | 85 | let IdxFactoryCfgBirdsDapp = 11 | |
80 | 86 | ||
81 | 87 | func keyFactoryCfg () = "%s__factoryConfig" | |
82 | 88 | ||
83 | 89 | ||
84 | 90 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
85 | 91 | ||
86 | 92 | ||
87 | 93 | func keyFactoryLpList () = "%s__lpTokensList" | |
88 | 94 | ||
89 | 95 | ||
90 | 96 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
91 | 97 | ||
92 | 98 | ||
93 | 99 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
94 | 100 | ||
95 | 101 | ||
96 | 102 | func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
97 | 103 | ||
98 | 104 | ||
99 | 105 | func readFactoryAddressOrFail () = addressFromStringValue(strf(this, keyFactoryAddress())) | |
100 | 106 | ||
101 | 107 | ||
102 | 108 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
103 | 109 | ||
104 | 110 | ||
105 | 111 | func readFactoryCfgOrFail (factory) = split(strf(factory, keyFactoryCfg()), SEP) | |
106 | 112 | ||
107 | 113 | ||
108 | 114 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
109 | 115 | ||
110 | 116 | ||
111 | 117 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
112 | 118 | ||
113 | 119 | ||
114 | 120 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
115 | 121 | ||
116 | 122 | ||
117 | 123 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
118 | 124 | ||
119 | 125 | ||
120 | 126 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
121 | 127 | ||
122 | 128 | ||
123 | 129 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
124 | 130 | ||
125 | 131 | ||
126 | 132 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
127 | 133 | ||
128 | 134 | ||
129 | 135 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
130 | 136 | ||
131 | 137 | ||
132 | 138 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
133 | 139 | ||
134 | 140 | ||
135 | 141 | func keyBoostingV2StartHeight () = "%s%s__boostingV2__startBlock" | |
136 | 142 | ||
137 | 143 | ||
138 | 144 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
139 | 145 | ||
140 | 146 | ||
141 | 147 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
142 | 148 | ||
143 | 149 | ||
144 | 150 | func keyNextPeriod () = "%s__nextPeriod" | |
145 | 151 | ||
146 | 152 | ||
147 | 153 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
148 | 154 | ||
149 | 155 | ||
150 | 156 | let IdxCfgAssetId = 1 | |
151 | 157 | ||
152 | 158 | let IdxCfgMinLockAmount = 2 | |
153 | 159 | ||
154 | 160 | let IdxCfgMinLockDuration = 3 | |
155 | 161 | ||
156 | 162 | let IdxCfgMaxLockDuration = 4 | |
157 | 163 | ||
158 | 164 | let IdxCfgMathContract = 5 | |
159 | 165 | ||
160 | 166 | func keyConfig () = "%s__config" | |
161 | 167 | ||
162 | 168 | ||
163 | 169 | func readConfigArrayOrFail () = split(strf(this, keyConfig()), SEP) | |
164 | 170 | ||
165 | 171 | ||
166 | 172 | let mathContract = addressFromStringValue(readConfigArrayOrFail()[IdxCfgMathContract]) | |
167 | 173 | ||
168 | 174 | func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP) | |
169 | 175 | ||
170 | 176 | ||
171 | 177 | func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract) | |
172 | 178 | ||
173 | 179 | ||
174 | 180 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
175 | 181 | case s: String => | |
176 | 182 | fromBase58String(s) | |
177 | 183 | case _: Unit => | |
178 | 184 | unit | |
179 | 185 | case _ => | |
180 | 186 | throw("Match error") | |
181 | 187 | } | |
182 | 188 | ||
183 | 189 | ||
184 | 190 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
185 | 191 | case s: String => | |
186 | 192 | fromBase58String(s) | |
187 | 193 | case _: Unit => | |
188 | 194 | unit | |
189 | 195 | case _ => | |
190 | 196 | throw("Match error") | |
191 | 197 | } | |
192 | 198 | ||
193 | 199 | ||
194 | 200 | func mustManager (i) = { | |
195 | 201 | let pd = throw("Permission denied") | |
196 | 202 | match managerPublicKeyOrUnit() { | |
197 | 203 | case pk: ByteVector => | |
198 | 204 | if ((i.callerPublicKey == pk)) | |
199 | 205 | then true | |
200 | 206 | else pd | |
201 | 207 | case _: Unit => | |
202 | 208 | if ((i.caller == this)) | |
203 | 209 | then true | |
204 | 210 | else pd | |
205 | 211 | case _ => | |
206 | 212 | throw("Match error") | |
207 | 213 | } | |
208 | 214 | } | |
209 | 215 | ||
210 | 216 | ||
211 | 217 | let IdxLockUserNum = 1 | |
212 | 218 | ||
213 | 219 | let IdxLockAmount = 2 | |
214 | 220 | ||
215 | 221 | let IdxLockStart = 3 | |
216 | 222 | ||
217 | 223 | let IdxLockDuration = 4 | |
218 | 224 | ||
219 | 225 | let IdxLockParamK = 5 | |
220 | 226 | ||
221 | 227 | let IdxLockParamB = 6 | |
222 | 228 | ||
223 | 229 | func keyLockParamsRecord (userAddress) = makeString(["%s%s__lock", userAddress], SEP) | |
224 | 230 | ||
225 | 231 | ||
226 | 232 | func readLockParamsRecordOrFail (userAddress) = split(strf(this, keyLockParamsRecord(userAddress)), SEP) | |
227 | 233 | ||
228 | 234 | ||
229 | 235 | func formatLockParamsRecordS (userNum,amount,start,duration,paramK,paramB,lastUpdTimestamp,gwxAmount) = makeString(["%d%d%d%d%d%d%d%d", userNum, amount, start, duration, paramK, paramB, lastUpdTimestamp, gwxAmount], SEP) | |
230 | 236 | ||
231 | 237 | ||
232 | 238 | func formatLockParamsRecord (userNum,amount,start,duration,paramK,paramB,gwxAmount) = formatLockParamsRecordS(userNum, toString(amount), toString(start), toString(duration), toString(paramK), toString(paramB), toString(lastBlock.timestamp), toString(gwxAmount)) | |
233 | 239 | ||
234 | 240 | ||
235 | 241 | func keyNextUserNum () = "%s__nextUserNum" | |
236 | 242 | ||
237 | 243 | ||
238 | 244 | func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP) | |
239 | 245 | ||
240 | 246 | ||
241 | 247 | func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP) | |
242 | 248 | ||
243 | 249 | ||
244 | 250 | func keyLockParamUserAmount (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "amount"], SEP) | |
245 | 251 | ||
246 | 252 | ||
247 | 253 | func keyLockParamStartBlock (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "start"], SEP) | |
248 | 254 | ||
249 | 255 | ||
250 | 256 | func keyLockParamDuration (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "duration"], SEP) | |
251 | 257 | ||
252 | 258 | ||
253 | 259 | func keyLockParamK (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "k"], SEP) | |
254 | 260 | ||
255 | 261 | ||
256 | 262 | func keyLockParamB (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "b"], SEP) | |
257 | 263 | ||
258 | 264 | ||
259 | 265 | func keyLockParamByPeriodK (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "k", period], SEP) | |
260 | 266 | ||
261 | 267 | ||
262 | 268 | func keyLockParamByPeriodB (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "b", period], SEP) | |
263 | 269 | ||
264 | 270 | ||
265 | 271 | func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked" | |
266 | 272 | ||
267 | 273 | ||
268 | 274 | func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks" | |
269 | 275 | ||
270 | 276 | ||
271 | 277 | func keyStatsLocksCount () = "%s%s__stats__locksCount" | |
272 | 278 | ||
273 | 279 | ||
274 | 280 | func keyStatsUsersCount () = "%s%s__stats__activeUsersCount" | |
275 | 281 | ||
276 | 282 | ||
277 | 283 | func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum], SEP) | |
278 | 284 | ||
279 | 285 | ||
280 | 286 | func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", userNum, lpAssetId], SEP) | |
281 | 287 | ||
282 | 288 | ||
283 | 289 | func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP) | |
284 | 290 | ||
285 | 291 | ||
286 | 292 | func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total" | |
287 | 293 | ||
288 | 294 | ||
289 | 295 | func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", userNum], SEP) | |
290 | 296 | ||
291 | 297 | ||
292 | 298 | func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", userNum], SEP) | |
293 | 299 | ||
294 | 300 | ||
295 | 301 | func keyTotalCachedGwx () = "%s%s__gwxCached__total" | |
296 | 302 | ||
297 | 303 | ||
298 | 304 | func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective" | |
299 | 305 | ||
300 | 306 | ||
301 | 307 | let factoryContract = readFactoryAddressOrFail() | |
302 | 308 | ||
303 | 309 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
304 | 310 | ||
305 | 311 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
306 | 312 | ||
307 | 313 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
308 | 314 | ||
309 | 315 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
310 | 316 | ||
311 | 317 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
312 | 318 | ||
313 | 319 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
314 | 320 | ||
315 | 321 | let boostCoeff = { | |
316 | 322 | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
317 | 323 | if ($isInstanceOf(@, "Int")) | |
318 | 324 | then @ | |
319 | 325 | else throw(($getType(@) + " couldn't be cast to Int")) | |
320 | 326 | } | |
321 | 327 | ||
322 | 328 | func getTotalCachedGwx (correct) = { | |
323 | 329 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
324 | 330 | let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi) | |
325 | 331 | let keyTargetEpoch = makeString(["%s%s", "totalCachedGwxCorrection__activationEpoch"], SEP) | |
326 | 332 | let targetEpochOption = getInteger(this, keyTargetEpoch) | |
327 | 333 | let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0) | |
328 | 334 | let isCorrectionActivated = if (isDefined(targetEpochOption)) | |
329 | 335 | then (currentEpochUi >= value(targetEpochOption)) | |
330 | 336 | else false | |
331 | 337 | let corrective = if (if (isCorrectionActivated) | |
332 | 338 | then correct | |
333 | 339 | else false) | |
334 | 340 | then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0) | |
335 | 341 | else 0 | |
336 | 342 | max([0, (totalCachedGwxRaw + corrective)]) | |
337 | 343 | } | |
338 | 344 | ||
339 | 345 | ||
340 | 346 | func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = { | |
341 | 347 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
342 | 348 | let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(k), toString(b)], SEP) | |
343 | 349 | StringEntry(historyKEY, historyDATA) | |
344 | 350 | } | |
345 | 351 | ||
346 | 352 | ||
347 | 353 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
348 | 354 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
349 | 355 | let locksCountKEY = keyStatsLocksCount() | |
350 | 356 | let usersCountKEY = keyStatsUsersCount() | |
351 | 357 | let totalAmountKEY = keyLockParamTotalAmount() | |
352 | 358 | let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY) | |
353 | 359 | let locksCount = ioz(this, locksCountKEY) | |
354 | 360 | let usersCount = ioz(this, usersCountKEY) | |
355 | 361 | let totalAmount = ioz(this, totalAmountKEY) | |
356 | 362 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
357 | 363 | } | |
358 | 364 | ||
359 | 365 | ||
360 | 366 | func calcGwxAmount (kRaw,bRaw,h) = { | |
361 | 367 | let SCALE = 1000 | |
362 | 368 | (((kRaw * h) + bRaw) / SCALE) | |
363 | 369 | } | |
364 | 370 | ||
365 | 371 | ||
366 | 372 | func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = { | |
367 | 373 | let userAmountKEY = keyLockParamUserAmount(userNum) | |
368 | 374 | let startBlockKEY = keyLockParamStartBlock(userNum) | |
369 | 375 | let durationKEY = keyLockParamDuration(userNum) | |
370 | 376 | let kKEY = keyLockParamK(userNum) | |
371 | 377 | let bKEY = keyLockParamB(userNum) | |
372 | 378 | let kByPeriodKEY = keyLockParamByPeriodK(userNum, period) | |
373 | 379 | let bByPeriodKEY = keyLockParamByPeriodB(userNum, period) | |
374 | 380 | let gwxAmount = calcGwxAmount(k, b, height) | |
375 | 381 | [IntegerEntry(userAmountKEY, amount), IntegerEntry(startBlockKEY, start), IntegerEntry(durationKEY, duration), IntegerEntry(kKEY, k), IntegerEntry(bKEY, b), IntegerEntry(kByPeriodKEY, k), IntegerEntry(bByPeriodKEY, b), StringEntry(keyLockParamsRecord(userAddress), formatLockParamsRecord(userNum, amount, start, duration, k, b, gwxAmount))] | |
376 | 382 | } | |
377 | 383 | ||
378 | 384 | ||
379 | 385 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
380 | 386 | then throw("only one payment is allowed") | |
381 | 387 | else if ((size(i.payments) == 0)) | |
382 | 388 | then 0 | |
383 | 389 | else { | |
384 | 390 | let pmt = i.payments[0] | |
385 | 391 | if ((value(pmt.assetId) != expectedAssetId)) | |
386 | 392 | then throw("invalid asset id in payment") | |
387 | 393 | else pmt.amount | |
388 | 394 | } | |
389 | 395 | ||
390 | 396 | ||
391 | 397 | func calcUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
392 | 398 | let EMPTY = "empty" | |
393 | 399 | let user2NumMappingKEY = keyUser2NumMapping(userAddress) | |
394 | 400 | let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY) | |
395 | 401 | let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0) | |
396 | 402 | let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0) | |
397 | 403 | let gwxAmountCalc = calcGwxAmount(k, b, targetHeight) | |
398 | 404 | let gwxAmount = if ((0 > gwxAmountCalc)) | |
399 | 405 | then 0 | |
400 | 406 | else gwxAmountCalc | |
401 | 407 | gwxAmount | |
402 | 408 | } | |
403 | 409 | ||
404 | 410 | ||
405 | 411 | func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height) | |
406 | 412 | ||
407 | 413 | ||
414 | + | func getVoteInfoREADONLY (lpAssetIdStr,userAddressStr) = { | |
415 | + | let userAddress = addressFromStringValue(userAddressStr) | |
416 | + | let idxAmountAssetId = 4 | |
417 | + | let idxPriceAssetId = 5 | |
418 | + | let poolCfg = { | |
419 | + | let @ = invoke(factoryContract, "getPoolConfigByLpAssetId", [lpAssetIdStr], nil) | |
420 | + | if ($isInstanceOf(@, "List[Any]")) | |
421 | + | then @ | |
422 | + | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
423 | + | } | |
424 | + | let amountAssetId = { | |
425 | + | let @ = poolCfg[idxAmountAssetId] | |
426 | + | if ($isInstanceOf(@, "String")) | |
427 | + | then @ | |
428 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
429 | + | } | |
430 | + | let priceAssetId = { | |
431 | + | let @ = poolCfg[idxPriceAssetId] | |
432 | + | if ($isInstanceOf(@, "String")) | |
433 | + | then @ | |
434 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
435 | + | } | |
436 | + | let keyCurrentEpoch = makeString(["%s", "currentEpoch"], SEP) | |
437 | + | let lastFinalizedEpoch = { | |
438 | + | let epoch = (value(getInteger(this, keyCurrentEpoch)) - 1) | |
439 | + | if ((0 > epoch)) | |
440 | + | then throwErr("invalid epoch") | |
441 | + | else epoch | |
442 | + | } | |
443 | + | func keyVote (pool,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
444 | + | ||
445 | + | func keyVotingResult (pool,epoch) = makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(epoch)], SEP) | |
446 | + | ||
447 | + | let pool = $Tuple2(amountAssetId, priceAssetId) | |
448 | + | let userVote = valueOrElse(getInteger(this, keyVote(pool, userAddress, lastFinalizedEpoch)), 0) | |
449 | + | let poolResult = valueOrElse(getInteger(this, keyVotingResult(pool, lastFinalizedEpoch)), 0) | |
450 | + | $Tuple2(userVote, poolResult) | |
451 | + | } | |
452 | + | ||
453 | + | ||
408 | 454 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
409 | 455 | let EMPTY = "EMPTY" | |
410 | 456 | let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY) | |
411 | 457 | if ((userRecordOrEmpty == EMPTY)) | |
412 | 458 | then $Tuple3(0, nil, "userRecord::is::empty") | |
413 | 459 | else { | |
414 | 460 | let userRecordArray = split(userRecordOrEmpty, SEP) | |
415 | 461 | let userNumStr = userRecordArray[IdxLockUserNum] | |
416 | 462 | let EMPTYSTR = "empty" | |
417 | 463 | let poolWeight = if ((lpAssetIdStr != EMPTYSTR)) | |
418 | 464 | then { | |
419 | 465 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
420 | 466 | getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
421 | 467 | } | |
422 | 468 | else if (readOnly) | |
423 | 469 | then 0 | |
424 | 470 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
425 | 471 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
426 | 472 | let boostingV2StartHeight = iof(emissionContract, keyBoostingV2StartHeight()) | |
427 | 473 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
428 | 474 | let h = if ((height > emissionEnd)) | |
429 | 475 | then emissionEnd | |
430 | 476 | else height | |
431 | 477 | let dh = max([(h - boostingV2StartHeight), 0]) | |
432 | 478 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr) | |
433 | 479 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
434 | 480 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY)) | |
435 | 481 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * (boostCoeff - 1)) / boostCoeff) | |
436 | 482 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
437 | 483 | let udh = fraction(userBoostEmissionIntegral, boostCoeff, ((boostCoeff - 1) * wxEmissionPerBlock)) | |
438 | 484 | let uLastH = (h - udh) | |
439 | 485 | if ((0 > userBoostEmissionIntegral)) | |
440 | 486 | then throw("wrong calculations") | |
441 | 487 | else { | |
442 | 488 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
443 | 489 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
444 | 490 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
445 | 491 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
446 | - | let $t01675316890 = { | |
447 | - | let @ = invoke(votingEmissionContract, "getVoteInfoREADONLY", [lpAssetIdStr, userAddressStr], nil) | |
448 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
449 | - | then @ | |
450 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
451 | - | } | |
452 | - | let userVote = $t01675316890._1 | |
453 | - | let totalVotes = $t01675316890._2 | |
492 | + | let $t01812418202 = getVoteInfoREADONLY(lpAssetIdStr, userAddressStr) | |
493 | + | let userVote = $t01812418202._1 | |
494 | + | let totalVotes = $t01812418202._2 | |
454 | 495 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
455 | 496 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
456 | 497 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
457 | 498 | let userBoostAvaliableToClaimTotalNew = if ((totalVotes == 0)) | |
458 | 499 | then 0 | |
459 | 500 | else fraction(poolUserBoostEmissionIntegral, userVote, totalVotes) | |
460 | 501 | let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr) | |
461 | 502 | let userBoostClaimed = ioz(this, userBoostClaimedKEY) | |
462 | 503 | let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed) | |
463 | 504 | let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] | |
464 | 505 | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(userBoostClaimed), toString(userBoostAvailable), toString(poolWeight), toString(h), toString(udh), toString(uLastH), toString(userVote), toString(totalVotes)], ":") | |
465 | 506 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
466 | 507 | } | |
467 | 508 | } | |
468 | 509 | } | |
469 | 510 | ||
470 | 511 | ||
471 | 512 | func lockActions (i,duration) = { | |
472 | 513 | let cfgArray = readConfigArrayOrFail() | |
473 | 514 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
474 | 515 | let assetId = fromBase58String(assetIdStr) | |
475 | 516 | let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount]) | |
476 | 517 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
477 | 518 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
478 | 519 | if ((size(i.payments) != 1)) | |
479 | 520 | then throw("invalid payment - exact one payment must be attached") | |
480 | 521 | else { | |
481 | 522 | let pmt = i.payments[0] | |
482 | 523 | let pmtAmount = pmt.amount | |
483 | 524 | if ((assetId != value(pmt.assetId))) | |
484 | 525 | then throw((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
485 | 526 | else { | |
486 | 527 | let nextUserNumKEY = keyNextUserNum() | |
487 | 528 | let userAddressStr = toString(i.caller) | |
488 | 529 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
489 | 530 | let userNumStr = if (userIsExisting) | |
490 | 531 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
491 | 532 | else toString(iof(this, nextUserNumKEY)) | |
492 | 533 | let userNum = parseIntValue(userNumStr) | |
493 | 534 | let lockStart = height | |
494 | 535 | let startBlockKEY = keyLockParamStartBlock(userNumStr) | |
495 | 536 | let durationKEY = keyLockParamDuration(userNumStr) | |
496 | 537 | let userAmountKEY = keyLockParamUserAmount(userNumStr) | |
497 | 538 | if ((minLockAmount > pmtAmount)) | |
498 | 539 | then throw(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
499 | 540 | else if ((minLockDuration > duration)) | |
500 | 541 | then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
501 | 542 | else if ((duration > maxLockDuration)) | |
502 | 543 | then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
503 | 544 | else if (if (userIsExisting) | |
504 | 545 | then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart) | |
505 | 546 | else false) | |
506 | 547 | then throw("there is an active lock - consider to use increaseLock") | |
507 | 548 | else if ((ioz(this, userAmountKEY) > 0)) | |
508 | 549 | then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY)) | |
509 | 550 | else { | |
510 | 551 | let coeffX8 = fraction(duration, MULT8, maxLockDuration) | |
511 | 552 | let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8) | |
512 | 553 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil)) | |
513 | 554 | let k = ai(gWxParamsResultList[0]) | |
514 | 555 | let b = ai(gWxParamsResultList[1]) | |
515 | 556 | let period = toString(ai(gWxParamsResultList[2])) | |
516 | 557 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
517 | 558 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
518 | 559 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
519 | 560 | let h = if ((height > emissionEnd)) | |
520 | 561 | then emissionEnd | |
521 | 562 | else height | |
522 | 563 | let dh = max([(h - emissionStart), 0]) | |
523 | 564 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
524 | 565 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
525 | 566 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
526 | 567 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
527 | 568 | let userMaxBoostInt = ((gWxAmountStart * duration) / 2) | |
528 | 569 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
529 | 570 | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
530 | 571 | let arr = if (userIsExisting) | |
531 | 572 | then nil | |
532 | 573 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
533 | 574 | $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
534 | 575 | then 0 | |
535 | 576 | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart) | |
536 | 577 | } | |
537 | 578 | } | |
538 | 579 | } | |
539 | 580 | } | |
540 | 581 | ||
541 | 582 | ||
542 | 583 | @Callable(i) | |
543 | 584 | func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = { | |
544 | 585 | let checkCaller = mustManager(i) | |
545 | 586 | if ((checkCaller == checkCaller)) | |
546 | 587 | then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0)) | |
547 | 588 | else throw("Strict value is not equal to itself.") | |
548 | 589 | } | |
549 | 590 | ||
550 | 591 | ||
551 | 592 | ||
552 | 593 | @Callable(i) | |
553 | 594 | func lockRef (duration,referrerAddress,signature) = { | |
554 | - | let $ | |
555 | - | let lockActionsResult = $ | |
556 | - | let gWxAmountStart = $ | |
595 | + | let $t02415424219 = lockActions(i, duration) | |
596 | + | let lockActionsResult = $t02415424219._1 | |
597 | + | let gWxAmountStart = $t02415424219._2 | |
557 | 598 | let referralAddress = toString(i.caller) | |
558 | 599 | let refInv = if (if ((referrerAddress == "")) | |
559 | 600 | then true | |
560 | 601 | else (signature == base58'')) | |
561 | 602 | then unit | |
562 | 603 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
563 | 604 | if ((refInv == refInv)) | |
564 | 605 | then { | |
565 | 606 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
566 | 607 | if ((updateRefActivity == updateRefActivity)) | |
567 | 608 | then $Tuple2(lockActionsResult, unit) | |
568 | 609 | else throw("Strict value is not equal to itself.") | |
569 | 610 | } | |
570 | 611 | else throw("Strict value is not equal to itself.") | |
571 | 612 | } | |
572 | 613 | ||
573 | 614 | ||
574 | 615 | ||
575 | 616 | @Callable(i) | |
576 | 617 | func lock (duration) = { | |
577 | - | let $ | |
578 | - | let lockActionsResult = $ | |
579 | - | let gWxAmountStart = $ | |
618 | + | let $t02467724742 = lockActions(i, duration) | |
619 | + | let lockActionsResult = $t02467724742._1 | |
620 | + | let gWxAmountStart = $t02467724742._2 | |
580 | 621 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
581 | 622 | if ((updateRefActivity == updateRefActivity)) | |
582 | 623 | then $Tuple2(lockActionsResult, unit) | |
583 | 624 | else throw("Strict value is not equal to itself.") | |
584 | 625 | } | |
585 | 626 | ||
586 | 627 | ||
587 | 628 | ||
588 | 629 | @Callable(i) | |
589 | 630 | func increaseLock (deltaDuration) = { | |
590 | 631 | let cfgArray = readConfigArrayOrFail() | |
591 | 632 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
592 | 633 | let assetId = fromBase58String(assetIdStr) | |
593 | 634 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
594 | 635 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
595 | 636 | let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId) | |
596 | 637 | let userAddressStr = toString(i.caller) | |
597 | 638 | let userRecordArray = readLockParamsRecordOrFail(userAddressStr) | |
598 | 639 | let userNumStr = userRecordArray[IdxLockUserNum] | |
599 | 640 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
600 | 641 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
601 | 642 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
602 | 643 | let lockEnd = (lockStart + lockDuration) | |
603 | 644 | let remainingDuration = max([(lockEnd - height), 0]) | |
604 | 645 | let userAmountNew = (userAmount + pmtAmount) | |
605 | 646 | let lockDurationNew = (remainingDuration + deltaDuration) | |
606 | 647 | if ((0 > deltaDuration)) | |
607 | 648 | then throw("duration is less then zero") | |
608 | 649 | else if ((minLockDuration > lockDurationNew)) | |
609 | 650 | then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration))) | |
610 | 651 | else if ((lockDurationNew > maxLockDuration)) | |
611 | 652 | then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
612 | 653 | else { | |
613 | 654 | let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration) | |
614 | 655 | let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8) | |
615 | 656 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
616 | 657 | if ((updateRefActivity == updateRefActivity)) | |
617 | 658 | then { | |
618 | 659 | let lockStartNew = height | |
619 | 660 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil)) | |
620 | 661 | let k = ai(gWxParamsResultList[0]) | |
621 | 662 | let b = ai(gWxParamsResultList[1]) | |
622 | 663 | let period = toString(ai(gWxParamsResultList[2])) | |
623 | 664 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
624 | 665 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
625 | 666 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
626 | 667 | let h = if ((height > emissionEnd)) | |
627 | 668 | then emissionEnd | |
628 | 669 | else height | |
629 | 670 | let dh = max([(h - emissionStart), 0]) | |
630 | 671 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
631 | 672 | let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY) | |
632 | 673 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
633 | 674 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
634 | 675 | if ((0 > userBoostEmissionIntegral)) | |
635 | 676 | then throw("wrong calculations") | |
636 | 677 | else { | |
637 | 678 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
638 | 679 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
639 | 680 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
640 | 681 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
641 | 682 | let currUserGwx = calcCurrentGwxAmount(userAddressStr) | |
642 | 683 | let gwxDiff = (gWxAmountStart - currUserGwx) | |
643 | 684 | if ((0 > gwxDiff)) | |
644 | 685 | then throw(("gwxDiff is less then 0: " + toString(gwxDiff))) | |
645 | 686 | else { | |
646 | 687 | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
647 | 688 | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
648 | 689 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
649 | 690 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
650 | 691 | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected) | |
651 | 692 | let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2) | |
652 | 693 | let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2) | |
653 | 694 | let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt) | |
654 | 695 | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gwxDiff))]) | |
655 | 696 | } | |
656 | 697 | } | |
657 | 698 | } | |
658 | 699 | else throw("Strict value is not equal to itself.") | |
659 | 700 | } | |
660 | 701 | } | |
661 | 702 | ||
662 | 703 | ||
663 | 704 | ||
664 | 705 | @Callable(i) | |
665 | 706 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
666 | 707 | then throw("permissions denied") | |
667 | 708 | else { | |
668 | - | let $ | |
669 | - | let userBoostAvailable = $ | |
670 | - | let dataState = $ | |
671 | - | let debug = $ | |
709 | + | let $t02972329825 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
710 | + | let userBoostAvailable = $t02972329825._1 | |
711 | + | let dataState = $t02972329825._2 | |
712 | + | let debug = $t02972329825._3 | |
672 | 713 | $Tuple2(dataState, [userBoostAvailable]) | |
673 | 714 | } | |
674 | 715 | ||
675 | 716 | ||
676 | 717 | ||
677 | 718 | @Callable(i) | |
678 | 719 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
679 | - | let $ | |
680 | - | let userBoostAvailable = $ | |
681 | - | let dataState = $ | |
682 | - | let debug = $ | |
720 | + | let $t02995730058 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
721 | + | let userBoostAvailable = $t02995730058._1 | |
722 | + | let dataState = $t02995730058._2 | |
723 | + | let debug = $t02995730058._3 | |
683 | 724 | $Tuple2(nil, [userBoostAvailable, debug]) | |
684 | 725 | } | |
685 | 726 | ||
686 | 727 | ||
687 | 728 | ||
688 | 729 | @Callable(i) | |
689 | 730 | func unlock (userAddress) = { | |
690 | 731 | let userRecordArray = readLockParamsRecordOrFail(userAddress) | |
691 | 732 | let userNumStr = userRecordArray[IdxLockUserNum] | |
692 | 733 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
693 | 734 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
694 | 735 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
695 | 736 | let lockEnd = (lockStart + lockDuration) | |
696 | 737 | let cfgArray = readConfigArrayOrFail() | |
697 | 738 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
698 | 739 | if ((lockEnd >= height)) | |
699 | 740 | then throw((("wait " + toString(lockEnd)) + " to unlock")) | |
700 | 741 | else if ((0 >= userAmount)) | |
701 | 742 | then throw("nothing to unlock") | |
702 | 743 | else { | |
703 | 744 | let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0) | |
704 | 745 | (((LockParamsEntry(userAddress, userNumStr, 0, lockStart, lockDuration, 0, 0, toString(period)) ++ StatsEntry(-(userAmount), 0, 0, -1)) :+ HistoryEntry("unlock", userAddress, userAmount, lockStart, lockDuration, 0, 0, i)) :+ ScriptTransfer(addressFromStringValue(userAddress), userAmount, assetId)) | |
705 | 746 | } | |
706 | 747 | } | |
707 | 748 | ||
708 | 749 | ||
709 | 750 | ||
710 | 751 | @Callable(i) | |
711 | 752 | func gwxUserInfoREADONLY (userAddress) = { | |
712 | 753 | let gwxAmount = calcCurrentGwxAmount(userAddress) | |
713 | 754 | $Tuple2(nil, [gwxAmount]) | |
714 | 755 | } | |
715 | 756 | ||
716 | 757 | ||
717 | 758 | ||
718 | 759 | @Callable(i) | |
719 | 760 | func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = { | |
720 | 761 | let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight) | |
721 | 762 | $Tuple2(nil, gwxAmount) | |
722 | 763 | } | |
723 | 764 | ||
724 | 765 | ||
725 | 766 | ||
726 | 767 | @Callable(i) | |
727 | 768 | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true)) | |
728 | 769 | ||
729 | 770 | ||
730 | 771 | ||
731 | 772 | @Callable(i) | |
732 | 773 | func setManager (pendingManagerPublicKey) = { | |
733 | 774 | let checkCaller = mustManager(i) | |
734 | 775 | if ((checkCaller == checkCaller)) | |
735 | 776 | then { | |
736 | 777 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
737 | 778 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
738 | 779 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
739 | 780 | else throw("Strict value is not equal to itself.") | |
740 | 781 | } | |
741 | 782 | else throw("Strict value is not equal to itself.") | |
742 | 783 | } | |
743 | 784 | ||
744 | 785 | ||
745 | 786 | ||
746 | 787 | @Callable(i) | |
747 | 788 | func confirmManager () = { | |
748 | 789 | let pm = pendingManagerPublicKeyOrUnit() | |
749 | 790 | let hasPM = if (isDefined(pm)) | |
750 | 791 | then true | |
751 | 792 | else throw("No pending manager") | |
752 | 793 | if ((hasPM == hasPM)) | |
753 | 794 | then { | |
754 | 795 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
755 | 796 | then true | |
756 | 797 | else throw("You are not pending manager") | |
757 | 798 | if ((checkPM == checkPM)) | |
758 | 799 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
759 | 800 | else throw("Strict value is not equal to itself.") | |
760 | 801 | } | |
761 | 802 | else throw("Strict value is not equal to itself.") | |
762 | 803 | } | |
763 | 804 | ||
764 | 805 | ||
765 | 806 | @Verifier(tx) | |
766 | 807 | func verify () = { | |
767 | 808 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
768 | 809 | case pk: ByteVector => | |
769 | 810 | pk | |
770 | 811 | case _: Unit => | |
771 | 812 | tx.senderPublicKey | |
772 | 813 | case _ => | |
773 | 814 | throw("Match error") | |
774 | 815 | } | |
775 | 816 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
776 | 817 | } | |
777 | 818 |
github/deemru/w8io/026f985 95.24 ms ◑