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