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