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