Skip to content

Commit

Permalink
Merge pull request #401 from BalancerMaxis/fix/raise_on_pools_gauges_…
Browse files Browse the repository at this point in the history
…failure

fix: only run for prod chains and raise on errors
  • Loading branch information
gosuto-inzasheru authored Aug 6, 2024
2 parents 2e9db18 + b5b0137 commit 525db4f
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions gen_pools_and_gauges.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,20 @@ def main():

with open("extras/chains.json", "r") as f:
chains = json.load(f)
for chain in chains["CHAIN_IDS_BY_NAME"]:
print(chain)
if chain == "fantom":
# not a balancer native chain
continue
for chain in chains["BALANCER_PRODUCTION_CHAINS"]:
print(f"Generating pools and gauges for {chain}...")
gauge_info = BalPoolsGauges(chain)
# pools
# TODO: consider moving to query object??
try:
result = process_query_swap_enabled_pools(query_swap_enabled_pools(chain))
if result:
pools[chain] = result
except Exception as e:
print(f"Error using core subgraph for {chain}, skipping: {e}")
pools[chain] = {}
result = process_query_swap_enabled_pools(query_swap_enabled_pools(chain))
if result:
pools[chain] = result
# gauges
try:
result = process_query_preferential_gauges(
gauge_info.query_preferential_gauges()
)
if result:
gauges[chain] = result
except Exception as e:
print(f"Error using gauge subgraph for {chain}, skipping: {e}")
gauges[chain] = {}
result = process_query_preferential_gauges(
gauge_info.query_preferential_gauges()
)
if result:
gauges[chain] = result
# cache mainnet BalPoolsGauges
if chain == "mainnet":
gauge_info_mainnet = gauge_info
Expand Down

0 comments on commit 525db4f

Please sign in to comment.