Functions to support GnosisSafe link

pull/3421/head
Victor Baranov 4 years ago
parent cb0d50c7d8
commit 6829890875
  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
### 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
- [#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

@ -294,9 +294,7 @@ defmodule BlockScoutWeb.AddressView do
address.contracts_creation_transaction.from_address_hash
end
def from_address_hash(_address) do
nil
end
def from_address_hash(_address), do: nil
def address_link_to_other_explorer(link, address, full) do
if full do
@ -383,4 +381,10 @@ defmodule BlockScoutWeb.AddressView do
true -> "#{to_string(address)}"
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

@ -899,7 +899,7 @@ msgstr ""
#: 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_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/overview_view.ex:40
#: lib/block_scout_web/views/transaction_view.ex:395
@ -1798,7 +1798,7 @@ msgstr ""
#, elixir-format
#: 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/views/address_view.ex:358
#: lib/block_scout_web/views/address_view.ex:356
msgid "Blocks Validated"
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/_eth_rpc_item.html.eex:126
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:352
#: lib/block_scout_web/views/address_view.ex:350
msgid "Decompiled Code"
msgstr ""
@ -1828,7 +1828,7 @@ msgstr ""
#: 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_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
msgid "Internal Transactions"
msgstr ""
@ -1838,7 +1838,7 @@ msgstr ""
#: 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_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
msgid "Logs"
msgstr ""
@ -1846,7 +1846,7 @@ msgstr ""
#, elixir-format
#: 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/views/address_view.ex:353
#: lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/tokens/overview_view.ex:42
msgid "Read Contract"
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:108
#: 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"
msgstr ""
@ -1869,7 +1869,7 @@ msgstr ""
#: 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/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"
msgstr ""
@ -1909,13 +1909,13 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -1932,7 +1932,7 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""

@ -899,7 +899,7 @@ msgstr ""
#: 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_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/overview_view.ex:40
#: lib/block_scout_web/views/transaction_view.ex:395
@ -1798,7 +1798,7 @@ msgstr ""
#, elixir-format
#: 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/views/address_view.ex:358
#: lib/block_scout_web/views/address_view.ex:356
msgid "Blocks Validated"
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/_eth_rpc_item.html.eex:126
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:352
#: lib/block_scout_web/views/address_view.ex:350
msgid "Decompiled Code"
msgstr ""
@ -1828,7 +1828,7 @@ msgstr ""
#: 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_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
msgid "Internal Transactions"
msgstr ""
@ -1838,7 +1838,7 @@ msgstr ""
#: 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_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
msgid "Logs"
msgstr ""
@ -1846,7 +1846,7 @@ msgstr ""
#, elixir-format
#: 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/views/address_view.ex:353
#: lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/tokens/overview_view.ex:42
msgid "Read Contract"
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:108
#: 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"
msgstr ""
@ -1869,7 +1869,7 @@ msgstr ""
#: 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/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"
msgstr ""
@ -1909,13 +1909,13 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -1932,7 +1932,7 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""

@ -5326,10 +5326,20 @@ defmodule Explorer.Chain do
if implementation_method_abi, do: true, else: false
end
def proxy_contract?(abi) when is_nil(abi) do
false
def proxy_contract?(abi) when is_nil(abi), do: 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
def gnosis_safe_contract?(abi) when is_nil(abi), do: false
def get_implementation_address_hash(proxy_address_hash, abi)
when not is_nil(proxy_address_hash) and not is_nil(abi) do
implementation_method_abi =

Loading…
Cancel
Save