tx · TNGSjtbGVKhaZFEee4E8MWr22wGjXm6vnBRV63HeQ8K 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA: -0.01300000 Waves 2023.06.06 12:31 [2610633] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves
{ "type": 13, "id": "TNGSjtbGVKhaZFEee4E8MWr22wGjXm6vnBRV63HeQ8K", "fee": 1300000, "feeAssetId": null, "timestamp": 1686043873913, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "2th7oszH3iqqiWR82TpqeYfouHuFQTdKZ8acmBDEAm7eJZ4AADCj96RfJYNJgDgpkbPskRtpHMBvr18LnaiXLJ2z" ], "script": "base64:BgKMDggCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAEgMKAQEiA1NFUCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIPZ2V0U3RyaW5nT3JGYWlsIgdhZGRyZXNzIgNrZXkiEWtleUZhY3RvcnlBZGRyZXNzIhlrZXlWb3RpbmdWZXJpZmllZENvbnRyYWN0IiJrZXlWb3RpbmdFbWlzc2lvbkNhbmRpZGF0ZUNvbnRyYWN0IhRrZXlVc2VyUG9vbHNDb250cmFjdCIda2V5Vm90aW5nRW1pc3Npb25SYXRlQ29udHJhY3QiFnZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiH3ZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiEXVzZXJQb29sc0NvbnRyYWN0Ihp2b3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCIYSWR4RmFjdG9yeUNmZ1N0YWtpbmdEYXBwIhlJZHhGYWN0b3J5Q2ZnQm9vc3RpbmdEYXBwIhRJZHhGYWN0b3J5Q2ZnSWRvRGFwcCIVSWR4RmFjdG9yeUNm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lcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJhUgECYVMABAJhVAQCYWgJAQJhagADCQABAgUCYWgCCkJ5dGVWZWN0b3IEAmFvBQJhaAUCYW8DCQABAgUCYWgCBFVuaXQIBQJhUg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCYVIJYm9keUJ5dGVzCQCRAwIIBQJhUgZwcm9vZnMAAAUCYVQS84Eq", "height": 2610633, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BSNgrMg4mT4g7KrnKGQHVECrtzrXftLm6K6MQqcu1VZw Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
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 | ||
91 | 95 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
92 | 96 | ||
93 | 97 | ||
98 | + | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
99 | + | ||
100 | + | ||
94 | 101 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
95 | 102 | ||
96 | 103 | ||
109 | 116 | let boostCoeffDefault = 3 | |
110 | 117 | ||
111 | 118 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
119 | + | ||
120 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
121 | + | ||
122 | + | ||
123 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
124 | + | ||
112 | 125 | ||
113 | 126 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
114 | 127 | ||
219 | 232 | ||
220 | 233 | ||
221 | 234 | @Callable(i) | |
235 | + | func gwxHoldersRewardUpdate () = { | |
236 | + | let factoryContract = readFactoryAddressOrFail() | |
237 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
238 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
239 | + | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
240 | + | then true | |
241 | + | else mustManager(i) | |
242 | + | if ((checkCaller == checkCaller)) | |
243 | + | then { | |
244 | + | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
245 | + | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
246 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
247 | + | let actions = if (shouldBeUpdated) | |
248 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
249 | + | else nil | |
250 | + | $Tuple2(actions, shouldBeUpdated) | |
251 | + | } | |
252 | + | else throw("Strict value is not equal to itself.") | |
253 | + | } | |
254 | + | ||
255 | + | ||
256 | + | ||
257 | + | @Callable(i) | |
222 | 258 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
259 | + | ||
260 | + | ||
261 | + | ||
262 | + | @Callable(i) | |
263 | + | func changeRatePerBlock (newRatePerBlock) = { | |
264 | + | let check = if (if ((i.caller == votingEmissionRateContract)) | |
265 | + | then true | |
266 | + | else mustManager(i)) | |
267 | + | then true | |
268 | + | else throwErr("should be invoked by votingEmissionRateContract") | |
269 | + | if ((check == check)) | |
270 | + | then { | |
271 | + | let factoryContract = readFactoryAddressOrFail() | |
272 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
273 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
274 | + | let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil) | |
275 | + | if ((boostingInvoke == boostingInvoke)) | |
276 | + | then { | |
277 | + | let blockTimestamp = match blockInfoByHeight(height) { | |
278 | + | case bi: BlockInfo => | |
279 | + | bi.timestamp | |
280 | + | case _ => | |
281 | + | throwErr("BlockInfo.timestamp error") | |
282 | + | } | |
283 | + | [IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)] | |
284 | + | } | |
285 | + | else throw("Strict value is not equal to itself.") | |
286 | + | } | |
287 | + | else throw("Strict value is not equal to itself.") | |
288 | + | } | |
223 | 289 | ||
224 | 290 | ||
225 | 291 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
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 | 96 | ||
93 | 97 | ||
98 | + | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
99 | + | ||
100 | + | ||
94 | 101 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
95 | 102 | ||
96 | 103 | ||
97 | 104 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
98 | 105 | ||
99 | 106 | ||
100 | 107 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
101 | 108 | ||
102 | 109 | ||
103 | 110 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
104 | 111 | ||
105 | 112 | ||
106 | 113 | func keyBoostCoeff () = "%s__boostCoeff" | |
107 | 114 | ||
108 | 115 | ||
109 | 116 | let boostCoeffDefault = 3 | |
110 | 117 | ||
111 | 118 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
119 | + | ||
120 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
121 | + | ||
122 | + | ||
123 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
124 | + | ||
112 | 125 | ||
113 | 126 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
114 | 127 | ||
115 | 128 | ||
116 | 129 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
117 | 130 | ||
118 | 131 | ||
119 | 132 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
120 | 133 | case s: String => | |
121 | 134 | addressFromStringValue(s) | |
122 | 135 | case _ => | |
123 | 136 | this | |
124 | 137 | } | |
125 | 138 | ||
126 | 139 | ||
127 | 140 | func managerPublicKeyOrUnit () = { | |
128 | 141 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
129 | 142 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
130 | 143 | case s: String => | |
131 | 144 | fromBase58String(s) | |
132 | 145 | case _: Unit => | |
133 | 146 | unit | |
134 | 147 | case _ => | |
135 | 148 | throw("Match error") | |
136 | 149 | } | |
137 | 150 | } | |
138 | 151 | ||
139 | 152 | ||
140 | 153 | func mustManager (i) = { | |
141 | 154 | let pd = throwErr("Permission denied") | |
142 | 155 | match managerPublicKeyOrUnit() { | |
143 | 156 | case pk: ByteVector => | |
144 | 157 | if ((i.callerPublicKey == pk)) | |
145 | 158 | then true | |
146 | 159 | else pd | |
147 | 160 | case _: Unit => | |
148 | 161 | if ((i.caller == this)) | |
149 | 162 | then true | |
150 | 163 | else pd | |
151 | 164 | case _ => | |
152 | 165 | throw("Match error") | |
153 | 166 | } | |
154 | 167 | } | |
155 | 168 | ||
156 | 169 | ||
157 | 170 | @Callable(i) | |
158 | 171 | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
159 | 172 | let checkCaller = mustManager(i) | |
160 | 173 | if ((checkCaller == checkCaller)) | |
161 | 174 | 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))] | |
162 | 175 | else throw("Strict value is not equal to itself.") | |
163 | 176 | } | |
164 | 177 | ||
165 | 178 | ||
166 | 179 | ||
167 | 180 | @Callable(i) | |
168 | 181 | func constructorV2 (votingVerifiedContractPrm) = { | |
169 | 182 | let checkCaller = mustManager(i) | |
170 | 183 | if ((checkCaller == checkCaller)) | |
171 | 184 | then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit) | |
172 | 185 | else throw("Strict value is not equal to itself.") | |
173 | 186 | } | |
174 | 187 | ||
175 | 188 | ||
176 | 189 | ||
177 | 190 | @Callable(i) | |
178 | 191 | func emit (amount) = if ((0 >= amount)) | |
179 | 192 | then $Tuple2(nil, nil) | |
180 | 193 | else { | |
181 | 194 | let factoryContract = readFactoryAddressOrFail() | |
182 | 195 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
183 | 196 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
184 | 197 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
185 | 198 | let caller = i.caller | |
186 | 199 | if (if ((caller != stakingContract)) | |
187 | 200 | then (caller != gwxRewardsContract) | |
188 | 201 | else false) | |
189 | 202 | then throwErr("permissions denied") | |
190 | 203 | else { | |
191 | 204 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
192 | 205 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
193 | 206 | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
194 | 207 | } | |
195 | 208 | } | |
196 | 209 | ||
197 | 210 | ||
198 | 211 | ||
199 | 212 | @Callable(i) | |
200 | 213 | func burn () = { | |
201 | 214 | let factoryContract = readFactoryAddressOrFail() | |
202 | 215 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
203 | 216 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
204 | 217 | if ((size(i.payments) != 1)) | |
205 | 218 | then throwErr("exact one payment is allowed") | |
206 | 219 | else { | |
207 | 220 | let pmt = i.payments[0] | |
208 | 221 | let assetId = value(pmt.assetId) | |
209 | 222 | let pmtAmount = pmt.amount | |
210 | 223 | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
211 | 224 | if ((assetId != wxAssetId)) | |
212 | 225 | then throwErr("invalid wxAssetId is passed") | |
213 | 226 | else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller))) | |
214 | 227 | then throwErr("permissions denied") | |
215 | 228 | 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))] | |
216 | 229 | } | |
217 | 230 | } | |
218 | 231 | ||
219 | 232 | ||
220 | 233 | ||
221 | 234 | @Callable(i) | |
235 | + | func gwxHoldersRewardUpdate () = { | |
236 | + | let factoryContract = readFactoryAddressOrFail() | |
237 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
238 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
239 | + | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
240 | + | then true | |
241 | + | else mustManager(i) | |
242 | + | if ((checkCaller == checkCaller)) | |
243 | + | then { | |
244 | + | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
245 | + | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
246 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
247 | + | let actions = if (shouldBeUpdated) | |
248 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
249 | + | else nil | |
250 | + | $Tuple2(actions, shouldBeUpdated) | |
251 | + | } | |
252 | + | else throw("Strict value is not equal to itself.") | |
253 | + | } | |
254 | + | ||
255 | + | ||
256 | + | ||
257 | + | @Callable(i) | |
222 | 258 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
259 | + | ||
260 | + | ||
261 | + | ||
262 | + | @Callable(i) | |
263 | + | func changeRatePerBlock (newRatePerBlock) = { | |
264 | + | let check = if (if ((i.caller == votingEmissionRateContract)) | |
265 | + | then true | |
266 | + | else mustManager(i)) | |
267 | + | then true | |
268 | + | else throwErr("should be invoked by votingEmissionRateContract") | |
269 | + | if ((check == check)) | |
270 | + | then { | |
271 | + | let factoryContract = readFactoryAddressOrFail() | |
272 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
273 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
274 | + | let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil) | |
275 | + | if ((boostingInvoke == boostingInvoke)) | |
276 | + | then { | |
277 | + | let blockTimestamp = match blockInfoByHeight(height) { | |
278 | + | case bi: BlockInfo => | |
279 | + | bi.timestamp | |
280 | + | case _ => | |
281 | + | throwErr("BlockInfo.timestamp error") | |
282 | + | } | |
283 | + | [IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)] | |
284 | + | } | |
285 | + | else throw("Strict value is not equal to itself.") | |
286 | + | } | |
287 | + | else throw("Strict value is not equal to itself.") | |
288 | + | } | |
223 | 289 | ||
224 | 290 | ||
225 | 291 | @Verifier(tx) | |
226 | 292 | func verify () = { | |
227 | 293 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
228 | 294 | case pk: ByteVector => | |
229 | 295 | pk | |
230 | 296 | case _: Unit => | |
231 | 297 | tx.senderPublicKey | |
232 | 298 | case _ => | |
233 | 299 | throw("Match error") | |
234 | 300 | } | |
235 | 301 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
236 | 302 | } | |
237 | 303 |
github/deemru/w8io/026f985 44.75 ms ◑