tx · FEzvvvkhm6XxPJQLEH2u3REURnSBt6rd6JRKNbLXRnWi

3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA:  -0.01400000 Waves

2023.05.31 10:59 [2601879] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves

{ "type": 13, "id": "FEzvvvkhm6XxPJQLEH2u3REURnSBt6rd6JRKNbLXRnWi", "fee": 1400000, "feeAssetId": null, "timestamp": 1685519951241, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "4kDLfueWUYmkZK7GwEzAfPwyFHdLvEZtsusC9MvifTdUHmbC1LJMd955BDuTYCTdDiQCge6c9PM1KMUix13vMQMJ" ], "script": "base64:BgLgCwgCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAEgMKAQESAwoBASIDU0VQIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIg9nZXRTdHJpbmdPckZhaWwiB2FkZHJlc3MiA2tleSIRa2V5RmFjdG9yeUFkZHJlc3MiGWtleVZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiImtleVZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiFGtleVVzZXJQb29sc0NvbnRyYWN0Ih1rZXlWb3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCIWdm90aW5nVmVyaWZpZWRDb250cmFjdCIfdm90aW5nRW1pc3Npb25DYW5kaWRhdGVDb250cmFjdCIRdXNlclBvb2xzQ29udHJhY3QiGnZvdGluZ0VtaXNzaW9uUmF0ZUNvbnRyYWN0IhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiGklkeEZhY3RvcnlDZmdHd3hSZXdhcmREYXBwIg1rZXlGYWN0b3J5Q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sbGVyBQFwBgkBAVgBBQFZBgkBAWQBAi9zaG91bGQgYmUgaW52b2tlZCBieSB2b3RpbmdFbWlzc2lvblJhdGVDb250cmFjdAMJAAACBQJhegUCYXoEAmFsCQEBdQAEAXkJAQF2AQUCYWwEAmFxCQEBeAEFAXkEAmFDCQD9BwQFAmFxAhVvbkJvb3N0RW1pc3Npb25VcGRhdGUFA25pbAUDbmlsAwkAAAIFAmFDBQJhQwQCYUQJAPwHBAUEdGhpcwIaY2hhbmdlUmF0ZVBlckJsb2NrSU5URVJOQUwJAMwIAgUCYXkFA25pbAUDbmlsAwkAAAIFAmFEBQJhRAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJhRQECYUYABAJhRwQBVAkBAVYAAwkAAQIFAVQCCkJ5dGVWZWN0b3IEAmFhBQFUBQJhYQMJAAECBQFUAgRVbml0CAUCYUUPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmFFCWJvZHlCeXRlcwkAkQMCCAUCYUUGcHJvb2ZzAAAFAmFHqnIf+g==", "height": 2601879, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 86V7ovYsNMTAbaA99dhcFUvhMdSrbAGPcYJrXYTf1wpY Next: 2PN4HQmJLtq1kKcwvUud8MjAVQjns96pqt8fgewNrQrW Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
2121
2222 let keyUserPoolsContract = "%s%s__config__userPoolsContract"
2323
24+let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract"
25+
2426 let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract))
2527
2628 let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract))
2729
2830 let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract))
2931
32+let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract))
33+
3034 let IdxFactoryCfgStakingDapp = 1
3135
3236 let IdxFactoryCfgBoostingDapp = 2
33-
34-let IdxFactoryCfgIdoDapp = 3
35-
36-let IdxFactoryCfgTeamDapp = 4
37-
38-let IdxFactoryCfgEmissionDapp = 5
39-
40-let IdxFactoryCfgRestDapp = 6
41-
42-let IdxFactoryCfgSlippageDapp = 7
4337
4438 let IdxFactoryCfgGwxRewardDapp = 10
4539
4640 func keyFactoryCfg () = "%s__factoryConfig"
4741
4842
49-func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
50-
51-
52-func keyFactoryLpList () = "%s__lpTokensList"
53-
54-
55-func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
56-
57-
58-func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
59-
60-
6143 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
62-
63-
64-func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
6544
6645
6746 func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
6847
6948
7049 func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
71-
72-
73-func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
7450
7551
7652 func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
10985 let boostCoeffDefault = 3
11086
11187 let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault)
88+
89+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
90+
91+
92+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
93+
11294
11395 func keyManagerPublicKey () = "%s__managerPublicKey"
11496
219201
220202
221203 @Callable(i)
204+func gwxHoldersRewardUpdate () = {
205+ let factoryContract = readFactoryAddressOrFail()
206+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
207+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
208+ let checkCaller = if ((i.caller == gwxRewardsContract))
209+ then true
210+ else mustManager(i)
211+ if ((checkCaller == checkCaller))
212+ then {
213+ let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0)
214+ let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent)
215+ let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext)
216+ let actions = if (shouldBeUpdated)
217+ then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())]
218+ else nil
219+ $Tuple2(actions, shouldBeUpdated)
220+ }
221+ else throw("Strict value is not equal to itself.")
222+ }
223+
224+
225+
226+@Callable(i)
222227 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
228+
229+
230+
231+@Callable(i)
232+func changeRatePerBlockINTERNAL (newRatePerBlock) = {
233+ let check = if ((i.caller == this))
234+ then true
235+ else throwErr("should be invoked internally")
236+ if ((check == check))
237+ then {
238+ let blockTimestamp = match blockInfoByHeight(height) {
239+ case bi: BlockInfo =>
240+ bi.timestamp
241+ case _ =>
242+ throwErr("BlockInfo.timestamp error")
243+ }
244+[IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)]
245+ }
246+ else throw("Strict value is not equal to itself.")
247+ }
248+
249+
250+
251+@Callable(i)
252+func changeRatePerBlock (newRatePerBlock) = {
253+ let check = if (if ((i.caller == votingEmissionRateContract))
254+ then true
255+ else mustManager(i))
256+ then true
257+ else throwErr("should be invoked by votingEmissionRateContract")
258+ if ((check == check))
259+ then {
260+ let factoryContract = readFactoryAddressOrFail()
261+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
262+ let boostingContract = getBoostingAddressOrFail(factoryCfg)
263+ let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil)
264+ if ((boostingInvoke == boostingInvoke))
265+ then {
266+ let internalInv = invoke(this, "changeRatePerBlockINTERNAL", [newRatePerBlock], nil)
267+ if ((internalInv == internalInv))
268+ then nil
269+ else throw("Strict value is not equal to itself.")
270+ }
271+ else throw("Strict value is not equal to itself.")
272+ }
273+ else throw("Strict value is not equal to itself.")
274+ }
223275
224276
225277 @Verifier(tx)
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 func wrapErr (msg) = makeString(["emission.ride:", toString(this), msg], " ")
77
88
99 func throwErr (msg) = throw(wrapErr(msg))
1010
1111
1212 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined")))
1313
1414
1515 func keyFactoryAddress () = "%s%s__config__factoryAddress"
1616
1717
1818 let keyVotingVerifiedContract = "%s%s__config__votingVerifiedContract"
1919
2020 let keyVotingEmissionCandidateContract = "%s%s__config__votingEmissionCandidateContract"
2121
2222 let keyUserPoolsContract = "%s%s__config__userPoolsContract"
2323
24+let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract"
25+
2426 let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract))
2527
2628 let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract))
2729
2830 let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract))
2931
32+let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract))
33+
3034 let IdxFactoryCfgStakingDapp = 1
3135
3236 let IdxFactoryCfgBoostingDapp = 2
33-
34-let IdxFactoryCfgIdoDapp = 3
35-
36-let IdxFactoryCfgTeamDapp = 4
37-
38-let IdxFactoryCfgEmissionDapp = 5
39-
40-let IdxFactoryCfgRestDapp = 6
41-
42-let IdxFactoryCfgSlippageDapp = 7
4337
4438 let IdxFactoryCfgGwxRewardDapp = 10
4539
4640 func keyFactoryCfg () = "%s__factoryConfig"
4741
4842
49-func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
50-
51-
52-func keyFactoryLpList () = "%s__lpTokensList"
53-
54-
55-func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
56-
57-
58-func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
59-
60-
6143 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
62-
63-
64-func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
6544
6645
6746 func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
6847
6948
7049 func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
71-
72-
73-func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
7450
7551
7652 func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
7753
7854
7955 func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
8056
8157
8258 func keyConfig () = "%s__config"
8359
8460
8561 func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
8662
8763
8864 func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP)
8965
9066
9167 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
9268
9369
9470 func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
9571
9672
9773 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
9874
9975
10076 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
10177
10278
10379 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
10480
10581
10682 func keyBoostCoeff () = "%s__boostCoeff"
10783
10884
10985 let boostCoeffDefault = 3
11086
11187 let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault)
88+
89+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
90+
91+
92+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
93+
11294
11395 func keyManagerPublicKey () = "%s__managerPublicKey"
11496
11597
11698 func keyManagerVaultAddress () = "%s__managerVaultAddress"
11799
118100
119101 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
120102 case s: String =>
121103 addressFromStringValue(s)
122104 case _ =>
123105 this
124106 }
125107
126108
127109 func managerPublicKeyOrUnit () = {
128110 let managerVaultAddress = getManagerVaultAddressOrThis()
129111 match getString(managerVaultAddress, keyManagerPublicKey()) {
130112 case s: String =>
131113 fromBase58String(s)
132114 case _: Unit =>
133115 unit
134116 case _ =>
135117 throw("Match error")
136118 }
137119 }
138120
139121
140122 func mustManager (i) = {
141123 let pd = throwErr("Permission denied")
142124 match managerPublicKeyOrUnit() {
143125 case pk: ByteVector =>
144126 if ((i.callerPublicKey == pk))
145127 then true
146128 else pd
147129 case _: Unit =>
148130 if ((i.caller == this))
149131 then true
150132 else pd
151133 case _ =>
152134 throw("Match error")
153135 }
154136 }
155137
156138
157139 @Callable(i)
158140 func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
159141 let checkCaller = mustManager(i)
160142 if ((checkCaller == checkCaller))
161143 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))]
162144 else throw("Strict value is not equal to itself.")
163145 }
164146
165147
166148
167149 @Callable(i)
168150 func constructorV2 (votingVerifiedContractPrm) = {
169151 let checkCaller = mustManager(i)
170152 if ((checkCaller == checkCaller))
171153 then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit)
172154 else throw("Strict value is not equal to itself.")
173155 }
174156
175157
176158
177159 @Callable(i)
178160 func emit (amount) = if ((0 >= amount))
179161 then $Tuple2(nil, nil)
180162 else {
181163 let factoryContract = readFactoryAddressOrFail()
182164 let factoryCfg = readFactoryCfgOrFail(factoryContract)
183165 let stakingContract = getStakingAddressOrFail(factoryCfg)
184166 let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
185167 let caller = i.caller
186168 if (if ((caller != stakingContract))
187169 then (caller != gwxRewardsContract)
188170 else false)
189171 then throwErr("permissions denied")
190172 else {
191173 let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
192174 let wxAssetId = fromBase58String(wxAssetIdStr)
193175 $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
194176 }
195177 }
196178
197179
198180
199181 @Callable(i)
200182 func burn () = {
201183 let factoryContract = readFactoryAddressOrFail()
202184 let factoryCfg = readFactoryCfgOrFail(factoryContract)
203185 let boostingContract = getBoostingAddressOrFail(factoryCfg)
204186 if ((size(i.payments) != 1))
205187 then throwErr("exact one payment is allowed")
206188 else {
207189 let pmt = i.payments[0]
208190 let assetId = value(pmt.assetId)
209191 let pmtAmount = pmt.amount
210192 let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
211193 if ((assetId != wxAssetId))
212194 then throwErr("invalid wxAssetId is passed")
213195 else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller)))
214196 then throwErr("permissions denied")
215197 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))]
216198 }
217199 }
218200
219201
220202
221203 @Callable(i)
204+func gwxHoldersRewardUpdate () = {
205+ let factoryContract = readFactoryAddressOrFail()
206+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
207+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
208+ let checkCaller = if ((i.caller == gwxRewardsContract))
209+ then true
210+ else mustManager(i)
211+ if ((checkCaller == checkCaller))
212+ then {
213+ let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0)
214+ let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent)
215+ let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext)
216+ let actions = if (shouldBeUpdated)
217+ then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())]
218+ else nil
219+ $Tuple2(actions, shouldBeUpdated)
220+ }
221+ else throw("Strict value is not equal to itself.")
222+ }
223+
224+
225+
226+@Callable(i)
222227 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
228+
229+
230+
231+@Callable(i)
232+func changeRatePerBlockINTERNAL (newRatePerBlock) = {
233+ let check = if ((i.caller == this))
234+ then true
235+ else throwErr("should be invoked internally")
236+ if ((check == check))
237+ then {
238+ let blockTimestamp = match blockInfoByHeight(height) {
239+ case bi: BlockInfo =>
240+ bi.timestamp
241+ case _ =>
242+ throwErr("BlockInfo.timestamp error")
243+ }
244+[IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)]
245+ }
246+ else throw("Strict value is not equal to itself.")
247+ }
248+
249+
250+
251+@Callable(i)
252+func changeRatePerBlock (newRatePerBlock) = {
253+ let check = if (if ((i.caller == votingEmissionRateContract))
254+ then true
255+ else mustManager(i))
256+ then true
257+ else throwErr("should be invoked by votingEmissionRateContract")
258+ if ((check == check))
259+ then {
260+ let factoryContract = readFactoryAddressOrFail()
261+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
262+ let boostingContract = getBoostingAddressOrFail(factoryCfg)
263+ let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil)
264+ if ((boostingInvoke == boostingInvoke))
265+ then {
266+ let internalInv = invoke(this, "changeRatePerBlockINTERNAL", [newRatePerBlock], nil)
267+ if ((internalInv == internalInv))
268+ then nil
269+ else throw("Strict value is not equal to itself.")
270+ }
271+ else throw("Strict value is not equal to itself.")
272+ }
273+ else throw("Strict value is not equal to itself.")
274+ }
223275
224276
225277 @Verifier(tx)
226278 func verify () = {
227279 let targetPublicKey = match managerPublicKeyOrUnit() {
228280 case pk: ByteVector =>
229281 pk
230282 case _: Unit =>
231283 tx.senderPublicKey
232284 case _ =>
233285 throw("Match error")
234286 }
235287 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
236288 }
237289

github/deemru/w8io/026f985 
42.45 ms