- <%= block.gas_used |> Cldr.Number.to_string! %>
- (<%= (block.gas_used / block.gas_limit) |> Cldr.Number.to_string!(format: "#.#%") %>)
+ <%= formatted_gas_used(block.gas_used) %>
+ (<%= formatted_gas_used(block.gas_used / block.gas_limit, format: "#.#%") %>)
<%= gettext "Gas Used" %>
diff --git a/apps/explorer_web/lib/explorer_web/views/block_view.ex b/apps/explorer_web/lib/explorer_web/views/block_view.ex
index 73d0bfc47a..8fa7cd9160 100644
--- a/apps/explorer_web/lib/explorer_web/views/block_view.ex
+++ b/apps/explorer_web/lib/explorer_web/views/block_view.ex
@@ -20,6 +20,10 @@ defmodule ExplorerWeb.BlockView do
"#{average} #{unit_text}"
end
+ def formatted_gas_used(gas, format \\ []) do
+ Cldr.Number.to_string!(gas, format)
+ end
+
def formatted_timestamp(%Block{timestamp: timestamp}) do
Timex.format!(timestamp, "%b-%d-%Y %H:%M:%S %p %Z", :strftime)
end