Merge pull request #3421 from poanetwork/vb-functions-for-gnosis-safelink

Functions to enable GnosisSafe app link
pull/3422/head
Victor Baranov 4 years ago committed by GitHub
commit 6c1d7506f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 10
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  3. 26
      apps/block_scout_web/priv/gettext/default.pot
  4. 26
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  5. 14
      apps/explorer/lib/explorer/chain.ex

@ -41,6 +41,7 @@
- [#3335](https://github.com/poanetwork/blockscout/pull/3335) - MarketCap calculation: check that ETS tables exist before inserting new data or lookup from the table - [#3335](https://github.com/poanetwork/blockscout/pull/3335) - MarketCap calculation: check that ETS tables exist before inserting new data or lookup from the table
### Chore ### Chore
- [#3421](https://github.com/poanetwork/blockscout/pull/3421) - Functions to enable GnosisSafe app link
- [#3414](https://github.com/poanetwork/blockscout/pull/3414) - Manage lis of other explorers in the footer via env var - [#3414](https://github.com/poanetwork/blockscout/pull/3414) - Manage lis of other explorers in the footer via env var
- [#3407](https://github.com/poanetwork/blockscout/pull/3407) - Add EthereumJSONRPC.HTTP.HTTPoison.json_rpc function clause when URL is null - [#3407](https://github.com/poanetwork/blockscout/pull/3407) - Add EthereumJSONRPC.HTTP.HTTPoison.json_rpc function clause when URL is null
- [#3405](https://github.com/poanetwork/blockscout/pull/3405) - N/A instead of 0 for market cap if it is not fetched - [#3405](https://github.com/poanetwork/blockscout/pull/3405) - N/A instead of 0 for market cap if it is not fetched

@ -294,9 +294,7 @@ defmodule BlockScoutWeb.AddressView do
address.contracts_creation_transaction.from_address_hash address.contracts_creation_transaction.from_address_hash
end end
def from_address_hash(_address) do def from_address_hash(_address), do: nil
nil
end
def address_link_to_other_explorer(link, address, full) do def address_link_to_other_explorer(link, address, full) do
if full do if full do
@ -383,4 +381,10 @@ defmodule BlockScoutWeb.AddressView do
true -> "#{to_string(address)}" true -> "#{to_string(address)}"
end end
end end
def smart_contract_is_gnosis_safe_proxy?(%Address{smart_contract: %SmartContract{}} = address) do
address.smart_contract.name == "GnosisSafeProxy" && Chain.gnosis_safe_contract?(address.smart_contract.abi)
end
def smart_contract_is_gnosis_safe_proxy?(_address), do: false
end end

@ -899,7 +899,7 @@ msgstr ""
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7
#: lib/block_scout_web/views/address_view.ex:350 #: lib/block_scout_web/views/address_view.ex:348
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:119 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:119
#: lib/block_scout_web/views/tokens/overview_view.ex:40 #: lib/block_scout_web/views/tokens/overview_view.ex:40
#: lib/block_scout_web/views/transaction_view.ex:395 #: lib/block_scout_web/views/transaction_view.ex:395
@ -1798,7 +1798,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:46 #: lib/block_scout_web/templates/address/_tabs.html.eex:46
#: lib/block_scout_web/templates/address_validation/index.html.eex:13 #: lib/block_scout_web/templates/address_validation/index.html.eex:13
#: lib/block_scout_web/views/address_view.ex:358 #: lib/block_scout_web/views/address_view.ex:356
msgid "Blocks Validated" msgid "Blocks Validated"
msgstr "" msgstr ""
@ -1808,18 +1808,18 @@ msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:351 #: lib/block_scout_web/views/address_view.ex:349
msgid "Code" msgid "Code"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/views/address_view.ex:357 #: lib/block_scout_web/views/address_view.ex:355
msgid "Coin Balance History" msgid "Coin Balance History"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/address_view.ex:352 #: lib/block_scout_web/views/address_view.ex:350
msgid "Decompiled Code" msgid "Decompiled Code"
msgstr "" msgstr ""
@ -1828,7 +1828,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:348 #: lib/block_scout_web/views/address_view.ex:346
#: lib/block_scout_web/views/transaction_view.ex:396 #: lib/block_scout_web/views/transaction_view.ex:396
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -1838,7 +1838,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8 #: lib/block_scout_web/templates/address_logs/index.html.eex:8
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:359 #: lib/block_scout_web/views/address_view.ex:357
#: lib/block_scout_web/views/transaction_view.ex:397 #: lib/block_scout_web/views/transaction_view.ex:397
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -1846,7 +1846,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:79 #: lib/block_scout_web/templates/address/_tabs.html.eex:79
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25
#: lib/block_scout_web/views/address_view.ex:353 #: lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/tokens/overview_view.ex:42 #: lib/block_scout_web/views/tokens/overview_view.ex:42
msgid "Read Contract" msgid "Read Contract"
msgstr "" msgstr ""
@ -1858,7 +1858,7 @@ msgstr ""
#: lib/block_scout_web/templates/layout/_topnav.html.eex:87 #: lib/block_scout_web/templates/layout/_topnav.html.eex:87
#: lib/block_scout_web/templates/layout/_topnav.html.eex:108 #: lib/block_scout_web/templates/layout/_topnav.html.eex:108
#: lib/block_scout_web/templates/tokens/index.html.eex:4 #: lib/block_scout_web/templates/tokens/index.html.eex:4
#: lib/block_scout_web/views/address_view.ex:347 #: lib/block_scout_web/views/address_view.ex:345
msgid "Tokens" msgid "Tokens"
msgstr "" msgstr ""
@ -1869,7 +1869,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18 #: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:238 #: lib/block_scout_web/templates/chain/show.html.eex:238
#: lib/block_scout_web/templates/layout/_topnav.html.eex:53 #: lib/block_scout_web/templates/layout/_topnav.html.eex:53
#: lib/block_scout_web/views/address_view.ex:349 #: lib/block_scout_web/views/address_view.ex:347
msgid "Transactions" msgid "Transactions"
msgstr "" msgstr ""
@ -1909,13 +1909,13 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:86 #: lib/block_scout_web/templates/address/_tabs.html.eex:86
#: lib/block_scout_web/views/address_view.ex:354 #: lib/block_scout_web/views/address_view.ex:352
msgid "Read Proxy" msgid "Read Proxy"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:93 #: lib/block_scout_web/templates/address/_tabs.html.eex:93
#: lib/block_scout_web/views/address_view.ex:355 #: lib/block_scout_web/views/address_view.ex:353
msgid "Write Contract" msgid "Write Contract"
msgstr "" msgstr ""
@ -1932,7 +1932,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:100 #: lib/block_scout_web/templates/address/_tabs.html.eex:100
#: lib/block_scout_web/views/address_view.ex:356 #: lib/block_scout_web/views/address_view.ex:354
msgid "Write Proxy" msgid "Write Proxy"
msgstr "" msgstr ""

@ -899,7 +899,7 @@ msgstr ""
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7
#: lib/block_scout_web/views/address_view.ex:350 #: lib/block_scout_web/views/address_view.ex:348
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:119 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:119
#: lib/block_scout_web/views/tokens/overview_view.ex:40 #: lib/block_scout_web/views/tokens/overview_view.ex:40
#: lib/block_scout_web/views/transaction_view.ex:395 #: lib/block_scout_web/views/transaction_view.ex:395
@ -1798,7 +1798,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:46 #: lib/block_scout_web/templates/address/_tabs.html.eex:46
#: lib/block_scout_web/templates/address_validation/index.html.eex:13 #: lib/block_scout_web/templates/address_validation/index.html.eex:13
#: lib/block_scout_web/views/address_view.ex:358 #: lib/block_scout_web/views/address_view.ex:356
msgid "Blocks Validated" msgid "Blocks Validated"
msgstr "" msgstr ""
@ -1808,18 +1808,18 @@ msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:351 #: lib/block_scout_web/views/address_view.ex:349
msgid "Code" msgid "Code"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/views/address_view.ex:357 #: lib/block_scout_web/views/address_view.ex:355
msgid "Coin Balance History" msgid "Coin Balance History"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/address_view.ex:352 #: lib/block_scout_web/views/address_view.ex:350
msgid "Decompiled Code" msgid "Decompiled Code"
msgstr "" msgstr ""
@ -1828,7 +1828,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:348 #: lib/block_scout_web/views/address_view.ex:346
#: lib/block_scout_web/views/transaction_view.ex:396 #: lib/block_scout_web/views/transaction_view.ex:396
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -1838,7 +1838,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8 #: lib/block_scout_web/templates/address_logs/index.html.eex:8
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:359 #: lib/block_scout_web/views/address_view.ex:357
#: lib/block_scout_web/views/transaction_view.ex:397 #: lib/block_scout_web/views/transaction_view.ex:397
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -1846,7 +1846,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:79 #: lib/block_scout_web/templates/address/_tabs.html.eex:79
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25
#: lib/block_scout_web/views/address_view.ex:353 #: lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/tokens/overview_view.ex:42 #: lib/block_scout_web/views/tokens/overview_view.ex:42
msgid "Read Contract" msgid "Read Contract"
msgstr "" msgstr ""
@ -1858,7 +1858,7 @@ msgstr ""
#: lib/block_scout_web/templates/layout/_topnav.html.eex:87 #: lib/block_scout_web/templates/layout/_topnav.html.eex:87
#: lib/block_scout_web/templates/layout/_topnav.html.eex:108 #: lib/block_scout_web/templates/layout/_topnav.html.eex:108
#: lib/block_scout_web/templates/tokens/index.html.eex:4 #: lib/block_scout_web/templates/tokens/index.html.eex:4
#: lib/block_scout_web/views/address_view.ex:347 #: lib/block_scout_web/views/address_view.ex:345
msgid "Tokens" msgid "Tokens"
msgstr "" msgstr ""
@ -1869,7 +1869,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18 #: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:238 #: lib/block_scout_web/templates/chain/show.html.eex:238
#: lib/block_scout_web/templates/layout/_topnav.html.eex:53 #: lib/block_scout_web/templates/layout/_topnav.html.eex:53
#: lib/block_scout_web/views/address_view.ex:349 #: lib/block_scout_web/views/address_view.ex:347
msgid "Transactions" msgid "Transactions"
msgstr "" msgstr ""
@ -1909,13 +1909,13 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:86 #: lib/block_scout_web/templates/address/_tabs.html.eex:86
#: lib/block_scout_web/views/address_view.ex:354 #: lib/block_scout_web/views/address_view.ex:352
msgid "Read Proxy" msgid "Read Proxy"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:93 #: lib/block_scout_web/templates/address/_tabs.html.eex:93
#: lib/block_scout_web/views/address_view.ex:355 #: lib/block_scout_web/views/address_view.ex:353
msgid "Write Contract" msgid "Write Contract"
msgstr "" msgstr ""
@ -1932,7 +1932,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:100 #: lib/block_scout_web/templates/address/_tabs.html.eex:100
#: lib/block_scout_web/views/address_view.ex:356 #: lib/block_scout_web/views/address_view.ex:354
msgid "Write Proxy" msgid "Write Proxy"
msgstr "" msgstr ""

@ -5326,10 +5326,20 @@ defmodule Explorer.Chain do
if implementation_method_abi, do: true, else: false if implementation_method_abi, do: true, else: false
end end
def proxy_contract?(abi) when is_nil(abi) do def proxy_contract?(abi) when is_nil(abi), do: false
false
def gnosis_safe_contract?(abi) when not is_nil(abi) do
implementation_method_abi =
abi
|> Enum.find(fn method ->
master_copy_pattern?(method)
end)
if implementation_method_abi, do: true, else: false
end end
def gnosis_safe_contract?(abi) when is_nil(abi), do: false
def get_implementation_address_hash(proxy_address_hash, abi) def get_implementation_address_hash(proxy_address_hash, abi)
when not is_nil(proxy_address_hash) and not is_nil(abi) do when not is_nil(proxy_address_hash) and not is_nil(abi) do
implementation_method_abi = implementation_method_abi =

Loading…
Cancel
Save