tx · CBTYBsa7RBN6d8kZrKtgcqSsEcjCAjy6Zm6vxikQEo8b

3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M:  -0.01400000 Waves

2022.03.10 15:59 [1957871] smart account 3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M > SELF 0.00000000 Waves

{ "type": 13, "id": "CBTYBsa7RBN6d8kZrKtgcqSsEcjCAjy6Zm6vxikQEo8b", "fee": 1400000, "feeAssetId": null, "timestamp": 1646917219991, "version": 2, "chainId": 84, "sender": "3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M", "senderPublicKey": "FWZMxrtn6KRrWMPXmQPqDg5eRzwB2YvHhMjMJpwnLmBi", "proofs": [ "5effBCrMPkCjaHvfJyNEm33ZvAnVJGDx2uFA6KUeJhJSG2KszXfdH9e8K8CbWboTW5HUmvGbJo6TQBLNj5rmJveg" ], "script": "base64:AAIFAAAAAAAABr0IAhIJCgcIAQEBAQEIEgMKAQESABIDCgEIEgAaHQoBQRIYZ2V0RW1pc3Npb25BZGRyZXNzT3JGYWlsGhwKAUISF2dldFN0YWtpbmdBZGRyZXNzT3JGYWlsGh4KAUMSGWdldEd3eFJld2FyZEFkZHJlc3NPckZhaWwaDgoBRBIJa2V5Q29uZmlnGh4KAUUSGWtleVJhdGVQZXJCbG9ja01heEN1cnJlbnQaIAoBRhIba2V5UmF0ZVBlckJsb2NrTWF4U3RhcnRGcm9tGg4KAUcSCXRpbWVzdGFtcBoKCgFIEgVibG9jaxobCgFJEhZrZXlSYXRlUGVyQmxvY2tDdXJyZW50Gh0KAUoSGGtleVJhdGVQZXJCbG9ja1N0YXJ0RnJvbRoaCgFLEhVrZXlFbWlzc2lvblN0YXJ0QmxvY2saIAoBTBIba2V5RW1pc3Npb25EdXJhdGlvbkluQmxvY2tzGhgKAU0SE2tleUVtaXNzaW9uRW5kQmxvY2saGAoBThITa2V5TWFuYWdlclB1YmxpY0tleRofCgFPEhprZXlQZW5kaW5nTWFuY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: original | compacted Prev: GA4wjDNWTNPnP47Afay9RXsK8k8829yXpMkg67i7ob8r Next: 3agbDC377kX4quSvwhKBdkGyNhmoELSL3e5RKm5SXGcd Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let SEP = "__"
5+
6+func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined"))
7+
8+
9+func keyFactoryAddress () = "%s%s__config__factoryAddress"
10+
11+
12+let IdxFactoryCfgStakingDapp = 1
13+
14+let IdxFactoryCfgBoostingDapp = 2
15+
16+let IdxFactoryCfgIdoDapp = 3
17+
18+let IdxFactoryCfgTeamDapp = 4
19+
20+let IdxFactoryCfgEmissionDapp = 5
21+
22+let IdxFactoryCfgRestDapp = 6
23+
24+let IdxFactoryCfgSlippageDapp = 7
25+
26+let IdxFactoryCfgGwxRewardDapp = 10
27+
28+func keyFactoryCfg () = "%s__factoryConfig"
29+
30+
31+func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
32+
33+
34+func keyFactoryLpList () = "%s__lpTokensList"
35+
36+
37+func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
38+
39+
40+func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
41+
42+
43+func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
44+
45+
46+func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
47+
48+
49+func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
50+
51+
52+func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
53+
54+
55+func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
56+
57+
58+func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
59+
60+
61+func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
62+
63+
64+func keyConfig () = "%s__config"
65+
66+
67+func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
68+
69+
70+func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP)
71+
72+
73+func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
74+
75+
76+func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
77+
78+
79+func keyEmissionStartBlock () = "%s%s__emission__startBlock"
80+
81+
82+func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
83+
84+
85+func keyEmissionEndBlock () = "%s%s__emission__endBlock"
86+
87+
488 func keyManagerPublicKey () = "%s__managerPublicKey"
589
690
791 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
8-
9-
10-let separator = "__"
11-
12-func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
13-
14-
15-let keyStart = makeString(["%s", "start"], separator)
16-
17-let keyDuration = makeString(["%s", "duration"], separator)
18-
19-let keyAsset = makeString(["%s", "asset"], separator)
20-
21-let keyIsDataReady = makeString(["%s", "isDataReady"], separator)
22-
23-func keyUserRewardInfo (address) = makeString(["%s%s", "userRewardInfo", toString(address)], separator)
24-
25-
26-func keyClaimHistoryRecord (address,txId) = makeString(["%s%s%s", "claimHistoryRecord", toString(address), toBase58String(txId)], separator)
27-
28-
29-func formatHistoryRecord (amount) = makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(amount)], separator)
30-
31-
32-func dataUserRewardInfo (totalAmt,claimedAmt) = makeString(["%d%d", toString(totalAmt), toString(claimedAmt)], separator)
33-
34-
35-func readUserRewardInfo (userAddr) = split(getStringOrFail(this, keyUserRewardInfo(userAddr)), separator)
36-
37-
38-func checkIfDataIsReady () = {
39- let isDataReady = valueOrElse(getBoolean(this, keyIsDataReady), false)
40- if (isDataReady)
41- then true
42- else throw("Data is not ready")
43- }
44-
45-
46-func getUserRewards (address) = {
47- let start = valueOrErrorMessage(getInteger(this, keyStart), "Start block is not specified")
48- let duration = valueOrErrorMessage(getInteger(this, keyDuration), "Duration is not specified")
49- let userRewardInfo = readUserRewardInfo(address)
50- let total = parseIntValue(userRewardInfo[1])
51- let claimed = parseIntValue(userRewardInfo[2])
52- let availableTotal = fraction(total, min([duration, max([0, (height - start)])]), duration)
53- let available = max([0, (availableTotal - claimed)])
54- $Tuple3(total, claimed, available)
55- }
5692
5793
5894 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
93129
94130
95131 @Callable(i)
96-func constructor (start,duration,assetId) = {
132+func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
97133 let checkCaller = mustManager(i)
98134 if ((checkCaller == checkCaller))
99- then [IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), StringEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
135+ then [IntegerEntry(keyRatePerBlockMaxStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlockMax), IntegerEntry(keyRatePerBlockMaxCurrent(), ratePerBlockMax), IntegerEntry(keyRatePerBlockStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlock), IntegerEntry(keyRatePerBlockCurrent(), ratePerBlock), IntegerEntry(keyEmissionStartBlock(), emissionStartBlock), IntegerEntry(keyEmissionDurationInBlocks(), emissionDuration), IntegerEntry(keyEmissionEndBlock(), (emissionStartBlock + emissionDuration)), StringEntry(keyFactoryAddress(), factoryAddress), StringEntry(keyConfig(), ("%s__" + wxAssetIdStr))]
100136 else throw("Strict value is not equal to itself.")
101137 }
102138
103139
104140
105141 @Callable(i)
106-func claim () = {
107- let $t030183077 = getUserRewards(i.caller)
108- let total = $t030183077._1
109- let claimed = $t030183077._2
110- let available = $t030183077._3
111- let asset = fromBase58String(getStringOrFail(this, keyAsset))
112- let balance = assetBalance(this, asset)
113- let checks = [checkIfDataIsReady(), if ((available > 0))
114- then true
115- else throw("No reward available"), if ((balance >= available))
116- then true
117- else throw("Insufficient funds. Contact support")]
118- if ((checks == checks))
119- then [ScriptTransfer(i.caller, available, asset), StringEntry(keyUserRewardInfo(i.caller), dataUserRewardInfo(total, (claimed + available))), StringEntry(keyClaimHistoryRecord(i.caller, i.transactionId), formatHistoryRecord(available))]
120- else throw("Strict value is not equal to itself.")
121- }
142+func emit (amount) = if ((0 >= amount))
143+ then $Tuple2(nil, nil)
144+ else {
145+ let factoryContract = readFactoryAddressOrFail()
146+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
147+ let stakingContract = getStakingAddressOrFail(factoryCfg)
148+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
149+ let caller = i.caller
150+ if (if ((caller != stakingContract))
151+ then (caller != gwxRewardsContract)
152+ else false)
153+ then throw("permissions denied")
154+ else {
155+ let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
156+ let wxAssetId = fromBase58String(wxAssetIdStr)
157+ $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
158+ }
159+ }
122160
123161
124162
125163 @Callable(i)
126-func getUserRewardsREADONLY (address) = {
127- let checks = [checkIfDataIsReady()]
128- if ((checks == checks))
129- then {
130- let $t037563839 = getUserRewards(addressFromStringValue(address))
131- let total = $t037563839._1
132- let claimed = $t037563839._2
133- let available = $t037563839._3
134- $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator))
164+func burn () = {
165+ let factoryContract = readFactoryAddressOrFail()
166+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
167+ let boostingContract = getBoostingAddressOrFail(factoryCfg)
168+ if ((size(i.payments) != 1))
169+ then throw("exact one payment is allowed")
170+ else {
171+ let pmt = i.payments[0]
172+ let assetId = value(pmt.assetId)
173+ let pmtAmount = pmt.amount
174+ let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
175+ if ((assetId != wxAssetId))
176+ then throw("invalid wxAssetId is passed")
177+ else if ((i.caller != boostingContract))
178+ then throw("permissions denied")
179+ else [Burn(assetId, pmtAmount), StringEntry(("%s%s%s__history__burn__" + toBase58String(i.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(pmtAmount)], SEP))]
135180 }
136- else throw("Strict value is not equal to itself.")
137181 }
138182
139183
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let SEP = "__"
5+
6+func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined"))
7+
8+
9+func keyFactoryAddress () = "%s%s__config__factoryAddress"
10+
11+
12+let IdxFactoryCfgStakingDapp = 1
13+
14+let IdxFactoryCfgBoostingDapp = 2
15+
16+let IdxFactoryCfgIdoDapp = 3
17+
18+let IdxFactoryCfgTeamDapp = 4
19+
20+let IdxFactoryCfgEmissionDapp = 5
21+
22+let IdxFactoryCfgRestDapp = 6
23+
24+let IdxFactoryCfgSlippageDapp = 7
25+
26+let IdxFactoryCfgGwxRewardDapp = 10
27+
28+func keyFactoryCfg () = "%s__factoryConfig"
29+
30+
31+func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
32+
33+
34+func keyFactoryLpList () = "%s__lpTokensList"
35+
36+
37+func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
38+
39+
40+func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
41+
42+
43+func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
44+
45+
46+func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
47+
48+
49+func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
50+
51+
52+func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
53+
54+
55+func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
56+
57+
58+func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
59+
60+
61+func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
62+
63+
64+func keyConfig () = "%s__config"
65+
66+
67+func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
68+
69+
70+func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP)
71+
72+
73+func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
74+
75+
76+func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
77+
78+
79+func keyEmissionStartBlock () = "%s%s__emission__startBlock"
80+
81+
82+func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
83+
84+
85+func keyEmissionEndBlock () = "%s%s__emission__endBlock"
86+
87+
488 func keyManagerPublicKey () = "%s__managerPublicKey"
589
690
791 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
8-
9-
10-let separator = "__"
11-
12-func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
13-
14-
15-let keyStart = makeString(["%s", "start"], separator)
16-
17-let keyDuration = makeString(["%s", "duration"], separator)
18-
19-let keyAsset = makeString(["%s", "asset"], separator)
20-
21-let keyIsDataReady = makeString(["%s", "isDataReady"], separator)
22-
23-func keyUserRewardInfo (address) = makeString(["%s%s", "userRewardInfo", toString(address)], separator)
24-
25-
26-func keyClaimHistoryRecord (address,txId) = makeString(["%s%s%s", "claimHistoryRecord", toString(address), toBase58String(txId)], separator)
27-
28-
29-func formatHistoryRecord (amount) = makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(amount)], separator)
30-
31-
32-func dataUserRewardInfo (totalAmt,claimedAmt) = makeString(["%d%d", toString(totalAmt), toString(claimedAmt)], separator)
33-
34-
35-func readUserRewardInfo (userAddr) = split(getStringOrFail(this, keyUserRewardInfo(userAddr)), separator)
36-
37-
38-func checkIfDataIsReady () = {
39- let isDataReady = valueOrElse(getBoolean(this, keyIsDataReady), false)
40- if (isDataReady)
41- then true
42- else throw("Data is not ready")
43- }
44-
45-
46-func getUserRewards (address) = {
47- let start = valueOrErrorMessage(getInteger(this, keyStart), "Start block is not specified")
48- let duration = valueOrErrorMessage(getInteger(this, keyDuration), "Duration is not specified")
49- let userRewardInfo = readUserRewardInfo(address)
50- let total = parseIntValue(userRewardInfo[1])
51- let claimed = parseIntValue(userRewardInfo[2])
52- let availableTotal = fraction(total, min([duration, max([0, (height - start)])]), duration)
53- let available = max([0, (availableTotal - claimed)])
54- $Tuple3(total, claimed, available)
55- }
5692
5793
5894 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5995 case s: String =>
6096 fromBase58String(s)
6197 case _: Unit =>
6298 unit
6399 case _ =>
64100 throw("Match error")
65101 }
66102
67103
68104 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
69105 case s: String =>
70106 fromBase58String(s)
71107 case _: Unit =>
72108 unit
73109 case _ =>
74110 throw("Match error")
75111 }
76112
77113
78114 func mustManager (i) = {
79115 let pd = throw("Permission denied")
80116 match managerPublicKeyOrUnit() {
81117 case pk: ByteVector =>
82118 if ((i.callerPublicKey == pk))
83119 then true
84120 else pd
85121 case _: Unit =>
86122 if ((i.caller == this))
87123 then true
88124 else pd
89125 case _ =>
90126 throw("Match error")
91127 }
92128 }
93129
94130
95131 @Callable(i)
96-func constructor (start,duration,assetId) = {
132+func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
97133 let checkCaller = mustManager(i)
98134 if ((checkCaller == checkCaller))
99- then [IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), StringEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
135+ then [IntegerEntry(keyRatePerBlockMaxStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlockMax), IntegerEntry(keyRatePerBlockMaxCurrent(), ratePerBlockMax), IntegerEntry(keyRatePerBlockStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlock), IntegerEntry(keyRatePerBlockCurrent(), ratePerBlock), IntegerEntry(keyEmissionStartBlock(), emissionStartBlock), IntegerEntry(keyEmissionDurationInBlocks(), emissionDuration), IntegerEntry(keyEmissionEndBlock(), (emissionStartBlock + emissionDuration)), StringEntry(keyFactoryAddress(), factoryAddress), StringEntry(keyConfig(), ("%s__" + wxAssetIdStr))]
100136 else throw("Strict value is not equal to itself.")
101137 }
102138
103139
104140
105141 @Callable(i)
106-func claim () = {
107- let $t030183077 = getUserRewards(i.caller)
108- let total = $t030183077._1
109- let claimed = $t030183077._2
110- let available = $t030183077._3
111- let asset = fromBase58String(getStringOrFail(this, keyAsset))
112- let balance = assetBalance(this, asset)
113- let checks = [checkIfDataIsReady(), if ((available > 0))
114- then true
115- else throw("No reward available"), if ((balance >= available))
116- then true
117- else throw("Insufficient funds. Contact support")]
118- if ((checks == checks))
119- then [ScriptTransfer(i.caller, available, asset), StringEntry(keyUserRewardInfo(i.caller), dataUserRewardInfo(total, (claimed + available))), StringEntry(keyClaimHistoryRecord(i.caller, i.transactionId), formatHistoryRecord(available))]
120- else throw("Strict value is not equal to itself.")
121- }
142+func emit (amount) = if ((0 >= amount))
143+ then $Tuple2(nil, nil)
144+ else {
145+ let factoryContract = readFactoryAddressOrFail()
146+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
147+ let stakingContract = getStakingAddressOrFail(factoryCfg)
148+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
149+ let caller = i.caller
150+ if (if ((caller != stakingContract))
151+ then (caller != gwxRewardsContract)
152+ else false)
153+ then throw("permissions denied")
154+ else {
155+ let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
156+ let wxAssetId = fromBase58String(wxAssetIdStr)
157+ $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
158+ }
159+ }
122160
123161
124162
125163 @Callable(i)
126-func getUserRewardsREADONLY (address) = {
127- let checks = [checkIfDataIsReady()]
128- if ((checks == checks))
129- then {
130- let $t037563839 = getUserRewards(addressFromStringValue(address))
131- let total = $t037563839._1
132- let claimed = $t037563839._2
133- let available = $t037563839._3
134- $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator))
164+func burn () = {
165+ let factoryContract = readFactoryAddressOrFail()
166+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
167+ let boostingContract = getBoostingAddressOrFail(factoryCfg)
168+ if ((size(i.payments) != 1))
169+ then throw("exact one payment is allowed")
170+ else {
171+ let pmt = i.payments[0]
172+ let assetId = value(pmt.assetId)
173+ let pmtAmount = pmt.amount
174+ let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
175+ if ((assetId != wxAssetId))
176+ then throw("invalid wxAssetId is passed")
177+ else if ((i.caller != boostingContract))
178+ then throw("permissions denied")
179+ else [Burn(assetId, pmtAmount), StringEntry(("%s%s%s__history__burn__" + toBase58String(i.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(pmtAmount)], SEP))]
135180 }
136- else throw("Strict value is not equal to itself.")
137181 }
138182
139183
140184
141185 @Callable(i)
142186 func setManager (pendingManagerPublicKey) = {
143187 let checkCaller = mustManager(i)
144188 if ((checkCaller == checkCaller))
145189 then {
146190 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
147191 if ((checkManagerPublicKey == checkManagerPublicKey))
148192 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
149193 else throw("Strict value is not equal to itself.")
150194 }
151195 else throw("Strict value is not equal to itself.")
152196 }
153197
154198
155199
156200 @Callable(i)
157201 func confirmManager () = {
158202 let pm = pendingManagerPublicKeyOrUnit()
159203 let hasPM = if (isDefined(pm))
160204 then true
161205 else throw("No pending manager")
162206 if ((hasPM == hasPM))
163207 then {
164208 let checkPM = if ((i.callerPublicKey == value(pm)))
165209 then true
166210 else throw("You are not pending manager")
167211 if ((checkPM == checkPM))
168212 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
169213 else throw("Strict value is not equal to itself.")
170214 }
171215 else throw("Strict value is not equal to itself.")
172216 }
173217
174218
175219 @Verifier(tx)
176220 func verify () = {
177221 let targetPublicKey = match managerPublicKeyOrUnit() {
178222 case pk: ByteVector =>
179223 pk
180224 case _: Unit =>
181225 tx.senderPublicKey
182226 case _ =>
183227 throw("Match error")
184228 }
185229 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
186230 }
187231

github/deemru/w8io/026f985 
39.82 ms