diff --git a/explorer/lib/explorer/contract_managers/batcher_payment_service_manager.ex b/explorer/lib/explorer/contract_managers/batcher_payment_service_manager.ex index e91496214..883d08694 100644 --- a/explorer/lib/explorer/contract_managers/batcher_payment_service_manager.ex +++ b/explorer/lib/explorer/contract_managers/batcher_payment_service_manager.ex @@ -48,20 +48,24 @@ defmodule BatcherPaymentServiceManager do ) |> Ethers.get_logs(fromBlock: @first_block) |> case do + {:ok, []} -> + Logger.warning("No fee per proof events found for merkle root: #{merkle_root}.") + 0 + {:ok, events} -> event = events |> hd() fee_per_proof = event.data |> hd() - Logger.debug("Fee per proof of #{merkle_root}: #{fee_per_proof} wei") + Logger.debug("Fee per proof of #{merkle_root}: #{fee_per_proof} WEI.") fee_per_proof {:error, reason} -> - Logger.error("Error getting gas per proof: #{inspect(reason)}") - raise("Error getting gas per proof") + Logger.error("Error getting fee per proof: #{inspect(reason)}.") + raise("Error getting fee per proof events.") other -> - Logger.error("Unexpected response: #{inspect(other)}") - raise("Unexpected response") + Logger.error("Unexpected response on fee per proof events: #{inspect(other)}") + raise("Unexpected response on fee per proof events.") end end end diff --git a/explorer/lib/explorer/models/batches.ex b/explorer/lib/explorer/models/batches.ex index 3f4699078..b3093b30f 100644 --- a/explorer/lib/explorer/models/batches.ex +++ b/explorer/lib/explorer/models/batches.ex @@ -34,7 +34,7 @@ defmodule Batches do |> validate_format(:submission_transaction_hash, ~r/0x[a-fA-F0-9]{64}/) |> validate_number(:response_block_number, greater_than: 0) |> validate_format(:response_transaction_hash, ~r/0x[a-fA-F0-9]{64}/) - |> validate_number(:fee_per_proof, greater_than: 0) + |> validate_number(:fee_per_proof, greater_than_or_equal_to: 0) end def cast_to_batches(%BatchDB{} = batch_db) do diff --git a/explorer/lib/explorer_web/live/pages/batch/index.html.heex b/explorer/lib/explorer_web/live/pages/batch/index.html.heex index f6b728b6e..67b5626f3 100644 --- a/explorer/lib/explorer_web/live/pages/batch/index.html.heex +++ b/explorer/lib/explorer_web/live/pages/batch/index.html.heex @@ -39,19 +39,20 @@
<%= @current_batch.amount_of_proofs %>
- <%= if @current_batch.fee_per_proof != nil do %> -- <%= @current_batch.fee_per_proof |> EthConverter.wei_to_eth() %> ETH - <%= if @eth_usd_price != :empty and @eth_usd_price != "0.00000" do %> - (<%= @eth_usd_price %> USD) - <% end %> -
-+ <%= @current_batch.fee_per_proof |> EthConverter.wei_to_eth() %> ETH + <%= if @eth_usd_price != :empty and @eth_usd_price != "0.00000" do %> + (<%= @eth_usd_price %> USD) + <% end %> +
+