Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-1559 support #4520

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
## 3.7.3-beta

### Features
- [#4520](https://github.com/blockscout/blockscout/pull/4520) - Add support for EIP-1559
- [#4569](https://github.com/blockscout/blockscout/pull/4569) - Smart-Contract: remove comment with the submission date
- [#4568](https://github.com/blockscout/blockscout/pull/4568) - TX page: Token transfer and minting section improvements
- [#4540](https://github.com/blockscout/blockscout/pull/4540) - Allign copy buttons for `Block Details` and `Transaction Details` pages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% burned_fee = if !is_nil(@block.base_fee_per_gas), do: Wei.mult(@block.base_fee_per_gas, BlockBurnedFeeCounter.fetch(@block.hash)), else: nil %>
<% priority_fee = if !is_nil(@block.base_fee_per_gas), do: BlockPriorityFeeCounter.fetch(@block.hash), else: nil %>
<div class="tile tile-type-<%= String.downcase(@block_type) %> fade-up" data-selector="block-tile" data-block-number="<%= to_string(@block.number) %>" data-block-hash="<%= @block.hash %>">
<div class="row">
<div class="tile-transaction-type-block col-md-2 d-flex flex-row flex-md-column">
Expand Down Expand Up @@ -53,6 +55,12 @@
<% end %>
</div>
<div class="col-md-4 col-lg-3 text-md-right d-flex flex-column align-items-md-end justify-content-md-end mt-3 mt-md-0">
<%= if !is_nil(@block.base_fee_per_gas) do %>
<!-- Priority Fee -->
<span> <%= format_wei_value(%Wei{value: priority_fee}, :ether) %> <%= gettext "Priority Fees" %> </span>
<!-- Burnt Fees -->
<span> <%= format_wei_value(burned_fee, :ether) %> <%= gettext "Burnt Fees" %> </span>
<% end %>
<!-- Gas Limit -->
<span> <%= formatted_gas(@block.gas_limit) %> <%= gettext "Gas Limit" %> </span>
<!-- Gas Used -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% burned_fee = if !is_nil(@block.base_fee_per_gas), do: Wei.mult(@block.base_fee_per_gas, BlockBurnedFeeCounter.fetch(@block.hash)), else: nil %>
<% priority_fee = if !is_nil(@block.base_fee_per_gas), do: BlockPriorityFeeCounter.fetch(@block.hash), else: nil %>
<section>
<%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
<div class="row">
Expand Down Expand Up @@ -186,6 +188,35 @@
<dd class="col-sm-9 col-lg-10"><%= to_string(@block.nonce) %></dd>
</dl>
<% end %>
<%= if !is_nil(@block.base_fee_per_gas) do%>
<!-- Base Fee per Gas -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Minimum fee required per unit of gas. Fee adjusts based on network congestion.") %>
<%= gettext("Base Fee per Gas") %>
</dt>
<dd class="col-sm-9 col-lg-10"><%= format_wei_value(@block.base_fee_per_gas, :gwei) %></dd>
</dl>
<!-- Burnt Fees -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("xDai burned from transactions included in the block (Base fee (per unit of gas) * Gas Used).") %>
<%= gettext("Burnt Fees") %>
</dt>
<dd class="col-sm-9 col-lg-10"><i class="fas fa-fire i-tooltip-2"></i> <s><%= format_wei_value(burned_fee, :ether) %></s></dd>
</dl>
<!-- Priority Fee / Tip -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("User-defined tips sent to validator for transaction priority/inclusion.") %>
<%= gettext("Priority Fee / Tip") %>
</dt>
<dd class="col-sm-9 col-lg-10"><%= format_wei_value(%Wei{value: priority_fee}, :ether) %></dd>
</dl>
<% end %>
<%= if show_reward?(@block.rewards) do %>
<hr>
<%= for block_reward <- @block.rewards do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<% from_address_hash = @transaction.from_address_hash %>
<% to_address_hash = @transaction.to_address_hash %>
<% created_address_hash = @transaction.created_contract_address_hash %>
<% type = if @transaction.type == 2, do: "2 (EIP-1559)", else: @transaction.type %>
<% base_fee_per_gas = if block, do: block.base_fee_per_gas, else: nil %>
<% max_priority_fee_per_gas = @transaction.max_priority_fee_per_gas %>
<% max_fee_per_gas = @transaction.max_fee_per_gas %>
<% burned_fee = if !is_nil(max_fee_per_gas) and !is_nil(@transaction.gas_used) and !is_nil(base_fee_per_gas), do: Wei.mult(base_fee_per_gas, @transaction.gas_used), else: nil %>
<% priority_fee_per_gas = if is_nil(max_priority_fee_per_gas) or is_nil(base_fee_per_gas), do: nil, else: Enum.min_by([max_priority_fee_per_gas, Wei.sub(max_fee_per_gas, base_fee_per_gas)], fn x -> Wei.to(x, :wei) end) %>
<% priority_fee = if is_nil(priority_fee_per_gas), do: nil, else: Wei.mult(priority_fee_per_gas, @transaction.gas_used) %>
<% decoded_input_data = decoded_input_data(@transaction) %>
<% status = transaction_status(@transaction) %>
<% circles_addresses_list = CustomContractsHelpers.get_custom_addresses_list(:circles_addresses) %>
Expand Down Expand Up @@ -284,8 +291,7 @@
</dt>
<dd class="col-sm-9 col-lg-10"> <%= value(@transaction) %>
<%= if !empty_exchange_rate?(@exchange_rate) do %>
(<span class="address-current-balance large"
data-wei-value=<%= @transaction.value.value %>
(<span data-wei-value=<%= @transaction.value.value %>
data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>
</span>)
<% end %>
Expand Down Expand Up @@ -315,6 +321,16 @@
</dt>
<dd class="col-sm-9 col-lg-10"> <%= gas_price(@transaction, :gwei) %> </dd>
</dl>
<%= if !is_nil(type) do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Transaction type, introduced in EIP-2718.") %>
<%= gettext "Transaction Type" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= type %> </dd>
</dl>
<% end %>
<hr>
<!-- Gas Limit -->
<dl class="row">
Expand All @@ -325,6 +341,46 @@
</dt>
<dd class="col-sm-9 col-lg-10"> <%= format_gas_limit(@transaction.gas) %> </dd>
</dl>
<%= if !is_nil(max_fee_per_gas) do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Maximum total amount per unit of gas a user is willing to pay for a transaction, including base fee and priority fee.") %>
<%= gettext "Max Fee per Gas" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= format_wei_value(max_fee_per_gas, :gwei) %> </dd>
</dl>
<% end %>
<%= if !is_nil(max_priority_fee_per_gas) do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("User defined maximum fee (tip) per unit of gas paid to validator for transaction prioritization.") %>
<%= gettext "Max Priority Fee per Gas" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= format_wei_value(max_priority_fee_per_gas, :gwei) %> </dd>
</dl>
<% end %>
<%= if !is_nil(priority_fee) do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("User-defined tip sent to validator for transaction priority/inclusion.") %>
<%= gettext "Priority Fee / Tip" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= format_wei_value(priority_fee, :ether) %> </dd>
</dl>
<% end %>
<%= if !is_nil(burned_fee) do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Amount of xDai burned for this transaction. Equals Block Base Fee per Gas * Gas Used.") %>
<%= gettext "Transaction Burned Fee" %>
</dt>
<dd class="col-sm-9 col-lg-10"><i class="fas fa-fire i-tooltip-2"></i> <s><%= format_wei_value(burned_fee, :gwei) %></s></dd>
</dl>
<% end %>
<!-- Gas Used by Transaction -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted transaction-gas-used">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule BlockScoutWeb.BlockView do
alias Explorer.Chain
alias Explorer.Chain.{Block, Wei}
alias Explorer.Chain.Block.Reward
alias Explorer.Counters.{BlockBurnedFeeCounter, BlockPriorityFeeCounter}

@dialyzer :no_match

Expand Down
Loading