chore: Manage Solidityscan platform id via runtime variable (#10473)

* Manage Solidityscan platform id via runtime variable

* Extend common-blockscout.env
pull/10486/head
Victor Baranov 4 months ago committed by GitHub
parent c17d53063b
commit df084cf639
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      apps/explorer/lib/explorer/third_party_integrations/solidityscan.ex
  2. 1
      config/runtime.exs
  3. 1
      docker-compose/envs/common-blockscout.env

@ -6,7 +6,6 @@ defmodule Explorer.ThirdPartyIntegrations.SolidityScan do
require Logger require Logger
alias Explorer.Helper alias Explorer.Helper
@blockscout_platform_id "16"
@recv_timeout 60_000 @recv_timeout 60_000
@doc """ @doc """
@ -37,12 +36,16 @@ defmodule Explorer.ThirdPartyIntegrations.SolidityScan do
defp base_url(address_hash_string) do defp base_url(address_hash_string) do
if chain_id() && api_key() do if chain_id() && api_key() do
"https://api.solidityscan.com/api/v1/quickscan/#{@blockscout_platform_id}/#{chain_id()}/#{address_hash_string}" "https://api.solidityscan.com/api/v1/quickscan/#{platform_id()}/#{chain_id()}/#{address_hash_string}"
else else
nil nil
end end
end end
defp platform_id do
Application.get_env(:explorer, __MODULE__)[:platform_id]
end
defp chain_id do defp chain_id do
Application.get_env(:explorer, __MODULE__)[:chain_id] Application.get_env(:explorer, __MODULE__)[:chain_id]
end end

@ -457,6 +457,7 @@ config :explorer, Explorer.ThirdPartyIntegrations.Sourcify,
repo_url: System.get_env("SOURCIFY_REPO_URL") || "https://repo.sourcify.dev/contracts" repo_url: System.get_env("SOURCIFY_REPO_URL") || "https://repo.sourcify.dev/contracts"
config :explorer, Explorer.ThirdPartyIntegrations.SolidityScan, config :explorer, Explorer.ThirdPartyIntegrations.SolidityScan,
platform_id: System.get_env("SOLIDITYSCAN_PLATFORM_ID", "16"),
chain_id: System.get_env("SOLIDITYSCAN_CHAIN_ID"), chain_id: System.get_env("SOLIDITYSCAN_CHAIN_ID"),
api_key: System.get_env("SOLIDITYSCAN_API_TOKEN") api_key: System.get_env("SOLIDITYSCAN_API_TOKEN")

@ -378,6 +378,7 @@ SOURCIFY_SERVER_URL=
SOURCIFY_REPO_URL= SOURCIFY_REPO_URL=
SHOW_TENDERLY_LINK=false SHOW_TENDERLY_LINK=false
TENDERLY_CHAIN_PATH= TENDERLY_CHAIN_PATH=
# SOLIDITYSCAN_PLATFORM_ID=
# SOLIDITYSCAN_CHAIN_ID= # SOLIDITYSCAN_CHAIN_ID=
# SOLIDITYSCAN_API_TOKEN= # SOLIDITYSCAN_API_TOKEN=
# NOVES_FI_BASE_API_URL= # NOVES_FI_BASE_API_URL=

Loading…
Cancel
Save