tx · HysWtk6dUsvdzxkuVcGbWUjnrSxBno7eeyrT6GxNJx4E 3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE: -0.01800000 Waves 2022.11.01 13:52 [2297955] smart account 3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE > SELF 0.00000000 Waves
{ "type": 13, "id": "HysWtk6dUsvdzxkuVcGbWUjnrSxBno7eeyrT6GxNJx4E", "fee": 1800000, "feeAssetId": null, "timestamp": 1667299960515, "version": 1, "sender": "3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE", "senderPublicKey": "G349Uq3FTox7dRNLeAfAQeoACvwZ9iEnVSaHcEYn6j8J", "proofs": [ "2BoUXM6bPRt98vFPU8HXfExPQJN3XXugmgnLwbpPzfaP7LjnQmdmTjsVm7f1QhBgHH9shSQRsuL7DnyJZMQ8utU" ], "script": "base64:BgKPGQgCEgQKAggBEgASAwoBARIAEgASABIDCgEIEgMKAQgSAwoBCBIFCgMBAQESBQoDAQEBEgASAwoBCBIHCgUICAgICBIDCgEIEgAiA1NFUCIFU0NBTEUiBU1VTFQ4Igp6ZXJvQmlnSW50IhRwcm9jZXNzaW5nU3RhZ2VUb3RhbCIVcHJvY2Vzc2luZ1N0YWdlU2hhcmVzIg5nZXROdW1iZXJCeUtleSIDa2V5Ig9nZXROdW1iZXJPckZhaWwiDmdldFN0cmluZ0J5S2V5Ig9nZXRTdHJpbmdPckZhaWwiA2FicyIDdmFsIglhYnNCaWdJbnQiC2tleU1heERlcHRoIg9tYXhEZXB0aERlZmF1bHQiCG1heERlcHRoIhFrZXlGYWN0b3J5QWRkcmVzcyIRZmFjdG9yeUFkZHJlc3NTdHIiD2ZhY3RvcnlDb250cmFjdCISa2V5RW1pc3Npb25BZGRyZXNzIhNrZXlOdW1Ub1VzZXJNYXBwaW5nIgNudW0iFmtleVJlZmVycmFsUHJvZ3JhbU5hbWUiGnJlZmVycmFsUHJvZ3JhbU5hbWVEZWZhdWx0IhNyZWZlcnJhbFByb2dyYW1O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Wx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECZGEBAmRiAAQCZGMEAmFPCQECYU4AAwkAAQIFAmFPAgpCeXRlVmVjdG9yBAJhVAUCYU8FAmFUAwkAAQIFAmFPAgRVbml0CAUCZGEPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmRhCWJvZHlCeXRlcwkAkQMCCAUCZGEGcHJvb2ZzAAAFAmRj6gXGCA==", "chainId": 84, "height": 2297955, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GrLmd7bKQYGCb8yZmXvR7LpSZhDYTzKhApTdEmqdk2Ar Next: FWL2HwD6oRFLzo6F455UKyxYYhaPwpX4iTJF1DskdgTa Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined")) | |
26 | 26 | ||
27 | 27 | ||
28 | - | func abs (val) = if ((zeroBigInt > val)) | |
28 | + | func abs (val) = if ((0 > val)) | |
29 | + | then -(val) | |
30 | + | else val | |
31 | + | ||
32 | + | ||
33 | + | func absBigInt (val) = if ((zeroBigInt > val)) | |
29 | 34 | then -(val) | |
30 | 35 | else val | |
31 | 36 | ||
325 | 330 | then $Tuple2(nil, false) | |
326 | 331 | else if ((processingStage == processingStageTotal)) | |
327 | 332 | then { | |
328 | - | let $ | |
329 | - | let userWeight = $ | |
330 | - | let userActions = $ | |
333 | + | let $t01208212198 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser) | |
334 | + | let userWeight = $t01208212198._1 | |
335 | + | let userActions = $t01208212198._2 | |
331 | 336 | let totalWeightNew = (totalWeight + userWeight) | |
332 | 337 | let processingActions = if (((usersCount - 1) > currentUser)) | |
333 | 338 | then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))] | |
433 | 438 | func claimReward () = { | |
434 | 439 | let cfgArray = readConfigArrayOrFail() | |
435 | 440 | let address = toString(i.caller) | |
436 | - | let $ | |
437 | - | let amount = $ | |
438 | - | let actions = $ | |
441 | + | let $t01754017590 = commonClaimReward(address) | |
442 | + | let amount = $t01754017590._1 | |
443 | + | let actions = $t01754017590._2 | |
439 | 444 | let checkAmount = if ((amount > 0)) | |
440 | 445 | then true | |
441 | 446 | else throw("Nothing to claim") | |
458 | 463 | ||
459 | 464 | @Callable(i) | |
460 | 465 | func claimRewardREADONLY (address) = { | |
461 | - | let $ | |
462 | - | let amount = $ | |
463 | - | let actions = $ | |
466 | + | let $t01816318213 = commonClaimReward(address) | |
467 | + | let amount = $t01816318213._1 | |
468 | + | let actions = $t01816318213._2 | |
464 | 469 | let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0) | |
465 | 470 | let totalAmount = (amount + referralUnclaimed) | |
466 | 471 | $Tuple2(nil, totalAmount) | |
525 | 530 | then $Tuple2(nil, toString(zeroBigInt)) | |
526 | 531 | else { | |
527 | 532 | let ann = (amp * nCoins) | |
528 | - | let arr = [1, 2, 3, 4, 5, 6 | |
533 | + | let arr = [0, 1, 2, 3, 4, 5, 6] | |
529 | 534 | func calc (acc,cur) = { | |
530 | - | let $t02077720966 = acc | |
531 | - | let d = $t02077720966._1 | |
532 | - | let dPrev = $t02077720966._2 | |
533 | - | let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins)) | |
534 | - | let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp))) | |
535 | - | $Tuple2(dNext, d) | |
535 | + | let $t02084620873 = acc | |
536 | + | let d = $t02084620873._1 | |
537 | + | let dPrev = $t02084620873._2 | |
538 | + | let found = $t02084620873._3 | |
539 | + | if ((found != unit)) | |
540 | + | then acc | |
541 | + | else { | |
542 | + | let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins)) | |
543 | + | let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp))) | |
544 | + | let dDiff = absBigInt((dNext - value(d))) | |
545 | + | if ((targetPrecision >= dDiff)) | |
546 | + | then $Tuple3(dNext, d, cur) | |
547 | + | else $Tuple3(dNext, d, unit) | |
548 | + | } | |
536 | 549 | } | |
537 | 550 | ||
538 | - | let $ | |
551 | + | let $t02147121534 = { | |
539 | 552 | let $l = arr | |
540 | 553 | let $s = size($l) | |
541 | - | let $acc0 = $ | |
554 | + | let $acc0 = $Tuple3(s, unit, unit) | |
542 | 555 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
543 | 556 | then $a | |
544 | 557 | else calc($a, $l[$i]) | |
549 | 562 | ||
550 | 563 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
551 | 564 | } | |
552 | - | let dNext = $ | |
553 | - | let dPrev = $ | |
554 | - | let | |
555 | - | if (( | |
565 | + | let dNext = $t02147121534._1 | |
566 | + | let dPrev = $t02147121534._2 | |
567 | + | let found = $t02147121534._3 | |
568 | + | if ((found != unit)) | |
556 | 569 | then $Tuple2(nil, toString(dNext)) | |
557 | - | else throw(("D calculation error, dDiff = " + toString(dDiff))) | |
570 | + | else { | |
571 | + | let dDiff = absBigInt((dNext - value(dPrev))) | |
572 | + | throw(("D calculation error, dDiff = " + toString(dDiff))) | |
573 | + | } | |
558 | 574 | } | |
559 | 575 | } | |
560 | 576 |
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 SCALE = 1000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let processingStageTotal = 0 | |
13 | 13 | ||
14 | 14 | let processingStageShares = 1 | |
15 | 15 | ||
16 | 16 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("mandatory this." + key) + " is not defined")) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined")) | |
26 | 26 | ||
27 | 27 | ||
28 | - | func abs (val) = if ((zeroBigInt > val)) | |
28 | + | func abs (val) = if ((0 > val)) | |
29 | + | then -(val) | |
30 | + | else val | |
31 | + | ||
32 | + | ||
33 | + | func absBigInt (val) = if ((zeroBigInt > val)) | |
29 | 34 | then -(val) | |
30 | 35 | else val | |
31 | 36 | ||
32 | 37 | ||
33 | 38 | let keyMaxDepth = "%s__maxDepth" | |
34 | 39 | ||
35 | 40 | let maxDepthDefault = 30 | |
36 | 41 | ||
37 | 42 | let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault) | |
38 | 43 | ||
39 | 44 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
40 | 45 | ||
41 | 46 | ||
42 | 47 | let factoryAddressStr = getStringOrFail(keyFactoryAddress()) | |
43 | 48 | ||
44 | 49 | let factoryContract = addressFromStringValue(factoryAddressStr) | |
45 | 50 | ||
46 | 51 | func keyEmissionAddress () = "%s%s__config__emissionAddress" | |
47 | 52 | ||
48 | 53 | ||
49 | 54 | func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP) | |
50 | 55 | ||
51 | 56 | ||
52 | 57 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
53 | 58 | ||
54 | 59 | let referralProgramNameDefault = "wxlock" | |
55 | 60 | ||
56 | 61 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
57 | 62 | ||
58 | 63 | let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP) | |
59 | 64 | ||
60 | 65 | let referralMinGWxAmountDefault = (500 * MULT8) | |
61 | 66 | ||
62 | 67 | let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault) | |
63 | 68 | ||
64 | 69 | let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP) | |
65 | 70 | ||
66 | 71 | let referrerRewardPermilleDefault = 50 | |
67 | 72 | ||
68 | 73 | let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault) | |
69 | 74 | ||
70 | 75 | let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP) | |
71 | 76 | ||
72 | 77 | let referralRewardPermilleDefault = 50 | |
73 | 78 | ||
74 | 79 | let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault) | |
75 | 80 | ||
76 | 81 | func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP) | |
77 | 82 | ||
78 | 83 | ||
79 | 84 | func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP) | |
80 | 85 | ||
81 | 86 | ||
82 | 87 | let emissionAddressStr = getStringOrFail(keyEmissionAddress()) | |
83 | 88 | ||
84 | 89 | let emissionContract = addressFromStringValue(emissionAddressStr) | |
85 | 90 | ||
86 | 91 | let IdxCfgAssetId = 1 | |
87 | 92 | ||
88 | 93 | let IdxCfgPacemakerAddress = 2 | |
89 | 94 | ||
90 | 95 | let IdxCfgBoostingContract = 3 | |
91 | 96 | ||
92 | 97 | let IdxCfgMaxDepth = 4 | |
93 | 98 | ||
94 | 99 | func keyConfig () = "%s__config" | |
95 | 100 | ||
96 | 101 | ||
97 | 102 | func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP) | |
98 | 103 | ||
99 | 104 | ||
100 | 105 | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP) | |
101 | 106 | ||
102 | 107 | ||
103 | 108 | func boostingContractOrFail () = { | |
104 | 109 | let cfgArray = readConfigArrayOrFail() | |
105 | 110 | valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined") | |
106 | 111 | } | |
107 | 112 | ||
108 | 113 | ||
109 | 114 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
110 | 115 | ||
111 | 116 | ||
112 | 117 | func keyUsersCount () = "%s__nextUserNum" | |
113 | 118 | ||
114 | 119 | ||
115 | 120 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
116 | 121 | ||
117 | 122 | ||
118 | 123 | func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL" | |
119 | 124 | ||
120 | 125 | ||
121 | 126 | func keyNextProcessedUser () = "%s__nextProcessedUser" | |
122 | 127 | ||
123 | 128 | ||
124 | 129 | func keyLatestPeriod () = "%s__latestPeriod" | |
125 | 130 | ||
126 | 131 | ||
127 | 132 | func keyNextPeriod () = "%s__nextPeriod" | |
128 | 133 | ||
129 | 134 | ||
130 | 135 | func keyProcessingStage () = "%s__processingStage" | |
131 | 136 | ||
132 | 137 | ||
133 | 138 | func keyNextProcessedPeriod () = "%s__nextProcessedPeriod" | |
134 | 139 | ||
135 | 140 | ||
136 | 141 | func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP) | |
137 | 142 | ||
138 | 143 | ||
139 | 144 | func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d__nextClaimedPeriod", toString(userIndex)], SEP) | |
140 | 145 | ||
141 | 146 | ||
142 | 147 | func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d__lastProcessedPeriod", toString(userIndex)], SEP) | |
143 | 148 | ||
144 | 149 | ||
145 | 150 | func keyHeightForPeriod (period) = makeString(["%s%d__startHeightForPeriod", toString(period)], SEP) | |
146 | 151 | ||
147 | 152 | ||
148 | 153 | func keyAuxEmissionRewardForPeriod (period) = makeString(["%s%d__auxEmissionReward", toString(period)], SEP) | |
149 | 154 | ||
150 | 155 | ||
151 | 156 | func keyTotalAmountForPeriod (period) = makeString(["%s%d__totalAmountForPeriod", toString(period)], SEP) | |
152 | 157 | ||
153 | 158 | ||
154 | 159 | func keyLastPayoutInfo () = "%s__lastPayoutInfo" | |
155 | 160 | ||
156 | 161 | ||
157 | 162 | func PeriodPayoutInfo (period,matcherReward,emissionReward) = makeString(["%d%d%d", toString(period), toString(matcherReward), toString(emissionReward)], SEP) | |
158 | 163 | ||
159 | 164 | ||
160 | 165 | func keyPayoutHistoryInfo (period) = makeString(["%s%s%d__payouts__history", toString(period)], SEP) | |
161 | 166 | ||
162 | 167 | ||
163 | 168 | func keyTotalWeightForPeriod (period) = makeString(["%s%d__totalWeightForPeriod", toString(period)], SEP) | |
164 | 169 | ||
165 | 170 | ||
166 | 171 | func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "k", toString(period)], SEP) | |
167 | 172 | ||
168 | 173 | ||
169 | 174 | func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "b", toString(period)], SEP) | |
170 | 175 | ||
171 | 176 | ||
172 | 177 | func keyUserWeightForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "weight", toString(period)], SEP) | |
173 | 178 | ||
174 | 179 | ||
175 | 180 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
176 | 181 | ||
177 | 182 | ||
178 | 183 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress())) | |
179 | 184 | ||
180 | 185 | func HistoryEntry (type,user,amount,i) = { | |
181 | 186 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
182 | 187 | let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
183 | 188 | StringEntry(historyKEY, historyDATA) | |
184 | 189 | } | |
185 | 190 | ||
186 | 191 | ||
187 | 192 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
188 | 193 | ||
189 | 194 | ||
190 | 195 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
191 | 196 | ||
192 | 197 | ||
193 | 198 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
194 | 199 | case s: String => | |
195 | 200 | fromBase58String(s) | |
196 | 201 | case _: Unit => | |
197 | 202 | unit | |
198 | 203 | case _ => | |
199 | 204 | throw("Match error") | |
200 | 205 | } | |
201 | 206 | ||
202 | 207 | ||
203 | 208 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
204 | 209 | case s: String => | |
205 | 210 | fromBase58String(s) | |
206 | 211 | case _: Unit => | |
207 | 212 | unit | |
208 | 213 | case _ => | |
209 | 214 | throw("Match error") | |
210 | 215 | } | |
211 | 216 | ||
212 | 217 | ||
213 | 218 | func mustManager (i) = { | |
214 | 219 | let pd = throw("Permission denied") | |
215 | 220 | match managerPublicKeyOrUnit() { | |
216 | 221 | case pk: ByteVector => | |
217 | 222 | if ((i.callerPublicKey == pk)) | |
218 | 223 | then true | |
219 | 224 | else pd | |
220 | 225 | case _: Unit => | |
221 | 226 | if ((i.caller == this)) | |
222 | 227 | then true | |
223 | 228 | else pd | |
224 | 229 | case _ => | |
225 | 230 | throw("Match error") | |
226 | 231 | } | |
227 | 232 | } | |
228 | 233 | ||
229 | 234 | ||
230 | 235 | func calcUserWeight (boostingContractAddress,heightForPeriod,period,userIndex) = { | |
231 | 236 | let kLast = keyLastProcessedPeriodOfUser(userIndex) | |
232 | 237 | let kKey = keyUserKValueForPeriod(period, userIndex) | |
233 | 238 | let kRaw = getInteger(boostingContractAddress, kKey) | |
234 | 239 | let kUserWeight = keyUserWeightForPeriod(period, userIndex) | |
235 | 240 | if (isDefined(kRaw)) | |
236 | 241 | then { | |
237 | 242 | let k = value(kRaw) | |
238 | 243 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(period, userIndex))) | |
239 | 244 | let w = ((k * heightForPeriod) + b) | |
240 | 245 | if ((w > 0)) | |
241 | 246 | then $Tuple2((w / SCALE), [IntegerEntry(kLast, period), IntegerEntry(kUserWeight, w)]) | |
242 | 247 | else $Tuple2(0, nil) | |
243 | 248 | } | |
244 | 249 | else { | |
245 | 250 | let p = getInteger(this, kLast) | |
246 | 251 | if (if (isDefined(p)) | |
247 | 252 | then (period >= value(p)) | |
248 | 253 | else false) | |
249 | 254 | then { | |
250 | 255 | let pv = value(p) | |
251 | 256 | let k = value(getInteger(boostingContractAddress, keyUserKValueForPeriod(pv, userIndex))) | |
252 | 257 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(pv, userIndex))) | |
253 | 258 | let w = ((k * heightForPeriod) + b) | |
254 | 259 | if ((w > 0)) | |
255 | 260 | then $Tuple2((w / SCALE), [IntegerEntry(kUserWeight, w)]) | |
256 | 261 | else $Tuple2(0, nil) | |
257 | 262 | } | |
258 | 263 | else $Tuple2(0, nil) | |
259 | 264 | } | |
260 | 265 | } | |
261 | 266 | ||
262 | 267 | ||
263 | 268 | func calcUserWeightForClaim (boostingContractAddress,heightForPeriod,period,userIndex) = { | |
264 | 269 | let kUserWeight = keyUserWeightForPeriod(period, userIndex) | |
265 | 270 | let userWeightOrUnit = getInteger(kUserWeight) | |
266 | 271 | match userWeightOrUnit { | |
267 | 272 | case _: Unit => | |
268 | 273 | 0 | |
269 | 274 | case w: Int => | |
270 | 275 | (w / SCALE) | |
271 | 276 | case _ => | |
272 | 277 | throw("Match error") | |
273 | 278 | } | |
274 | 279 | } | |
275 | 280 | ||
276 | 281 | ||
277 | 282 | func getUserIndexByAddress (boostingContractAddressStr,userAddress) = { | |
278 | 283 | let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP) | |
279 | 284 | parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key))) | |
280 | 285 | } | |
281 | 286 | ||
282 | 287 | ||
283 | 288 | func nextPeriod () = getNumberByKey(keyNextPeriod()) | |
284 | 289 | ||
285 | 290 | ||
286 | 291 | func commonClaimReward (userAddress) = { | |
287 | 292 | let cfgArray = readConfigArrayOrFail() | |
288 | 293 | let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress) | |
289 | 294 | let userUnclaimedOption = getInteger(keyUserUnclaimed(userIdx)) | |
290 | 295 | match userUnclaimedOption { | |
291 | 296 | case _: Unit => | |
292 | 297 | $Tuple2(0, nil) | |
293 | 298 | case u: Int => | |
294 | 299 | $Tuple2(u, [IntegerEntry(keyUserUnclaimed(userIdx), 0)]) | |
295 | 300 | case _ => | |
296 | 301 | throw("Match error") | |
297 | 302 | } | |
298 | 303 | } | |
299 | 304 | ||
300 | 305 | ||
301 | 306 | @Callable(i) | |
302 | 307 | func updateReferralActivity (userAddress,gWxAmountStart) = { | |
303 | 308 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress)) | |
304 | 309 | let activeReferralInv = if ((referrer == unit)) | |
305 | 310 | then unit | |
306 | 311 | else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil) | |
307 | 312 | if ((activeReferralInv == activeReferralInv)) | |
308 | 313 | then $Tuple2(nil, unit) | |
309 | 314 | else throw("Strict value is not equal to itself.") | |
310 | 315 | } | |
311 | 316 | ||
312 | 317 | ||
313 | 318 | ||
314 | 319 | @Callable(i) | |
315 | 320 | func finalizeHelper () = { | |
316 | 321 | let processingStage = valueOrElse(getInteger(keyProcessingStage()), processingStageTotal) | |
317 | 322 | let currentPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
318 | 323 | let currentUser = getNumberByKey(keyNextProcessedUser()) | |
319 | 324 | let latestPeriod = getNumberByKey(keyLatestPeriod()) | |
320 | 325 | let usersCount = valueOrElse(getInteger(boostingContractOrFail(), keyUsersCount()), 0) | |
321 | 326 | let totalWeightKey = keyTotalWeightForPeriod(currentPeriod) | |
322 | 327 | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
323 | 328 | let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod)) | |
324 | 329 | if ((currentPeriod > latestPeriod)) | |
325 | 330 | then $Tuple2(nil, false) | |
326 | 331 | else if ((processingStage == processingStageTotal)) | |
327 | 332 | then { | |
328 | - | let $ | |
329 | - | let userWeight = $ | |
330 | - | let userActions = $ | |
333 | + | let $t01208212198 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser) | |
334 | + | let userWeight = $t01208212198._1 | |
335 | + | let userActions = $t01208212198._2 | |
331 | 336 | let totalWeightNew = (totalWeight + userWeight) | |
332 | 337 | let processingActions = if (((usersCount - 1) > currentUser)) | |
333 | 338 | then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))] | |
334 | 339 | else [IntegerEntry(keyProcessingStage(), processingStageShares), IntegerEntry(keyNextProcessedUser(), 0)] | |
335 | 340 | $Tuple2((([IntegerEntry(totalWeightKey, totalWeightNew)] ++ processingActions) ++ userActions), true) | |
336 | 341 | } | |
337 | 342 | else if ((processingStage == processingStageShares)) | |
338 | 343 | then { | |
339 | 344 | let userWeight = calcUserWeightForClaim(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser) | |
340 | 345 | let userAmountMatcherForPeriod = fraction(getNumberByKey(keyTotalAmountForPeriod(currentPeriod)), userWeight, totalWeight) | |
341 | 346 | let userAmountEmissionForPeriod = fraction(getNumberByKey(keyAuxEmissionRewardForPeriod(currentPeriod)), userWeight, totalWeight) | |
342 | 347 | let userTotalAmount = (userAmountEmissionForPeriod + userAmountMatcherForPeriod) | |
343 | 348 | let userUnclaimedOption = getInteger(keyUserUnclaimed(currentUser)) | |
344 | 349 | let userAddress = getStringValue(boostingContractOrFail(), keyNumToUserMapping(currentUser)) | |
345 | 350 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress)) | |
346 | 351 | let activeReferralInv = if ((referrer == unit)) | |
347 | 352 | then unit | |
348 | 353 | else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userWeight >= referralMinGWxAmount)], nil) | |
349 | 354 | if ((activeReferralInv == activeReferralInv)) | |
350 | 355 | then { | |
351 | 356 | let referralInv = if (if ((referrer == unit)) | |
352 | 357 | then true | |
353 | 358 | else (referralMinGWxAmount > userWeight)) | |
354 | 359 | then unit | |
355 | 360 | else { | |
356 | 361 | let referrerReward = fraction(userTotalAmount, referrerRewardPermille, SCALE) | |
357 | 362 | let referralReward = fraction(userTotalAmount, referralRewardPermille, SCALE) | |
358 | 363 | invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil) | |
359 | 364 | } | |
360 | 365 | if ((referralInv == referralInv)) | |
361 | 366 | then { | |
362 | 367 | let unclaimedActions = [IntegerEntry(keyUserUnclaimed(currentUser), (valueOrElse(userUnclaimedOption, 0) + userTotalAmount))] | |
363 | 368 | let processingActions = if (((usersCount - 1) > currentUser)) | |
364 | 369 | then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))] | |
365 | 370 | else [IntegerEntry(keyNextProcessedPeriod(), (currentPeriod + 1)), IntegerEntry(keyNextProcessedUser(), 0), DeleteEntry(keyProcessingStage())] | |
366 | 371 | $Tuple2((unclaimedActions ++ processingActions), true) | |
367 | 372 | } | |
368 | 373 | else throw("Strict value is not equal to itself.") | |
369 | 374 | } | |
370 | 375 | else throw("Strict value is not equal to itself.") | |
371 | 376 | } | |
372 | 377 | else throw("invalid processing stage") | |
373 | 378 | } | |
374 | 379 | ||
375 | 380 | ||
376 | 381 | ||
377 | 382 | @Callable(i) | |
378 | 383 | func finalizeWrapper (counter) = { | |
379 | 384 | let result = { | |
380 | 385 | let @ = invoke(this, "finalizeHelper", nil, nil) | |
381 | 386 | if ($isInstanceOf(@, "Boolean")) | |
382 | 387 | then @ | |
383 | 388 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
384 | 389 | } | |
385 | 390 | if ((result == result)) | |
386 | 391 | then if (!(result)) | |
387 | 392 | then if ((counter == maxDepth)) | |
388 | 393 | then throw("Nothing to process") | |
389 | 394 | else $Tuple2(nil, unit) | |
390 | 395 | else if ((counter > 0)) | |
391 | 396 | then $Tuple2(nil, invoke(this, "finalizeWrapper", [(counter - 1)], nil)) | |
392 | 397 | else $Tuple2(nil, unit) | |
393 | 398 | else throw("Strict value is not equal to itself.") | |
394 | 399 | } | |
395 | 400 | ||
396 | 401 | ||
397 | 402 | ||
398 | 403 | @Callable(i) | |
399 | 404 | func processPendingPeriodsAndUsers () = $Tuple2(nil, invoke(this, "finalizeWrapper", [maxDepth], nil)) | |
400 | 405 | ||
401 | 406 | ||
402 | 407 | ||
403 | 408 | @Callable(i) | |
404 | 409 | func deposit () = { | |
405 | 410 | let cfgArray = readConfigArrayOrFail() | |
406 | 411 | if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress])))) | |
407 | 412 | then throw("Wrong caller address") | |
408 | 413 | else { | |
409 | 414 | let assetId = value(value(i.payments[0]).assetId) | |
410 | 415 | if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId]))) | |
411 | 416 | then throw("Wrong payment asset") | |
412 | 417 | else { | |
413 | 418 | let period = nextPeriod() | |
414 | 419 | let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight())) | |
415 | 420 | let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined")) | |
416 | 421 | let weight = valueOrErrorMessage(getInteger(factoryContract, keyPoolWeightVirtual()), (("mandatory factory_contract." + keyPoolWeightVirtual()) + " is not defined")) | |
417 | 422 | let auxAmount = fraction((deltaH * weight), emissionRate, MULT8) | |
418 | 423 | let em = invoke(emissionContract, "emit", [auxAmount], nil) | |
419 | 424 | if ((em == em)) | |
420 | 425 | then { | |
421 | 426 | let matcherPart = value(i.payments[0]).amount | |
422 | 427 | let payoutInfo = PeriodPayoutInfo(period, matcherPart, auxAmount) | |
423 | 428 | [IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyAuxEmissionRewardForPeriod(period), auxAmount), IntegerEntry(keyGwxRewardEmissionStartHeight(), height), IntegerEntry(keyTotalAmountForPeriod(period), matcherPart), IntegerEntry(keyNextPeriod(), (period + 1)), StringEntry(keyLastPayoutInfo(), payoutInfo), StringEntry(keyPayoutHistoryInfo(period), payoutInfo)] | |
424 | 429 | } | |
425 | 430 | else throw("Strict value is not equal to itself.") | |
426 | 431 | } | |
427 | 432 | } | |
428 | 433 | } | |
429 | 434 | ||
430 | 435 | ||
431 | 436 | ||
432 | 437 | @Callable(i) | |
433 | 438 | func claimReward () = { | |
434 | 439 | let cfgArray = readConfigArrayOrFail() | |
435 | 440 | let address = toString(i.caller) | |
436 | - | let $ | |
437 | - | let amount = $ | |
438 | - | let actions = $ | |
441 | + | let $t01754017590 = commonClaimReward(address) | |
442 | + | let amount = $t01754017590._1 | |
443 | + | let actions = $t01754017590._2 | |
439 | 444 | let checkAmount = if ((amount > 0)) | |
440 | 445 | then true | |
441 | 446 | else throw("Nothing to claim") | |
442 | 447 | if ((checkAmount == checkAmount)) | |
443 | 448 | then { | |
444 | 449 | let amountFromEmission = 0 | |
445 | 450 | let claimedReferral = { | |
446 | 451 | let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil) | |
447 | 452 | if ($isInstanceOf(@, "Int")) | |
448 | 453 | then @ | |
449 | 454 | else throw(($getType(@) + " couldn't be cast to Int")) | |
450 | 455 | } | |
451 | 456 | let totalAmount = (amount + claimedReferral) | |
452 | 457 | $Tuple2(([ScriptTransfer(i.caller, totalAmount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", address, amount, i)] ++ actions), [totalAmount, amountFromEmission]) | |
453 | 458 | } | |
454 | 459 | else throw("Strict value is not equal to itself.") | |
455 | 460 | } | |
456 | 461 | ||
457 | 462 | ||
458 | 463 | ||
459 | 464 | @Callable(i) | |
460 | 465 | func claimRewardREADONLY (address) = { | |
461 | - | let $ | |
462 | - | let amount = $ | |
463 | - | let actions = $ | |
466 | + | let $t01816318213 = commonClaimReward(address) | |
467 | + | let amount = $t01816318213._1 | |
468 | + | let actions = $t01816318213._2 | |
464 | 469 | let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0) | |
465 | 470 | let totalAmount = (amount + referralUnclaimed) | |
466 | 471 | $Tuple2(nil, totalAmount) | |
467 | 472 | } | |
468 | 473 | ||
469 | 474 | ||
470 | 475 | ||
471 | 476 | @Callable(i) | |
472 | 477 | func latestFinalizedPeriodREADONLY (address) = $Tuple2(nil, valueOrElse(getInteger(this, keyLatestPeriod()), -1)) | |
473 | 478 | ||
474 | 479 | ||
475 | 480 | ||
476 | 481 | @Callable(i) | |
477 | 482 | func latestFinalizedPeriodInfoREADONLY (address) = $Tuple2(nil, getStringByKey(keyLastPayoutInfo())) | |
478 | 483 | ||
479 | 484 | ||
480 | 485 | ||
481 | 486 | @Callable(i) | |
482 | 487 | func calcGwxParamsREADONLY (gwxAmountStart,lockStartHeight,lockDurationBlocks) = { | |
483 | 488 | let lockEndHeight = (lockStartHeight + lockDurationBlocks) | |
484 | 489 | let scale8ParamK = -(fraction(gwxAmountStart, SCALE, lockDurationBlocks)) | |
485 | 490 | let scale8ParamB = (fraction(gwxAmountStart, SCALE, lockDurationBlocks) * lockEndHeight) | |
486 | 491 | $Tuple2(nil, [scale8ParamK, scale8ParamB, nextPeriod()]) | |
487 | 492 | } | |
488 | 493 | ||
489 | 494 | ||
490 | 495 | ||
491 | 496 | @Callable(i) | |
492 | 497 | func calcGwxAmountStartREADONLY (wxLockAmount,lockDuration,maxLockDuration) = { | |
493 | 498 | let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration) | |
494 | 499 | let gWxAmountStart = fraction(wxLockAmount, coeffX8, MULT8) | |
495 | 500 | $Tuple2(nil, [gWxAmountStart]) | |
496 | 501 | } | |
497 | 502 | ||
498 | 503 | ||
499 | 504 | ||
500 | 505 | @Callable(i) | |
501 | 506 | func onEmissionForGwxStart () = if ((i.caller != factoryContract)) | |
502 | 507 | then throw("permissions denied") | |
503 | 508 | else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)] | |
504 | 509 | ||
505 | 510 | ||
506 | 511 | ||
507 | 512 | @Callable(i) | |
508 | 513 | func latestPeriodEmissionRewardsREADONLY (address) = { | |
509 | 514 | let period = nextPeriod() | |
510 | 515 | $Tuple2(nil, [getNumberByKey(keyAuxEmissionRewardForPeriod(period))]) | |
511 | 516 | } | |
512 | 517 | ||
513 | 518 | ||
514 | 519 | ||
515 | 520 | @Callable(i) | |
516 | 521 | func calcD (x1BigIntStr,x2BigIntStr,ampBigIntStr,aPrecisionBigIntStr,targetPrecisionBigIntStr) = { | |
517 | 522 | let nCoins = toBigInt(2) | |
518 | 523 | let aPrecision = parseBigIntValue(aPrecisionBigIntStr) | |
519 | 524 | let targetPrecision = parseBigIntValue(targetPrecisionBigIntStr) | |
520 | 525 | let x1 = parseBigIntValue(x1BigIntStr) | |
521 | 526 | let x2 = parseBigIntValue(x2BigIntStr) | |
522 | 527 | let amp = (parseBigIntValue(ampBigIntStr) * aPrecision) | |
523 | 528 | let s = (x1 + x2) | |
524 | 529 | if ((s == zeroBigInt)) | |
525 | 530 | then $Tuple2(nil, toString(zeroBigInt)) | |
526 | 531 | else { | |
527 | 532 | let ann = (amp * nCoins) | |
528 | - | let arr = [1, 2, 3, 4, 5, 6 | |
533 | + | let arr = [0, 1, 2, 3, 4, 5, 6] | |
529 | 534 | func calc (acc,cur) = { | |
530 | - | let $t02077720966 = acc | |
531 | - | let d = $t02077720966._1 | |
532 | - | let dPrev = $t02077720966._2 | |
533 | - | let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins)) | |
534 | - | let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp))) | |
535 | - | $Tuple2(dNext, d) | |
535 | + | let $t02084620873 = acc | |
536 | + | let d = $t02084620873._1 | |
537 | + | let dPrev = $t02084620873._2 | |
538 | + | let found = $t02084620873._3 | |
539 | + | if ((found != unit)) | |
540 | + | then acc | |
541 | + | else { | |
542 | + | let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins)) | |
543 | + | let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp))) | |
544 | + | let dDiff = absBigInt((dNext - value(d))) | |
545 | + | if ((targetPrecision >= dDiff)) | |
546 | + | then $Tuple3(dNext, d, cur) | |
547 | + | else $Tuple3(dNext, d, unit) | |
548 | + | } | |
536 | 549 | } | |
537 | 550 | ||
538 | - | let $ | |
551 | + | let $t02147121534 = { | |
539 | 552 | let $l = arr | |
540 | 553 | let $s = size($l) | |
541 | - | let $acc0 = $ | |
554 | + | let $acc0 = $Tuple3(s, unit, unit) | |
542 | 555 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
543 | 556 | then $a | |
544 | 557 | else calc($a, $l[$i]) | |
545 | 558 | ||
546 | 559 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
547 | 560 | then $a | |
548 | 561 | else throw("List size exceeds 7") | |
549 | 562 | ||
550 | 563 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
551 | 564 | } | |
552 | - | let dNext = $ | |
553 | - | let dPrev = $ | |
554 | - | let | |
555 | - | if (( | |
565 | + | let dNext = $t02147121534._1 | |
566 | + | let dPrev = $t02147121534._2 | |
567 | + | let found = $t02147121534._3 | |
568 | + | if ((found != unit)) | |
556 | 569 | then $Tuple2(nil, toString(dNext)) | |
557 | - | else throw(("D calculation error, dDiff = " + toString(dDiff))) | |
570 | + | else { | |
571 | + | let dDiff = absBigInt((dNext - value(dPrev))) | |
572 | + | throw(("D calculation error, dDiff = " + toString(dDiff))) | |
573 | + | } | |
558 | 574 | } | |
559 | 575 | } | |
560 | 576 | ||
561 | 577 | ||
562 | 578 | ||
563 | 579 | @Callable(i) | |
564 | 580 | func setManager (pendingManagerPublicKey) = { | |
565 | 581 | let checkCaller = mustManager(i) | |
566 | 582 | if ((checkCaller == checkCaller)) | |
567 | 583 | then { | |
568 | 584 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
569 | 585 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
570 | 586 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
571 | 587 | else throw("Strict value is not equal to itself.") | |
572 | 588 | } | |
573 | 589 | else throw("Strict value is not equal to itself.") | |
574 | 590 | } | |
575 | 591 | ||
576 | 592 | ||
577 | 593 | ||
578 | 594 | @Callable(i) | |
579 | 595 | func confirmManager () = { | |
580 | 596 | let pm = pendingManagerPublicKeyOrUnit() | |
581 | 597 | let hasPM = if (isDefined(pm)) | |
582 | 598 | then true | |
583 | 599 | else throw("No pending manager") | |
584 | 600 | if ((hasPM == hasPM)) | |
585 | 601 | then { | |
586 | 602 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
587 | 603 | then true | |
588 | 604 | else throw("You are not pending manager") | |
589 | 605 | if ((checkPM == checkPM)) | |
590 | 606 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
591 | 607 | else throw("Strict value is not equal to itself.") | |
592 | 608 | } | |
593 | 609 | else throw("Strict value is not equal to itself.") | |
594 | 610 | } | |
595 | 611 | ||
596 | 612 | ||
597 | 613 | @Verifier(tx) | |
598 | 614 | func verify () = { | |
599 | 615 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
600 | 616 | case pk: ByteVector => | |
601 | 617 | pk | |
602 | 618 | case _: Unit => | |
603 | 619 | tx.senderPublicKey | |
604 | 620 | case _ => | |
605 | 621 | throw("Match error") | |
606 | 622 | } | |
607 | 623 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
608 | 624 | } | |
609 | 625 |
github/deemru/w8io/026f985 73.16 ms ◑