Skip to content
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
80 changes: 46 additions & 34 deletions explorer/lib/explorer_web/components/contracts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,54 @@ defmodule ContractsComponent do
def mount(socket) do
addresses = Helpers.get_aligned_contracts_addresses()

proof_aggregator_service =
case Helpers.is_mainnet() do
true ->
[]

false ->
[
%{
contract_name: "AlignedProofAggregationService",
address: addresses["alignedProofAggregationService"]
}
]
end

{:ok,
assign(socket,
contracts: [
%{
contract_name: "AlignedProofAggregationService",
address: addresses["alignedProofAggregationService"]
},
%{
contract_name: "AlignedServiceManager",
address: addresses["alignedLayerServiceManager"]
},
%{
contract_name: "BatcherPaymentService",
address: addresses["batcherPaymentService"]
},
%{
contract_name: "BlsApkRegistry",
address: addresses["blsApkRegistry"]
},
%{
contract_name: "IndexRegistry",
address: addresses["indexRegistry"]
},
%{
contract_name: "OperatorStateRetriever",
address: addresses["operatorStateRetriever"]
},
%{
contract_name: "RegistryCoordinator",
address: addresses["registryCoordinator"]
},
%{
contract_name: "StakeRegistry",
address: addresses["stakeRegistry"]
}
]
contracts:
proof_aggregator_service ++
[
%{
contract_name: "AlignedServiceManager",
address: addresses["alignedLayerServiceManager"]
},
%{
contract_name: "BatcherPaymentService",
address: addresses["batcherPaymentService"]
},
%{
contract_name: "BlsApkRegistry",
address: addresses["blsApkRegistry"]
},
%{
contract_name: "IndexRegistry",
address: addresses["indexRegistry"]
},
%{
contract_name: "OperatorStateRetriever",
address: addresses["operatorStateRetriever"]
},
%{
contract_name: "RegistryCoordinator",
address: addresses["registryCoordinator"]
},
%{
contract_name: "StakeRegistry",
address: addresses["stakeRegistry"]
}
]
)}
end

Expand Down
54 changes: 29 additions & 25 deletions explorer/lib/explorer_web/components/nav.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@ defmodule NavComponent do
>
Batches
</.link>
<.link
class={
active_view_class(assigns.socket.view, [
ExplorerWeb.AggProofs.Index,
ExplorerWeb.AggProof.Index
])
}
navigate={~p"/aggregated_proofs"}
>
Aggregation
</.link>
<%= if !ExplorerWeb.Helpers.is_mainnet() do %>
<.link
class={
active_view_class(@socket.view, [
ExplorerWeb.AggProofs.Index,
ExplorerWeb.AggProof.Index
])
}
navigate={~p"/aggregated_proofs"}
>
Aggregation
</.link>
<% end %>
<.nav_links_dropdown
title="Restaking"
class={
Expand Down Expand Up @@ -154,20 +156,22 @@ defmodule NavComponent do
>
Batches
</.link>
<.link
class={
classes([
active_view_class(assigns.socket.view, [
ExplorerWeb.AggregatedProofs.Index,
ExplorerWeb.AggregatedProof.Index
]),
"text-foreground/80 hover:text-foreground font-semibold"
])
}
navigate={~p"/aggregated_proofs"}
>
Aggregation
</.link>
<%= if !ExplorerWeb.Helpers.is_mainnet() do %>
<.link
class={
classes([
active_view_class(assigns.socket.view, [
ExplorerWeb.AggregatedProofs.Index,
ExplorerWeb.AggregatedProof.Index
]),
"text-foreground/80 hover:text-foreground font-semibold"
])
}
navigate={~p"/aggregated_proofs"}
>
Aggregation
</.link>
<% end %>
<.link
class="hover:text-foreground"
target="_blank"
Expand Down
70 changes: 41 additions & 29 deletions explorer/lib/explorer_web/live/pages/home/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ defmodule ExplorerWeb.Home.Index do

operator_latest_release = ReleasesHelper.get_latest_release()

# Only show aggregated proof stat for testnet
aggregated_proof_stat =
if !ExplorerWeb.Helpers.is_mainnet() do
[
%{
title: "Aggregated proofs",
value: aggregated_proofs,
tooltip_text: nil,
link: "/aggregated_proofs"
}
]
else
[]
end

[
%{
title: "Proofs verified",
Expand All @@ -59,36 +74,33 @@ defmodule ExplorerWeb.Home.Index do
_ -> nil
end,
link: nil
},
%{
title: "Aggregated proofs",
value: aggregated_proofs,
tooltip_text: nil,
link: "/aggregated_proofs"
},
%{
title: "AVG proof cost",
value: "#{avg_fee_per_proof_usd} USD",
tooltip_text: "~= #{avg_fee_per_proof_eth} ETH",
link: nil
},
%{
title: "Operators",
value: operators_registered,
tooltip_text: "Current version #{operator_latest_release}",
link: "/operators"
},
%{
title: "Total restaked",
value: "#{restaked_amount_usd_shorthand} USD",
# Using HTML.raw to break paragraph line with <br>
tooltip_text:
Phoenix.HTML.raw(
"= #{Helpers.format_number(restaked_amount_usd)} USD<br>~= #{restaked_amount_eth} ETH"
),
link: "/restaked"
}
]
] ++
aggregated_proof_stat ++
[
%{
title: "AVG proof cost",
value: "#{avg_fee_per_proof_usd} USD",
tooltip_text: "~= #{avg_fee_per_proof_eth} ETH",
link: nil
},
%{
title: "Operators",
value: operators_registered,
tooltip_text: "Current version #{operator_latest_release}",
link: "/operators"
},
%{
title: "Total restaked",
value: "#{restaked_amount_usd_shorthand} USD",
# Using HTML.raw to break paragraph line with <br>
tooltip_text:
Phoenix.HTML.raw(
"= #{Helpers.format_number(restaked_amount_usd)} USD<br>~= #{restaked_amount_eth} ETH"
),
link: "/restaked"
}
]
end

def get_cost_per_proof_chart_data(amount) do
Expand Down
9 changes: 9 additions & 0 deletions explorer/lib/explorer_web/live/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ defmodule ExplorerWeb.Helpers do
Integer.to_string(value) |> String.pad_leading(2, "0")
end

def is_mainnet() do
prefix = System.get_env("ENVIRONMENT")

case prefix do
"mainnet" -> true
_ -> false
end
end

@doc """
Get the EigenLayer Explorer URL based on the environment.
- `holesky` -> https://holesky.eigenlayer.xyz
Expand Down
Loading