Merge pull request #8252 from blockscout/mf-rootstock-tx-types

Add remasc and bridge tx types
mf-rootstock-tracing
Victor Baranov 1 year ago committed by Maxim Filonov
parent 68e54281af
commit 3421d84c93
  1. 28
      apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex
  2. 22
      apps/explorer/lib/explorer/chain/transaction.ex
  3. 4
      config/runtime.exs
  4. 6
      cspell.json
  5. 7
      docker-compose/envs/common-blockscout.env

@ -629,9 +629,31 @@ defmodule BlockScoutWeb.API.V2.TransactionView do
tx_types(tx, types, :coin_transfer)
end
defp tx_types(%Transaction{value: value}, types, :coin_transfer) do
if Decimal.compare(value.value, 0) == :gt do
[:coin_transfer | types]
defp tx_types(%Transaction{value: value} = tx, types, :coin_transfer) do
types =
if Decimal.compare(value.value, 0) == :gt do
[:coin_transfer | types]
else
types
end
tx_types(tx, types, :rootstock_remasc)
end
defp tx_types(%Transaction{to_address_hash: to_address_hash} = tx, types, :rootstock_remasc) do
types =
if to_address_hash && to_address_hash == Transaction.rootstock_remasc_address_hash() do
[:rootstock_remasc | types]
else
types
end
tx_types(tx, types, :rootstock_bridge)
end
defp tx_types(%Transaction{to_address_hash: to_address_hash}, types, :rootstock_bridge) do
if to_address_hash && to_address_hash == Transaction.rootstock_bridge_address_hash() do
[:rootstock_bridge | types]
else
types
end

@ -1002,4 +1002,26 @@ defmodule Explorer.Chain.Transaction do
limit: 1
)
end
@doc """
Get rootstock REMASC address if env is set and valid, nil otherwise.
"""
@spec rootstock_remasc_address_hash :: nil | Explorer.Chain.Hash.t()
def rootstock_remasc_address_hash do
case Hash.Address.cast(Application.get_env(:explorer, __MODULE__)[:rootstock_remasc_address]) do
{:ok, address} -> address
_ -> nil
end
end
@doc """
Get rootstock bridge address if env is set and valid, nil otherwise.
"""
@spec rootstock_bridge_address_hash :: nil | Explorer.Chain.Hash.t()
def rootstock_bridge_address_hash do
case Hash.Address.cast(Application.get_env(:explorer, __MODULE__)[:rootstock_bridge_address]) do
{:ok, address} -> address
_ -> nil
end
end
end

@ -416,6 +416,10 @@ config :explorer, Explorer.TokenInstanceOwnerAddressMigration,
concurrency: ConfigHelper.parse_integer_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_CONCURRENCY", 5),
batch_size: ConfigHelper.parse_integer_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_BATCH_SIZE", 50)
config :explorer, Explorer.Chain.Transaction,
rootstock_remasc_address: System.get_env("ROOTSTOCK_REMASC_ADDRESS"),
rootstock_bridge_address: System.get_env("ROOTSTOCK_BRIDGE_ADDRESS")
###############
### Indexer ###
###############

@ -25,6 +25,7 @@
"ARGMAX",
"arounds",
"asda",
"Asfpp",
"atoken",
"autodetectfalse",
"Autodetection",
@ -147,6 +148,7 @@
"Erigon",
"errora",
"errorb",
"erts",
"Ethash",
"etherchain",
"ethsupply",
@ -285,6 +287,7 @@
"mydep",
"nanomorph",
"nbsp",
"Nerg",
"Nethermind",
"Neue",
"newkey",
@ -351,6 +354,7 @@
"questiona",
"questionb",
"qwertyufhgkhiop",
"qwertyuioiuytrewertyuioiuytrertyuio",
"racecar",
"raisedbrow",
"rangeright",
@ -366,6 +370,7 @@
"REINDEX",
"relname",
"reltuples",
"remasc",
"removedfile",
"repayer",
"reqs",
@ -378,6 +383,7 @@
"safelow",
"savechives",
"Secon",
"secp",
"Segoe",
"seindexed",
"selfdestruct",

@ -144,6 +144,13 @@ INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT=
# INDEXER_DISABLE_WITHDRAWALS_FETCHER=
# WITHDRAWALS_FIRST_BLOCK=
# INDEXER_DISABLE_ROOTSTOCK_DATA_FETCHER=
# INDEXER_ROOTSTOCK_DATA_FETCHER_INTERVAL=
# INDEXER_ROOTSTOCK_DATA_FETCHER_BATCH_SIZE=
# INDEXER_ROOTSTOCK_DATA_FETCHER_CONCURRENCY=
# INDEXER_ROOTSTOCK_DATA_FETCHER_DB_BATCH_SIZE=
# ROOTSTOCK_REMASC_ADDRESS=
# ROOTSTOCK_BRIDGE_ADDRESS=
# TOKEN_ID_MIGRATION_FIRST_BLOCK=
# TOKEN_ID_MIGRATION_CONCURRENCY=
# TOKEN_ID_MIGRATION_BATCH_SIZE=

Loading…
Cancel
Save