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
17 changes: 2 additions & 15 deletions bal_tools/pools_gauges.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Dict, List, Union
import json
import requests
from .utils import to_checksum_address, flatten_nested_dict
from .utils import to_checksum_address, flatten_nested_dict, chain_names_prod

from gql.transport.exceptions import TransportQueryError
from bal_tools.safe_tx_builder import ZERO_ADDRESS
Expand Down Expand Up @@ -292,20 +292,7 @@ def build_core_pools(
if debug:
return core_pools_extended

core_pools = {
"mainnet": {},
"polygon": {},
"arbitrum": {},
"gnosis": {},
"zkevm": {},
"avalanche": {},
"base": {},
"mode": {},
"fraxtal": {},
"hyperevm": {},
"optimism": {},
"plasma": {},
}
core_pools = {chain: {} for chain in chain_names_prod()}

# summarise extended core pools dict into core_pools dict
for pool in core_pools_extended:
Expand Down
10 changes: 10 additions & 0 deletions bal_tools/subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def url_dict_from_df(df):
"avalanche": f"{AURA_SUBGRAPH_URI}/aura-finance-avalanche/v0.0.1/",
"plasma": None,
}
BLOCKS_SUBGRAPHS_BY_CHAIN = {
"base": "GU5jJMiEHpomqddtbsXC3Avj3EweLHk6up1pvy2TCQQZ",
}

VAULT_V3_SUBGRAPHS_BY_CHAIN, VAULT_V3_SUBGRAPHS_BY_CHAIN_DEV = url_dict_from_df(
vault_df
)
Expand Down Expand Up @@ -108,6 +112,12 @@ def get_subgraph_url(self, subgraph="core") -> str:
return SNAPSHOT_URL
if subgraph == "aura":
return AURA_SUBGRAPHS_BY_CHAIN.get(self.chain, None)
if subgraph == "blocks":
subgraph_id = BLOCKS_SUBGRAPHS_BY_CHAIN.get(self.chain)
if subgraph_id:
graph_api_key = os.getenv("GRAPH_API_KEY")
if graph_api_key:
return f"https://gateway.thegraph.com/api/{graph_api_key}/subgraphs/id/{subgraph_id}"
url = self.get_subgraph_url_from_backend_config(subgraph)
if url:
return url
Expand Down
16 changes: 12 additions & 4 deletions tests/test_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ def test_find_all_subgraph_urls(
pytest.skip(
f"No {subgraph_type} subgraph exists on {subgraph_all_chains.chain}"
)
if subgraph_all_chains.chain == "hyperevm" and subgraph_type in [
if subgraph_all_chains.chain in [
"hyperevm",
"monad",
"xlayer",
] and subgraph_type in [
"core",
"gauges",
"blocks",
Expand All @@ -141,8 +145,12 @@ def test_find_all_subgraph_urls(

url = subgraph_all_chains.get_subgraph_url(subgraph_type)

assert url is not None
assert url is not ""
if have_thegraph_key:
assert url is not None
assert url is not ""
else:
# some chains only have gateway URLs requiring a key; None is expected
assert url is None or url != ""

if not have_thegraph_key:
subgraph_all_chains.set_silence_warnings(False)
Expand Down Expand Up @@ -195,7 +203,7 @@ def test_get_first_block_after_utc_timestamp_with_etherscan(
if not os.getenv("ETHERSCAN_API_KEY"):
pytest.skip("ETHERSCAN_API_KEY not set")

if chain not in chains_prod or chain in ["fantom", "sonic", "mode"]:
if chain not in chains_prod or chain in ["fantom", "sonic", "mode", "zkevm"]:
pytest.skip(f"Skipping {chain}")

test_timestamp = int((datetime.now() - timedelta(days=1)).timestamp())
Expand Down