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