Skip to content

Commit

Permalink
feat(indexer): index staking contract on eth mainnet on deployed to d…
Browse files Browse the repository at this point in the history
…ifferent address than op (#580)
  • Loading branch information
nutrina authored Apr 26, 2024
1 parent 7bfd133 commit 9a6aa99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion indexer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ INDEXER_OPTIMISM_ENABLED=true

INDEXER_ETHEREUM_START_BLOCK=0
INDEXER_OPTIMISM_START_BLOCK=0
STAKING_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000
STAKING_CONTRACT_ADDRESS_ETH_MAINNET=0x0000000000000000000000000000000000000000
STAKING_CONTRACT_ADDRESS_OP_MAINNET=0x0000000000000000000000000000000000000000

DB_USER=user
DB_PASSWORD=pw
Expand Down
9 changes: 6 additions & 3 deletions indexer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ async fn main() -> Result<()> {

loop {
let postgres_client = PostgresClient::new().await?;
let contract_address = get_env("STAKING_CONTRACT_ADDRESS")
let contract_address_eth_mainnet = get_env("STAKING_CONTRACT_ADDRESS_ETH_MAINNET")
.parse::<Address>()
.unwrap();
let contract_address_op_mainnet = get_env("STAKING_CONTRACT_ADDRESS_OP_MAINNET")
.parse::<Address>()
.unwrap();

match try_join!(
run_legacy_indexer(postgres_client.clone()),
run_ethereum_indexer(postgres_client.clone(), &contract_address),
run_optimism_indexer(postgres_client.clone(), &contract_address)
run_ethereum_indexer(postgres_client.clone(), &contract_address_eth_mainnet),
run_optimism_indexer(postgres_client.clone(), &contract_address_op_mainnet)
) {
Ok(_) => {
eprintln!("Warning - top-level join ended without error");
Expand Down

0 comments on commit 9a6aa99

Please sign in to comment.