Add links to contract libraries

pull/3377/head
Victor Baranov 4 years ago
parent bf53cf51fc
commit ed6259da25
  1. 1
      CHANGELOG.md
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex
  3. 5
      apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex

@ -1,6 +1,7 @@
## Current ## Current
### Features ### 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 - [#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 - [#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 - [#3333](https://github.com/poanetwork/blockscout/pull/3333), [#3337](https://github.com/poanetwork/blockscout/pull/3337) - Dark forest contract custom theme

@ -145,7 +145,7 @@
<h3><%= gettext "External libraries" %></h3> <h3><%= gettext "External libraries" %></h3>
</div> </div>
<div class="tile tile-muted mb-4"> <div class="tile tile-muted mb-4">
<pre class="pre-wrap pre-scrollable"><code class="nohighlight"><%= raw(format_external_libraries(target_contract.external_libraries)) %></code> <pre class="pre-wrap pre-scrollable"><code class="nohighlight"><%= raw(format_external_libraries(target_contract.external_libraries, @conn)) %></code>
</pre> </pre>
</div> </div>
</section> </section>

@ -82,9 +82,10 @@ defmodule BlockScoutWeb.AddressContractView do
|> TypeDecoder.decode_raw(types) |> TypeDecoder.decode_raw(types)
end 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 -> Enum.reduce(libraries, "", fn %{name: name, address_hash: address_hash}, acc ->
"#{acc}<span class=\"hljs-title\">#{name}</span> : #{address_hash} \n" address = get_address(address_hash)
"#{acc}<span class=\"hljs-title\">#{name}</span> : #{get_formatted_address_data(address, address_hash, conn)} \n"
end) end)
end end

Loading…
Cancel
Save