tx · EwHC1EYU26NM6VxgFWpth1z8V8NeZNYVe6AsoeQKpk7P 3MuqubsQAq9mrsN65SePHeThcN3JVAbgZ9d: -0.01500000 Waves 2023.08.17 16:34 [2714660] smart account 3MuqubsQAq9mrsN65SePHeThcN3JVAbgZ9d > SELF 0.00000000 Waves
{ "type": 13, "id": "EwHC1EYU26NM6VxgFWpth1z8V8NeZNYVe6AsoeQKpk7P", "fee": 1500000, "feeAssetId": null, "timestamp": 1692279290938, "version": 2, "chainId": 84, "sender": "3MuqubsQAq9mrsN65SePHeThcN3JVAbgZ9d", "senderPublicKey": "GWTozVWP9MvUxrEuz1BPrNAbtLYAec9LrT4U82jWG6KX", "proofs": [ "v2BUkuw76WyoSL8WwJuauvFnshoiCuSTy52EZVwE314ckmYnWgoVcZG9p4bWbbda7TNCZNLBedYsmE3sNH3Z3VF" ], "script": "base64:BgIhCAISCAoGCAgIAQEBEgASAwoBARIAEgMKAQESABIDCgEIIQAJc2VwYXJhdG9yAgJfXwAQY29udHJhY3RGaWxlbmFtZQIZdm90aW5nX2VtaXNzaW9uX3JhdGUucmlkZQATREVGQVVMVF9FUE9DSF9DT1VOVAAEAA5rZXlFcG9jaExlbmd0aAkAuQkCCQDMCAICAiVzCQDMCAICC2Vwb2NoTGVuZ3RoBQNuaWwFCXNlcGFyYXRvcgATa2V5RW1pc3Npb25Db250cmFjdAkAuQkCCQDMCAICAiVzCQDMCAICEGVtaXNzaW9uQ29udHJhY3QFA25pbAUJc2VwYXJhdG9yABlrZXlWb3RpbmdFbWlzc2lvbkNvbnRyYWN0CQC5CQIJAMwIAgICJXMJAMwIAgIWdm90aW5nRW1pc3Npb25Db250cmFjdAUDbmlsBQlzZXBhcmF0b3IAE2tleUJvb3N0aW5nQ29udHJhY3QJALkJAgkAzAgCAgIlcwkAzAgCAhBib29zdGluZ0NvbnRyYWN0BQNuaWwFCXNlcGFyYXRvcgAMa2V5VGhyZXNob2xkCQC5CQIJAMwIAgICJXMJAMwIAgIPdm90aW5n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VW5pdAADCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCcGsFByRtYXRjaDAFAnBrAwkAAQIFByRtYXRjaDACBFVuaXQIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUPdGFyZ2V0UHVibGljS2V59dAdIQ==", "height": 2714660, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ExZC2eVXxqQFAGtvkHsd1w49UzxSP6osqz2P9gzcZDts Next: GKcAEz3Wz8vwFPapJeDaNXfXagbe15CydL3V3bBPqNvx Diff:
Old | New | Differences | |
---|---|---|---|
319 | 319 | } | |
320 | 320 | ||
321 | 321 | ||
322 | + | ||
323 | + | @Callable(i) | |
324 | + | func getLockedGwxAmount (userAddressStr) = { | |
325 | + | let startHeight = getIntegerValue(keyStartHeight) | |
326 | + | let gwxAmount = match getString(this, keyVote(userAddressStr, startHeight)) { | |
327 | + | case _: Unit => | |
328 | + | 0 | |
329 | + | case s: String => | |
330 | + | valueOrElse(parseInt(split(s, separator)[1]), 0) | |
331 | + | case _ => | |
332 | + | throw("Match error") | |
333 | + | } | |
334 | + | $Tuple2(nil, gwxAmount) | |
335 | + | } | |
336 | + | ||
337 | + | ||
322 | 338 | @Verifier(tx) | |
323 | 339 | func verify () = { | |
324 | 340 | 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 separator = "__" | |
5 | 5 | ||
6 | 6 | let contractFilename = "voting_emission_rate.ride" | |
7 | 7 | ||
8 | 8 | let DEFAULT_EPOCH_COUNT = 4 | |
9 | 9 | ||
10 | 10 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
11 | 11 | ||
12 | 12 | let keyEmissionContract = makeString(["%s", "emissionContract"], separator) | |
13 | 13 | ||
14 | 14 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], separator) | |
15 | 15 | ||
16 | 16 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
17 | 17 | ||
18 | 18 | let keyThreshold = makeString(["%s", "votingThreshold"], separator) | |
19 | 19 | ||
20 | 20 | let keyRatePerBlock = makeString(["%s%s", "ratePerBlock", "current"], separator) | |
21 | 21 | ||
22 | 22 | let keyRatePerBlockMax = makeString(["%s%s", "ratePerBlockMax", "current"], separator) | |
23 | 23 | ||
24 | 24 | let keyRateChangeStep = makeString(["%s", "rateChangeStep"], separator) | |
25 | 25 | ||
26 | 26 | let keyStartHeight = makeString(["%s", "startHeight"], separator) | |
27 | 27 | ||
28 | 28 | let keyVotingResult = makeString(["%s", "votingResult"], separator) | |
29 | 29 | ||
30 | 30 | let keyVotingEmissionEpochCount = makeString(["%s", "votingEmissionEpochCount"], separator) | |
31 | 31 | ||
32 | 32 | func throwErr (s) = throw(((contractFilename + ": ") + s)) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (key + " is not defined")) | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func totalVotes (totalIncrease,totalCurrent,totalDecrease) = makeString(["%d%d%d", totalIncrease, totalCurrent, totalDecrease], separator) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func keyVote (voterAddress,startHeight) = makeString(["%s%s%d", "vote", voterAddress, toString(startHeight)], separator) | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyVoteValue (gwxAmount,vote) = { | |
48 | 48 | let key = if ((vote == 1)) | |
49 | 49 | then makeString(["%d%s", gwxAmount, "increase"], separator) | |
50 | 50 | else if ((vote == -1)) | |
51 | 51 | then makeString(["%d%s", gwxAmount, "decrease"], separator) | |
52 | 52 | else makeString(["%d%s", gwxAmount, "current"], separator) | |
53 | 53 | key | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract)) | |
58 | 58 | ||
59 | 59 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract)) | |
60 | 60 | ||
61 | 61 | let votingEmissionContract = addressFromStringValue(getStringOrFail(keyVotingEmissionContract)) | |
62 | 62 | ||
63 | 63 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
70 | 70 | case s: String => | |
71 | 71 | addressFromStringValue(s) | |
72 | 72 | case _ => | |
73 | 73 | this | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func managerPublicKeyOrUnit () = { | |
78 | 78 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
79 | 79 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
80 | 80 | case s: String => | |
81 | 81 | fromBase58String(s) | |
82 | 82 | case _: Unit => | |
83 | 83 | unit | |
84 | 84 | case _ => | |
85 | 85 | throw("Match error") | |
86 | 86 | } | |
87 | 87 | } | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func isManager (i) = match managerPublicKeyOrUnit() { | |
91 | 91 | case pk: ByteVector => | |
92 | 92 | (i.callerPublicKey == pk) | |
93 | 93 | case _: Unit => | |
94 | 94 | (i.caller == this) | |
95 | 95 | case _ => | |
96 | 96 | throw("Match error") | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func mustManager (i) = if (isManager(i)) | |
101 | 101 | then true | |
102 | 102 | else throwErr("permission denied") | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func asInt (val) = match val { | |
106 | 106 | case valInt: Int => | |
107 | 107 | valInt | |
108 | 108 | case _ => | |
109 | 109 | throwErr("failed to cast into Integer") | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func calcNewRate (ratePerBlockMax,ratePerBlock,changeStep) = { | |
114 | 114 | let maxAllowed = fraction(100, ratePerBlockMax, 120) | |
115 | 115 | let increasedRate = min([fraction((100 + changeStep), ratePerBlock, 100), maxAllowed]) | |
116 | 116 | let decreasedRate = max([fraction((100 - changeStep), ratePerBlock, 100), 0]) | |
117 | 117 | $Tuple3(increasedRate, ratePerBlock, decreasedRate) | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func getRateChangeAmountsINTERNAL () = { | |
122 | 122 | let ratePerBlockMax = getIntegerValue(emissionContract, keyRatePerBlockMax) | |
123 | 123 | let ratePerBlock = getIntegerValue(emissionContract, keyRatePerBlock) | |
124 | 124 | let rateChangeStep = getIntegerValue(this, keyRateChangeStep) | |
125 | 125 | calcNewRate(ratePerBlockMax, ratePerBlock, rateChangeStep) | |
126 | 126 | } | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func getEpochLength (votingEmissionContract) = { | |
130 | 130 | let votingEpochLength = getIntegerValue(votingEmissionContract, keyEpochLength) | |
131 | 131 | let votingStartLength = getIntegerValue(votingEmissionContract, keyStartHeight) | |
132 | 132 | let votingEmissionEpochCount = valueOrElse(getInteger(this, keyVotingEmissionEpochCount), DEFAULT_EPOCH_COUNT) | |
133 | 133 | (((votingStartLength + (votingEpochLength * votingEmissionEpochCount)) - height) - 1) | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | @Callable(i) | |
138 | 138 | func constructor (boostingContractPrm,emissionContractPrm,votingEmissionContractPrm,threshold,rateChangeStep,votingEmissionEpochCount) = { | |
139 | 139 | let checks = [mustManager(i), if (isDefined(addressFromString(boostingContractPrm))) | |
140 | 140 | then true | |
141 | 141 | else throwErr("Invalid boosting contract address"), if (isDefined(addressFromString(emissionContractPrm))) | |
142 | 142 | then true | |
143 | 143 | else throwErr("Invalid emission contract address"), if (isDefined(addressFromString(votingEmissionContractPrm))) | |
144 | 144 | then true | |
145 | 145 | else throwErr("Invalid emission contract address"), if ((threshold > 0)) | |
146 | 146 | then true | |
147 | 147 | else throwErr("invalid threshold"), if ((rateChangeStep > 0)) | |
148 | 148 | then true | |
149 | 149 | else throwErr("invalid rateChangeStep"), if ((votingEmissionEpochCount > 0)) | |
150 | 150 | then true | |
151 | 151 | else throwErr("invalid votingEmissionEpochCount")] | |
152 | 152 | if ((checks == checks)) | |
153 | 153 | then { | |
154 | 154 | let votingEmission = addressFromStringValue(votingEmissionContractPrm) | |
155 | 155 | $Tuple2([StringEntry(keyBoostingContract, boostingContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), StringEntry(keyVotingEmissionContract, votingEmissionContractPrm), IntegerEntry(keyEpochLength, getEpochLength(votingEmission)), IntegerEntry(keyThreshold, threshold), IntegerEntry(keyRateChangeStep, rateChangeStep), IntegerEntry(keyVotingEmissionEpochCount, votingEmissionEpochCount), IntegerEntry(keyStartHeight, height), StringEntry(keyVotingResult, totalVotes("0", "0", "0"))], unit) | |
156 | 156 | } | |
157 | 157 | else throw("Strict value is not equal to itself.") | |
158 | 158 | } | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | ||
162 | 162 | @Callable(i) | |
163 | 163 | func getRateChangeAmountsREADONLY () = $Tuple2(nil, getRateChangeAmountsINTERNAL()) | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | @Callable(i) | |
168 | 168 | func vote (inFavor) = { | |
169 | 169 | let startHeight = getIntegerValue(keyStartHeight) | |
170 | 170 | let votingFinishHeight = (startHeight + getIntegerValue(keyEpochLength)) | |
171 | 171 | let userAddress = toString(i.caller) | |
172 | 172 | let checks = [if ((votingFinishHeight > height)) | |
173 | 173 | then true | |
174 | 174 | else throwErr("too late to vote"), if (containsElement([1, 0, -1], inFavor)) | |
175 | 175 | then true | |
176 | 176 | else throwErr("not valid argument"), if (!(isDefined(getString(keyVote(userAddress, startHeight))))) | |
177 | 177 | then true | |
178 | 178 | else throwErr("you already voted")] | |
179 | 179 | if ((checks == checks)) | |
180 | 180 | then { | |
181 | 181 | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [userAddress, votingFinishHeight], nil) | |
182 | 182 | let notZero = if ((asInt(gwxAmount) > 0)) | |
183 | 183 | then true | |
184 | 184 | else throwErr("you don't have gwx") | |
185 | 185 | if ((notZero == notZero)) | |
186 | 186 | then { | |
187 | 187 | let votingResult = split(getStringValue(keyVotingResult), separator) | |
188 | 188 | let votesForIncrease = votingResult[1] | |
189 | 189 | let votesForCurrent = votingResult[2] | |
190 | 190 | let votesForDecrease = votingResult[3] | |
191 | 191 | let newPositiveAndNegativeVotes = if ((inFavor == 1)) | |
192 | 192 | then { | |
193 | 193 | let newIncreaseVotes = (parseIntValue(votesForIncrease) + asInt(gwxAmount)) | |
194 | 194 | [toString(newIncreaseVotes), votesForCurrent, votesForDecrease] | |
195 | 195 | } | |
196 | 196 | else if ((inFavor == -1)) | |
197 | 197 | then { | |
198 | 198 | let newDecreaseVotes = (parseIntValue(votesForDecrease) + asInt(gwxAmount)) | |
199 | 199 | [votesForIncrease, votesForCurrent, toString(newDecreaseVotes)] | |
200 | 200 | } | |
201 | 201 | else { | |
202 | 202 | let newCurrentVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
203 | 203 | [votesForIncrease, toString(newCurrentVotes), votesForDecrease] | |
204 | 204 | } | |
205 | 205 | let voteKey = keyVote(toString(i.caller), startHeight) | |
206 | 206 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
207 | 207 | $Tuple2([StringEntry(keyVotingResult, totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1], newPositiveAndNegativeVotes[2])), StringEntry(voteKey, voteValue)], unit) | |
208 | 208 | } | |
209 | 209 | else throw("Strict value is not equal to itself.") | |
210 | 210 | } | |
211 | 211 | else throw("Strict value is not equal to itself.") | |
212 | 212 | } | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | ||
216 | 216 | @Callable(i) | |
217 | 217 | func cancelVote () = { | |
218 | 218 | let startHeight = getIntegerValue(keyStartHeight) | |
219 | 219 | let votingFinishHeight = (startHeight + getIntegerValue(keyEpochLength)) | |
220 | 220 | let userAddress = if ((i.caller == this)) | |
221 | 221 | then toString(i.originCaller) | |
222 | 222 | else toString(i.caller) | |
223 | 223 | let checks = [if ((votingFinishHeight > height)) | |
224 | 224 | then true | |
225 | 225 | else throwErr("too late to cancel vote"), if (isDefined(getString(keyVotingResult))) | |
226 | 226 | then true | |
227 | 227 | else throwErr("no vote"), if (isDefined(getString(keyVote(userAddress, startHeight)))) | |
228 | 228 | then true | |
229 | 229 | else throwErr("no user vote")] | |
230 | 230 | if ((checks == checks)) | |
231 | 231 | then { | |
232 | 232 | let vote = split(getStringValue(keyVote(userAddress, startHeight)), separator) | |
233 | 233 | let voteValue = vote[1] | |
234 | 234 | let voteType = vote[2] | |
235 | 235 | let votingResult = split(getStringValue(keyVotingResult), separator) | |
236 | 236 | let votesForIncrease = votingResult[1] | |
237 | 237 | let votesForCurrent = votingResult[2] | |
238 | 238 | let votesForDecrease = votingResult[3] | |
239 | 239 | let actions = if ((voteType == "increase")) | |
240 | 240 | then { | |
241 | 241 | let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue)) | |
242 | 242 | [StringEntry(keyVotingResult, totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease))] | |
243 | 243 | } | |
244 | 244 | else if ((voteType == "decrease")) | |
245 | 245 | then { | |
246 | 246 | let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue)) | |
247 | 247 | [StringEntry(keyVotingResult, totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes)))] | |
248 | 248 | } | |
249 | 249 | else { | |
250 | 250 | let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue)) | |
251 | 251 | [StringEntry(keyVotingResult, totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease))] | |
252 | 252 | } | |
253 | 253 | let defaultActions = [DeleteEntry(keyVote(userAddress, startHeight))] | |
254 | 254 | (actions ++ defaultActions) | |
255 | 255 | } | |
256 | 256 | else throw("Strict value is not equal to itself.") | |
257 | 257 | } | |
258 | 258 | ||
259 | 259 | ||
260 | 260 | ||
261 | 261 | @Callable(i) | |
262 | 262 | func setThreshold (newThreshold) = { | |
263 | 263 | let checks = [mustManager(i), if ((newThreshold > 0)) | |
264 | 264 | then true | |
265 | 265 | else throwErr("invalid threshold")] | |
266 | 266 | if ((checks == checks)) | |
267 | 267 | then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit) | |
268 | 268 | else throw("Strict value is not equal to itself.") | |
269 | 269 | } | |
270 | 270 | ||
271 | 271 | ||
272 | 272 | ||
273 | 273 | @Callable(i) | |
274 | 274 | func finalize () = { | |
275 | 275 | let check = if (if ((i.caller == votingEmissionContract)) | |
276 | 276 | then true | |
277 | 277 | else mustManager(i)) | |
278 | 278 | then true | |
279 | 279 | else throwErr("Permission denied") | |
280 | 280 | if ((check == check)) | |
281 | 281 | then { | |
282 | 282 | let votingFinishHeight = (getIntegerValue(keyStartHeight) + value(getInteger(keyEpochLength))) | |
283 | 283 | if ((height >= votingFinishHeight)) | |
284 | 284 | then { | |
285 | 285 | let votingResult = split(value(getString(keyVotingResult)), separator) | |
286 | 286 | let votesForIncrease = parseIntValue(votingResult[1]) | |
287 | 287 | let votesForCurrent = parseIntValue(votingResult[2]) | |
288 | 288 | let votesForDecrease = parseIntValue(votingResult[3]) | |
289 | 289 | let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease) | |
290 | 290 | let threshold = getIntOrFail(keyThreshold) | |
291 | 291 | let $t01019810278 = getRateChangeAmountsINTERNAL() | |
292 | 292 | let increasedRate = $t01019810278._1 | |
293 | 293 | let currentRate = $t01019810278._2 | |
294 | 294 | let decreasedRate = $t01019810278._3 | |
295 | 295 | let votesList = [votesForIncrease, votesForCurrent, votesForDecrease] | |
296 | 296 | let newRate = if (if ((threshold > allVotes)) | |
297 | 297 | then true | |
298 | 298 | else (votesForCurrent == max(votesList))) | |
299 | 299 | then unit | |
300 | 300 | else if ((votesForIncrease == max(votesList))) | |
301 | 301 | then increasedRate | |
302 | 302 | else decreasedRate | |
303 | 303 | let changeRateInvokes = match newRate { | |
304 | 304 | case r: Int => | |
305 | 305 | let emissionChangeRate = invoke(emissionContract, "changeRatePerBlock", [r], nil) | |
306 | 306 | if ((emissionChangeRate == emissionChangeRate)) | |
307 | 307 | then emissionChangeRate | |
308 | 308 | else throw("Strict value is not equal to itself.") | |
309 | 309 | case _ => | |
310 | 310 | unit | |
311 | 311 | } | |
312 | 312 | if ((changeRateInvokes == changeRateInvokes)) | |
313 | 313 | then [IntegerEntry(keyStartHeight, height), IntegerEntry(keyEpochLength, getEpochLength(votingEmissionContract)), StringEntry(keyVotingResult, totalVotes("0", "0", "0"))] | |
314 | 314 | else throw("Strict value is not equal to itself.") | |
315 | 315 | } | |
316 | 316 | else nil | |
317 | 317 | } | |
318 | 318 | else throw("Strict value is not equal to itself.") | |
319 | 319 | } | |
320 | 320 | ||
321 | 321 | ||
322 | + | ||
323 | + | @Callable(i) | |
324 | + | func getLockedGwxAmount (userAddressStr) = { | |
325 | + | let startHeight = getIntegerValue(keyStartHeight) | |
326 | + | let gwxAmount = match getString(this, keyVote(userAddressStr, startHeight)) { | |
327 | + | case _: Unit => | |
328 | + | 0 | |
329 | + | case s: String => | |
330 | + | valueOrElse(parseInt(split(s, separator)[1]), 0) | |
331 | + | case _ => | |
332 | + | throw("Match error") | |
333 | + | } | |
334 | + | $Tuple2(nil, gwxAmount) | |
335 | + | } | |
336 | + | ||
337 | + | ||
322 | 338 | @Verifier(tx) | |
323 | 339 | func verify () = { | |
324 | 340 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
325 | 341 | case pk: ByteVector => | |
326 | 342 | pk | |
327 | 343 | case _: Unit => | |
328 | 344 | tx.senderPublicKey | |
329 | 345 | case _ => | |
330 | 346 | throw("Match error") | |
331 | 347 | } | |
332 | 348 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
333 | 349 | } | |
334 | 350 |
github/deemru/w8io/fabc49c 38.86 ms ◑