diff --git a/.github/workflows/generate_permissions.yaml b/.github/workflows/generate_permissions.yaml index addbcae1..065aafda 100644 --- a/.github/workflows/generate_permissions.yaml +++ b/.github/workflows/generate_permissions.yaml @@ -11,6 +11,7 @@ jobs: env: INFURA_KEY: ${{ secrets.INFURA_KEY }} ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }} + DRPC_KEY: ${{ secrets.DRPC_KEY }} steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/bal_addresses/requirements.txt b/bal_addresses/requirements.txt index 885eca0e..e41d4bf7 100644 --- a/bal_addresses/requirements.txt +++ b/bal_addresses/requirements.txt @@ -1,5 +1,5 @@ pathlib>=1.0 -git+https://github.com/BalancerMaxis/bal_tools@v0.1.1 +git+https://github.com/BalancerMaxis/bal_tools@v0.1.2 requests pandas web3 diff --git a/generate_current_permissions.py b/generate_current_permissions.py index 10e16e0b..32bd41f8 100644 --- a/generate_current_permissions.py +++ b/generate_current_permissions.py @@ -1,43 +1,11 @@ import requests import json import os -from bal_addresses import AddrBook, GITHUB_DEPLOYMENTS_RAW +from bal_addresses import AddrBook, GITHUB_DEPLOYMENTS_RAW, NoResultError from web3 import Web3 +from bal_tools import Web3Rpc -INFURA_KEY = os.getenv("INFURA_KEY") -ALCHEMY_KEY = os.getenv("ALCHEMY_KEY") - -w3_by_chain = { - "gnosis": Web3(Web3.HTTPProvider(f"https://rpc.gnosischain.com")), - "zkevm": Web3( - Web3.HTTPProvider( - f"https://polygonzkevm-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}" - ) - ), - "avalanche": Web3(Web3.HTTPProvider(f"https://api.avax.network/ext/bc/C/rpc")), - ### Less reliable RPCs first to fail fast :) - # "linea": Web3(Web3.HTTPProvider(f"https://linea-mainnet.infura.io/v3/{INFURA_KEY}")), - "mainnet": Web3( - Web3.HTTPProvider(f"https://eth-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}") - ), - "base": Web3( - Web3.HTTPProvider(f"https://base-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}") - ), - "arbitrum": Web3( - Web3.HTTPProvider(f"https://arb-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}") - ), - "optimism": Web3( - Web3.HTTPProvider(f"https://opt-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}") - ), - "polygon": Web3( - Web3.HTTPProvider(f"https://polygon-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}") - ), - "mode": Web3(Web3.HTTPProvider("https://mainnet.mode.network/")), - "fraxtal": Web3(Web3.HTTPProvider("https://rpc.frax.com")), - "sepolia": Web3( - Web3.HTTPProvider(f"https://eth-sepolia.g.alchemy.com/v2/{ALCHEMY_KEY}") - ), -} +DRPC_KEY = os.getenv("DRPC_KEY") def build_chain_permissions_list(chain_name): @@ -46,9 +14,15 @@ def build_chain_permissions_list(chain_name): action_ids_list = ( f"{GITHUB_DEPLOYMENTS_RAW}/action-ids/{chain_name}/action-ids.json" ) - w3 = w3_by_chain[chain_name] + w3 = Web3Rpc(chain_name, DRPC_KEY) + + try: + authorizer_address = a.search_unique("20210418-authorizer/Authorizer").address + except NoResultError as e: + print(f"WARNING: Authorizer not found: {e}") + return results authorizer = w3.eth.contract( - address=a.search_unique("20210418-authorizer/Authorizer").address, + address=authorizer_address, abi=json.load(open("bal_addresses/abis/Authorizer.json")), ) try: @@ -82,7 +56,7 @@ def generate_chain_files(chain): def main(): - for chain in w3_by_chain: + for chain in AddrBook.chains.BALANCER_PRODUCTION_CHAINS: print(f"\n\n\nGenerating Permissions Data for {chain.capitalize()}\n\n\n") generate_chain_files(chain) diff --git a/setup.py b/setup.py index 9505dd1f..33d173fb 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = "0.9.8" +VERSION = "0.9.9" DESCRIPTION = "Balancer Maxi Addressbook" LONG_DESCRIPTION = "Balancer Maxi Addressbook and Balancer Permissions helper" @@ -8,7 +8,7 @@ setup( name="bal_addresses", version=VERSION, - author="Tritium", + author="The Balancer Maxis", author_email="", description=DESCRIPTION, long_description=LONG_DESCRIPTION, @@ -23,7 +23,7 @@ "web3", "gql[requests]", "requests", - "bal_tools @ git+https://github.com/BalancerMaxis/bal_tools@v0.1.1", + "bal_tools @ git+https://github.com/BalancerMaxis/bal_tools@v0.1.2", ], keywords=["python", "first package"], classifiers=[