tx · HwsjgXbVdVHiWR2zTWfQBixHfvVJPYv8TF2Ma28nBz7S 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA: -0.01300000 Waves 2023.05.19 10:44 [2584548] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves
{ "type": 13, "id": "HwsjgXbVdVHiWR2zTWfQBixHfvVJPYv8TF2Ma28nBz7S", "fee": 1300000, "feeAssetId": null, "timestamp": 1684482333274, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "3GhN9HAscZ2dMhbs48S2KFpgXekyR2AGXxUHZmXKaQ2pizTpP7ioarZdQVw1aPkLPefgQ1UWGShEEyFRHp4dEf8k" ], "script": "base64:BgKPDggCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAEgMKAQESAwoBASIDU0VQIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIg9nZXRTdHJpbmdPckZhaWwiB2FkZHJlc3MiA2tleSIRa2V5RmFjdG9yeUFkZHJlc3MiGWtleVZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiImtleVZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiFGtleVVzZXJQb29sc0NvbnRyYWN0Ih1rZXlWb3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCIWdm90aW5nVmVyaWZpZWRDb250cmFjdCIfdm90aW5nRW1pc3Npb25DYW5kaWRhdGVDb250cmFjdCIRdXNlclBvb2xzQ29udHJhY3QiGnZvdGluZ0VtaXNzaW9uUmF0ZUNvbnRyYWN0IhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiFElkeEZhY3RvcnlDZmdJZG9EYXBwIhVJZHhGYWN0b3J5Q2Zn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GFuZ2VSYXRlUGVyQmxvY2tJTlRFUk5BTAkAzAgCBQJhTAUDbmlsBQNuaWwDCQAAAgUCYVAFAmFQBAJhUQkA/AcEBQJhRAIVb25Cb29zdEVtaXNzaW9uVXBkYXRlBQNuaWwFA25pbAMJAAACBQJhUQUCYVEFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECYVIBAmFTAAQCYVQEAmFnCQECYWkAAwkAAQIFAmFnAgpCeXRlVmVjdG9yBAJhbgUCYWcFAmFuAwkAAQIFAmFnAgRVbml0CAUCYVIPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmFSCWJvZHlCeXRlcwkAkQMCCAUCYVIGcHJvb2ZzAAAFAmFUFO9M6w==", "height": 2584548, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9idrWeaZjmVTjCAjpG4LDD2d6okaYVXCToR5NXtFwch3 Next: 2Kt552qWbY8Qai6uYCM9mrh16NYbVc1Ao7Qwt1sPfP94 Diff:
Old | New | Differences | |
---|---|---|---|
21 | 21 | ||
22 | 22 | let keyUserPoolsContract = "%s%s__config__userPoolsContract" | |
23 | 23 | ||
24 | + | let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract" | |
25 | + | ||
24 | 26 | let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract)) | |
25 | 27 | ||
26 | 28 | let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract)) | |
27 | 29 | ||
28 | 30 | let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract)) | |
31 | + | ||
32 | + | let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract)) | |
29 | 33 | ||
30 | 34 | let IdxFactoryCfgStakingDapp = 1 | |
31 | 35 | ||
89 | 93 | ||
90 | 94 | ||
91 | 95 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
92 | - | ||
93 | - | ||
94 | - | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
95 | 96 | ||
96 | 97 | ||
97 | 98 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
254 | 255 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
255 | 256 | ||
256 | 257 | ||
258 | + | ||
259 | + | @Callable(i) | |
260 | + | func changeRatePerBlockINTERNAL (newRatePerBlock) = { | |
261 | + | let check = if ((i.caller == this)) | |
262 | + | then true | |
263 | + | else throwErr("should be invoked internally") | |
264 | + | if ((check == check)) | |
265 | + | then { | |
266 | + | let blockTimestamp = match blockInfoByHeight(height) { | |
267 | + | case bi: BlockInfo => | |
268 | + | bi.timestamp | |
269 | + | case _ => | |
270 | + | throwErr("BlockInfo.timestamp error") | |
271 | + | } | |
272 | + | [IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)] | |
273 | + | } | |
274 | + | else throw("Strict value is not equal to itself.") | |
275 | + | } | |
276 | + | ||
277 | + | ||
278 | + | ||
279 | + | @Callable(i) | |
280 | + | func changeRatePerBlock (newRatePerBlock) = { | |
281 | + | let check = if ((i.caller == votingEmissionRateContract)) | |
282 | + | then true | |
283 | + | else mustManager(i) | |
284 | + | if ((check == check)) | |
285 | + | then { | |
286 | + | let factoryContract = readFactoryAddressOrFail() | |
287 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
288 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
289 | + | let changeRate = invoke(this, "changeRatePerBlockINTERNAL", [newRatePerBlock], nil) | |
290 | + | if ((changeRate == changeRate)) | |
291 | + | then { | |
292 | + | let boostinEmissionUpdate = invoke(boostingContract, "onBoostEmissionUpdate", nil, nil) | |
293 | + | if ((boostinEmissionUpdate == boostinEmissionUpdate)) | |
294 | + | then nil | |
295 | + | else throw("Strict value is not equal to itself.") | |
296 | + | } | |
297 | + | else throw("Strict value is not equal to itself.") | |
298 | + | } | |
299 | + | else throw("Strict value is not equal to itself.") | |
300 | + | } | |
301 | + | ||
302 | + | ||
257 | 303 | @Verifier(tx) | |
258 | 304 | func verify () = { | |
259 | 305 | let targetPublicKey = match managerPublicKeyOrUnit() { |
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 | func wrapErr (msg) = makeString(["emission.ride:", toString(this), msg], " ") | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func throwErr (msg) = throw(wrapErr(msg)) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | let keyVotingVerifiedContract = "%s%s__config__votingVerifiedContract" | |
19 | 19 | ||
20 | 20 | let keyVotingEmissionCandidateContract = "%s%s__config__votingEmissionCandidateContract" | |
21 | 21 | ||
22 | 22 | let keyUserPoolsContract = "%s%s__config__userPoolsContract" | |
23 | 23 | ||
24 | + | let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract" | |
25 | + | ||
24 | 26 | let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract)) | |
25 | 27 | ||
26 | 28 | let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract)) | |
27 | 29 | ||
28 | 30 | let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract)) | |
31 | + | ||
32 | + | let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract)) | |
29 | 33 | ||
30 | 34 | let IdxFactoryCfgStakingDapp = 1 | |
31 | 35 | ||
32 | 36 | let IdxFactoryCfgBoostingDapp = 2 | |
33 | 37 | ||
34 | 38 | let IdxFactoryCfgIdoDapp = 3 | |
35 | 39 | ||
36 | 40 | let IdxFactoryCfgTeamDapp = 4 | |
37 | 41 | ||
38 | 42 | let IdxFactoryCfgEmissionDapp = 5 | |
39 | 43 | ||
40 | 44 | let IdxFactoryCfgRestDapp = 6 | |
41 | 45 | ||
42 | 46 | let IdxFactoryCfgSlippageDapp = 7 | |
43 | 47 | ||
44 | 48 | let IdxFactoryCfgGwxRewardDapp = 10 | |
45 | 49 | ||
46 | 50 | func keyFactoryCfg () = "%s__factoryConfig" | |
47 | 51 | ||
48 | 52 | ||
49 | 53 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
50 | 54 | ||
51 | 55 | ||
52 | 56 | func keyFactoryLpList () = "%s__lpTokensList" | |
53 | 57 | ||
54 | 58 | ||
55 | 59 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
56 | 60 | ||
57 | 61 | ||
58 | 62 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
59 | 63 | ||
60 | 64 | ||
61 | 65 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
62 | 66 | ||
63 | 67 | ||
64 | 68 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
65 | 69 | ||
66 | 70 | ||
67 | 71 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
68 | 72 | ||
69 | 73 | ||
70 | 74 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
71 | 75 | ||
72 | 76 | ||
73 | 77 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
74 | 78 | ||
75 | 79 | ||
76 | 80 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
77 | 81 | ||
78 | 82 | ||
79 | 83 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
80 | 84 | ||
81 | 85 | ||
82 | 86 | func keyConfig () = "%s__config" | |
83 | 87 | ||
84 | 88 | ||
85 | 89 | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
86 | 90 | ||
87 | 91 | ||
88 | 92 | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
89 | 93 | ||
90 | 94 | ||
91 | 95 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
92 | - | ||
93 | - | ||
94 | - | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
95 | 96 | ||
96 | 97 | ||
97 | 98 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
98 | 99 | ||
99 | 100 | ||
100 | 101 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
101 | 102 | ||
102 | 103 | ||
103 | 104 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
104 | 105 | ||
105 | 106 | ||
106 | 107 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
107 | 108 | ||
108 | 109 | ||
109 | 110 | func keyBoostCoeff () = "%s__boostCoeff" | |
110 | 111 | ||
111 | 112 | ||
112 | 113 | let boostCoeffDefault = 3 | |
113 | 114 | ||
114 | 115 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
115 | 116 | ||
116 | 117 | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
117 | 118 | ||
118 | 119 | ||
119 | 120 | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
120 | 121 | ||
121 | 122 | ||
122 | 123 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
123 | 124 | ||
124 | 125 | ||
125 | 126 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
126 | 127 | ||
127 | 128 | ||
128 | 129 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
129 | 130 | case s: String => | |
130 | 131 | addressFromStringValue(s) | |
131 | 132 | case _ => | |
132 | 133 | this | |
133 | 134 | } | |
134 | 135 | ||
135 | 136 | ||
136 | 137 | func managerPublicKeyOrUnit () = { | |
137 | 138 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
138 | 139 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
139 | 140 | case s: String => | |
140 | 141 | fromBase58String(s) | |
141 | 142 | case _: Unit => | |
142 | 143 | unit | |
143 | 144 | case _ => | |
144 | 145 | throw("Match error") | |
145 | 146 | } | |
146 | 147 | } | |
147 | 148 | ||
148 | 149 | ||
149 | 150 | func mustManager (i) = { | |
150 | 151 | let pd = throwErr("Permission denied") | |
151 | 152 | match managerPublicKeyOrUnit() { | |
152 | 153 | case pk: ByteVector => | |
153 | 154 | if ((i.callerPublicKey == pk)) | |
154 | 155 | then true | |
155 | 156 | else pd | |
156 | 157 | case _: Unit => | |
157 | 158 | if ((i.caller == this)) | |
158 | 159 | then true | |
159 | 160 | else pd | |
160 | 161 | case _ => | |
161 | 162 | throw("Match error") | |
162 | 163 | } | |
163 | 164 | } | |
164 | 165 | ||
165 | 166 | ||
166 | 167 | @Callable(i) | |
167 | 168 | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
168 | 169 | let checkCaller = mustManager(i) | |
169 | 170 | if ((checkCaller == checkCaller)) | |
170 | 171 | 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))] | |
171 | 172 | else throw("Strict value is not equal to itself.") | |
172 | 173 | } | |
173 | 174 | ||
174 | 175 | ||
175 | 176 | ||
176 | 177 | @Callable(i) | |
177 | 178 | func constructorV2 (votingVerifiedContractPrm) = { | |
178 | 179 | let checkCaller = mustManager(i) | |
179 | 180 | if ((checkCaller == checkCaller)) | |
180 | 181 | then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit) | |
181 | 182 | else throw("Strict value is not equal to itself.") | |
182 | 183 | } | |
183 | 184 | ||
184 | 185 | ||
185 | 186 | ||
186 | 187 | @Callable(i) | |
187 | 188 | func emit (amount) = if ((0 >= amount)) | |
188 | 189 | then $Tuple2(nil, nil) | |
189 | 190 | else { | |
190 | 191 | let factoryContract = readFactoryAddressOrFail() | |
191 | 192 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
192 | 193 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
193 | 194 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
194 | 195 | let caller = i.caller | |
195 | 196 | if (if ((caller != stakingContract)) | |
196 | 197 | then (caller != gwxRewardsContract) | |
197 | 198 | else false) | |
198 | 199 | then throwErr("permissions denied") | |
199 | 200 | else { | |
200 | 201 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
201 | 202 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
202 | 203 | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
203 | 204 | } | |
204 | 205 | } | |
205 | 206 | ||
206 | 207 | ||
207 | 208 | ||
208 | 209 | @Callable(i) | |
209 | 210 | func burn () = { | |
210 | 211 | let factoryContract = readFactoryAddressOrFail() | |
211 | 212 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
212 | 213 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
213 | 214 | if ((size(i.payments) != 1)) | |
214 | 215 | then throwErr("exact one payment is allowed") | |
215 | 216 | else { | |
216 | 217 | let pmt = i.payments[0] | |
217 | 218 | let assetId = value(pmt.assetId) | |
218 | 219 | let pmtAmount = pmt.amount | |
219 | 220 | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
220 | 221 | if ((assetId != wxAssetId)) | |
221 | 222 | then throwErr("invalid wxAssetId is passed") | |
222 | 223 | else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller))) | |
223 | 224 | then throwErr("permissions denied") | |
224 | 225 | 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))] | |
225 | 226 | } | |
226 | 227 | } | |
227 | 228 | ||
228 | 229 | ||
229 | 230 | ||
230 | 231 | @Callable(i) | |
231 | 232 | func gwxHoldersRewardUpdate () = { | |
232 | 233 | let factoryContract = readFactoryAddressOrFail() | |
233 | 234 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
234 | 235 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
235 | 236 | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
236 | 237 | then true | |
237 | 238 | else mustManager(i) | |
238 | 239 | if ((checkCaller == checkCaller)) | |
239 | 240 | then { | |
240 | 241 | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
241 | 242 | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
242 | 243 | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
243 | 244 | let actions = if (shouldBeUpdated) | |
244 | 245 | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
245 | 246 | else nil | |
246 | 247 | $Tuple2(actions, shouldBeUpdated) | |
247 | 248 | } | |
248 | 249 | else throw("Strict value is not equal to itself.") | |
249 | 250 | } | |
250 | 251 | ||
251 | 252 | ||
252 | 253 | ||
253 | 254 | @Callable(i) | |
254 | 255 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
255 | 256 | ||
256 | 257 | ||
258 | + | ||
259 | + | @Callable(i) | |
260 | + | func changeRatePerBlockINTERNAL (newRatePerBlock) = { | |
261 | + | let check = if ((i.caller == this)) | |
262 | + | then true | |
263 | + | else throwErr("should be invoked internally") | |
264 | + | if ((check == check)) | |
265 | + | then { | |
266 | + | let blockTimestamp = match blockInfoByHeight(height) { | |
267 | + | case bi: BlockInfo => | |
268 | + | bi.timestamp | |
269 | + | case _ => | |
270 | + | throwErr("BlockInfo.timestamp error") | |
271 | + | } | |
272 | + | [IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)] | |
273 | + | } | |
274 | + | else throw("Strict value is not equal to itself.") | |
275 | + | } | |
276 | + | ||
277 | + | ||
278 | + | ||
279 | + | @Callable(i) | |
280 | + | func changeRatePerBlock (newRatePerBlock) = { | |
281 | + | let check = if ((i.caller == votingEmissionRateContract)) | |
282 | + | then true | |
283 | + | else mustManager(i) | |
284 | + | if ((check == check)) | |
285 | + | then { | |
286 | + | let factoryContract = readFactoryAddressOrFail() | |
287 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
288 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
289 | + | let changeRate = invoke(this, "changeRatePerBlockINTERNAL", [newRatePerBlock], nil) | |
290 | + | if ((changeRate == changeRate)) | |
291 | + | then { | |
292 | + | let boostinEmissionUpdate = invoke(boostingContract, "onBoostEmissionUpdate", nil, nil) | |
293 | + | if ((boostinEmissionUpdate == boostinEmissionUpdate)) | |
294 | + | then nil | |
295 | + | else throw("Strict value is not equal to itself.") | |
296 | + | } | |
297 | + | else throw("Strict value is not equal to itself.") | |
298 | + | } | |
299 | + | else throw("Strict value is not equal to itself.") | |
300 | + | } | |
301 | + | ||
302 | + | ||
257 | 303 | @Verifier(tx) | |
258 | 304 | func verify () = { | |
259 | 305 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
260 | 306 | case pk: ByteVector => | |
261 | 307 | pk | |
262 | 308 | case _: Unit => | |
263 | 309 | tx.senderPublicKey | |
264 | 310 | case _ => | |
265 | 311 | throw("Match error") | |
266 | 312 | } | |
267 | 313 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
268 | 314 | } | |
269 | 315 |
github/deemru/w8io/026f985 38.88 ms ◑