--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190219082636_add_indexes_for_block_reward_query.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddIndexesForBlockRewardQuery do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(index(:blocks, [:number]))
6 | create(index(:emission_rewards, [:block_range]))
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20200608075122_alter_transactions_add_error_reason.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AlterTransactionsAddErrorReason do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:transactions) do
6 | add(:revert_reason, :text)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210701084814_support_partial_match.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.SupportPartialMatch do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:smart_contracts) do
6 | add(:partially_verified, :boolean, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210823144531_tokens_add_metadata_fetch_flag.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.TokensAddMetadataFetchFlag do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:tokens) do
6 | add(:skip_metadata, :boolean, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/icons/dots.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/controllers/page_not_found_controller.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.PageNotFoundController do
2 | use BlockScoutWeb, :controller
3 |
4 | def index(conn, _params) do
5 | conn
6 | |> put_status(:not_found)
7 | |> render("index.html", token: nil)
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20200812143050_add_addresses_contract_code_index.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddAddressesContractCodeIndex do
2 | use Ecto.Migration
3 |
4 | def change do
5 | execute("CREATE INDEX addresses_contract_code_index ON addresses (md5(contract_code::text));")
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20220306091504_add_implementation_name.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddImplementationName do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:smart_contracts) do
6 | add(:implementation_name, :string, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/transaction/_transfer_token_with_id.html.eex:
--------------------------------------------------------------------------------
1 | <%= "TokenID " %><%= render BlockScoutWeb.TransactionView, "_link_to_token_instance.html", transfer: @transfer, token_id: @token_id %>
2 | <%= " " %><%= render BlockScoutWeb.TransactionView, "_link_to_token_symbol.html", transfer: @transfer %>
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/tokens/inventory_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.Tokens.InventoryView do
2 | use BlockScoutWeb, :view
3 |
4 | import BlockScoutWeb.Tokens.Instance.OverviewView, only: [media_src: 1, media_type: 1]
5 |
6 | alias BlockScoutWeb.Tokens.OverviewView
7 | alias Explorer.Chain
8 | end
9 |
--------------------------------------------------------------------------------
/config/dev.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | # DO NOT make it `:debug` or all Ecto logs will be shown for indexer
4 | config :logger, :console, level: :info
5 |
6 | config :logger, :ecto,
7 | level: :debug,
8 | path: Path.absname("logs/dev/ecto.log")
9 |
10 | config :logger, :error, path: Path.absname("logs/dev/error.log")
11 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20200904075501_add_bridged_token_custom_metadata.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddBridgedTokenCustomMetadata do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:bridged_tokens) do
6 | add(:custom_metadata, :string, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210916194004_add_file_path_for_sourcify_contracts.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddFilePathForSourcifyContracts do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:smart_contracts) do
6 | add(:file_path, :text, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20220622140604_remove_bridged_tokens.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.RemoveBridgedTokens do
2 | use Ecto.Migration
3 |
4 | def change do
5 | drop_if_exists(table(:bridged_tokens))
6 |
7 | alter table(:tokens) do
8 | remove(:bridged)
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/bin/deployment/migrate:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 |
5 | cd /opt/app || exit 1
6 |
7 | export HOME=/home/ec2-user
8 | export MIX_ENV=prod
9 |
10 | source /etc/environment
11 |
12 | export DATABASE_URL
13 | export POOL_SIZE
14 | export ECTO_USE_SSL
15 |
16 | mix ecto.create
17 | mix ecto.migrate
18 |
19 | exit 0
20 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #da532c
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/icons/copy.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/common_components/_table-loader.html.eex:
--------------------------------------------------------------------------------
1 | <%= for _r <- 1..5 do %>
2 |
3 | <%= for _c <- 1..@columns_num do %>
4 |
5 |
6 |
7 | <% end %>
8 |
9 | <% end %>
10 |
--------------------------------------------------------------------------------
/apps/explorer/.sobelow-conf:
--------------------------------------------------------------------------------
1 | [
2 | verbose: false,
3 | private: true,
4 | skip: true,
5 | exit: "low",
6 | format: "compact",
7 | ignore: ["Config.HTTPS"],
8 | ignore_files: [
9 | "lib/explorer/smart_contract/solidity/code_compiler.ex",
10 | "lib/explorer/smart_contract/vyper/code_compiler.ex"
11 | ]
12 | ]
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20181212115448_add_indexes_to_token_transfers.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddIndexesToTokenTransfers do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(index("token_transfers", [:from_address_hash]))
6 | create(index("token_transfers", [:to_address_hash]))
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210226154732_add_exchange_rate_column_to_bridged_tokens.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddExchangeRateColumnToBridgedTokens do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table("bridged_tokens") do
6 | add(:exchange_rate, :decimal)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210616120552_smart_contracts_add_is_vyper_flag.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.SmartContractsAddIsVyperFlag do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:smart_contracts) do
6 | add(:is_vyper_contract, :boolean, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_btn_wallet.scss:
--------------------------------------------------------------------------------
1 | $btn-wallet-color: $btn-line-color !default;
2 | $btn-wallet-dimensions: 31px !default;
3 |
4 | .btn-wallet-icon {
5 | @include square-icon-button($btn-wallet-color, $btn-wallet-dimensions);
6 | color: $btn-wallet-color;
7 | &:hover {
8 | color: #fff;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_inventory_token_instance_image_container.scss:
--------------------------------------------------------------------------------
1 | /* ERC721 media block */
2 | .inventory-erc721-media {
3 | display: flex;
4 | justify-content: center;
5 | max-height: 50px;
6 | }
7 |
8 | .inventory-erc721-media img {
9 | height: 50px;
10 | }
11 | /* ERC721 media block end */
12 |
--------------------------------------------------------------------------------
/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case.ex:
--------------------------------------------------------------------------------
1 | defmodule EthereumJSONRPC.WebSocket.Case do
2 | use ExUnit.CaseTemplate
3 |
4 | import EthereumJSONRPC.Case, only: [module: 2]
5 |
6 | setup do
7 | module("ETHEREUM_JSONRPC_WEB_SOCKET_CASE", "EthereumJSONRPC.WebSocket.Case.Mox").setup()
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20211018164843_transactions_block_number_index.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.TransactionsBlockNumberIndex do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(
6 | index(
7 | :transactions,
8 | ~w(block_number)a
9 | )
10 | )
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/docker/README.md:
--------------------------------------------------------------------------------
1 | # BlockScout Docker Integration
2 |
3 | This integration is not production ready, and should be used for local BlockScout deployment only.
4 |
5 | For usage instructions and ENV variables, see the [docker integration documentation](https://docs.blockscout.com/for-developers/information-and-settings/docker-integration-local-use-only).
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20181015173318_add_case_insensitive_extension.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddCaseInsensitiveExtension do
2 | use Ecto.Migration
3 |
4 | def change do
5 | execute(
6 | "CREATE EXTENSION IF NOT EXISTS citext",
7 | "DROP EXTENSION IF EXISTS citext"
8 | )
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190215093358_add_compound_index_address_token_balances.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddCompoundIndexAddressTokenBalances do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(index(:address_current_token_balances, [:block_number], name: :address_cur_token_balances_index))
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20191007082500_add_indexes_for_token_instances_query.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddIndexesForTokenInstrancesQuery do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create_if_not_exists(index(:token_instances, [:token_id]))
6 | create_if_not_exists(index(:tokens, [:type]))
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20211006121008_add_block_is_empty_flag.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddBlockIsEmptyFlag do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:blocks) do
6 | add(:is_empty, :bool, null: true)
7 | end
8 |
9 | create(index(:blocks, [:is_empty]))
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/js/lib/pretty_json.js:
--------------------------------------------------------------------------------
1 | import $ from 'jquery'
2 |
3 | function prettyPrint (element) {
4 | const jsonString = element.dataset.json
5 | const pretty = JSON.stringify(JSON.parse(jsonString), undefined, 2)
6 | element.innerHTML = pretty
7 | }
8 |
9 | $('[data-json]').each((_index, element) => prettyPrint(element))
10 |
--------------------------------------------------------------------------------
/apps/explorer/lib/explorer/schema.ex:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Schema do
2 | @moduledoc "Common configuration for Explorer schemas."
3 |
4 | defmacro __using__(_opts) do
5 | quote do
6 | use Ecto.Schema
7 |
8 | import Ecto.{Changeset, Query}
9 |
10 | @timestamps_opts [type: :utc_datetime_usec]
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190910170703_create_indexes_for_block_number_in_token_transfers_and_transactions.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateIndexesForBlockNumberInTokenTransfersAndTransactions do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create_if_not_exists(index(:token_transfers, [:block_number]))
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/apps/indexer/lib/indexer/transform/blocks/base.ex:
--------------------------------------------------------------------------------
1 | defmodule Indexer.Transform.Blocks.Base do
2 | @moduledoc """
3 | Default block transformer to be used.
4 | """
5 |
6 | alias Indexer.Transform.Blocks
7 |
8 | @behaviour Blocks
9 |
10 | @impl Blocks
11 | def transform(block) when is_map(block) do
12 | block
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/custom-themes/dark-forest/copy-df.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/icons/_test_network_icon.html.eex:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20191010075740_add_error_to_token_instances.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddErrorToTokenInstances do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:token_instances) do
6 | add(:error, :string)
7 | end
8 |
9 | create(index(:token_instances, [:error]))
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20201026093652_transactions_stat_add_gas_usage_column.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.TransactionsStatAddGasUsageColumn do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:transaction_stats) do
6 | add(:gas_used, :numeric, precision: 100, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210527093756_transaction_stats_add_total_fee_column.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.TransactionStatsAddTotalFeeColumn do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:transaction_stats) do
6 | add(:total_fee, :numeric, precision: 100, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_alerts.scss:
--------------------------------------------------------------------------------
1 | $alert-danger-background-color: #fff3f7 !default;
2 | $alert-danger-border-color: #fff3f7 !default;
3 | $alert-danger-color: #ff7986 !default;
4 |
5 | .alert-danger {
6 | background-color: $alert-danger-background-color;
7 | border-color: $alert-danger-border-color;
8 | color: $alert-danger-color;
9 | }
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/icons/_accounts_icon.html.eex:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190213180502_add_earliest_processing_start_to_transactions.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddEarliestProcessingStartToTransactions do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:transactions) do
6 | add(:earliest_processing_start, :utc_datetime_usec)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190807113117_create_suggested_indexes.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateSuggestedIndexes do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create_if_not_exists(index(:address_token_balances, [:block_number, :address_hash]))
6 | create_if_not_exists(index(:block_rewards, [:block_hash]))
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/metadata_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.Tokens.Instance.MetadataView do
2 | use BlockScoutWeb, :view
3 |
4 | alias BlockScoutWeb.Tokens.Instance.OverviewView
5 |
6 | def format_metadata(nil), do: ""
7 |
8 | def format_metadata(metadata), do: Poison.encode!(metadata, pretty: true)
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190208113202_add_unique_index_to_rewards.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddUniqueIndexToRewards do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(
6 | unique_index(
7 | :block_rewards,
8 | [:address_hash, :block_hash, :address_type]
9 | )
10 | )
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190421143300_add_index_to_bsdr.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddIndexToBsdr do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:block_second_degree_relations) do
6 | # Null for old relations without fetched index
7 | add(:index, :integer, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210309104122_add_bridged_token_custom_cap.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddBridgedTokenCustomCap do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:bridged_tokens) do
6 | add(:lp_token, :boolean, null: true)
7 | add(:custom_cap, :decimal, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20220111085751_address_add_counters.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddressAddCounters do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:addresses) do
6 | add(:transactions_count, :integer, null: true)
7 | add(:token_transfers_count, :integer, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/lib/explorer/chain/smart_contract/external_library.ex:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Chain.SmartContract.ExternalLibrary do
2 | @moduledoc """
3 | The representation of an external library that was used for a smart contract.
4 | """
5 |
6 | use Ecto.Schema
7 |
8 | embedded_schema do
9 | field(:name)
10 | field(:address_hash)
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20191009121635_add_token_transfer_sorting_indexes.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddTokenTransferSortingIndexes do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(
6 | index(
7 | :token_transfers,
8 | ["block_number DESC", "log_index DESC"]
9 | )
10 | )
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20211018170638_add_logs_address_hash_transaction_hash_index.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddLogsAddressHashTransactionHashIndex do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(
6 | index(
7 | :logs,
8 | ~w(address_hash transaction_hash)a
9 | )
10 | )
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20211217201759_add_has_error_in_iternal_txs_field_to_transaction.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddHasErrorInInternalTxsFieldToTransaction do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:transactions) do
6 | add(:has_error_in_internal_txs, :boolean, null: true)
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/_layout.scss:
--------------------------------------------------------------------------------
1 | @import '~@tarekraafat/autocomplete.js/dist/css/autoComplete.01.css';
2 |
3 | .layout-container {
4 | display: flex;
5 | flex-direction: column;
6 | min-height: 100vh;
7 |
8 | main {
9 | flex-grow: 1;
10 | background-color: #fbfafc;
11 | }
12 | }
13 |
14 | .logs-hash {
15 | line-height: 24px !important;
16 | }
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210331074008_add_pool_name_description.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddPoolNameDescription do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:staking_pools) do
6 | add(:name, :string, size: 256, null: true)
7 | add(:description, :string, size: 1024, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/indexer/test/support/indexer/block/catchup_supervisor_case.ex:
--------------------------------------------------------------------------------
1 | defmodule Indexer.Block.Catchup.Supervisor.Case do
2 | alias Indexer.Block.Catchup
3 |
4 | def start_supervised!(fetcher_arguments) when is_map(fetcher_arguments) do
5 | [fetcher_arguments]
6 | |> Catchup.Supervisor.child_spec()
7 | |> ExUnit.Callbacks.start_supervised!()
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_btn_address_card.scss:
--------------------------------------------------------------------------------
1 | $btn-address-card-icon-color: $primary !default;
2 | $btn-address-card-icon-dimensions: 31px !default;
3 |
4 | .btn-address-card-icon {
5 | @include square-icon-button($btn-address-card-icon-color, $btn-address-card-icon-dimensions);
6 |
7 | svg {
8 | height: 10px;
9 | width: 20px;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/custom-themes/circles/copy-circles.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/common_components/_channel_disconnected_message.html.eex:
--------------------------------------------------------------------------------
1 |
2 |
3 | <%= @text %>
4 |
5 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/api/v1/supply_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.API.V1.SupplyView do
2 | use BlockScoutWeb, :view
3 |
4 | def render("supply.json", %{total: total_supply, circulating: circulating_supply}) do
5 | %{
6 | "total_supply" => total_supply,
7 | "circulating_supply" => circulating_supply
8 | }
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190114204640_add_tokens_holder_count.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddTokensHolderCount do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:tokens) do
6 | # `NULL` so it can be filled in in the background while upgrading
7 | add(:holder_count, :integer, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/config/test/geth.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | config :explorer,
4 | json_rpc_named_arguments: [
5 | transport: EthereumJSONRPC.Mox,
6 | transport_options: [],
7 | variant: EthereumJSONRPC.Geth
8 | ],
9 | subscribe_named_arguments: [
10 | transport: EthereumJSONRPC.Mox,
11 | transport_options: [],
12 | variant: EthereumJSONRPC.Geth
13 | ]
14 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20200410141202_create_index_token_transfers_token_contract_address_hash_block_number.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateIndexTokenTransfersTokenContractAddressHashBlockNumber do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create_if_not_exists(index(:token_transfers, [:token_contract_address_hash, :block_number]))
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/scripts/20190326202921_lose_consensus_for_invalid_blocks.sql:
--------------------------------------------------------------------------------
1 | UPDATE blocks SET consensus = FALSE, updated_at = NOW()
2 | WHERE consensus AND number IN (
3 | SELECT b0.number - 1 FROM "blocks" AS b0
4 | LEFT JOIN "blocks" AS b1 ON (b0."parent_hash" = b1."hash") AND b1."consensus"
5 | WHERE b0."number" > 0 AND b0."consensus" AND b1."hash" IS NULL
6 | );
7 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_module_item.html.eex:
--------------------------------------------------------------------------------
1 |
2 | <%= "#{String.capitalize(@module.name)}" %>
3 | ?module=<%= @module.name %>
4 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/common_components/_btn_external_link.html.eex:
--------------------------------------------------------------------------------
1 |
6 | <%= render BlockScoutWeb.IconsView, "_external_link.html" %>
7 | <%= @text %>
8 |
--------------------------------------------------------------------------------
/apps/block_scout_web/test/block_scout_web/controllers/page_not_found_controller_test.exs:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.PageNotFoundControllerTest do
2 | use BlockScoutWeb.ConnCase
3 |
4 | describe "GET index/2" do
5 | test "returns 404 status", %{conn: conn} do
6 | conn = get(conn, "/wrong", %{})
7 |
8 | assert html_response(conn, 404)
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190124082812_add_index_on_transaction_nonce_and_from_address_hash.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddIndexOnTransactionNonceAndFromAddressHash do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(index(:transactions, [:nonce, :from_address_hash, :block_hash]))
6 | create(index(:transactions, [:block_hash, :error]))
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20211018073652_add_token_balances_contract_address_hash_index.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddTokenBalancesContractAddressHashIndex do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(
6 | index(
7 | :address_token_balances,
8 | ~w(token_contract_address_hash)a
9 | )
10 | )
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/block_scout_web/.sobelow-conf:
--------------------------------------------------------------------------------
1 | [
2 | verbose: false,
3 | private: true,
4 | skip: true,
5 | router: "lib/block_scout_web/router.ex",
6 | exit: "low",
7 | format: "compact",
8 | ignore: ["Config.Headers", "Config.CSWH", "XSS.SendResp", "XSS.Raw"],
9 | ignore_files: [
10 | "apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex"
11 | ]
12 | ]
13 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/icons/check-1.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/controllers/common_components_controller.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.CommonComponentsController do
2 | use BlockScoutWeb, :controller
3 |
4 | def index(conn, params) do
5 | []
6 | |> handle_render(conn, params)
7 | end
8 |
9 | defp handle_render(_full_options, conn, _params) do
10 | render(conn, "index.html")
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/config/test/ganache.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | config :explorer,
4 | json_rpc_named_arguments: [
5 | transport: EthereumJSONRPC.Mox,
6 | transport_options: [],
7 | variant: EthereumJSONRPC.Ganache
8 | ],
9 | subscribe_named_arguments: [
10 | transport: EthereumJSONRPC.Mox,
11 | transport_options: [],
12 | variant: EthereumJSONRPC.Ganache
13 | ]
14 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.TransactionLogView do
2 | use BlockScoutWeb, :view
3 | @dialyzer :no_match
4 |
5 | alias Explorer.Chain.Log
6 | import BlockScoutWeb.AddressView, only: [implementation_name: 1, primary_name: 1]
7 |
8 | def decode(log, transaction) do
9 | Log.decode(log, transaction)
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/explorer/config/test/arbitrum.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | config :explorer,
4 | json_rpc_named_arguments: [
5 | transport: EthereumJSONRPC.Mox,
6 | transport_options: [],
7 | variant: EthereumJSONRPC.Arbitrum
8 | ],
9 | subscribe_named_arguments: [
10 | transport: EthereumJSONRPC.Mox,
11 | transport_options: [],
12 | variant: EthereumJSONRPC.Arbitrum
13 | ]
14 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190513134025_add_refetch_needed_to_block.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddRefetchNeededToBlock do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:blocks) do
6 | add(:refetch_needed, :boolean, default: false)
7 | end
8 |
9 | execute("UPDATE blocks SET refetch_needed = TRUE WHERE consensus", "")
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20191208135613_block_rewards_block_hash_partial_index.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.BlockRewardsBlockHashPartialIndex do
2 | use Ecto.Migration
3 |
4 | def change do
5 | execute(
6 | "CREATE INDEX IF NOT EXISTS block_rewards_block_hash_partial_index on block_rewards(block_hash) WHERE address_type='validator';"
7 | )
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190709043832_create_transaction_stats.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateTransactionStats do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create table(:transaction_stats) do
6 | add(:date, :date)
7 | add(:number_of_transactions, :integer)
8 | end
9 |
10 | create(unique_index(:transaction_stats, :date))
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20200410115841_create_index_address_current_token_balances_token_contract_address_hash_value.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateIndexAddressCurrentTokenBalancesTokenContractAddressHashValue do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create_if_not_exists(index(:address_current_token_balances, [:token_contract_address_hash, :value]))
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/network-selector-icons/lukso-l14-testnet.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/resolvers/block.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.Resolvers.Block do
2 | @moduledoc false
3 |
4 | alias Explorer.Chain
5 |
6 | def get_by(_, %{number: number}, _) do
7 | case Chain.number_to_block(number) do
8 | {:ok, _} = result -> result
9 | {:error, :not_found} -> {:error, "Block number #{number} was not found."}
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20180919175123_alter_token_decimals_to_bigint.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AlterTokenDecimalsToBigint do
2 | use Ecto.Migration
3 |
4 | def up do
5 | alter table("tokens") do
6 | modify(:decimals, :bigint)
7 | end
8 | end
9 |
10 | def down do
11 | alter table("tokens") do
12 | modify(:decimals, :smallint)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210423115108_extend_token_transfers_for_erc1155.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.ExtendTokenTransfersForErc1155 do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:token_transfers) do
6 | add(:amounts, {:array, :decimal}, null: true)
7 | add(:token_ids, {:array, :numeric}, precision: 78, scale: 0, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/config/prod.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | # Do not print debug messages in production
4 |
5 | config :logger, :console, level: :info
6 |
7 | config :logger, :ecto,
8 | level: :info,
9 | path: Path.absname("logs/prod/ecto.log"),
10 | rotate: %{max_bytes: 52_428_800, keep: 19}
11 |
12 | config :logger, :error,
13 | path: Path.absname("logs/prod/error.log"),
14 | rotate: %{max_bytes: 52_428_800, keep: 19}
15 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/__tests__/lib/utils.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @jest-environment jsdom
3 | */
4 |
5 | import { escapeHtml } from '../../js/lib/utils'
6 |
7 | test('escapeHtml', () => {
8 | expect(escapeHtml('
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/apps/explorer/config/test/parity.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | config :explorer,
4 | transport: EthereumJSONRPC.HTTP,
5 | json_rpc_named_arguments: [
6 | transport: EthereumJSONRPC.Mox,
7 | transport_options: [],
8 | variant: EthereumJSONRPC.Parity
9 | ],
10 | subscribe_named_arguments: [
11 | transport: EthereumJSONRPC.Mox,
12 | transport_options: [],
13 | variant: EthereumJSONRPC.Parity
14 | ]
15 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/seeds.exs:
--------------------------------------------------------------------------------
1 | # Script for populating the database. You can run it as:
2 | #
3 | # mix run priv/repo/seeds.exs
4 | #
5 | # Inside the script, you can read and write to any of your
6 | # repositories directly:
7 | #
8 | # Explorer.Repo.insert!(%Explorer.SomeSchema{})
9 | #
10 | # We recommend using the bang functions (`insert!`, `update!`
11 | # and so on) as they will fail if something goes wrong.
12 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/icons/_block_icon.html.eex:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/icons/_search_icon.html.eex:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190102141900_index_current_token_holders.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.IndexCurrentTokenHolders do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(
6 | index(:address_current_token_balances, [:token_contract_address_hash],
7 | where: "address_hash != '\\x0000000000000000000000000000000000000000' AND value > 0"
8 | )
9 | )
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190424170833_change_block_size_to_nullable.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.ChangeBlockSizeToNullable do
2 | use Ecto.Migration
3 |
4 | def up do
5 | alter table(:blocks) do
6 | modify(:size, :integer, null: true)
7 | end
8 | end
9 |
10 | def down do
11 | alter table(:blocks) do
12 | modify(:size, :integer, null: false)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddAdditionalContractFields do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:smart_contracts) do
6 | add(:optimization_runs, :integer, null: true)
7 | add(:evm_version, :string, null: true)
8 | add(:external_libraries, :jsonb, null: true)
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/bin/deployment/health_check:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | # Timeout after 2 min if we still haven't gotten a response
5 | timeout 120s bash </dev/null; then
10 | exit 0
11 | fi
12 | done
13 | }
14 |
15 | ping_server
16 | EOT
17 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_external_link.scss:
--------------------------------------------------------------------------------
1 | .external-link-icon {
2 | float: right;
3 | margin-top: -1px;
4 |
5 | & {
6 | &.active,
7 | &:hover,
8 | &:focus {
9 | path {
10 | fill: $header-icon-color-hover;
11 | }
12 | }
13 | }
14 | }
15 |
16 |
17 | .external-token-icon {
18 | path {
19 | fill: $header-icon-color-hover;
20 | }
21 | }
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/cldr.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.Cldr do
2 | @moduledoc """
3 | Cldr global configuration.
4 | """
5 |
6 | use Cldr,
7 | default_locale: "en",
8 | locales: ["en"],
9 | gettext: BlockScoutWeb.Gettext,
10 | generate_docs: false,
11 | precompile_number_formats: ["#,###", "#,##0.##################", "#.#%", "#,##0"],
12 | providers: [Cldr.Number, Cldr.Unit]
13 | end
14 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/address_transaction_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.AddressTransactionView do
2 | use BlockScoutWeb, :view
3 |
4 | alias BlockScoutWeb.AccessHelpers
5 | alias Explorer.Chain.Address
6 |
7 | def format_current_filter(filter) do
8 | case filter do
9 | "to" -> gettext("To")
10 | "from" -> gettext("From")
11 | _ -> gettext("All")
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20191220113006_pending_block_operations_block_hash_partial_index.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.PendingBlockOperationsBlockHashPartialIndex do
2 | use Ecto.Migration
3 |
4 | def change do
5 | execute(
6 | "CREATE INDEX pending_block_operations_block_hash_index_partial ON pending_block_operations(block_hash) WHERE fetch_internal_transactions=true;"
7 | )
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/common_components/_i_tooltip_2.html.eex:
--------------------------------------------------------------------------------
1 | "
3 | data-boundary="window"
4 | data-container="body"
5 | data-html="true"
6 | data-placement="top"
7 | data-toggle="tooltip"
8 | title="<%= @text %>"
9 | >
10 |
11 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/address_token_transfer_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.AddressTokenTransferView do
2 | use BlockScoutWeb, :view
3 |
4 | alias BlockScoutWeb.AccessHelpers
5 | alias Explorer.Chain.Address
6 |
7 | def format_current_filter(filter) do
8 | case filter do
9 | "to" -> gettext("To")
10 | "from" -> gettext("From")
11 | _ -> gettext("All")
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190228220746_add_internal_transactions_indexed_at_to_blocks.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddInternalTransactionsIndexedAtToBlocks do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:blocks) do
6 | # `null` when `internal_transactions` has never been fetched
7 | add(:internal_transactions_indexed_at, :utc_datetime_usec, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/test/support/fakes/no_op_source.ex:
--------------------------------------------------------------------------------
1 | defmodule Explorer.ExchangeRates.Source.NoOpSource do
2 | @moduledoc false
3 |
4 | alias Explorer.ExchangeRates.Source
5 |
6 | @behaviour Source
7 |
8 | @impl Source
9 | def format_data(_), do: []
10 |
11 | @impl Source
12 | def source_url, do: ""
13 |
14 | @impl Source
15 | def source_url(_), do: :ignore
16 |
17 | @impl Source
18 | def headers, do: []
19 | end
20 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190208143201_add_index_on_address_hash_block_number_and_token_contract_address_hash_for_current_token_balance.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddIndexOnAddressHashBlockNumberAndTokenContractAddressHashForCurrentTokenBalance do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create(index(:address_current_token_balances, [:address_hash, :block_number, :token_contract_address_hash]))
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/network-selector-icons/ethereum-classic.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20180508183700_create_users.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateUsers do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create table(:users) do
6 | add(:username, :string, null: false)
7 | add(:password_hash, :string, null: false)
8 |
9 | timestamps()
10 | end
11 |
12 | create(index(:users, ["lower(username)"], unique: true, name: :unique_username))
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190215105501_add_constructor_arguments_to_smart_contracts.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddConstructorArgumentsToSmartContracts do
2 | use Ecto.Migration
3 |
4 | def change do
5 | execute("ALTER TABLE smart_contracts DROP COLUMN IF EXISTS constructor_arguments")
6 |
7 | alter table(:smart_contracts) do
8 | add(:constructor_arguments, :string, null: true)
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/static/images/icons/fontawesome/tag.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/advertisement/text_ad/index.html.eex:
--------------------------------------------------------------------------------
1 |
2 |
3 | : -
4 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/views/address_internal_transaction_view.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.AddressInternalTransactionView do
2 | use BlockScoutWeb, :view
3 |
4 | alias BlockScoutWeb.AccessHelpers
5 | alias Explorer.Chain.Address
6 |
7 | def format_current_filter(filter) do
8 | case filter do
9 | "to" -> gettext("To")
10 | "from" -> gettext("From")
11 | _ -> gettext("All")
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190709103104_add_external_libraries_to_smart_contracts.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddExternalLibrariesToSmartContracts do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:smart_contracts) do
6 | remove(:external_libraries)
7 | end
8 |
9 | alter table(:smart_contracts) do
10 | add(:external_libraries, {:array, :map}, default: [])
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20211017135545_migrate_optimization_runs_to_int8.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.MigrateOptimizationRunsToInt8 do
2 | use Ecto.Migration
3 |
4 | def up do
5 | alter table(:smart_contracts) do
6 | modify(:optimization_runs, :bigint)
7 | end
8 | end
9 |
10 | def down do
11 | alter table(:smart_contracts) do
12 | modify(:optimization_runs, :integer)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/bin/deployment/build:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 |
5 | cd /opt/app || exit 1
6 |
7 | export HOME=/home/ec2-user
8 | export MIX_ENV=prod
9 |
10 | source /etc/environment
11 |
12 | mix local.rebar --force
13 | mix local.hex --force
14 |
15 | mix deps.get
16 |
17 | mix compile
18 |
19 | # Install node dependencies
20 | pushd apps/explorer || exit 1
21 | npm install
22 | popd
23 |
24 | chown -R ec2-user:ec2-user /opt/app
25 |
26 | exit 0
27 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/plug/allow_iframe.ex:
--------------------------------------------------------------------------------
1 | defmodule BlockScoutWeb.Plug.AllowIframe do
2 | @moduledoc """
3 | Allows for iframes by deleting the
4 | [`X-Frame-Options` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options)
5 | """
6 |
7 | alias Plug.Conn
8 |
9 | def init(opts), do: opts
10 |
11 | def call(conn, _opts) do
12 | Conn.delete_resp_header(conn, "x-frame-options")
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/common_components/_tenderly_link.html.eex:
--------------------------------------------------------------------------------
1 | <% tenderly_link = "https://dashboard.tenderly.co/tx#{@tenderly_chain_path}/" <> "0x" <> Base.encode16(@transaction_hash.bytes, case: :lower) %>
2 |
3 | Open in Tenderly <%= render BlockScoutWeb.IconsView, "_external_link.html" %>
4 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20180522154253_create_block_rewards.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateBlockRewards do
2 | use Ecto.Migration
3 |
4 | def change do
5 | create table(:block_rewards, primary_key: false) do
6 | add(:block_range, :int8range)
7 | add(:reward, :decimal)
8 | end
9 |
10 | create(constraint(:block_rewards, :no_overlapping_ranges, exclude: ~s|gist (block_range WITH &&)|))
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190313103912_change_transactions_v_column_type.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.ChangeTransactionsVColumnType do
2 | use Ecto.Migration
3 |
4 | def up do
5 | alter table(:transactions) do
6 | modify(:v, :numeric, precision: 100, null: false)
7 | end
8 | end
9 |
10 | def down do
11 | alter table(:transactions) do
12 | modify(:v, :integer, null: false)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20191128124415_remove_duplicate_indexes_token_entities.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.RemoveDuplicateIndexesTokenEntities do
2 | use Ecto.Migration
3 |
4 | def change do
5 | drop_if_exists(index(:address_token_balances, [:block_number], name: "address_token_balances_block_number_index"))
6 |
7 | drop_if_exists(index(:token_instances, [:token_id], name: "token_instances_token_id_index"))
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20200214152058_add_token_id_to_token_balances.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddTokenIdToTokenBalances do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:address_token_balances) do
6 | add(:token_id, :numeric, precision: 78, scale: 0, null: true)
7 | add(:token_type, :string, null: true)
8 | end
9 |
10 | create(index(:address_token_balances, [:token_id]))
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon.html.eex:
--------------------------------------------------------------------------------
1 | <% token_icon_url = Explorer.Chain.get_token_icon_url_by(@chain_id, @address) %>
2 | " alt="" onerror="this.style.visibility='hidden'"/>
--------------------------------------------------------------------------------
/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/transaction_test.exs:
--------------------------------------------------------------------------------
1 | defmodule EthereumJSONRPC.TransactionTest do
2 | use ExUnit.Case, async: true
3 |
4 | doctest EthereumJSONRPC.Transaction
5 |
6 | alias EthereumJSONRPC.Transaction
7 |
8 | describe "to_elixir/1" do
9 | test "skips unsupported keys" do
10 | map = %{"key" => "value", "key1" => "value1"}
11 |
12 | assert %{nil: nil} = Transaction.to_elixir(map)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190118040301_create_tokens_primary_key.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.CreateTokensPrimaryKey do
2 | use Ecto.Migration
3 |
4 | def up do
5 | # Don't use `modify` as it requires restating the whole column description
6 | execute("ALTER TABLE tokens ADD PRIMARY KEY (contract_address_hash)")
7 | end
8 |
9 | def down do
10 | execute("ALTER TABLE tokens DROP CONSTRAINT tokens_pkey")
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190228152333_change_constructor_arguments_to_text.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.ChangeConstructorArgumentsToText do
2 | use Ecto.Migration
3 |
4 | def up do
5 | alter table(:smart_contracts) do
6 | modify(:constructor_arguments, :text)
7 | end
8 | end
9 |
10 | def down do
11 | alter table(:smart_contracts) do
12 | modify(:constructor_arguments, :string)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20190321185644_add_old_value_for_current_token_balances.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.AddOldValueForCurrentTokenBalances do
2 | use Ecto.Migration
3 |
4 | def change do
5 | alter table(:address_current_token_balances) do
6 | # A transient field for deriving token holder count deltas during address_current_token_balances upserts
7 | add(:old_value, :decimal, null: true)
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/apps/explorer/priv/repo/migrations/20210524165427_min_missing_block_number.exs:
--------------------------------------------------------------------------------
1 | defmodule Explorer.Repo.Migrations.MinMissingBlockNumber do
2 | use Ecto.Migration
3 |
4 | def change do
5 | insert_initial_genesis_block = """
6 | INSERT INTO last_fetched_counters (counter_type, value, inserted_at, updated_at)
7 | VALUES ('min_missing_block_number', 0, NOW(), NOW());
8 | """
9 |
10 | execute(insert_initial_genesis_block)
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_highlight.scss:
--------------------------------------------------------------------------------
1 | //replace the default background color from highlightjs
2 | .hljs {
3 | background: $gray-100;
4 | }
5 |
6 | .line-numbers {
7 | [data-line-number] {
8 | &:before {
9 | content: attr(data-line-number);
10 | display: inline-block;
11 | border-right: 1px solid $gray-400;
12 | padding: 0 0.5em;
13 | margin-right: 0.5em;
14 | color: $gray-600;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/apps/block_scout_web/assets/css/components/_table.scss:
--------------------------------------------------------------------------------
1 | .table-font {
2 | thead th,
3 | td,
4 | th {
5 | border-top: none;
6 | border-bottom: none;
7 | }
8 |
9 | i {
10 | color: $gray-500;
11 | }
12 |
13 | img {
14 | width: 12px;
15 | }
16 | }
17 |
18 | .table-horizontal {
19 | th {
20 | width: 35%;
21 | }
22 | }
23 |
24 | .address-cell {
25 | width: 150px;
26 | }
27 |
28 | .token-icon {
29 | padding-right: 5px;
30 | }
31 |
--------------------------------------------------------------------------------
/apps/block_scout_web/lib/block_scout_web/templates/common_components/_changed_bytecode_warning.html.eex:
--------------------------------------------------------------------------------
1 |
2 | <%= render BlockScoutWeb.CommonComponentsView, "_info.html" %>
3 | <%= gettext("Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.") %>
4 |