Skip to content

Commit

Permalink
Merge pull request blockscout#3252 from poanetwork/vb-gas-price
Browse files Browse the repository at this point in the history
Gas price at the main page
  • Loading branch information
vbaranov authored Aug 24, 2020
2 parents c794a6f + c7f2c1b commit ee8d99b
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Current

### Features
- [#3252](https://github.com/poanetwork/blockscout/pull/3252) - Gas price at the main page
- [#3239](https://github.com/poanetwork/blockscout/pull/3239) - Hide address page tabs if no items
- [#3236](https://github.com/poanetwork/blockscout/pull/3236) - Easy verification of contracts which hash verified twins (the same bytecode)
- [#3227](https://github.com/poanetwork/blockscout/pull/3227) - Distinguishing of bridged tokens
Expand Down
16 changes: 16 additions & 0 deletions apps/block_scout_web/assets/css/components/_dashboard-banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ $dashboard-banner-chart-axis-font-color: $dashboard-stats-item-value-color !defa
font-size: 12px;
font-weight: normal;
line-height: 1.2;

&.inline {
display: inline-block;
}
}

.dashboard-banner-chart-legend-value-container {
white-space: nowrap;
}

.gas-price-icon {
position: relative;
top: -2px;
path {
fill: $dashboard-line-color-price;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion apps/block_scout_web/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ config :block_scout_web,
api_url: System.get_env("API_URL"),
apps_menu: if(System.get_env("APPS_MENU", "false") == "true", do: true, else: false),
external_apps: System.get_env("EXTERNAL_APPS"),
multi_token_bridge_mediator: System.get_env("MULTI_TOKEN_BRIDGE_MEDIATOR")
multi_token_bridge_mediator: System.get_env("MULTI_TOKEN_BRIDGE_MEDIATOR"),
gas_price: System.get_env("GAS_PRICE", nil)

config :block_scout_web, BlockScoutWeb.Counters.BlocksIndexedCounter, enabled: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ defmodule BlockScoutWeb.ChainController do
transaction_estimated_count: transaction_estimated_count,
transactions_path: recent_transactions_path(conn, :index),
transaction_stats: transaction_stats,
block_count: block_count
block_count: block_count,
gas_price: Application.get_env(:block_scout_web, :gas_price)
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,19 @@
<span class="dashboard-banner-chart-legend-label">
<%= gettext "Price" %>
</span>
<span class="dashboard-banner-chart-legend-value" data-selector="exchange-rate" data-wei-value="<%= Explorer.Chain.Wei.from(Decimal.new(1), :ether).value %>" data-usd-exchange-rate="<%= @exchange_rate.usd_value %>">
</span>
<div class="dashboard-banner-chart-legend-value-container">
<span class="dashboard-banner-chart-legend-value inline" data-selector="exchange-rate" data-wei-value="<%= Explorer.Chain.Wei.from(Decimal.new(1), :ether).value %>" data-usd-exchange-rate="<%= @exchange_rate.usd_value %>">
</span>
<%= if @gas_price do%>
<span class="dashboard-banner-chart-legend-value inline ml-2">
<span class="gas-price-icon">
<%= render BlockScoutWeb.IconsView, "_gas_price_icon.html" %>
</span>
<%= @gas_price <> " " %>
<%= gettext "Gwei" %>
</span>
<% end %>
</div>
</div>
<% end %>
<%= if Enum.member?(@chart_config.market, :market_cap) do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.0178 3.76L14.0311 3.74667L10.72 0.444458L9.77779 1.38667L11.6533 3.26221C10.8178 3.58221 10.2222 4.38667 10.2222 5.33333C10.2222 6.56 11.2177 7.55554 12.4444 7.55554C12.76 7.55554 13.0622 7.48888 13.3333 7.36888V13.7778C13.3333 14.2667 12.9333 14.6667 12.4445 14.6667C11.9556 14.6667 11.5556 14.2667 11.5556 13.7778V9.77779C11.5556 8.79558 10.76 8 9.77779 8H8.88892V1.77779C8.88888 0.795542 8.09333 0 7.11113 0H1.77779C0.795542 0 0 0.795542 0 1.77779V16H8.88888V9.33333H10.2222V13.7778C10.2222 15.0045 11.2177 16 12.4444 16C13.6711 16 14.6666 15.0045 14.6666 13.7778V5.33333C14.6667 4.72 14.4178 4.16446 14.0178 3.76ZM7.11113 6.22221H1.77779V1.77779H7.11113V6.22221ZM12.4445 6.22221C11.9556 6.22221 11.5556 5.82221 11.5556 5.33333C11.5556 4.84446 11.9556 4.44446 12.4445 4.44446C12.9333 4.44446 13.3333 4.84446 13.3333 5.33333C13.3333 5.82221 12.9333 6.22221 12.4445 6.22221Z" fill="#FF8A58"/>
</svg>
27 changes: 14 additions & 13 deletions apps/block_scout_web/priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ msgid "Anything not in this list is not supported. Click on the method to be tak
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:84
#: lib/block_scout_web/templates/chain/show.html.eex:95
msgid "Average block time"
msgstr ""

Expand Down Expand Up @@ -233,7 +233,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:126
#: lib/block_scout_web/templates/chain/show.html.eex:137
#: lib/block_scout_web/templates/layout/_topnav.html.eex:31
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35
msgid "Blocks"
Expand Down Expand Up @@ -737,6 +737,7 @@ msgid "GraphQL"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:54
#: lib/block_scout_web/views/block_view.ex:20
#: lib/block_scout_web/views/wei_helpers.ex:77
msgid "Gwei"
Expand Down Expand Up @@ -776,7 +777,7 @@ msgid "Success"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:65
#: lib/block_scout_web/templates/chain/show.html.eex:76
#: lib/block_scout_web/templates/layout/app.html.eex:33
msgid "Tx/day"
msgstr ""
Expand Down Expand Up @@ -1031,7 +1032,7 @@ msgid "Mainnet"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:52
#: lib/block_scout_web/templates/chain/show.html.eex:63
#: lib/block_scout_web/templates/layout/app.html.eex:30
#: lib/block_scout_web/views/address_view.ex:142
msgid "Market Cap"
Expand Down Expand Up @@ -1064,7 +1065,7 @@ msgid "More internal transactions have come in"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:187
#: lib/block_scout_web/templates/chain/show.html.eex:198
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:10
#: lib/block_scout_web/templates/transaction/index.html.eex:10
msgid "More transactions have come in"
Expand Down Expand Up @@ -1307,7 +1308,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:59
#: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/block_transaction/index.html.eex:23
#: lib/block_scout_web/templates/chain/show.html.eex:130
#: lib/block_scout_web/templates/chain/show.html.eex:141
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:20
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:21
Expand All @@ -1321,7 +1322,7 @@ msgid "Something went wrong, click to reload."
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:193
#: lib/block_scout_web/templates/chain/show.html.eex:204
msgid "Something went wrong, click to retry."
msgstr ""

Expand Down Expand Up @@ -1450,7 +1451,7 @@ msgid "Total Supply"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:101
#: lib/block_scout_web/templates/chain/show.html.eex:112
msgid "Total blocks"
msgstr ""

Expand Down Expand Up @@ -1590,12 +1591,12 @@ msgid "Version"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:125
#: lib/block_scout_web/templates/chain/show.html.eex:136
msgid "View All Blocks"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:183
#: lib/block_scout_web/templates/chain/show.html.eex:194
msgid "View All Transactions"
msgstr ""

Expand Down Expand Up @@ -1637,7 +1638,7 @@ msgid "WEI"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:109
#: lib/block_scout_web/templates/chain/show.html.eex:120
msgid "Wallet addresses"
msgstr ""

Expand Down Expand Up @@ -1776,7 +1777,7 @@ msgid "Module"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:93
#: lib/block_scout_web/templates/chain/show.html.eex:104
msgid "Total transactions"
msgstr ""

Expand Down Expand Up @@ -1863,7 +1864,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:15
#: lib/block_scout_web/templates/block_transaction/index.html.eex:10
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:184
#: lib/block_scout_web/templates/chain/show.html.eex:195
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:344
msgid "Transactions"
Expand Down
27 changes: 14 additions & 13 deletions apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ msgid "Anything not in this list is not supported. Click on the method to be tak
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:84
#: lib/block_scout_web/templates/chain/show.html.eex:95
msgid "Average block time"
msgstr ""

Expand Down Expand Up @@ -233,7 +233,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:126
#: lib/block_scout_web/templates/chain/show.html.eex:137
#: lib/block_scout_web/templates/layout/_topnav.html.eex:31
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35
msgid "Blocks"
Expand Down Expand Up @@ -737,6 +737,7 @@ msgid "GraphQL"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:54
#: lib/block_scout_web/views/block_view.ex:20
#: lib/block_scout_web/views/wei_helpers.ex:77
msgid "Gwei"
Expand Down Expand Up @@ -776,7 +777,7 @@ msgid "Success"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:65
#: lib/block_scout_web/templates/chain/show.html.eex:76
#: lib/block_scout_web/templates/layout/app.html.eex:33
msgid "Tx/day"
msgstr ""
Expand Down Expand Up @@ -1031,7 +1032,7 @@ msgid "Mainnet"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:52
#: lib/block_scout_web/templates/chain/show.html.eex:63
#: lib/block_scout_web/templates/layout/app.html.eex:30
#: lib/block_scout_web/views/address_view.ex:142
msgid "Market Cap"
Expand Down Expand Up @@ -1064,7 +1065,7 @@ msgid "More internal transactions have come in"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:187
#: lib/block_scout_web/templates/chain/show.html.eex:198
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:10
#: lib/block_scout_web/templates/transaction/index.html.eex:10
msgid "More transactions have come in"
Expand Down Expand Up @@ -1307,7 +1308,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:59
#: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/block_transaction/index.html.eex:23
#: lib/block_scout_web/templates/chain/show.html.eex:130
#: lib/block_scout_web/templates/chain/show.html.eex:141
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:20
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:21
Expand All @@ -1321,7 +1322,7 @@ msgid "Something went wrong, click to reload."
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:193
#: lib/block_scout_web/templates/chain/show.html.eex:204
msgid "Something went wrong, click to retry."
msgstr ""

Expand Down Expand Up @@ -1450,7 +1451,7 @@ msgid "Total Supply"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:101
#: lib/block_scout_web/templates/chain/show.html.eex:112
msgid "Total blocks"
msgstr ""

Expand Down Expand Up @@ -1590,12 +1591,12 @@ msgid "Version"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:125
#: lib/block_scout_web/templates/chain/show.html.eex:136
msgid "View All Blocks"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:183
#: lib/block_scout_web/templates/chain/show.html.eex:194
msgid "View All Transactions"
msgstr ""

Expand Down Expand Up @@ -1637,7 +1638,7 @@ msgid "WEI"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:109
#: lib/block_scout_web/templates/chain/show.html.eex:120
msgid "Wallet addresses"
msgstr ""

Expand Down Expand Up @@ -1776,7 +1777,7 @@ msgid "Module"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:93
#: lib/block_scout_web/templates/chain/show.html.eex:104
msgid "Total transactions"
msgstr ""

Expand Down Expand Up @@ -1863,7 +1864,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:15
#: lib/block_scout_web/templates/block_transaction/index.html.eex:10
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:184
#: lib/block_scout_web/templates/chain/show.html.eex:195
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:344
msgid "Transactions"
Expand Down
3 changes: 3 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ endif
ifdef EXTERNAL_APPS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXTERNAL_APPS=$(EXTERNAL_APPS)'
endif
ifdef GAS_PRICE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'GAS_PRICE=$(GAS_PRICE)'
endif

HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep ${DOCKER_IMAGE})
build:
Expand Down

0 comments on commit ee8d99b

Please sign in to comment.