tx · 958jHzAm97nACCBdSrVUWCfUuN6RBimQU8Rf2Q2Wjz3k

3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE:  -0.01800000 Waves

2023.04.24 11:38 [2548400] smart account 3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE > SELF 0.00000000 Waves

{ "type": 13, "id": "958jHzAm97nACCBdSrVUWCfUuN6RBimQU8Rf2Q2Wjz3k", "fee": 1800000, "feeAssetId": null, "timestamp": 1682325588365, "version": 2, "chainId": 84, "sender": "3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE", "senderPublicKey": "G349Uq3FTox7dRNLeAfAQeoACvwZ9iEnVSaHcEYn6j8J", "proofs": [ "4WyRW2hyPzf3Bk8r9UnPNeQVMsvQaXLuHEAeenSMuQ3fiNHhjH3ivMfiCCBKYGrv5zsqKo1Xqss26uRRctVqGQtf" ], "script": "base64:BgKPGQgCEgQKAggBEgASAwoBARIAEgASABIDCgEIEgMKAQgSAwoBCBIFCgMBAQESBQoDAQEBEgASAwoBCBIHCgUICAgICBIDCgEIEgAiA1NFUCIFU0NBTEUiBU1VTFQ4Igp6ZXJvQmlnSW50IhRwcm9jZXNzaW5nU3RhZ2VUb3RhbCIVcHJvY2Vzc2luZ1N0YWdlU2hhcmVzIg5nZXROdW1iZXJCeUtleSIDa2V5Ig9nZXROdW1iZXJPckZhaWwiDmdldFN0cmluZ0J5S2V5Ig9nZXRTdHJpbmdPckZhaWwiA2FicyIDdmFsIglhYnNCaWdJbnQiC2tleU1heERlcHRoIg9tYXhEZXB0aERlZmF1bHQiCG1heERlcHRoIhFrZXlGYWN0b3J5QWRkcmVzcyIRZmFjdG9yeUFkZHJlc3NTdHIiD2ZhY3RvcnlDb250cmFjdCISa2V5RW1pc3Npb25BZGRyZXNzIhNrZXlOdW1Ub1VzZXJNYXBwaW5nIgNudW0iFmtleVJlZmVycmFsUHJvZ3JhbU5hbWUiGnJlZmVycmFsUHJvZ3JhbU5hbWVEZWZhdWx0IhNyZWZlc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gECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECZGEBAmRiAAQCZGMEAmFPCQECYU4AAwkAAQIFAmFPAgpCeXRlVmVjdG9yBAJhVAUCYU8FAmFUAwkAAQIFAmFPAgRVbml0CAUCZGEPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmRhCWJvZHlCeXRlcwkAkQMCCAUCZGEGcHJvb2ZzAAAFAmRj6gXGCA==", "height": 2548400, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 29mtBhKRAQh5dMH7TYqryWqcsiUQQSZiwH2q7VG5JL8L Next: 121KLAoDzyHyfc45Y69acyfxP1nJKnQE1VHsU4juyXwD Diff:
OldNewDifferences
1313
1414 let processingStageShares = 1
1515
16-let wavesString = "WAVES"
17-
1816 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
1917
2018
2523
2624
2725 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined"))
28-
29-
30-func parseAssetId (input) = if ((input == wavesString))
31- then unit
32- else fromBase58String(input)
33-
34-
35-func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ")
36-
37-
38-func throwErr (msg) = throw(wrapErr(msg))
3926
4027
4128 func abs (val) = if ((0 > val))
6350
6451 func keyEmissionAddress () = "%s%s__config__emissionAddress"
6552
66-
67-func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP)
68-
69-
70-let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract()))
7153
7254 func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP)
7355
11799 func keyConfig () = "%s__config"
118100
119101
120-func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined")))
121-
122-
123-let emissionAddress = getEmissionAddress()
124-
125-let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1]
126-
127-let wxAssetId = fromBase58String(wxAssetIdStr)
128-
129102 func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP)
130103
131104
145118
146119
147120 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
148-
149-
150-func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
151-
152-
153-func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
154121
155122
156123 func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL"
214181
215182
216183 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress()))
217-
218-func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP)
219-
220-
221-func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP)
222-
223184
224185 func HistoryEntry (type,user,amount,i) = {
225186 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
343304
344305
345306 @Callable(i)
346-func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
347- then nil
348- else {
349- let checks = [if ((i.caller == this))
350- then true
351- else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
352- then true
353- else throwErr("insufficient payment assetId")]
354- if ((checks == checks))
355- then {
356- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
357- if ((tradeRewardInternal == tradeRewardInternal))
358- then {
359- let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
360- let userAddress = addressFromStringValue(userAddresses[currentIter])
361- $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), ScriptTransfer(userAddress, rewards[currentIter], wxAssetId)], tradeRewardInternal)
362- }
363- else throw("Strict value is not equal to itself.")
364- }
365- else throw("Strict value is not equal to itself.")
366- }
367-
368-
369-
370-@Callable(i)
371307 func updateReferralActivity (userAddress,gWxAmountStart) = {
372308 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
373309 let activeReferralInv = if ((referrer == unit))
394330 then $Tuple2(nil, false)
395331 else if ((processingStage == processingStageTotal))
396332 then {
397- let $t01418114297 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
398- let userWeight = $t01418114297._1
399- let userActions = $t01418114297._2
333+ let $t01208212198 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
334+ let userWeight = $t01208212198._1
335+ let userActions = $t01208212198._2
400336 let totalWeightNew = (totalWeight + userWeight)
401337 let processingActions = if (((usersCount - 1) > currentUser))
402338 then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))]
471407
472408 @Callable(i)
473409 func deposit () = {
474- let checkCaller = if ((i.caller == votingEmissionContract))
475- then true
476- else mustManager(i)
477- if ((checkCaller == checkCaller))
478- then {
479- let period = nextPeriod()
480- let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
481- let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
482- let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0)
483- if ((gwxHoldersRewardCurrent == gwxHoldersRewardCurrent))
484- then {
485- let auxAmount = fraction((deltaH * gwxHoldersRewardCurrent), emissionRate, MULT8)
486- let em = if ((auxAmount > 0))
487- then invoke(emissionContract, "emit", [auxAmount], nil)
488- else unit
410+ let cfgArray = readConfigArrayOrFail()
411+ if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress]))))
412+ then throw("Wrong caller address")
413+ else {
414+ let assetId = value(value(i.payments[0]).assetId)
415+ if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId])))
416+ then throw("Wrong payment asset")
417+ else {
418+ let period = nextPeriod()
419+ let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
420+ let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
421+ let weight = valueOrErrorMessage(getInteger(factoryContract, keyPoolWeightVirtual()), (("mandatory factory_contract." + keyPoolWeightVirtual()) + " is not defined"))
422+ let auxAmount = fraction((deltaH * weight), emissionRate, MULT8)
423+ let em = invoke(emissionContract, "emit", [auxAmount], nil)
489424 if ((em == em))
490425 then {
491- let matcherPart = 0
426+ let matcherPart = value(i.payments[0]).amount
492427 let payoutInfo = PeriodPayoutInfo(period, matcherPart, auxAmount)
493- let gwxHoldersRewardUpdated = {
494- let @ = invoke(emissionContract, "gwxHoldersRewardUpdate", nil, nil)
495- if ($isInstanceOf(@, "Boolean"))
496- then @
497- else throw(($getType(@) + " couldn't be cast to Boolean"))
498- }
499- if ((gwxHoldersRewardUpdated == gwxHoldersRewardUpdated))
500- then {
501- let totalReward = (matcherPart + auxAmount)
502- let actions = if (if ((totalReward == 0))
503- then !(gwxHoldersRewardUpdated)
504- else false)
505- then nil
506- 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)]
507- $Tuple2(actions, unit)
508- }
509- else throw("Strict value is not equal to itself.")
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)]
510429 }
511430 else throw("Strict value is not equal to itself.")
512431 }
513- else throw("Strict value is not equal to itself.")
514432 }
515- else throw("Strict value is not equal to itself.")
516433 }
517434
518435
521438 func claimReward () = {
522439 let cfgArray = readConfigArrayOrFail()
523440 let address = toString(i.caller)
524- let $t01948619536 = commonClaimReward(address)
525- let amount = $t01948619536._1
526- let actions = $t01948619536._2
441+ let $t01754017590 = commonClaimReward(address)
442+ let amount = $t01754017590._1
443+ let actions = $t01754017590._2
527444 let checkAmount = if ((amount > 0))
528445 then true
529446 else throw("Nothing to claim")
546463
547464 @Callable(i)
548465 func claimRewardREADONLY (address) = {
549- let $t02010920159 = commonClaimReward(address)
550- let amount = $t02010920159._1
551- let actions = $t02010920159._2
466+ let $t01816318213 = commonClaimReward(address)
467+ let amount = $t01816318213._1
468+ let actions = $t01816318213._2
552469 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
553470 let totalAmount = (amount + referralUnclaimed)
554471 $Tuple2(nil, totalAmount)
615532 let ann = (amp * nCoins)
616533 let arr = [0, 1, 2, 3, 4, 5, 6]
617534 func calc (acc,cur) = {
618- let $t02279222819 = acc
619- let d = $t02279222819._1
620- let dPrev = $t02279222819._2
621- let found = $t02279222819._3
535+ let $t02084620873 = acc
536+ let d = $t02084620873._1
537+ let dPrev = $t02084620873._2
538+ let found = $t02084620873._3
622539 if ((found != unit))
623540 then acc
624541 else {
631548 }
632549 }
633550
634- let $t02341723480 = {
551+ let $t02147121534 = {
635552 let $l = arr
636553 let $s = size($l)
637554 let $acc0 = $Tuple3(s, unit, unit)
645562
646563 $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)
647564 }
648- let dNext = $t02341723480._1
649- let dPrev = $t02341723480._2
650- let found = $t02341723480._3
565+ let dNext = $t02147121534._1
566+ let dPrev = $t02147121534._2
567+ let found = $t02147121534._3
651568 if ((found != unit))
652569 then $Tuple2(nil, toString(dNext))
653570 else {
655572 throw(("D calculation error, dDiff = " + toString(dDiff)))
656573 }
657574 }
658- }
659-
660-
661-
662-@Callable(i)
663-func tradeReward (userAddresses,rewards) = {
664- let argsComparison = (size(userAddresses) == size(rewards))
665- let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
666- let payment = i.payments[0]
667- let paymentAssetId = payment.assetId
668- let paymentAmount = payment.amount
669- let checks = [if ((maxRecipients >= size(userAddresses)))
670- then true
671- else throwErr("Too many recipients"), if (argsComparison)
672- then true
673- else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
674- then true
675- else throwErr("Wrong asset payment")]
676- if ((checks == checks))
677- then {
678- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
679- if ((tradeRewardInternal == tradeRewardInternal))
680- then $Tuple2(nil, tradeRewardInternal)
681- else throw("Strict value is not equal to itself.")
682- }
683- else throw("Strict value is not equal to itself.")
684575 }
685576
686577
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let SCALE = 1000
77
88 let MULT8 = 100000000
99
1010 let zeroBigInt = toBigInt(0)
1111
1212 let processingStageTotal = 0
1313
1414 let processingStageShares = 1
1515
16-let wavesString = "WAVES"
17-
1816 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
1917
2018
2119 func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("mandatory this." + key) + " is not defined"))
2220
2321
2422 func getStringByKey (key) = valueOrElse(getString(this, key), "")
2523
2624
2725 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined"))
28-
29-
30-func parseAssetId (input) = if ((input == wavesString))
31- then unit
32- else fromBase58String(input)
33-
34-
35-func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ")
36-
37-
38-func throwErr (msg) = throw(wrapErr(msg))
3926
4027
4128 func abs (val) = if ((0 > val))
4229 then -(val)
4330 else val
4431
4532
4633 func absBigInt (val) = if ((zeroBigInt > val))
4734 then -(val)
4835 else val
4936
5037
5138 let keyMaxDepth = "%s__maxDepth"
5239
5340 let maxDepthDefault = 30
5441
5542 let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault)
5643
5744 func keyFactoryAddress () = "%s%s__config__factoryAddress"
5845
5946
6047 let factoryAddressStr = getStringOrFail(keyFactoryAddress())
6148
6249 let factoryContract = addressFromStringValue(factoryAddressStr)
6350
6451 func keyEmissionAddress () = "%s%s__config__emissionAddress"
6552
66-
67-func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP)
68-
69-
70-let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract()))
7153
7254 func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP)
7355
7456
7557 let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP)
7658
7759 let referralProgramNameDefault = "wxlock"
7860
7961 let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault)
8062
8163 let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP)
8264
8365 let referralMinGWxAmountDefault = (500 * MULT8)
8466
8567 let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault)
8668
8769 let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP)
8870
8971 let referrerRewardPermilleDefault = 50
9072
9173 let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault)
9274
9375 let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP)
9476
9577 let referralRewardPermilleDefault = 50
9678
9779 let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault)
9880
9981 func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP)
10082
10183
10284 func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP)
10385
10486
10587 let emissionAddressStr = getStringOrFail(keyEmissionAddress())
10688
10789 let emissionContract = addressFromStringValue(emissionAddressStr)
10890
10991 let IdxCfgAssetId = 1
11092
11193 let IdxCfgPacemakerAddress = 2
11294
11395 let IdxCfgBoostingContract = 3
11496
11597 let IdxCfgMaxDepth = 4
11698
11799 func keyConfig () = "%s__config"
118100
119101
120-func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined")))
121-
122-
123-let emissionAddress = getEmissionAddress()
124-
125-let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1]
126-
127-let wxAssetId = fromBase58String(wxAssetIdStr)
128-
129102 func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP)
130103
131104
132105 func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP)
133106
134107
135108 func boostingContractOrFail () = {
136109 let cfgArray = readConfigArrayOrFail()
137110 valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined")
138111 }
139112
140113
141114 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
142115
143116
144117 func keyUsersCount () = "%s__nextUserNum"
145118
146119
147120 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
148-
149-
150-func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
151-
152-
153-func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
154121
155122
156123 func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL"
157124
158125
159126 func keyNextProcessedUser () = "%s__nextProcessedUser"
160127
161128
162129 func keyLatestPeriod () = "%s__latestPeriod"
163130
164131
165132 func keyNextPeriod () = "%s__nextPeriod"
166133
167134
168135 func keyProcessingStage () = "%s__processingStage"
169136
170137
171138 func keyNextProcessedPeriod () = "%s__nextProcessedPeriod"
172139
173140
174141 func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP)
175142
176143
177144 func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d__nextClaimedPeriod", toString(userIndex)], SEP)
178145
179146
180147 func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d__lastProcessedPeriod", toString(userIndex)], SEP)
181148
182149
183150 func keyHeightForPeriod (period) = makeString(["%s%d__startHeightForPeriod", toString(period)], SEP)
184151
185152
186153 func keyAuxEmissionRewardForPeriod (period) = makeString(["%s%d__auxEmissionReward", toString(period)], SEP)
187154
188155
189156 func keyTotalAmountForPeriod (period) = makeString(["%s%d__totalAmountForPeriod", toString(period)], SEP)
190157
191158
192159 func keyLastPayoutInfo () = "%s__lastPayoutInfo"
193160
194161
195162 func PeriodPayoutInfo (period,matcherReward,emissionReward) = makeString(["%d%d%d", toString(period), toString(matcherReward), toString(emissionReward)], SEP)
196163
197164
198165 func keyPayoutHistoryInfo (period) = makeString(["%s%s%d__payouts__history", toString(period)], SEP)
199166
200167
201168 func keyTotalWeightForPeriod (period) = makeString(["%s%d__totalWeightForPeriod", toString(period)], SEP)
202169
203170
204171 func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "k", toString(period)], SEP)
205172
206173
207174 func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "b", toString(period)], SEP)
208175
209176
210177 func keyUserWeightForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "weight", toString(period)], SEP)
211178
212179
213180 func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP)
214181
215182
216183 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress()))
217-
218-func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP)
219-
220-
221-func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP)
222-
223184
224185 func HistoryEntry (type,user,amount,i) = {
225186 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
226187 let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP)
227188 StringEntry(historyKEY, historyDATA)
228189 }
229190
230191
231192 func keyManagerPublicKey () = "%s__managerPublicKey"
232193
233194
234195 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
235196
236197
237198 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
238199 case s: String =>
239200 fromBase58String(s)
240201 case _: Unit =>
241202 unit
242203 case _ =>
243204 throw("Match error")
244205 }
245206
246207
247208 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
248209 case s: String =>
249210 fromBase58String(s)
250211 case _: Unit =>
251212 unit
252213 case _ =>
253214 throw("Match error")
254215 }
255216
256217
257218 func mustManager (i) = {
258219 let pd = throw("Permission denied")
259220 match managerPublicKeyOrUnit() {
260221 case pk: ByteVector =>
261222 if ((i.callerPublicKey == pk))
262223 then true
263224 else pd
264225 case _: Unit =>
265226 if ((i.caller == this))
266227 then true
267228 else pd
268229 case _ =>
269230 throw("Match error")
270231 }
271232 }
272233
273234
274235 func calcUserWeight (boostingContractAddress,heightForPeriod,period,userIndex) = {
275236 let kLast = keyLastProcessedPeriodOfUser(userIndex)
276237 let kKey = keyUserKValueForPeriod(period, userIndex)
277238 let kRaw = getInteger(boostingContractAddress, kKey)
278239 let kUserWeight = keyUserWeightForPeriod(period, userIndex)
279240 if (isDefined(kRaw))
280241 then {
281242 let k = value(kRaw)
282243 let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(period, userIndex)))
283244 let w = ((k * heightForPeriod) + b)
284245 if ((w > 0))
285246 then $Tuple2((w / SCALE), [IntegerEntry(kLast, period), IntegerEntry(kUserWeight, w)])
286247 else $Tuple2(0, nil)
287248 }
288249 else {
289250 let p = getInteger(this, kLast)
290251 if (if (isDefined(p))
291252 then (period >= value(p))
292253 else false)
293254 then {
294255 let pv = value(p)
295256 let k = value(getInteger(boostingContractAddress, keyUserKValueForPeriod(pv, userIndex)))
296257 let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(pv, userIndex)))
297258 let w = ((k * heightForPeriod) + b)
298259 if ((w > 0))
299260 then $Tuple2((w / SCALE), [IntegerEntry(kUserWeight, w)])
300261 else $Tuple2(0, nil)
301262 }
302263 else $Tuple2(0, nil)
303264 }
304265 }
305266
306267
307268 func calcUserWeightForClaim (boostingContractAddress,heightForPeriod,period,userIndex) = {
308269 let kUserWeight = keyUserWeightForPeriod(period, userIndex)
309270 let userWeightOrUnit = getInteger(kUserWeight)
310271 match userWeightOrUnit {
311272 case _: Unit =>
312273 0
313274 case w: Int =>
314275 (w / SCALE)
315276 case _ =>
316277 throw("Match error")
317278 }
318279 }
319280
320281
321282 func getUserIndexByAddress (boostingContractAddressStr,userAddress) = {
322283 let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP)
323284 parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key)))
324285 }
325286
326287
327288 func nextPeriod () = getNumberByKey(keyNextPeriod())
328289
329290
330291 func commonClaimReward (userAddress) = {
331292 let cfgArray = readConfigArrayOrFail()
332293 let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress)
333294 let userUnclaimedOption = getInteger(keyUserUnclaimed(userIdx))
334295 match userUnclaimedOption {
335296 case _: Unit =>
336297 $Tuple2(0, nil)
337298 case u: Int =>
338299 $Tuple2(u, [IntegerEntry(keyUserUnclaimed(userIdx), 0)])
339300 case _ =>
340301 throw("Match error")
341302 }
342303 }
343304
344305
345306 @Callable(i)
346-func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
347- then nil
348- else {
349- let checks = [if ((i.caller == this))
350- then true
351- else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
352- then true
353- else throwErr("insufficient payment assetId")]
354- if ((checks == checks))
355- then {
356- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
357- if ((tradeRewardInternal == tradeRewardInternal))
358- then {
359- let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
360- let userAddress = addressFromStringValue(userAddresses[currentIter])
361- $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), ScriptTransfer(userAddress, rewards[currentIter], wxAssetId)], tradeRewardInternal)
362- }
363- else throw("Strict value is not equal to itself.")
364- }
365- else throw("Strict value is not equal to itself.")
366- }
367-
368-
369-
370-@Callable(i)
371307 func updateReferralActivity (userAddress,gWxAmountStart) = {
372308 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
373309 let activeReferralInv = if ((referrer == unit))
374310 then unit
375311 else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
376312 if ((activeReferralInv == activeReferralInv))
377313 then $Tuple2(nil, unit)
378314 else throw("Strict value is not equal to itself.")
379315 }
380316
381317
382318
383319 @Callable(i)
384320 func finalizeHelper () = {
385321 let processingStage = valueOrElse(getInteger(keyProcessingStage()), processingStageTotal)
386322 let currentPeriod = getNumberByKey(keyNextProcessedPeriod())
387323 let currentUser = getNumberByKey(keyNextProcessedUser())
388324 let latestPeriod = getNumberByKey(keyLatestPeriod())
389325 let usersCount = valueOrElse(getInteger(boostingContractOrFail(), keyUsersCount()), 0)
390326 let totalWeightKey = keyTotalWeightForPeriod(currentPeriod)
391327 let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod))
392328 let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod))
393329 if ((currentPeriod > latestPeriod))
394330 then $Tuple2(nil, false)
395331 else if ((processingStage == processingStageTotal))
396332 then {
397- let $t01418114297 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
398- let userWeight = $t01418114297._1
399- let userActions = $t01418114297._2
333+ let $t01208212198 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
334+ let userWeight = $t01208212198._1
335+ let userActions = $t01208212198._2
400336 let totalWeightNew = (totalWeight + userWeight)
401337 let processingActions = if (((usersCount - 1) > currentUser))
402338 then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))]
403339 else [IntegerEntry(keyProcessingStage(), processingStageShares), IntegerEntry(keyNextProcessedUser(), 0)]
404340 $Tuple2((([IntegerEntry(totalWeightKey, totalWeightNew)] ++ processingActions) ++ userActions), true)
405341 }
406342 else if ((processingStage == processingStageShares))
407343 then {
408344 let userWeight = calcUserWeightForClaim(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
409345 let userAmountMatcherForPeriod = fraction(getNumberByKey(keyTotalAmountForPeriod(currentPeriod)), userWeight, totalWeight)
410346 let userAmountEmissionForPeriod = fraction(getNumberByKey(keyAuxEmissionRewardForPeriod(currentPeriod)), userWeight, totalWeight)
411347 let userTotalAmount = (userAmountEmissionForPeriod + userAmountMatcherForPeriod)
412348 let userUnclaimedOption = getInteger(keyUserUnclaimed(currentUser))
413349 let userAddress = getStringValue(boostingContractOrFail(), keyNumToUserMapping(currentUser))
414350 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
415351 let activeReferralInv = if ((referrer == unit))
416352 then unit
417353 else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userWeight >= referralMinGWxAmount)], nil)
418354 if ((activeReferralInv == activeReferralInv))
419355 then {
420356 let referralInv = if (if ((referrer == unit))
421357 then true
422358 else (referralMinGWxAmount > userWeight))
423359 then unit
424360 else {
425361 let referrerReward = fraction(userTotalAmount, referrerRewardPermille, SCALE)
426362 let referralReward = fraction(userTotalAmount, referralRewardPermille, SCALE)
427363 invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
428364 }
429365 if ((referralInv == referralInv))
430366 then {
431367 let unclaimedActions = [IntegerEntry(keyUserUnclaimed(currentUser), (valueOrElse(userUnclaimedOption, 0) + userTotalAmount))]
432368 let processingActions = if (((usersCount - 1) > currentUser))
433369 then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))]
434370 else [IntegerEntry(keyNextProcessedPeriod(), (currentPeriod + 1)), IntegerEntry(keyNextProcessedUser(), 0), DeleteEntry(keyProcessingStage())]
435371 $Tuple2((unclaimedActions ++ processingActions), true)
436372 }
437373 else throw("Strict value is not equal to itself.")
438374 }
439375 else throw("Strict value is not equal to itself.")
440376 }
441377 else throw("invalid processing stage")
442378 }
443379
444380
445381
446382 @Callable(i)
447383 func finalizeWrapper (counter) = {
448384 let result = {
449385 let @ = invoke(this, "finalizeHelper", nil, nil)
450386 if ($isInstanceOf(@, "Boolean"))
451387 then @
452388 else throw(($getType(@) + " couldn't be cast to Boolean"))
453389 }
454390 if ((result == result))
455391 then if (!(result))
456392 then if ((counter == maxDepth))
457393 then throw("Nothing to process")
458394 else $Tuple2(nil, unit)
459395 else if ((counter > 0))
460396 then $Tuple2(nil, invoke(this, "finalizeWrapper", [(counter - 1)], nil))
461397 else $Tuple2(nil, unit)
462398 else throw("Strict value is not equal to itself.")
463399 }
464400
465401
466402
467403 @Callable(i)
468404 func processPendingPeriodsAndUsers () = $Tuple2(nil, invoke(this, "finalizeWrapper", [maxDepth], nil))
469405
470406
471407
472408 @Callable(i)
473409 func deposit () = {
474- let checkCaller = if ((i.caller == votingEmissionContract))
475- then true
476- else mustManager(i)
477- if ((checkCaller == checkCaller))
478- then {
479- let period = nextPeriod()
480- let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
481- let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
482- let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0)
483- if ((gwxHoldersRewardCurrent == gwxHoldersRewardCurrent))
484- then {
485- let auxAmount = fraction((deltaH * gwxHoldersRewardCurrent), emissionRate, MULT8)
486- let em = if ((auxAmount > 0))
487- then invoke(emissionContract, "emit", [auxAmount], nil)
488- else unit
410+ let cfgArray = readConfigArrayOrFail()
411+ if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress]))))
412+ then throw("Wrong caller address")
413+ else {
414+ let assetId = value(value(i.payments[0]).assetId)
415+ if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId])))
416+ then throw("Wrong payment asset")
417+ else {
418+ let period = nextPeriod()
419+ let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
420+ let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
421+ let weight = valueOrErrorMessage(getInteger(factoryContract, keyPoolWeightVirtual()), (("mandatory factory_contract." + keyPoolWeightVirtual()) + " is not defined"))
422+ let auxAmount = fraction((deltaH * weight), emissionRate, MULT8)
423+ let em = invoke(emissionContract, "emit", [auxAmount], nil)
489424 if ((em == em))
490425 then {
491- let matcherPart = 0
426+ let matcherPart = value(i.payments[0]).amount
492427 let payoutInfo = PeriodPayoutInfo(period, matcherPart, auxAmount)
493- let gwxHoldersRewardUpdated = {
494- let @ = invoke(emissionContract, "gwxHoldersRewardUpdate", nil, nil)
495- if ($isInstanceOf(@, "Boolean"))
496- then @
497- else throw(($getType(@) + " couldn't be cast to Boolean"))
498- }
499- if ((gwxHoldersRewardUpdated == gwxHoldersRewardUpdated))
500- then {
501- let totalReward = (matcherPart + auxAmount)
502- let actions = if (if ((totalReward == 0))
503- then !(gwxHoldersRewardUpdated)
504- else false)
505- then nil
506- 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)]
507- $Tuple2(actions, unit)
508- }
509- else throw("Strict value is not equal to itself.")
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)]
510429 }
511430 else throw("Strict value is not equal to itself.")
512431 }
513- else throw("Strict value is not equal to itself.")
514432 }
515- else throw("Strict value is not equal to itself.")
516433 }
517434
518435
519436
520437 @Callable(i)
521438 func claimReward () = {
522439 let cfgArray = readConfigArrayOrFail()
523440 let address = toString(i.caller)
524- let $t01948619536 = commonClaimReward(address)
525- let amount = $t01948619536._1
526- let actions = $t01948619536._2
441+ let $t01754017590 = commonClaimReward(address)
442+ let amount = $t01754017590._1
443+ let actions = $t01754017590._2
527444 let checkAmount = if ((amount > 0))
528445 then true
529446 else throw("Nothing to claim")
530447 if ((checkAmount == checkAmount))
531448 then {
532449 let amountFromEmission = 0
533450 let claimedReferral = {
534451 let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil)
535452 if ($isInstanceOf(@, "Int"))
536453 then @
537454 else throw(($getType(@) + " couldn't be cast to Int"))
538455 }
539456 let totalAmount = (amount + claimedReferral)
540457 $Tuple2(([ScriptTransfer(i.caller, totalAmount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", address, amount, i)] ++ actions), [totalAmount, amountFromEmission])
541458 }
542459 else throw("Strict value is not equal to itself.")
543460 }
544461
545462
546463
547464 @Callable(i)
548465 func claimRewardREADONLY (address) = {
549- let $t02010920159 = commonClaimReward(address)
550- let amount = $t02010920159._1
551- let actions = $t02010920159._2
466+ let $t01816318213 = commonClaimReward(address)
467+ let amount = $t01816318213._1
468+ let actions = $t01816318213._2
552469 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
553470 let totalAmount = (amount + referralUnclaimed)
554471 $Tuple2(nil, totalAmount)
555472 }
556473
557474
558475
559476 @Callable(i)
560477 func latestFinalizedPeriodREADONLY (address) = $Tuple2(nil, valueOrElse(getInteger(this, keyLatestPeriod()), -1))
561478
562479
563480
564481 @Callable(i)
565482 func latestFinalizedPeriodInfoREADONLY (address) = $Tuple2(nil, getStringByKey(keyLastPayoutInfo()))
566483
567484
568485
569486 @Callable(i)
570487 func calcGwxParamsREADONLY (gwxAmountStart,lockStartHeight,lockDurationBlocks) = {
571488 let lockEndHeight = (lockStartHeight + lockDurationBlocks)
572489 let scale8ParamK = -(fraction(gwxAmountStart, SCALE, lockDurationBlocks))
573490 let scale8ParamB = (fraction(gwxAmountStart, SCALE, lockDurationBlocks) * lockEndHeight)
574491 $Tuple2(nil, [scale8ParamK, scale8ParamB, nextPeriod()])
575492 }
576493
577494
578495
579496 @Callable(i)
580497 func calcGwxAmountStartREADONLY (wxLockAmount,lockDuration,maxLockDuration) = {
581498 let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration)
582499 let gWxAmountStart = fraction(wxLockAmount, coeffX8, MULT8)
583500 $Tuple2(nil, [gWxAmountStart])
584501 }
585502
586503
587504
588505 @Callable(i)
589506 func onEmissionForGwxStart () = if ((i.caller != factoryContract))
590507 then throw("permissions denied")
591508 else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
592509
593510
594511
595512 @Callable(i)
596513 func latestPeriodEmissionRewardsREADONLY (address) = {
597514 let period = nextPeriod()
598515 $Tuple2(nil, [getNumberByKey(keyAuxEmissionRewardForPeriod(period))])
599516 }
600517
601518
602519
603520 @Callable(i)
604521 func calcD (x1BigIntStr,x2BigIntStr,ampBigIntStr,aPrecisionBigIntStr,targetPrecisionBigIntStr) = {
605522 let nCoins = toBigInt(2)
606523 let aPrecision = parseBigIntValue(aPrecisionBigIntStr)
607524 let targetPrecision = parseBigIntValue(targetPrecisionBigIntStr)
608525 let x1 = parseBigIntValue(x1BigIntStr)
609526 let x2 = parseBigIntValue(x2BigIntStr)
610527 let amp = (parseBigIntValue(ampBigIntStr) * aPrecision)
611528 let s = (x1 + x2)
612529 if ((s == zeroBigInt))
613530 then $Tuple2(nil, toString(zeroBigInt))
614531 else {
615532 let ann = (amp * nCoins)
616533 let arr = [0, 1, 2, 3, 4, 5, 6]
617534 func calc (acc,cur) = {
618- let $t02279222819 = acc
619- let d = $t02279222819._1
620- let dPrev = $t02279222819._2
621- let found = $t02279222819._3
535+ let $t02084620873 = acc
536+ let d = $t02084620873._1
537+ let dPrev = $t02084620873._2
538+ let found = $t02084620873._3
622539 if ((found != unit))
623540 then acc
624541 else {
625542 let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins))
626543 let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp)))
627544 let dDiff = absBigInt((dNext - value(d)))
628545 if ((targetPrecision >= dDiff))
629546 then $Tuple3(dNext, d, cur)
630547 else $Tuple3(dNext, d, unit)
631548 }
632549 }
633550
634- let $t02341723480 = {
551+ let $t02147121534 = {
635552 let $l = arr
636553 let $s = size($l)
637554 let $acc0 = $Tuple3(s, unit, unit)
638555 func $f0_1 ($a,$i) = if (($i >= $s))
639556 then $a
640557 else calc($a, $l[$i])
641558
642559 func $f0_2 ($a,$i) = if (($i >= $s))
643560 then $a
644561 else throw("List size exceeds 7")
645562
646563 $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)
647564 }
648- let dNext = $t02341723480._1
649- let dPrev = $t02341723480._2
650- let found = $t02341723480._3
565+ let dNext = $t02147121534._1
566+ let dPrev = $t02147121534._2
567+ let found = $t02147121534._3
651568 if ((found != unit))
652569 then $Tuple2(nil, toString(dNext))
653570 else {
654571 let dDiff = absBigInt((dNext - value(dPrev)))
655572 throw(("D calculation error, dDiff = " + toString(dDiff)))
656573 }
657574 }
658- }
659-
660-
661-
662-@Callable(i)
663-func tradeReward (userAddresses,rewards) = {
664- let argsComparison = (size(userAddresses) == size(rewards))
665- let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
666- let payment = i.payments[0]
667- let paymentAssetId = payment.assetId
668- let paymentAmount = payment.amount
669- let checks = [if ((maxRecipients >= size(userAddresses)))
670- then true
671- else throwErr("Too many recipients"), if (argsComparison)
672- then true
673- else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
674- then true
675- else throwErr("Wrong asset payment")]
676- if ((checks == checks))
677- then {
678- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
679- if ((tradeRewardInternal == tradeRewardInternal))
680- then $Tuple2(nil, tradeRewardInternal)
681- else throw("Strict value is not equal to itself.")
682- }
683- else throw("Strict value is not equal to itself.")
684575 }
685576
686577
687578
688579 @Callable(i)
689580 func setManager (pendingManagerPublicKey) = {
690581 let checkCaller = mustManager(i)
691582 if ((checkCaller == checkCaller))
692583 then {
693584 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
694585 if ((checkManagerPublicKey == checkManagerPublicKey))
695586 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
696587 else throw("Strict value is not equal to itself.")
697588 }
698589 else throw("Strict value is not equal to itself.")
699590 }
700591
701592
702593
703594 @Callable(i)
704595 func confirmManager () = {
705596 let pm = pendingManagerPublicKeyOrUnit()
706597 let hasPM = if (isDefined(pm))
707598 then true
708599 else throw("No pending manager")
709600 if ((hasPM == hasPM))
710601 then {
711602 let checkPM = if ((i.callerPublicKey == value(pm)))
712603 then true
713604 else throw("You are not pending manager")
714605 if ((checkPM == checkPM))
715606 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
716607 else throw("Strict value is not equal to itself.")
717608 }
718609 else throw("Strict value is not equal to itself.")
719610 }
720611
721612
722613 @Verifier(tx)
723614 func verify () = {
724615 let targetPublicKey = match managerPublicKeyOrUnit() {
725616 case pk: ByteVector =>
726617 pk
727618 case _: Unit =>
728619 tx.senderPublicKey
729620 case _ =>
730621 throw("Match error")
731622 }
732623 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
733624 }
734625

github/deemru/w8io/026f985 
89.57 ms