Skip to content

Commit

Permalink
Merge pull request #119 from crypto-org-chain/hotfix/re-enable-priori…
Browse files Browse the repository at this point in the history
…ty-fee

update: re-enable the priority fee
  • Loading branch information
WilliamXieCrypto authored Feb 17, 2023
2 parents b655427 + 317ea7e commit 6566357
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 249 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% 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 @@ -206,6 +207,15 @@
</dt>
<dd class="col-sm-9 col-lg-10"><%= format_wei_value(@block.base_fee_per_gas, :ether) %></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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<% 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 %>
<% 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 @@ -369,6 +373,26 @@
<dd class="col-sm-9 col-lg-10"> <%= format_wei_value(max_fee_per_gas, :ether) %> </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, :ether) %> </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 %>
<!-- Gas Used by Transaction -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted transaction-gas-used">
Expand Down
Loading

0 comments on commit 6566357

Please sign in to comment.