Merge branch 'master' into allowed-evm-versions

pull/1964/head
Victor Baranov 6 years ago committed by GitHub
commit 0044b72715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .circleci/config.yml
  2. 8
      CHANGELOG.md
  3. 49
      apps/block_scout_web/assets/css/theme/_ether1_variables.scss
  4. 1
      apps/block_scout_web/assets/css/theme/_variables.scss
  5. 70
      apps/block_scout_web/assets/js/lib/async_listing_load.js
  6. 44
      apps/block_scout_web/assets/static/images/ether1_logo.svg
  7. 70
      apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex
  8. 4
      apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex
  9. 20
      apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex
  10. 19
      apps/block_scout_web/lib/block_scout_web/etherscan.ex
  11. 15
      apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex
  12. 25
      apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex
  13. 25
      apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex
  14. 25
      apps/block_scout_web/lib/block_scout_web/templates/address_token_transfer/index.html.eex
  15. 25
      apps/block_scout_web/lib/block_scout_web/templates/address_transaction/index.html.eex
  16. 24
      apps/block_scout_web/lib/block_scout_web/templates/address_validation/index.html.eex
  17. 25
      apps/block_scout_web/lib/block_scout_web/templates/block/index.html.eex
  18. 13
      apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex
  19. 23
      apps/block_scout_web/lib/block_scout_web/templates/common_components/_pagination_container.html.eex
  20. 18
      apps/block_scout_web/lib/block_scout_web/templates/pending_transaction/index.html.eex
  21. 23
      apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex
  22. 25
      apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex
  23. 25
      apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex
  24. 14
      apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/index.html.eex
  25. 2
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  26. 12
      apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex
  27. 0
      apps/block_scout_web/lib/block_scout_web/views/common_components_view.ex
  28. 2
      apps/block_scout_web/mix.exs
  29. 85
      apps/block_scout_web/priv/gettext/default.pot
  30. 94
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  31. 13
      apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs
  32. 28
      apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs
  33. 20
      apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs
  34. 156
      apps/explorer/lib/explorer/chain.ex
  35. 4
      apps/explorer/lib/explorer/chain/address.ex
  36. 14
      apps/explorer/lib/explorer/chain/import/runner/addresses.ex
  37. 26
      apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex
  38. 2
      apps/explorer/lib/explorer/smart_contract/solc_downloader.ex
  39. 14
      apps/explorer/priv/repo/migrations/20190516140202_add_address_hash_index_to_decompiled_smart_contracts.exs
  40. 18
      apps/explorer/priv/repo/migrations/20190516160535_add_decompiled_and_verified_flag_to_addresses.exs
  41. 6
      apps/explorer/test/explorer/chain_test.exs
  42. 5
      apps/explorer/test/support/factory.ex
  43. 3
      docker/Makefile
  44. 2
      mix.lock

@ -480,7 +480,7 @@ jobs:
command: dockerize -wait tcp://localhost:5432 -timeout 1m command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: - run:
name: mix test --exclude no_geth name: mix test --exclude no_parity
command: | command: |
# Don't submit coverage report for forks, but let the build succeed # Don't submit coverage report for forks, but let the build succeed
if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then
@ -534,7 +534,7 @@ jobs:
command: dockerize -wait tcp://localhost:5432 -timeout 1m command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: - run:
name: mix test --exclude no_geth name: mix test --exclude no_parity
command: | command: |
# Don't submit coverage report for forks, but let the build succeed # Don't submit coverage report for forks, but let the build succeed
if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then

@ -1,4 +1,5 @@
## Current ## Current
- [#2000](https://github.com/poanetwork/blockscout/pull/2000) - docker/Makefile: always set a container name
### Features ### Features
- [#1963](https://github.com/poanetwork/blockscout/pull/1963) - added rinkeby theme and rinkeby logo - [#1963](https://github.com/poanetwork/blockscout/pull/1963) - added rinkeby theme and rinkeby logo
@ -26,7 +27,11 @@
- [#1956](https://github.com/poanetwork/blockscout/pull/1956) - add logs tab to address - [#1956](https://github.com/poanetwork/blockscout/pull/1956) - add logs tab to address
- [#1933](https://github.com/poanetwork/blockscout/pull/1933) - add eth_BlockNumber json rpc method - [#1933](https://github.com/poanetwork/blockscout/pull/1933) - add eth_BlockNumber json rpc method
- [#1952](https://github.com/poanetwork/blockscout/pull/1952) - feat: exclude empty contracts by default - [#1952](https://github.com/poanetwork/blockscout/pull/1952) - feat: exclude empty contracts by default
- [#1989](https://github.com/poanetwork/blockscout/pull/1989) - fix: consolidate address w/ balance one at a time
- [#1954](https://github.com/poanetwork/blockscout/pull/1954) - feat: use creation init on self destruct - [#1954](https://github.com/poanetwork/blockscout/pull/1954) - feat: use creation init on self destruct
- [#1974](https://github.com/poanetwork/blockscout/pull/1974) - feat: previous page button logic
- [#1999](https://github.com/poanetwork/blockscout/pull/1999) - load data async on addresses page
- [#2002](https://github.com/poanetwork/blockscout/pull/2002) - Get estimated count of blocks when cache is empty
### Fixes ### Fixes
@ -51,6 +56,8 @@
- [#1937](https://github.com/poanetwork/blockscout/pull/1937) - Check the presence of overlap[i] object before retrieving properties from it - [#1937](https://github.com/poanetwork/blockscout/pull/1937) - Check the presence of overlap[i] object before retrieving properties from it
- [#1960](https://github.com/poanetwork/blockscout/pull/1960) - do not remove bold text in decompiled contacts - [#1960](https://github.com/poanetwork/blockscout/pull/1960) - do not remove bold text in decompiled contacts
- [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block - [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block
- [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling
- [#1966](https://github.com/poanetwork/blockscout/pull/1966) - fix: add fields for contract filter performance
### Chore ### Chore
@ -61,6 +68,7 @@
- [#1958](https://github.com/poanetwork/blockscout/pull/1958) - Default value for release link env var - [#1958](https://github.com/poanetwork/blockscout/pull/1958) - Default value for release link env var
- [#1964](https://github.com/poanetwork/blockscout/pull/1964) - ALLOWED_EVM_VERSIONS env var - [#1964](https://github.com/poanetwork/blockscout/pull/1964) - ALLOWED_EVM_VERSIONS env var
- [#1975](https://github.com/poanetwork/blockscout/pull/1975) - add log index to transaction view - [#1975](https://github.com/poanetwork/blockscout/pull/1975) - add log index to transaction view
- [#1988](https://github.com/poanetwork/blockscout/pull/1988) - Fix wrong parity tasks names in Circle CI
## 1.3.10-beta ## 1.3.10-beta

@ -0,0 +1,49 @@
// general
$primary: #840032;
$secondary: #343434;
$tertiary: #7f7f7f;
$additional-font: #ff95db;
// footer
$footer-background-color: $primary;
$footer-title-color: #fff;
$footer-text-color: #fff;
$footer-item-disc-color: $secondary;
// dashboard
$dashboard-line-color-price: $tertiary; // price left border
$dashboard-banner-chart-legend-value-color: $additional-font; // chart labels
$dashboard-stats-item-value-color: $additional-font; // stat values
$dashboard-stats-item-border-color: $secondary; // stat border
$dashboard-banner-gradient-start: $primary; // gradient begin
$dashboard-banner-gradient-end: lighten($primary, 5); // gradient end
$dashboard-banner-network-plain-container-background-color: #4b021e; // stats bg
// navigation
.navbar { box-shadow: 0px 0px 30px 0px rgba(75, 2, 30, 0.12); } // header shadow
$header-icon-border-color-hover: $tertiary; // top border on hover
$header-icon-color-hover: $tertiary; // nav icon on hover
.dropdown-item:hover, .dropdown-item:focus { background-color: $tertiary !important; } // dropdown item on hover
// buttons
$btn-line-bg: #fff; // button bg
$btn-line-color: #4b021e; // button border and font color && hover bg color
$btn-copy-color: #4b021e; // btn copy
$btn-qr-color: #4b021e; // btn qr-code
//links & tile
.tile a { color: $tertiary !important; } // links color for badges
.tile-type-block {
border-left: 4px solid #4b021e;
} // tab active bg
// card
$card-background-1: $tertiary;
$card-tab-active: $tertiary;

@ -3,6 +3,7 @@
// @import "dai_variables"; // @import "dai_variables";
// @import "ethereum_classic_variables"; // @import "ethereum_classic_variables";
// @import "ethereum_variables"; // @import "ethereum_variables";
// @import "ether1_variables";
// @import "expanse_variables"; // @import "expanse_variables";
// @import "gochain_variables"; // @import "gochain_variables";
// @import "goerli_variables"; // @import "goerli_variables";

@ -51,7 +51,11 @@ export const asyncInitialState = {
/* if it is loading the first page */ /* if it is loading the first page */
loadingFirstPage: true, loadingFirstPage: true,
/* link to the next page */ /* link to the next page */
nextPagePath: null nextPagePath: null,
/* link to the previous page */
prevPagePath: null,
/* visited pages */
pagesStack: []
} }
export function asyncReducer (state = asyncInitialState, action) { export function asyncReducer (state = asyncInitialState, action) {
@ -78,15 +82,35 @@ export function asyncReducer (state = asyncInitialState, action) {
}) })
} }
case 'ITEMS_FETCHED': { case 'ITEMS_FETCHED': {
var prevPagePath = null
if (state.pagesStack.length >= 2) {
prevPagePath = state.pagesStack[state.pagesStack.length - 2]
}
return Object.assign({}, state, { return Object.assign({}, state, {
requestError: false, requestError: false,
items: action.items, items: action.items,
nextPagePath: action.nextPagePath nextPagePath: action.nextPagePath,
prevPagePath: prevPagePath
}) })
} }
case 'NAVIGATE_TO_OLDER': { case 'NAVIGATE_TO_OLDER': {
history.replaceState({}, null, state.nextPagePath) history.replaceState({}, null, state.nextPagePath)
if (state.pagesStack.length === 0) {
state.pagesStack.push(window.location.href.split('?')[0])
}
state.pagesStack.push(state.nextPagePath)
return Object.assign({}, state, { beyondPageOne: true })
}
case 'NAVIGATE_TO_NEWER': {
history.replaceState({}, null, state.prevPagePath)
state.pagesStack.pop()
return Object.assign({}, state, { beyondPageOne: true }) return Object.assign({}, state, { beyondPageOne: true })
} }
default: default:
@ -153,6 +177,25 @@ export const elements = {
$el.attr('href', state.nextPagePath) $el.attr('href', state.nextPagePath)
} }
}, },
'[data-async-listing] [data-prev-page-button]': {
render ($el, state) {
if (state.requestError || !state.prevPagePath || state.loading) {
return $el.attr('disabled', 'disabled')
}
$el.attr('disabled', false)
$el.attr('href', state.prevPagePath)
}
},
'[data-async-listing] [data-page-number]': {
render ($el, state) {
if (state.pagesStack.length === 0) {
return $el.text('Page 1')
}
$el.text('Page ' + state.pagesStack.length)
}
},
'[data-async-listing] [data-loading-button]': { '[data-async-listing] [data-loading-button]': {
render ($el, state) { render ($el, state) {
if (!state.loadingFirstPage && state.loading) return $el.show() if (!state.loadingFirstPage && state.loading) return $el.show()
@ -193,7 +236,7 @@ export function createAsyncLoadStore (reducer, initialState, itemKey) {
function firstPageLoad (store) { function firstPageLoad (store) {
const $element = $('[data-async-listing]') const $element = $('[data-async-listing]')
function loadItems () { function loadItemsNext () {
const path = store.getState().nextPagePath const path = store.getState().nextPagePath
store.dispatch({type: 'START_REQUEST'}) store.dispatch({type: 'START_REQUEST'})
$.getJSON(path, {type: 'JSON'}) $.getJSON(path, {type: 'JSON'})
@ -201,18 +244,33 @@ function firstPageLoad (store) {
.fail(() => store.dispatch({type: 'REQUEST_ERROR'})) .fail(() => store.dispatch({type: 'REQUEST_ERROR'}))
.always(() => store.dispatch({type: 'FINISH_REQUEST'})) .always(() => store.dispatch({type: 'FINISH_REQUEST'}))
} }
loadItems()
function loadItemsPrev () {
const path = store.getState().prevPagePath
store.dispatch({type: 'START_REQUEST'})
$.getJSON(path, {type: 'JSON'})
.done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response))))
.fail(() => store.dispatch({type: 'REQUEST_ERROR'}))
.always(() => store.dispatch({type: 'FINISH_REQUEST'}))
}
loadItemsNext()
$element.on('click', '[data-error-message]', (event) => { $element.on('click', '[data-error-message]', (event) => {
event.preventDefault() event.preventDefault()
loadItems() loadItemsNext()
}) })
$element.on('click', '[data-next-page-button]', (event) => { $element.on('click', '[data-next-page-button]', (event) => {
event.preventDefault() event.preventDefault()
loadItems() loadItemsNext()
store.dispatch({type: 'NAVIGATE_TO_OLDER'}) store.dispatch({type: 'NAVIGATE_TO_OLDER'})
}) })
$element.on('click', '[data-prev-page-button]', (event) => {
event.preventDefault()
loadItemsPrev()
store.dispatch({type: 'NAVIGATE_TO_NEWER'})
})
} }
const $element = $('[data-async-load]') const $element = $('[data-async-load]')

@ -0,0 +1,44 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 681.502">
<linearGradient id="a" x1="92.465" x2="99.047" y1="689.896" y2="446.357" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff"/>
<stop offset=".19" stop-color="#e2e2e2"/>
<stop offset=".589" stop-color="#d5d5d5"/>
<stop offset=".868" stop-color="#c6c6c6"/>
<stop offset="1" stop-color="#b7b7b7"/>
</linearGradient>
<path fill="url(#a)" d="M191.506 496.463L1.681 392.807l189.825 288.695z"/>
<linearGradient id="b" x1="246.495" x2="109.916" y1="458.546" y2="613.226" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff"/>
<stop offset="1" stop-color="#fff" stop-opacity="0"/>
</linearGradient>
<path fill="url(#b)" d="M191.506 496.463l-81.21-44.346 81.21 229.385z" opacity=".5"/>
<linearGradient id="c" x1="296.634" x2="303.216" y1="695.414" y2="451.875" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff"/>
<stop offset=".19" stop-color="#e2e2e2"/>
<stop offset=".589" stop-color="#cfcfcf"/>
<stop offset=".868" stop-color="#ccc"/>
<stop offset="1" stop-color="#bababa"/>
</linearGradient>
<path fill="url(#c)" d="M208.501 681.502l189.821-288.695-189.821 103.656z"/>
<linearGradient id="d" x1="162.391" x2="326.945" y1="6.627" y2="477.251" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff"/>
<stop offset=".19" stop-color="#e2e2e2"/>
<stop offset=".589" stop-color="#ccc"/>
<stop offset=".868" stop-color="#bdbdbd"/>
<stop offset="1" stop-color="#a3a3a3"/>
</linearGradient>
<path fill="url(#d)" d="M400 346.41L200.003.006v453.968z"/>
<linearGradient id="e" x1="-50.463" x2="215.339" y1="226.987" y2="226.987" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff"/>
<stop offset=".19" stop-color="#efefef"/>
<stop offset=".589" stop-color="#cfcfcf"/>
<stop offset=".868" stop-color="#c6c6c6"/>
<stop offset="1" stop-color="#c6c6c6"/>
</linearGradient>
<path fill="url(#e)" d="M200 0L0 346.41l200 107.564h.003V.006z"/>
<linearGradient id="f" x1="254.812" x2="91.355" y1="159.307" y2="361.159" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff"/>
<stop offset="1" stop-color="#fff" stop-opacity="0"/>
</linearGradient>
<path fill="url(#f)" d="M120.273 138.091L200.003.006v453.968z" opacity=".5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -3,11 +3,13 @@ defmodule BlockScoutWeb.AddressController do
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
alias BlockScoutWeb.AddressView
alias Explorer.{Chain, Market} alias Explorer.{Chain, Market}
alias Explorer.Chain.Address alias Explorer.Chain.Address
alias Explorer.ExchangeRates.Token alias Explorer.ExchangeRates.Token
alias Phoenix.View
def index(conn, params) do def index(conn, %{"type" => "JSON"} = params) do
addresses = addresses =
params params
|> paging_options() |> paging_options()
@ -15,41 +17,51 @@ defmodule BlockScoutWeb.AddressController do
{addresses_page, next_page} = split_list_by_page(addresses) {addresses_page, next_page} = split_list_by_page(addresses)
cur_page_number =
cond do
!params["prev_page_number"] -> 1
params["next_page"] -> String.to_integer(params["prev_page_number"]) + 1
params["prev_page"] -> String.to_integer(params["prev_page_number"]) - 1
end
next_page_path = next_page_path =
case next_page_params(next_page, addresses_page, params) do case next_page_params(next_page, addresses_page, params) do
nil -> nil ->
nil nil
next_page_params -> next_page_params ->
next_params =
next_page_params
|> Map.put("prev_page_path", cur_page_path(conn, params))
|> Map.put("next_page", true)
|> Map.put("prev_page_number", cur_page_number)
address_path( address_path(
conn, conn,
:index, :index,
next_params next_page_params
) )
end end
exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null()
total_supply = Chain.total_supply()
items =
addresses_page
|> Enum.with_index(1)
|> Enum.map(fn {{address, tx_count}, index} ->
View.render_to_string(
AddressView,
"_tile.html",
address: address,
index: index,
exchange_rate: exchange_rate,
total_supply: total_supply,
tx_count: tx_count,
validation_count: validation_count(address)
)
end)
json(
conn,
%{
items: items,
next_page_path: next_page_path
}
)
end
def index(conn, _params) do
render(conn, "index.html", render(conn, "index.html",
address_tx_count_pairs: addresses_page, current_path: current_path(conn),
page_address_count: Enum.count(addresses_page), address_count: Chain.count_addresses_with_balance_from_cache()
address_count: Chain.count_addresses_with_balance_from_cache(),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
total_supply: Chain.total_supply(),
next_page_path: next_page_path,
prev_page_path: params["prev_page_path"],
cur_page_number: cur_page_number
) )
end end
@ -64,16 +76,4 @@ defmodule BlockScoutWeb.AddressController do
def validation_count(%Address{} = address) do def validation_count(%Address{} = address) do
Chain.address_to_validation_count(address) Chain.address_to_validation_count(address)
end end
defp cur_page_path(conn, %{"hash" => _hash, "fetched_coin_balance" => _balance} = params) do
new_params = Map.put(params, "next_page", false)
address_path(
conn,
:index,
new_params
)
end
defp cur_page_path(conn, _), do: address_path(conn, :index)
end end

@ -98,10 +98,10 @@ defmodule BlockScoutWeb.API.RPC.ContractController do
Chain.list_decompiled_contracts(page_size, offset, not_decompiled_with_version) Chain.list_decompiled_contracts(page_size, offset, not_decompiled_with_version)
:unverified -> :unverified ->
Chain.list_unverified_contracts(page_size, offset) Chain.list_unordered_unverified_contracts(page_size, offset)
:not_decompiled -> :not_decompiled ->
Chain.list_not_decompiled_contracts(page_size, offset) Chain.list_unordered_not_decompiled_contracts(page_size, offset)
:empty -> :empty ->
Chain.list_empty_contracts(page_size, offset) Chain.list_empty_contracts(page_size, offset)

@ -0,0 +1,20 @@
defmodule BlockScoutWeb.PaginationHelpers do
@moduledoc """
Common pagination logic helpers.
"""
def current_page_number(params) do
cond do
!params["prev_page_number"] -> 1
params["next_page"] -> String.to_integer(params["prev_page_number"]) + 1
params["prev_page"] -> String.to_integer(params["prev_page_number"]) - 1
end
end
def add_navigation_params(params, current_page_path, current_page_number) do
params
|> Map.put("prev_page_path", current_page_path)
|> Map.put("next_page", true)
|> Map.put("prev_page_number", current_page_number)
end
end

@ -862,11 +862,6 @@ defmodule BlockScoutWeb.Etherscan do
name: "Contract", name: "Contract",
fields: %{ fields: %{
"Address" => @address_hash_type, "Address" => @address_hash_type,
"DecompilerVersion" => %{
type: "decompiler version",
definition: "When decompiled source code is present, the decompiler version with which it was generated.",
example: "decompiler.version"
},
"ABI" => %{ "ABI" => %{
type: "ABI", type: "ABI",
definition: "JSON string for the contract's Application Binary Interface (ABI)", definition: "JSON string for the contract's Application Binary Interface (ABI)",
@ -938,9 +933,16 @@ defmodule BlockScoutWeb.Etherscan do
""" """
} }
@contract_decompiler_version_type %{
type: "decompiler version",
definition: "When decompiled source code is present, the decompiler version with which it was generated.",
example: "decompiler.version"
}
@contract_with_sourcecode_model @contract_model @contract_with_sourcecode_model @contract_model
|> put_in([:fields, "SourceCode"], @contract_source_code_type) |> put_in([:fields, "SourceCode"], @contract_source_code_type)
|> put_in([:fields, "DecompiledSourceCode"], @contract_decompiled_source_code_type) |> put_in([:fields, "DecompiledSourceCode"], @contract_decompiled_source_code_type)
|> put_in([:fields, "DecompilerVersion"], @contract_decompiler_version_type)
@transaction_receipt_status_model %{ @transaction_receipt_status_model %{
name: "TransactionReceiptStatus", name: "TransactionReceiptStatus",
@ -1831,7 +1833,12 @@ defmodule BlockScoutWeb.Etherscan do
@contract_listcontracts_action %{ @contract_listcontracts_action %{
name: "listcontracts", name: "listcontracts",
description: "Get a list of contracts, sorted ascending by the time they were first seen by the explorer.", description: """
Get a list of contracts, sorted ascending by the time they were first seen by the explorer.
If you provide the filters `not_decompiled`(`4`) or `not_verified(4)` the results will not
be sorted for performance reasons.
""",
required_params: [], required_params: [],
optional_params: [ optional_params: [
%{ %{

@ -1,20 +1,13 @@
<section class="container"> <section class="container">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body" data-async-load data-async-listing="<%= @current_path %>">
<h1 class="card-title"><%= gettext "Addresses" %></h1> <h1 class="card-title"><%= gettext "Addresses" %></h1>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", prev_page_path: @prev_page_path, next_page_path: @next_page_path, cur_page_number: @cur_page_number, show_pagination_limit: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %>
<div data-selector="top-addresses-list"> <div data-items data-selector="top-addresses-list"></div>
<%= for {{address, tx_count}, index} <- Enum.with_index(@address_tx_count_pairs, 1) do %>
<%= render "_tile.html",
address: address, index: index, exchange_rate: @exchange_rate,
total_supply: @total_supply, tx_count: tx_count,
validation_count: validation_count(address) %>
<% end %>
</div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", prev_page_path: @prev_page_path, next_page_path: @next_page_path, cur_page_number: @cur_page_number, show_pagination_limit: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %>
</div> </div>
</div> </div>
</section> </section>

@ -28,7 +28,7 @@
<canvas data-chart="coinBalanceHistoryChart" data-coin_balance_history_data_path="<%= address_coin_balance_by_day_path(@conn, :index, @address) %>" width="350" height="152"></canvas> <canvas data-chart="coinBalanceHistoryChart" data-coin_balance_history_data_path="<%= address_coin_balance_by_day_path(@conn, :index, @address) %>" width="350" height="152"></canvas>
</div> </div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<button data-error-message class="alert alert-danger col-12 text-left" style="display: none;"> <button data-error-message class="alert alert-danger col-12 text-left" style="display: none;">
<span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span> <span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span>
@ -40,31 +40,10 @@
</div> </div>
</div> </div>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading balances") %>...
</div>
<div data-selector="coin-balances-list" data-items></div> <div data-selector="coin-balances-list" data-items></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</section> </section>
</section> </section>

@ -55,7 +55,7 @@
</div> </div>
</div> </div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<button data-error-message class="alert alert-danger col-12 text-left" style="display: none;"> <button data-error-message class="alert alert-danger col-12 text-left" style="display: none;">
<span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span> <span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span>
@ -65,30 +65,11 @@
<span data-selector="empty-internal-transactions-list"><%= gettext "There are no internal transactions for this address." %></span> <span data-selector="empty-internal-transactions-list"><%= gettext "There are no internal transactions for this address." %></span>
</div> </div>
</div> </div>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
<div data-items></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <div data-items></div>
<!-- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>
</section> </section>

@ -9,15 +9,7 @@
<span class="text-muted"><%= gettext "Tokens" %></span> / <%= token_name(@token) %> <span class="text-muted"><%= gettext "Tokens" %></span> / <%= token_name(@token) %>
</h2> </h2>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading...") %>
</div>
<div data-empty-response-message class="tile tile-muted text-center" style="display: none;"> <div data-empty-response-message class="tile tile-muted text-center" style="display: none;">
<span><%= gettext "There are no token transfers for this address." %></span> <span><%= gettext "There are no token transfers for this address." %></span>
@ -31,21 +23,8 @@
<div data-items></div> <div data-items></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a data-next-page-button href="#" class="button button-secondary button-small float-right mt-4" style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div data-loading-button class="button button-secondary button-small float-right mt-4" style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>
</section> </section>

@ -51,7 +51,7 @@
</div> </div>
</div> </div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<button data-error-message class="alert alert-danger col-12 text-left" style="display: none;"> <button data-error-message class="alert alert-danger col-12 text-left" style="display: none;">
<span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span> <span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span>
@ -63,31 +63,10 @@
</div> </div>
</div> </div>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
<div data-items></div> <div data-items></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>
</section> </section>

@ -12,15 +12,8 @@
</div> </div>
<h2 class="card-title"><%=gettext("Blocks Validated")%></h2> <h2 class="card-title"><%=gettext("Blocks Validated")%></h2>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading...") %>
</div>
<div data-empty-response-message class="tile tile-muted text-center" style="display: none;"> <div data-empty-response-message class="tile tile-muted text-center" style="display: none;">
<span><%= gettext "There are no blocks validated by this address." %></span> <span><%= gettext "There are no blocks validated by this address." %></span>
</div> </div>
@ -31,21 +24,8 @@
</button> </button>
<div data-items data-selector="validations-list"></div> <div data-items data-selector="validations-list"></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a data-next-page-button href="#" class="button button-secondary button-small float-right mt-4" style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div data-loading-button class="button button-secondary button-small float-right mt-4" style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading...") %>
</div>
</div> <!-- Card Body --> </div> <!-- Card Body -->
</div> <!-- Card --> </div> <!-- Card -->
<section> <section>

@ -9,35 +9,14 @@
<h1 class="card-title"><%= gettext("%{block_type}s", block_type: @block_type) %></h1> <h1 class="card-title"><%= gettext("%{block_type}s", block_type: @block_type) %></h1>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
<div data-items></div> <div data-items></div>
<div data-empty-response-message style="display: none;"> <div data-empty-response-message style="display: none;">
<span><%= gettext "There are no blocks." %></span> <span><%= gettext "There are no blocks." %></span>
</div> </div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>

@ -44,19 +44,6 @@
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true %>
<% end %> <% end %>
<!--
<%= if @next_page_params do %>
<%= link(
gettext("Older"),
class: "button button-secondary button-sm float-right mt-3",
to: transaction_path(
@conn,
:index,
@next_page_params
)
) %>
<% end %>
-->
</div> </div>
</div> </div>
</section> </section>

@ -1,5 +1,5 @@
<div class='pagination-container <%= if assigns[:position] == "top" do %>position-top<% end %> <%= if assigns[:position] == "bottom" do %>position-bottom<% end %>'> <div class='pagination-container <%= if assigns[:position] == "top" do %>position-top<% end %> <%= if assigns[:position] == "bottom" do %>position-bottom<% end %>'>
<%= if assigns[:show_pagination_limit] do %> <%= if false do %>
<!-- Pagination limit --> <!-- Pagination limit -->
<div class="pagination-limit"> <div class="pagination-limit">
<%= gettext "Show" %> <%= gettext "Show" %>
@ -14,19 +14,22 @@
<!-- Pagination --> <!-- Pagination -->
<ul class="pagination"> <ul class="pagination">
<!-- First --> <!-- First -->
<li class="page-item"> <%= if assigns[:first_page_path] do %>
<a <li class="page-item">
<%= if !assigns[:first_page_path] do %>disabled<% end %> <a
class="page-link" <%= if !assigns[:first_page_path] do %>disabled<% end %>
href='<%= "#{assigns[:first_page_path]}" %>' class="page-link"
>First</a> href='<%= "#{assigns[:first_page_path]}" %>'
</li> >First</a>
</li>
<% end %>
<!-- Previous --> <!-- Previous -->
<li class="page-item"> <li class="page-item">
<a <a
<%= if !assigns[:prev_page_path] do %>disabled<% end %> <%= if !assigns[:prev_page_path] do %>disabled<% end %>
class="page-link" class="page-link"
href='<%= "#{assigns[:prev_page_path]}" %>' href='<%= "#{assigns[:prev_page_path]}" %>'
<%= if assigns[:data_prev_page_button] do %>data-prev-page-button<% end %>
> >
<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10"> <svg xmlns="http://www.w3.org/2000/svg" width="6" height="10">
<path fill-rule="evenodd" d="M2.358 5l3.357 3.358a.959.959 0 1 1-1.357 1.357L.502 5.859c-.076-.042-.153-.08-.217-.144A.949.949 0 0 1 .011 5a.949.949 0 0 1 .274-.715c.064-.064.142-.102.217-.145L4.358.285a.959.959 0 1 1 1.357 1.357L2.358 5z"/> <path fill-rule="evenodd" d="M2.358 5l3.357 3.358a.959.959 0 1 1-1.357 1.357L.502 5.859c-.076-.042-.153-.08-.217-.144A.949.949 0 0 1 .011 5a.949.949 0 0 1 .274-.715c.064-.064.142-.102.217-.145L4.358.285a.959.959 0 1 1 1.357 1.357L2.358 5z"/>
@ -34,7 +37,7 @@
</a> </a>
</li> </li>
<!-- Page X of XX --> <!-- Page X of XX -->
<li class="page-item"><a class="page-link no-hover" href><%= gettext "Page" %> <%= assigns[:cur_page_number] || "" %> <% if assigns[:total_pages_number] do %> <%= gettext "of" %> <%= assigns[:total_pages_number] || "undefined" %><% end %></a></li> <li class="page-item"><a class="page-link no-hover" href data-page-number><%= gettext "Page" %> <%= assigns[:cur_page_number] || "" %> <% if assigns[:total_pages_number] do %> <%= gettext "of" %> <%= assigns[:total_pages_number] || "undefined" %><% end %></a></li>
<!-- Next --> <!-- Next -->
<li class="page-item"> <li class="page-item">
<a <a
@ -49,6 +52,7 @@
</a> </a>
</li> </li>
<!-- Last --> <!-- Last -->
<%= if assigns[:last_page_path] do %>
<li class="page-item"> <li class="page-item">
<a <a
<%= if !assigns[:last_page_path] do %>disabled<% end %> <%= if !assigns[:last_page_path] do %>disabled<% end %>
@ -56,5 +60,6 @@
href='<%= "#{assigns[:last_page_path]}" %>' href='<%= "#{assigns[:last_page_path]}" %>'
>Last</a> >Last</a>
</li> </li>
<% end %>
</ul> </ul>
</div> </div>

@ -3,7 +3,7 @@
<div class="card-body" data-async-listing="<%= @current_path %>"> <div class="card-body" data-async-listing="<%= @current_path %>">
<h1 class="card-title"><%= gettext "Pending Transactions" %></h1> <h1 class="card-title"><%= gettext "Pending Transactions" %></h1>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<div data-selector="channel-batching-message" style="display:none;"> <div data-selector="channel-batching-message" style="display:none;">
<div data-selector="reload-button" class="alert alert-info"> <div data-selector="reload-button" class="alert alert-info">
@ -32,22 +32,8 @@
<%= gettext("Loading") %>... <%= gettext("Loading") %>...
</div> </div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>
</section> </section>

@ -15,6 +15,8 @@
<div class="card-body" data-async-load data-async-listing="<%= @current_path %>"> <div class="card-body" data-async-load data-async-listing="<%= @current_path %>">
<h2 class="card-title"><%= gettext "Token Holders" %></h2> <h2 class="card-title"><%= gettext "Token Holders" %></h2>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<button data-error-message class="alert alert-danger col-12 text-left" style="display: none;"> <button data-error-message class="alert alert-danger col-12 text-left" style="display: none;">
<span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span> <span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span>
</button> </button>
@ -25,24 +27,11 @@
</span> </span>
</div> </div>
</div> </div>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
<div data-items></div> <div data-items></div>
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Next Page") %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
</a>
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>
</section> </section>

@ -14,7 +14,7 @@
<div class="card-body" data-async-load data-async-listing="<%= @current_path %>"> <div class="card-body" data-async-load data-async-listing="<%= @current_path %>">
<h2 class="card-title"><%= gettext "Token Transfers" %></h2> <h2 class="card-title"><%= gettext "Token Transfers" %></h2>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<button data-error-message class="alert alert-danger col-12 text-left" style="display: none;"> <button data-error-message class="alert alert-danger col-12 text-left" style="display: none;">
<span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span> <span href="#" class="alert-link"><%= gettext("Something went wrong, click to reload.") %></span>
@ -26,31 +26,10 @@
</span> </span>
</div> </div>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
<div data-items></div> <div data-items></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a href="#" class="button button-secondary button-small float-right mt-4" data-next-page-button style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</div> </div>
</section> </section>

@ -3,7 +3,7 @@
<div class="card-body" data-async-listing="<%= @current_path %>"> <div class="card-body" data-async-listing="<%= @current_path %>">
<h1 class="card-title"><%= gettext "Validated Transactions" %></h1> <h1 class="card-title"><%= gettext "Validated Transactions" %></h1>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<div data-selector="channel-batching-message" style="display: none;"> <div data-selector="channel-batching-message" style="display: none;">
<div data-selector="reload-button" class="alert alert-info"> <div data-selector="reload-button" class="alert alert-info">
@ -28,30 +28,9 @@
</div> </div>
</div> </div>
<div data-loading-message class="tile tile-muted text-center mt-3">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
<div data-selector="transactions-list" data-items></div> <div data-selector="transactions-list" data-items></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<!--
<a href="#" data-next-page-button class="button button-secondary button-small float-right mt-4" style="display: none;">
<%= gettext("Older") %>
</a>
-->
<div class="button button-secondary button-small float-right mt-4" data-loading-button style="display: none;">
<span class="loading-spinner-small mr-2">
<span class="loading-spinner-block-1"></span>
<span class="loading-spinner-block-2"></span>
</span>
<%= gettext("Loading") %>...
</div>
</div> </div>
</section> </section>

@ -32,20 +32,6 @@
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true %>
<% end %> <% end %>
<!--
<%= if @next_page_params do %>
<%= link(
gettext("Older"),
class: "button button-secondary button-sm u-float-left mt-3",
to: transaction_token_transfer_path(
@conn,
:index,
@transaction,
@next_page_params
)
) %>
<% end %>
-->
</div> </div>
</div> </div>
</section> </section>

@ -3,8 +3,6 @@ defmodule BlockScoutWeb.AddressView do
require Logger require Logger
import BlockScoutWeb.AddressController, only: [validation_count: 1]
alias BlockScoutWeb.LayoutView alias BlockScoutWeb.LayoutView
alias Explorer.Chain alias Explorer.Chain
alias Explorer.Chain.{Address, Hash, InternalTransaction, SmartContract, Token, TokenTransfer, Transaction, Wei} alias Explorer.Chain.{Address, Hash, InternalTransaction, SmartContract, Token, TokenTransfer, Transaction, Wei}

@ -76,16 +76,12 @@ defmodule BlockScoutWeb.API.RPC.ContractView do
defp prepare_contract(%Address{ defp prepare_contract(%Address{
hash: hash, hash: hash,
smart_contract: nil, smart_contract: nil
decompiled_smart_contracts: decompiled_smart_contracts
}) do }) do
decompiled_smart_contract = latest_decompiled_smart_contract(decompiled_smart_contracts)
%{ %{
"Address" => to_string(hash), "Address" => to_string(hash),
"ABI" => "Contract source code not verified", "ABI" => "Contract source code not verified",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => decompiler_version(decompiled_smart_contract),
"CompilerVersion" => "", "CompilerVersion" => "",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
@ -93,16 +89,12 @@ defmodule BlockScoutWeb.API.RPC.ContractView do
defp prepare_contract(%Address{ defp prepare_contract(%Address{
hash: hash, hash: hash,
smart_contract: %SmartContract{} = contract, smart_contract: %SmartContract{} = contract
decompiled_smart_contracts: decompiled_smart_contracts
}) do }) do
decompiled_smart_contract = latest_decompiled_smart_contract(decompiled_smart_contracts)
%{ %{
"Address" => to_string(hash), "Address" => to_string(hash),
"ABI" => Jason.encode!(contract.abi), "ABI" => Jason.encode!(contract.abi),
"ContractName" => contract.name, "ContractName" => contract.name,
"DecompilerVersion" => decompiler_version(decompiled_smart_contract),
"CompilerVersion" => contract.compiler_version, "CompilerVersion" => contract.compiler_version,
"OptimizationUsed" => if(contract.optimization, do: "1", else: "0") "OptimizationUsed" => if(contract.optimization, do: "1", else: "0")
} }

@ -128,7 +128,7 @@ defmodule BlockScoutWeb.Mixfile do
{:timex, "~> 3.4"}, {:timex, "~> 3.4"},
{:wallaby, "~> 0.22", only: [:test], runtime: false}, {:wallaby, "~> 0.22", only: [:test], runtime: false},
# `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility # `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility
{:wobserver, "~> 0.2.0", github: "KronicDeth/wobserver", ref: "99683a936c75c0a94ebb884cef019f7ed0b97112"}, {:wobserver, "~> 0.2.0", github: "poanetwork/wobserver", branch: "support-https"},
{:phoenix_form_awesomplete, "~> 0.1.4"} {:phoenix_form_awesomplete, "~> 0.1.4"}
] ]
end end

@ -99,7 +99,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16
#: lib/block_scout_web/templates/transaction_log/index.html.eex:22 #: lib/block_scout_web/templates/transaction_log/index.html.eex:22
#: lib/block_scout_web/views/address_view.ex:101 #: lib/block_scout_web/views/address_view.ex:99
msgid "Address" msgid "Address"
msgstr "" msgstr ""
@ -190,7 +190,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/templates/address/overview.html.eex:95 #: lib/block_scout_web/templates/address/overview.html.eex:95
#: 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:302 #: lib/block_scout_web/views/address_view.ex:300
msgid "Blocks Validated" msgid "Blocks Validated"
msgstr "" msgstr ""
@ -218,7 +218,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:42 #: lib/block_scout_web/templates/address/_tabs.html.eex:42
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165
#: 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/views/address_view.ex:298 #: lib/block_scout_web/views/address_view.ex:296
msgid "Code" msgid "Code"
msgstr "" msgstr ""
@ -262,14 +262,14 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:13 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:13
#: lib/block_scout_web/views/address_view.ex:99 #: lib/block_scout_web/views/address_view.ex:97
msgid "Contract Address" msgid "Contract Address"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16
#: lib/block_scout_web/views/address_view.ex:39 #: lib/block_scout_web/views/address_view.ex:37
#: lib/block_scout_web/views/address_view.ex:73 #: lib/block_scout_web/views/address_view.ex:71
msgid "Contract Address Pending" msgid "Contract Address Pending"
msgstr "" msgstr ""
@ -478,7 +478,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:297 #: lib/block_scout_web/views/address_view.ex:295
#: lib/block_scout_web/views/transaction_view.ex:339 #: lib/block_scout_web/views/transaction_view.ex:339
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -505,7 +505,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:303 #: lib/block_scout_web/views/address_view.ex:301
#: lib/block_scout_web/views/transaction_view.ex:340 #: lib/block_scout_web/views/transaction_view.ex:340
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -513,7 +513,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:53 #: lib/block_scout_web/templates/layout/app.html.eex:53
#: lib/block_scout_web/views/address_view.ex:123 #: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap" msgid "Market Cap"
msgstr "" msgstr ""
@ -582,7 +582,6 @@ msgid "Next"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:37
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:32 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:32
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
@ -604,21 +603,6 @@ msgstr ""
msgid "OUT" msgid "OUT"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:57
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:81
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:38
#: lib/block_scout_web/templates/address_transaction/index.html.eex:80
#: lib/block_scout_web/templates/address_validation/index.html.eex:38
#: lib/block_scout_web/templates/block/index.html.eex:30
#: lib/block_scout_web/templates/block_transaction/index.html.eex:50
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:39
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:43
#: lib/block_scout_web/templates/transaction/index.html.eex:45
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:38
msgid "Older"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_contract/index.html.eex:34 #: lib/block_scout_web/templates/address_contract/index.html.eex:34
msgid "Optimization enabled" msgid "Optimization enabled"
@ -683,7 +667,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:58 #: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: 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:300 #: lib/block_scout_web/views/address_view.ex:298
#: lib/block_scout_web/views/tokens/overview_view.ex:37 #: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract" msgid "Read Contract"
msgstr "" msgstr ""
@ -750,7 +734,7 @@ msgid "Telegram"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:26
msgid "There are no holders for this Token." msgid "There are no holders for this Token."
msgstr "" msgstr ""
@ -771,7 +755,7 @@ msgid "There are no logs for this transaction."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:23 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:15
msgid "There are no token transfers for this address." msgid "There are no token transfers for this address."
msgstr "" msgstr ""
@ -863,7 +847,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8 #: lib/block_scout_web/templates/address/_tabs.html.eex:8
#: lib/block_scout_web/templates/address_token/index.html.eex:8 #: lib/block_scout_web/templates/address_token/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9
#: lib/block_scout_web/views/address_view.ex:295 #: lib/block_scout_web/views/address_view.ex:293
msgid "Tokens" msgid "Tokens"
msgstr "" msgstr ""
@ -922,7 +906,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:17 #: lib/block_scout_web/templates/block_transaction/index.html.eex:17
#: lib/block_scout_web/templates/chain/show.html.eex:108 #: lib/block_scout_web/templates/chain/show.html.eex:108
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35 #: lib/block_scout_web/templates/layout/_topnav.html.eex:35
#: lib/block_scout_web/views/address_view.ex:296 #: lib/block_scout_web/views/address_view.ex:294
msgid "Transactions" msgid "Transactions"
msgstr "" msgstr ""
@ -1105,9 +1089,6 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_read_contract/index.html.eex:14 #: lib/block_scout_web/templates/address_read_contract/index.html.eex:14
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19
#: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/address_validation/index.html.eex:47
#: lib/block_scout_web/templates/chain/show.html.eex:99 #: lib/block_scout_web/templates/chain/show.html.eex:99
#: lib/block_scout_web/templates/chain/show.html.eex:125 #: lib/block_scout_web/templates/chain/show.html.eex:125
#: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:21 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:21
@ -1130,22 +1111,7 @@ msgid "GraphQL"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:66
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:90
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:47
#: lib/block_scout_web/templates/address_transaction/index.html.eex:71
#: lib/block_scout_web/templates/address_transaction/index.html.eex:89
#: lib/block_scout_web/templates/block/index.html.eex:19
#: lib/block_scout_web/templates/block/index.html.eex:39
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:32 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:32
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:48
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:33
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:44
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:52
#: lib/block_scout_web/templates/transaction/index.html.eex:36
#: lib/block_scout_web/templates/transaction/index.html.eex:54
msgid "Loading" msgid "Loading"
msgstr "" msgstr ""
@ -1316,19 +1282,19 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20
#: lib/block_scout_web/templates/address_transaction/index.html.eex:57 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57
#: lib/block_scout_web/templates/address_validation/index.html.eex:29 #: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/chain/show.html.eex:91 #: lib/block_scout_web/templates/chain/show.html.eex:91
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:19 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:21
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20
#: lib/block_scout_web/templates/transaction/index.html.eex:20 #: lib/block_scout_web/templates/transaction/index.html.eex:20
msgid "Something went wrong, click to reload." msgid "Something went wrong, click to reload."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_validation/index.html.eex:25 #: lib/block_scout_web/templates/address_validation/index.html.eex:18
msgid "There are no blocks validated by this address." msgid "There are no blocks validated by this address."
msgstr "" msgstr ""
@ -1349,15 +1315,10 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20 #: lib/block_scout_web/templates/address/_tabs.html.eex:20
#: lib/block_scout_web/views/address_view.ex:301 #: lib/block_scout_web/views/address_view.ex:299
msgid "Coin Balance History" msgid "Coin Balance History"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:48
msgid "Loading balances"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:22 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:22
#: lib/block_scout_web/templates/chain/show.html.eex:13 #: lib/block_scout_web/templates/chain/show.html.eex:13
@ -1381,7 +1342,7 @@ msgid "There are no pending transactions."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/index.html.eex:23 #: lib/block_scout_web/templates/block/index.html.eex:16
msgid "There are no blocks." msgid "There are no blocks."
msgstr "" msgstr ""
@ -1658,7 +1619,7 @@ msgid "Copy Decompiled Contract Code"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/address_view.ex:299 #: lib/block_scout_web/views/address_view.ex:297
msgid "Decompiled Code" msgid "Decompiled Code"
msgstr "" msgstr ""
@ -1726,7 +1687,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: #:
#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40
msgid "Page" msgid "Page"
msgstr "" msgstr ""
@ -1744,7 +1705,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: #:
#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40
msgid "of" msgid "of"
msgstr "" msgstr ""

@ -99,7 +99,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16
#: lib/block_scout_web/templates/transaction_log/index.html.eex:22 #: lib/block_scout_web/templates/transaction_log/index.html.eex:22
#: lib/block_scout_web/views/address_view.ex:101 #: lib/block_scout_web/views/address_view.ex:99
msgid "Address" msgid "Address"
msgstr "" msgstr ""
@ -190,7 +190,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/templates/address/overview.html.eex:95 #: lib/block_scout_web/templates/address/overview.html.eex:95
#: 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:302 #: lib/block_scout_web/views/address_view.ex:300
msgid "Blocks Validated" msgid "Blocks Validated"
msgstr "" msgstr ""
@ -218,7 +218,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:42 #: lib/block_scout_web/templates/address/_tabs.html.eex:42
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165
#: 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/views/address_view.ex:298 #: lib/block_scout_web/views/address_view.ex:296
msgid "Code" msgid "Code"
msgstr "" msgstr ""
@ -262,14 +262,14 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:13 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:13
#: lib/block_scout_web/views/address_view.ex:99 #: lib/block_scout_web/views/address_view.ex:97
msgid "Contract Address" msgid "Contract Address"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16
#: lib/block_scout_web/views/address_view.ex:39 #: lib/block_scout_web/views/address_view.ex:37
#: lib/block_scout_web/views/address_view.ex:73 #: lib/block_scout_web/views/address_view.ex:71
msgid "Contract Address Pending" msgid "Contract Address Pending"
msgstr "" msgstr ""
@ -478,7 +478,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:297 #: lib/block_scout_web/views/address_view.ex:295
#: lib/block_scout_web/views/transaction_view.ex:339 #: lib/block_scout_web/views/transaction_view.ex:339
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -505,7 +505,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:303 #: lib/block_scout_web/views/address_view.ex:301
#: lib/block_scout_web/views/transaction_view.ex:340 #: lib/block_scout_web/views/transaction_view.ex:340
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -513,7 +513,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:53 #: lib/block_scout_web/templates/layout/app.html.eex:53
#: lib/block_scout_web/views/address_view.ex:123 #: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap" msgid "Market Cap"
msgstr "" msgstr ""
@ -582,7 +582,6 @@ msgid "Next"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:37
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:32 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:32
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
@ -604,21 +603,6 @@ msgstr ""
msgid "OUT" msgid "OUT"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:57
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:81
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:38
#: lib/block_scout_web/templates/address_transaction/index.html.eex:80
#: lib/block_scout_web/templates/address_validation/index.html.eex:38
#: lib/block_scout_web/templates/block/index.html.eex:30
#: lib/block_scout_web/templates/block_transaction/index.html.eex:50
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:39
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:43
#: lib/block_scout_web/templates/transaction/index.html.eex:45
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:38
msgid "Older"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_contract/index.html.eex:34 #: lib/block_scout_web/templates/address_contract/index.html.eex:34
msgid "Optimization enabled" msgid "Optimization enabled"
@ -683,7 +667,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:58 #: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: 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:300 #: lib/block_scout_web/views/address_view.ex:298
#: lib/block_scout_web/views/tokens/overview_view.ex:37 #: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract" msgid "Read Contract"
msgstr "" msgstr ""
@ -750,7 +734,7 @@ msgid "Telegram"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:26
msgid "There are no holders for this Token." msgid "There are no holders for this Token."
msgstr "" msgstr ""
@ -771,7 +755,7 @@ msgid "There are no logs for this transaction."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:23 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:15
msgid "There are no token transfers for this address." msgid "There are no token transfers for this address."
msgstr "" msgstr ""
@ -863,7 +847,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8 #: lib/block_scout_web/templates/address/_tabs.html.eex:8
#: lib/block_scout_web/templates/address_token/index.html.eex:8 #: lib/block_scout_web/templates/address_token/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9
#: lib/block_scout_web/views/address_view.ex:295 #: lib/block_scout_web/views/address_view.ex:293
msgid "Tokens" msgid "Tokens"
msgstr "" msgstr ""
@ -922,7 +906,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:17 #: lib/block_scout_web/templates/block_transaction/index.html.eex:17
#: lib/block_scout_web/templates/chain/show.html.eex:108 #: lib/block_scout_web/templates/chain/show.html.eex:108
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35 #: lib/block_scout_web/templates/layout/_topnav.html.eex:35
#: lib/block_scout_web/views/address_view.ex:296 #: lib/block_scout_web/views/address_view.ex:294
msgid "Transactions" msgid "Transactions"
msgstr "" msgstr ""
@ -1105,9 +1089,6 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_read_contract/index.html.eex:14 #: lib/block_scout_web/templates/address_read_contract/index.html.eex:14
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19
#: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/address_validation/index.html.eex:47
#: lib/block_scout_web/templates/chain/show.html.eex:99 #: lib/block_scout_web/templates/chain/show.html.eex:99
#: lib/block_scout_web/templates/chain/show.html.eex:125 #: lib/block_scout_web/templates/chain/show.html.eex:125
#: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:21 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:21
@ -1129,23 +1110,7 @@ msgstr ""
msgid "GraphQL" msgid "GraphQL"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:66
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:90
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:47
#: lib/block_scout_web/templates/address_transaction/index.html.eex:71
#: lib/block_scout_web/templates/address_transaction/index.html.eex:89
#: lib/block_scout_web/templates/block/index.html.eex:19
#: lib/block_scout_web/templates/block/index.html.eex:39
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:32 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:32
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:48
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:33
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:44
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:52
#: lib/block_scout_web/templates/transaction/index.html.eex:36
#: lib/block_scout_web/templates/transaction/index.html.eex:54
msgid "Loading" msgid "Loading"
msgstr "" msgstr ""
@ -1316,19 +1281,19 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20
#: lib/block_scout_web/templates/address_transaction/index.html.eex:57 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57
#: lib/block_scout_web/templates/address_validation/index.html.eex:29 #: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/chain/show.html.eex:91 #: lib/block_scout_web/templates/chain/show.html.eex:91
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:19 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:21
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20
#: lib/block_scout_web/templates/transaction/index.html.eex:20 #: lib/block_scout_web/templates/transaction/index.html.eex:20
msgid "Something went wrong, click to reload." msgid "Something went wrong, click to reload."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_validation/index.html.eex:25 #: lib/block_scout_web/templates/address_validation/index.html.eex:18
msgid "There are no blocks validated by this address." msgid "There are no blocks validated by this address."
msgstr "" msgstr ""
@ -1349,15 +1314,10 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20 #: lib/block_scout_web/templates/address/_tabs.html.eex:20
#: lib/block_scout_web/views/address_view.ex:301 #: lib/block_scout_web/views/address_view.ex:299
msgid "Coin Balance History" msgid "Coin Balance History"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:48
msgid "Loading balances"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:22 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:22
#: lib/block_scout_web/templates/chain/show.html.eex:13 #: lib/block_scout_web/templates/chain/show.html.eex:13
@ -1381,7 +1341,7 @@ msgid "There are no pending transactions."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/index.html.eex:23 #: lib/block_scout_web/templates/block/index.html.eex:16
msgid "There are no blocks." msgid "There are no blocks."
msgstr "" msgstr ""
@ -1658,7 +1618,7 @@ msgid "Copy Decompiled Contract Code"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/address_view.ex:299 #: lib/block_scout_web/views/address_view.ex:297
msgid "Decompiled Code" msgid "Decompiled Code"
msgstr "" msgstr ""
@ -1726,7 +1686,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: #:
#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40
msgid "Page" msgid "Page"
msgstr "" msgstr ""
@ -1744,16 +1704,16 @@ msgstr ""
#, elixir-format #, elixir-format
#: #:
#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40
msgid "of" msgid "of"
msgstr "" msgstr ""
#, elixir-format, fuzzy #, elixir-format
#: lib/block_scout_web/templates/address_contract/index.html.eex:83 #: lib/block_scout_web/templates/address_contract/index.html.eex:83
msgid "Contract Byte Code" msgid "Contract Byte Code"
msgstr "" msgstr ""
#, elixir-format, fuzzy #, elixir-format
#: lib/block_scout_web/templates/address_contract/index.html.eex:69 #: lib/block_scout_web/templates/address_contract/index.html.eex:69
msgid "Contract Creation Code" msgid "Contract Creation Code"
msgstr "" msgstr ""
@ -1763,7 +1723,7 @@ msgstr ""
msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified." msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified."
msgstr "" msgstr ""
#, elixir-format, fuzzy #, elixir-format
#: lib/block_scout_web/templates/address_contract/index.html.eex:85 #: lib/block_scout_web/templates/address_contract/index.html.eex:85
msgid "Copy Contract Byte Code" msgid "Copy Contract Byte Code"
msgstr "" msgstr ""
@ -1773,7 +1733,7 @@ msgstr ""
msgid "Displaying the init data provided of the creating transaction." msgid "Displaying the init data provided of the creating transaction."
msgstr "" msgstr ""
#, elixir-format, fuzzy #, elixir-format
#: lib/block_scout_web/templates/address_logs/index.html.eex:77 #: lib/block_scout_web/templates/address_logs/index.html.eex:77
msgid "There are no logs for this address." msgid "There are no logs for this address."
msgstr "" msgstr ""

@ -15,11 +15,10 @@ defmodule BlockScoutWeb.AddressControllerTest do
start_supervised!(AddressesWithBalanceCounter) start_supervised!(AddressesWithBalanceCounter)
AddressesWithBalanceCounter.consolidate() AddressesWithBalanceCounter.consolidate()
conn = get(conn, address_path(conn, :index)) conn = get(conn, address_path(conn, :index, %{type: "JSON"}))
{:ok, %{"items" => items}} = Poison.decode(conn.resp_body)
assert conn.assigns.address_tx_count_pairs assert Enum.count(items) == Enum.count(address_hashes)
|> Enum.map(fn {address, _transaction_count} -> address end)
|> Enum.map(& &1.hash) == address_hashes
end end
test "returns an address's primary name when present", %{conn: conn} do test "returns an address's primary name when present", %{conn: conn} do
@ -29,9 +28,11 @@ defmodule BlockScoutWeb.AddressControllerTest do
start_supervised!(AddressesWithBalanceCounter) start_supervised!(AddressesWithBalanceCounter)
AddressesWithBalanceCounter.consolidate() AddressesWithBalanceCounter.consolidate()
conn = get(conn, address_path(conn, :index)) conn = get(conn, address_path(conn, :index, %{type: "JSON"}))
assert html_response(conn, 200) =~ address_name.name {:ok, %{"items" => [item]}} = Poison.decode(conn.resp_body)
assert String.contains?(item, "POA Wallet")
end end
end end

@ -47,7 +47,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(contract.address_hash), "Address" => to_string(contract.address_hash),
"CompilerVersion" => contract.compiler_version, "CompilerVersion" => contract.compiler_version,
"ContractName" => contract.name, "ContractName" => contract.name,
"DecompilerVersion" => "",
"OptimizationUsed" => if(contract.optimization, do: "1", else: "0") "OptimizationUsed" => if(contract.optimization, do: "1", else: "0")
} }
] ]
@ -70,7 +69,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(address.hash), "Address" => to_string(address.hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]
@ -94,7 +92,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(address.hash), "Address" => to_string(address.hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]
@ -122,7 +119,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(address.hash), "Address" => to_string(address.hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]
@ -145,7 +141,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"ABI" => Jason.encode!(contract.abi), "ABI" => Jason.encode!(contract.abi),
"Address" => to_string(contract.address_hash), "Address" => to_string(contract.address_hash),
"CompilerVersion" => contract.compiler_version, "CompilerVersion" => contract.compiler_version,
"DecompilerVersion" => "",
"ContractName" => contract.name, "ContractName" => contract.name,
"OptimizationUsed" => if(contract.optimization, do: "1", else: "0") "OptimizationUsed" => if(contract.optimization, do: "1", else: "0")
} }
@ -170,7 +165,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(decompiled_smart_contract.address_hash), "Address" => to_string(decompiled_smart_contract.address_hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "test_decompiler",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]
@ -194,7 +188,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(smart_contract.address_hash), "Address" => to_string(smart_contract.address_hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "bizbuz",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]
@ -214,16 +207,15 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
assert response["message"] == "OK" assert response["message"] == "OK"
assert response["status"] == "1" assert response["status"] == "1"
assert response["result"] == [ assert %{
%{ "ABI" => "Contract source code not verified",
"ABI" => "Contract source code not verified", "Address" => to_string(smart_contract.address_hash),
"Address" => to_string(smart_contract.address_hash), "CompilerVersion" => "",
"CompilerVersion" => "", "ContractName" => "",
"ContractName" => "", "OptimizationUsed" => ""
"DecompilerVersion" => "bizbuz", } in response["result"]
"OptimizationUsed" => ""
} refute to_string(non_match.address_hash) in Enum.map(response["result"], &Map.get(&1, "Address"))
]
end end
test "filtering for only not_decompiled (and by extension not verified contracts)", %{params: params, conn: conn} do test "filtering for only not_decompiled (and by extension not verified contracts)", %{params: params, conn: conn} do
@ -245,7 +237,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(contract_address.hash), "Address" => to_string(contract_address.hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]
@ -274,7 +265,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do
"Address" => to_string(contract_address.hash), "Address" => to_string(contract_address.hash),
"CompilerVersion" => "", "CompilerVersion" => "",
"ContractName" => "", "ContractName" => "",
"DecompilerVersion" => "",
"OptimizationUsed" => "" "OptimizationUsed" => ""
} }
] ]

@ -2,7 +2,7 @@ defmodule BlockScoutWeb.API.V1.DecompiledControllerTest do
use BlockScoutWeb.ConnCase use BlockScoutWeb.ConnCase
alias Explorer.Repo alias Explorer.Repo
alias Explorer.Chain.DecompiledSmartContract alias Explorer.Chain.{Address, DecompiledSmartContract}
import Ecto.Query, import Ecto.Query,
only: [from: 2] only: [from: 2]
@ -87,6 +87,24 @@ defmodule BlockScoutWeb.API.V1.DecompiledControllerTest do
assert decompiled_smart_contract.decompiler_version == decompiler_version assert decompiled_smart_contract.decompiler_version == decompiler_version
assert decompiled_smart_contract.decompiled_source_code == decompiled_source_code assert decompiled_smart_contract.decompiled_source_code == decompiled_source_code
end end
test "updates the address to be decompiled", %{conn: conn} do
address_hash = to_string(insert(:address, hash: "0x0000000000000000000000000000000000000001").hash)
decompiler_version = "test_decompiler"
decompiled_source_code = "hello world"
params = %{
"address_hash" => address_hash,
"decompiler_version" => decompiler_version,
"decompiled_source_code" => decompiled_source_code
}
request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create), params)
assert request.status == 201
assert Repo.get!(Address, address_hash).decompiled
end
end end
describe "when user is not authorized" do describe "when user is not authorized" do

@ -363,21 +363,6 @@ defmodule Explorer.Chain do
Repo.aggregate(Block, :count, :hash) Repo.aggregate(Block, :count, :hash)
end end
@doc """
The number of consensus blocks.
iex> insert(:block, consensus: true)
iex> insert(:block, consensus: false)
iex> Explorer.Chain.block_consensus_count()
1
"""
def block_consensus_count do
Block
|> where(consensus: true)
|> Repo.aggregate(:count, :hash)
end
@doc """ @doc """
Reward for mining a block. Reward for mining a block.
@ -569,9 +554,19 @@ defmodule Explorer.Chain do
@spec create_decompiled_smart_contract(map()) :: {:ok, Address.t()} | {:error, Ecto.Changeset.t()} @spec create_decompiled_smart_contract(map()) :: {:ok, Address.t()} | {:error, Ecto.Changeset.t()}
def create_decompiled_smart_contract(attrs) do def create_decompiled_smart_contract(attrs) do
%DecompiledSmartContract{} changeset = DecompiledSmartContract.changeset(%DecompiledSmartContract{}, attrs)
|> DecompiledSmartContract.changeset(attrs)
|> Repo.insert(on_conflict: :replace_all, conflict_target: [:decompiler_version, :address_hash]) Multi.new()
|> Multi.insert(:decompiled_smart_contract, changeset,
on_conflict: :replace_all,
conflict_target: [:decompiler_version, :address_hash]
)
|> Multi.run(:set_address_decompiled, &set_address_decompiled/2)
|> Repo.transaction()
|> case do
{:ok, %{decompiled_smart_contract: decompiled_smart_contract}} -> {:ok, decompiled_smart_contract}
{:error, _, error_value, _} -> {:error, error_value}
end
end end
@doc """ @doc """
@ -1997,7 +1992,9 @@ defmodule Explorer.Chain do
cached_value = BlockCountCache.count() cached_value = BlockCountCache.count()
if is_nil(cached_value) do if is_nil(cached_value) do
block_consensus_count() %Postgrex.Result{rows: [[count]]} = Repo.query!("SELECT reltuples FROM pg_class WHERE relname = 'blocks';")
trunc(count * 0.90)
else else
cached_value cached_value
end end
@ -2248,6 +2245,7 @@ defmodule Explorer.Chain do
|> Multi.insert(:smart_contract, smart_contract_changeset) |> Multi.insert(:smart_contract, smart_contract_changeset)
|> Multi.run(:clear_primary_address_names, &clear_primary_address_names/2) |> Multi.run(:clear_primary_address_names, &clear_primary_address_names/2)
|> Multi.run(:insert_address_name, &create_address_name/2) |> Multi.run(:insert_address_name, &create_address_name/2)
|> Multi.run(:set_address_verified, &set_address_verified/2)
|> Repo.transaction() |> Repo.transaction()
with {:ok, %{smart_contract: smart_contract}} <- insert_result do with {:ok, %{smart_contract: smart_contract}} <- insert_result do
@ -2255,6 +2253,35 @@ defmodule Explorer.Chain do
else else
{:error, :smart_contract, changeset, _} -> {:error, :smart_contract, changeset, _} ->
{:error, changeset} {:error, changeset}
{:error, :set_address_verified, message, _} ->
{:error, message}
end
end
defp set_address_verified(repo, %{smart_contract: %SmartContract{address_hash: address_hash}}) do
query =
from(
address in Address,
where: address.hash == ^address_hash
)
case repo.update_all(query, set: [verified: true]) do
{1, _} -> {:ok, []}
_ -> {:error, "There was an error annotating that the address has been verified."}
end
end
defp set_address_decompiled(repo, %{decompiled_smart_contract: %DecompiledSmartContract{address_hash: address_hash}}) do
query =
from(
address in Address,
where: address.hash == ^address_hash
)
case repo.update_all(query, set: [decompiled: true]) do
{1, _} -> {:ok, []}
_ -> {:error, "There was an error annotating that the address has been verified."}
end end
end end
@ -2767,50 +2794,46 @@ defmodule Explorer.Chain do
query = query =
from( from(
address in Address, address in Address,
where: where: address.contract_code != <<>>,
fragment( where: not is_nil(address.contract_code),
"EXISTS (SELECT 1 FROM decompiled_smart_contracts WHERE decompiled_smart_contracts.address_hash = ?)", where: address.decompiled == true,
address.hash
),
preload: [:decompiled_smart_contracts, :smart_contract],
order_by: [asc: address.inserted_at],
limit: ^limit, limit: ^limit,
offset: ^offset offset: ^offset,
order_by: [asc: address.inserted_at],
preload: [:smart_contract]
) )
query query
|> filter_decompiled_with_version(not_decompiled_with_version) |> reject_decompiled_with_version(not_decompiled_with_version)
|> Repo.all() |> Repo.all()
end end
defp filter_decompiled_with_version(query, nil) do defp reject_decompiled_with_version(query, nil), do: query
query
end
defp filter_decompiled_with_version(query, not_decompiled_with_version) do defp reject_decompiled_with_version(query, reject_version) do
from(address in query, from(
left_join: decompiled_smart_contract in DecompiledSmartContract, address in query,
on: decompiled_smart_contract.decompiler_version == ^not_decompiled_with_version, left_join: decompiled_smart_contract in assoc(address, :decompiled_smart_contracts),
on: decompiled_smart_contract.address_hash == address.hash, on: decompiled_smart_contract.decompiler_version == ^reject_version,
where: is_nil(decompiled_smart_contract.id), where: is_nil(decompiled_smart_contract.address_hash)
distinct: [address.hash]
) )
end end
def list_verified_contracts(limit, offset) do def list_verified_contracts(limit, offset) do
query = query =
from( from(
address in Address, smart_contract in SmartContract,
where: not is_nil(address.contract_code), order_by: [asc: smart_contract.inserted_at],
join: smart_contract in SmartContract,
on: smart_contract.address_hash == address.hash,
preload: [{:smart_contract, smart_contract}, :decompiled_smart_contracts],
order_by: [asc: address.inserted_at],
limit: ^limit, limit: ^limit,
offset: ^offset offset: ^offset,
preload: [:address]
) )
Repo.all(query) query
|> Repo.all()
|> Enum.map(fn smart_contract ->
Map.put(smart_contract.address, :smart_contract, smart_contract)
end)
end end
def list_contracts(limit, offset) do def list_contracts(limit, offset) do
@ -2818,7 +2841,7 @@ defmodule Explorer.Chain do
from( from(
address in Address, address in Address,
where: not is_nil(address.contract_code), where: not is_nil(address.contract_code),
preload: [:smart_contract, :decompiled_smart_contracts], preload: [:smart_contract],
order_by: [asc: address.inserted_at], order_by: [asc: address.inserted_at],
limit: ^limit, limit: ^limit,
offset: ^offset offset: ^offset
@ -2827,22 +2850,22 @@ defmodule Explorer.Chain do
Repo.all(query) Repo.all(query)
end end
def list_unverified_contracts(limit, offset) do def list_unordered_unverified_contracts(limit, offset) do
query = query =
from( from(
address in Address, address in Address,
left_join: smart_contract in SmartContract,
on: smart_contract.address_hash == address.hash,
where: not is_nil(address.contract_code),
where: is_nil(smart_contract.address_hash),
where: address.contract_code != <<>>, where: address.contract_code != <<>>,
preload: [{:smart_contract, smart_contract}, :decompiled_smart_contracts], where: not is_nil(address.contract_code),
order_by: [asc: address.inserted_at], where: fragment("? IS NOT TRUE", address.verified),
limit: ^limit, limit: ^limit,
offset: ^offset offset: ^offset
) )
Repo.all(query) query
|> Repo.all()
|> Enum.map(fn address ->
%{address | smart_contract: nil}
end)
end end
def list_empty_contracts(limit, offset) do def list_empty_contracts(limit, offset) do
@ -2858,30 +2881,23 @@ defmodule Explorer.Chain do
Repo.all(query) Repo.all(query)
end end
def list_not_decompiled_contracts(limit, offset) do def list_unordered_not_decompiled_contracts(limit, offset) do
query = query =
from( from(
address in Address, address in Address,
where: where: fragment("? IS NOT TRUE", address.verified),
fragment( where: fragment("? IS NOT TRUE", address.decompiled),
"NOT EXISTS (SELECT 1 FROM decompiled_smart_contracts WHERE decompiled_smart_contracts.address_hash = ?)",
address.hash
),
where: address.contract_code != <<>>, where: address.contract_code != <<>>,
left_join: smart_contract in SmartContract,
on: smart_contract.address_hash == address.hash,
left_join: decompiled_smart_contract in DecompiledSmartContract,
on: decompiled_smart_contract.address_hash == address.hash,
preload: [:smart_contract, :decompiled_smart_contracts],
where: not is_nil(address.contract_code), where: not is_nil(address.contract_code),
where: is_nil(smart_contract.address_hash),
where: is_nil(decompiled_smart_contract.address_hash),
order_by: [asc: address.inserted_at],
limit: ^limit, limit: ^limit,
offset: ^offset offset: ^offset
) )
Repo.all(query) query
|> Repo.all()
|> Enum.map(fn address ->
%{address | smart_contract: nil}
end)
end end
@doc """ @doc """

@ -22,7 +22,7 @@ defmodule Explorer.Chain.Address do
Wei Wei
} }
@optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce)a @optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce decompiled verified)a
@required_attrs ~w(hash)a @required_attrs ~w(hash)a
@allowed_attrs @optional_attrs ++ @required_attrs @allowed_attrs @optional_attrs ++ @required_attrs
@ -75,6 +75,8 @@ defmodule Explorer.Chain.Address do
field(:fetched_coin_balance_block_number, :integer) field(:fetched_coin_balance_block_number, :integer)
field(:contract_code, Data) field(:contract_code, Data)
field(:nonce, :integer) field(:nonce, :integer)
field(:decompiled, :boolean, default: false)
field(:verified, :boolean, default: false)
field(:has_decompiled_code?, :boolean, virtual: true) field(:has_decompiled_code?, :boolean, virtual: true)
field(:stale?, :boolean, virtual: true) field(:stale?, :boolean, virtual: true)

@ -13,6 +13,11 @@ defmodule Explorer.Chain.Import.Runner.Addresses do
@behaviour Import.Runner @behaviour Import.Runner
@row_defaults %{
decompiled: false,
verified: false
}
# milliseconds # milliseconds
@timeout 60_000 @timeout 60_000
@ -45,9 +50,16 @@ defmodule Explorer.Chain.Import.Runner.Addresses do
update_transactions_options = %{timeout: transactions_timeout, timestamps: timestamps} update_transactions_options = %{timeout: transactions_timeout, timestamps: timestamps}
changes_list_with_defaults =
Enum.map(changes_list, fn change ->
Enum.reduce(@row_defaults, change, fn {default_key, default_value}, acc ->
Map.put_new(acc, default_key, default_value)
end)
end)
multi multi
|> Multi.run(:addresses, fn repo, _ -> |> Multi.run(:addresses, fn repo, _ ->
insert(repo, changes_list, insert_options) insert(repo, changes_list_with_defaults, insert_options)
end) end)
|> Multi.run(:created_address_code_indexed_at_transactions, fn repo, %{addresses: addresses} |> Multi.run(:created_address_code_indexed_at_transactions, fn repo, %{addresses: addresses}
when is_list(addresses) -> when is_list(addresses) ->

@ -40,15 +40,10 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do
end end
@impl true @impl true
def init(args) do def init(_args) do
create_table() create_table()
if enable_consolidation?() do {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}}
Task.start_link(&consolidate/0)
schedule_next_consolidation()
end
{:ok, args}
end end
def create_table do def create_table do
@ -63,9 +58,7 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do
end end
defp schedule_next_consolidation do defp schedule_next_consolidation do
if enable_consolidation?() do Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds))
Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds))
end
end end
@doc """ @doc """
@ -75,6 +68,19 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do
:ets.insert(table_name(), {key, info}) :ets.insert(table_name(), {key, info})
end end
@impl true
def handle_continue(:ok, %{consolidate?: true} = state) do
consolidate()
schedule_next_consolidation()
{:noreply, state}
end
@impl true
def handle_continue(:ok, state) do
{:noreply, state}
end
@impl true @impl true
def handle_info(:consolidate, state) do def handle_info(:consolidate, state) do
consolidate() consolidate()

@ -86,7 +86,7 @@ defmodule Explorer.SmartContract.SolcDownloader do
download_path = "https://ethereum.github.io/solc-bin/bin/soljson-#{version}.js" download_path = "https://ethereum.github.io/solc-bin/bin/soljson-#{version}.js"
download_path download_path
|> HTTPoison.get!([], timeout: 60_000) |> HTTPoison.get!([], timeout: 60_000, recv_timeout: 60_000)
|> Map.get(:body) |> Map.get(:body)
end end
end end

@ -0,0 +1,14 @@
defmodule Explorer.Repo.Migrations.AddAddressHashIndexToDecompiledSmartContracts do
use Ecto.Migration
def change do
execute(
"""
CREATE INDEX IF NOT EXISTS decompiled_smart_contracts_address_hash_index ON decompiled_smart_contracts(address_hash);
""",
"""
DROP INDEX IF EXISTS decompiled_smart_contracts_address_hash_index
"""
)
end
end

@ -0,0 +1,18 @@
defmodule Explorer.Repo.Migrations.AddDecompiledAndVerifiedFlagToAddresses do
use Ecto.Migration
def change do
execute(
"""
ALTER TABLE addresses
ADD COLUMN IF NOT EXISTS decompiled BOOLEAN,
ADD COLUMN IF NOT EXISTS verified BOOLEAN;
""",
"""
ALTER TABLE addresses
DROP COLUMN IF EXISTS decompiled,
DROP COLUMN IF EXISTS verified;
"""
)
end
end

@ -2859,6 +2859,12 @@ defmodule Explorer.ChainTest do
assert {:ok, _} = Chain.create_smart_contract(attrs) assert {:ok, _} = Chain.create_smart_contract(attrs)
assert Repo.get_by(Address.Name, name: "SimpleStorage") assert Repo.get_by(Address.Name, name: "SimpleStorage")
end end
test "sets the address verified field to true", %{valid_attrs: valid_attrs} do
assert {:ok, %SmartContract{} = smart_contract} = Chain.create_smart_contract(valid_attrs)
assert Repo.get_by(Address, hash: smart_contract.address_hash).verified == true
end
end end
describe "stream_unfetched_balances/2" do describe "stream_unfetched_balances/2" do

@ -482,6 +482,7 @@ defmodule Explorer.Factory do
address = %Address{ address = %Address{
hash: address_hash(), hash: address_hash(),
verified: true,
contract_code: contract_code_info().bytecode, contract_code: contract_code_info().bytecode,
smart_contract: smart_contract smart_contract: smart_contract
} }
@ -519,7 +520,7 @@ defmodule Explorer.Factory do
contract_code_info = contract_code_info() contract_code_info = contract_code_info()
%SmartContract{ %SmartContract{
address_hash: insert(:address, contract_code: contract_code_info.bytecode).hash, address_hash: insert(:address, contract_code: contract_code_info.bytecode, verified: true).hash,
compiler_version: contract_code_info.version, compiler_version: contract_code_info.version,
name: contract_code_info.name, name: contract_code_info.name,
contract_source_code: contract_code_info.source_code, contract_source_code: contract_code_info.source_code,
@ -532,7 +533,7 @@ defmodule Explorer.Factory do
contract_code_info = contract_code_info() contract_code_info = contract_code_info()
%DecompiledSmartContract{ %DecompiledSmartContract{
address_hash: insert(:address, contract_code: contract_code_info.bytecode).hash, address_hash: insert(:address, contract_code: contract_code_info.bytecode, decompiled: true).hash,
decompiler_version: "test_decompiler", decompiler_version: "test_decompiler",
decompiled_source_code: contract_code_info.source_code decompiled_source_code: contract_code_info.source_code
} }

@ -1,6 +1,7 @@
SYSTEM = $(shell uname -s) SYSTEM = $(shell uname -s)
HOST = host.docker.internal HOST = host.docker.internal
DOCKER_IMAGE = blockscout_prod DOCKER_IMAGE = blockscout_prod
BS_CONTAINER_NAME = blockscout
PG_CONTAINER_NAME = postgres PG_CONTAINER_NAME = postgres
PG_CONTAINER_IMAGE = postgres:10.4 PG_CONTAINER_IMAGE = postgres:10.4
THIS_FILE = $(lastword $(MAKEFILE_LIST)) THIS_FILE = $(lastword $(MAKEFILE_LIST))
@ -87,7 +88,7 @@ endif
start: build postgres start: build postgres
@echo "==> Starting blockscout" @echo "==> Starting blockscout"
@docker run --rm \ @docker run --rm --name $(BS_CONTAINER_NAME) \
$(BLOCKSCOUT_CONTAINNER_PARAMS) \ $(BLOCKSCOUT_CONTAINNER_PARAMS) \
-p 4000:4000 \ -p 4000:4000 \
$(DOCKER_IMAGE) /bin/sh -c "mix phx.server" $(DOCKER_IMAGE) /bin/sh -c "mix phx.server"

@ -109,5 +109,5 @@
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"},
"wallaby": {:hex, :wallaby, "0.22.0", "e5d16bfa7ab23562c8a6e3b0a31445a2fd470ca622082a910114807ba823780d", [:mix], [{:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm"}, "wallaby": {:hex, :wallaby, "0.22.0", "e5d16bfa7ab23562c8a6e3b0a31445a2fd470ca622082a910114807ba823780d", [:mix], [{:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm"},
"websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm"}, "websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm"},
"wobserver": {:git, "https://github.com/KronicDeth/wobserver.git", "99683a936c75c0a94ebb884cef019f7ed0b97112", [ref: "99683a936c75c0a94ebb884cef019f7ed0b97112"]}, "wobserver": {:git, "https://github.com/poanetwork/wobserver.git", "13bcda30a87f4f0be1878920a79433ad831eefbe", [branch: "support-https"]},
} }

Loading…
Cancel
Save