diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex index 2258f28f56..bca1166506 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex @@ -6,6 +6,8 @@ defmodule BlockScoutWeb.Tokens.OverviewView do alias BlockScoutWeb.{CurrencyHelpers, LayoutView} @tabs ["token_transfers", "token_holders", "read_contract", "inventory"] + @etherscan_token_link "https://etherscan.io/token/" + @blockscout_base_link "https://blockscout.com/" def decimals?(%Token{decimals: nil}), do: false def decimals?(%Token{decimals: _}), do: true @@ -71,16 +73,20 @@ defmodule BlockScoutWeb.Tokens.OverviewView do base_token_explorer_link <> foreign_token_contract_address_hash_string end + # credo:disable-for-next-line /Complexity/ defp get_base_token_explorer_link(chain_id) when not is_nil(chain_id) do case Decimal.to_integer(chain_id) do + 181 -> + @blockscout_base_link <> "poa/qdai/tokens/" + 100 -> - "https://blockscout.com/poa/xdai/tokens/" + @blockscout_base_link <> "poa/xdai/tokens/" 99 -> - "https://blockscout.com/poa/core/tokens/" + @blockscout_base_link <> "poa/core/tokens/" 77 -> - "https://blockscout.com/poa/sokol/tokens/" + @blockscout_base_link <> "poa/sokol/tokens/" 42 -> "https://kovan.etherscan.io/token/" @@ -95,12 +101,12 @@ defmodule BlockScoutWeb.Tokens.OverviewView do "https://goerli.etherscan.io/token/" 1 -> - "https://etherscan.io/token/" + @etherscan_token_link _ -> - "https://etherscan.io/token/" + @etherscan_token_link end end - defp get_base_token_explorer_link(_), do: "https://etherscan.io/" + defp get_base_token_explorer_link(_), do: @etherscan_token_link end diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index cd7469bafa..fc6b51977f 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -3480,7 +3480,7 @@ defmodule Explorer.Chain do |> json_rpc(json_rpc_named_arguments) "0x" <> foreign_chain_id_abi_encoded_no_prefix = foreign_chain_id_abi_encoded - {foreign_chain_id, _} = Integer.parse(foreign_chain_id_abi_encoded_no_prefix) + {foreign_chain_id, _} = Integer.parse(foreign_chain_id_abi_encoded_no_prefix, 16) set_bridged_token_metadata(token_address_hash, %{ foreign_chain_id: foreign_chain_id,