Skip to content

Commit

Permalink
deduplicate config network id
Browse files Browse the repository at this point in the history
  • Loading branch information
Tburm committed Jun 10, 2024
1 parent f61e8b4 commit 7156be9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
9 changes: 4 additions & 5 deletions extractors/configs/arbitrum_mainnet.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
network_id: 42161

blocks:
network_id: 42161
min_block: "218M"
requests_per_second: 25
block_increment: 4000

eth_calls:
- network_id: 42161
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultCollateral"
inputs:
- [1, "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"]
Expand All @@ -16,8 +16,7 @@ eth_calls:
requests_per_second: 25
block_increment: 4000

- network_id: 42161
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultDebt"
inputs:
- [1, "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"]
Expand Down
9 changes: 4 additions & 5 deletions extractors/configs/arbitrum_sepolia.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
network_id: 421614

blocks:
network_id: 421614
min_block: "41M"
requests_per_second: 25
block_increment: 4000

eth_calls:
- network_id: 421614
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultCollateral"
inputs:
- [1, "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73"]
Expand All @@ -18,8 +18,7 @@ eth_calls:
block_increment: 4000


- network_id: 421614
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultDebt"
inputs:
- [1, "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73"]
Expand Down
9 changes: 4 additions & 5 deletions extractors/configs/base_mainnet.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
network_id: 8453

blocks:
network_id: 8453
min_block: "7.5M"
requests_per_second: 25

eth_calls:
- network_id: 8453
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultCollateral"
inputs:
- [1, "0xC74eA762cF06c9151cE074E6a569a5945b6302E7"]
min_block: "7.5M"
requests_per_second: 25

- network_id: 8453
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultDebt"
inputs:
- [1, "0xC74eA762cF06c9151cE074E6a569a5945b6302E7"]
Expand Down
9 changes: 4 additions & 5 deletions extractors/configs/base_sepolia.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
network_id: 84532

blocks:
network_id: 84532
min_block: "8M"
requests_per_second: 25

eth_calls:
- network_id: 84532
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultCollateral"
inputs:
- [1, "0x8069c44244e72443722cfb22DcE5492cba239d39"]
min_block: "8M"
requests_per_second: 25

- network_id: 84532
contract_name: "CoreProxy"
- contract_name: "CoreProxy"
function_name: "getVaultDebt"
inputs:
- [1, "0x8069c44244e72443722cfb22DcE5492cba239d39"]
Expand Down
9 changes: 5 additions & 4 deletions extractors/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
with open(args.config, "r") as f:
config = yaml.safe_load(f)

network_id = config.get("network_id")
block_config = config.get("blocks")
eth_call_configs = config.get("eth_calls", [])

Expand All @@ -25,7 +26,7 @@
if args.name == "blocks":
# run blocks only
try:
extract_blocks(**block_config)
extract_blocks(network_id=network_id, **block_config)
except Exception as e:
print(f"Error extracting blocks: {e}")
else:
Expand All @@ -35,21 +36,21 @@
)
if eth_call_config:
try:
extract_data(**eth_call_config)
extract_data(network_id=network_id, **eth_call_config)
except Exception as e:
print(f"Error extracting eth_call {args.name}: {e}")
else:
print(f"No configuration found with name {args.name}")
else:
# run everything
try:
extract_blocks(**block_config)
extract_blocks(network_id=network_id, **block_config)
except Exception as e:
print(f"Error extracting blocks: {e}")

for eth_call_config in eth_call_configs:
try:
extract_data(**eth_call_config)
extract_data(network_id=network_id, **eth_call_config)
except Exception as e:
print(f"Error extracting eth_call {eth_call_config.get('name')}: {e}")
continue

0 comments on commit 7156be9

Please sign in to comment.