From ed6259da258dbdb6139e48ffa3fc6fe41815e5e3 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 21 Oct 2020 16:54:05 +0300 Subject: [PATCH] Add links to contract libraries --- CHANGELOG.md | 1 + .../templates/address_contract/index.html.eex | 2 +- .../lib/block_scout_web/views/address_contract_view.ex | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9374fa40c..811a4a33ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#3377](https://github.com/poanetwork/blockscout/pull/3377) - Add links to contract libraries - [#2292](https://github.com/poanetwork/blockscout/pull/2292), [#3356](https://github.com/poanetwork/blockscout/pull/3356), [#3359](https://github.com/poanetwork/blockscout/pull/3359), [#3360](https://github.com/poanetwork/blockscout/pull/3360), [#3365](https://github.com/poanetwork/blockscout/pull/3365) - Add Web UI for POSDAO Staking DApp - [#3354](https://github.com/poanetwork/blockscout/pull/3354) - Tx hash in EOA coin balance history - [#3333](https://github.com/poanetwork/blockscout/pull/3333), [#3337](https://github.com/poanetwork/blockscout/pull/3337) - Dark forest contract custom theme diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex index 7fa5ef23d1..df111a0c0f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex @@ -145,7 +145,7 @@

<%= gettext "External libraries" %>

-
<%= raw(format_external_libraries(target_contract.external_libraries)) %>
+              
<%= raw(format_external_libraries(target_contract.external_libraries, @conn)) %>
               
diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex index 1f2c9aa667..8608015071 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex @@ -82,9 +82,10 @@ defmodule BlockScoutWeb.AddressContractView do |> TypeDecoder.decode_raw(types) end - def format_external_libraries(libraries) do + def format_external_libraries(libraries, conn) do Enum.reduce(libraries, "", fn %{name: name, address_hash: address_hash}, acc -> - "#{acc}#{name} : #{address_hash} \n" + address = get_address(address_hash) + "#{acc}#{name} : #{get_formatted_address_data(address, address_hash, conn)} \n" end) end