Merge pull request #3370 from poanetwork/vb-improve-verification

Improve contracts verification: refine constructor arguments extractor
pull/3373/head
Victor Baranov 4 years ago committed by GitHub
commit ead706b917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 14
      apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex

@ -8,6 +8,7 @@
### Fixes
- [#3370](https://github.com/poanetwork/blockscout/pull/3370) - Improve contracts verification: refine constructor arguments extractor
- [#3368](https://github.com/poanetwork/blockscout/pull/3368) - Fix Verify contract loading button width
- [#3357](https://github.com/poanetwork/blockscout/pull/3357) - Fix token transfer realtime fetcher
- [#3353](https://github.com/poanetwork/blockscout/pull/3353) - Fix xDai buttons hover color

@ -244,8 +244,18 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArguments do
metadata_hash_prefix
) do
if is_constructor_arguments_still_has_metadata_prefix(constructor_arguments, metadata_hash_prefix) do
<<_::binary-size(2)>> <> rest = constructor_arguments
extract_constructor_arguments(rest, check_func, contract_source_code, contract_name)
{ind, _} = :binary.match(constructor_arguments, metadata_hash_prefix)
offset = if ind > 2, do: ind - 2, else: 0
processed_constructor_arguments =
if offset > 0 do
<<_::binary-size(offset)>> <> rest = constructor_arguments
rest
else
constructor_arguments
end
extract_constructor_arguments(processed_constructor_arguments, check_func, contract_source_code, contract_name)
else
extract_constructor_arguments_check_func(
constructor_arguments,

Loading…
Cancel
Save