Brownie cannot get networks via alchemy in project brownie-config.yaml

Context:

Explanation:

Since network field is deprecated in the brownie-config.yaml, it's possible to use networks directly instead, which can be successfully checked with brownie console invoking config dict and check that the nets are properly gathered.

The problem is that, when invoking that network, it looks up in the built-in brownie-config instead of the project one.

Reproduction of the problem:

brownie-config.yaml file:

dependencies:
  - OpenZeppelin/[email protected]

compiler:
  solc:
    remappings:
      - '@openzeppelin=OpenZeppelin/[email protected]'

dotenv: .env

wallets:
  from_key: ${PRIVATE_KEY}

networks:
  # any settings given here will replace the defaults
  development:
    host: http://127.0.0.1
    gas_price: 0
    persist: false
    reverting_tx_gas_limit: 6721975
    test_rpc:
      cmd: ganache-cli
      port: 8545
      gas_limit: 6721975
      accounts: 10
      evm_version: istanbul
      mnemonic: brownie
  # set your Infura API token to the environment variable WEB3_INFURA_PROJECT_ID
  mainnet:
    host: https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_MAINNET_AK}
  sepolia:
    host: https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_SEPOLIA_AK}
  polygon:
    host: https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_MAINPOLYGON_AK}

dependencies are successfully gathered from the project brownie-config.yaml. However,

$brownie run .\scripts\2_deploy_ez_token.py --network sepolia >>> ValueError: Unable to expand environment variable in host setting: 'https://sepolia.infura.io/v3/$WEB3_INFURA_PROJECT_ID'

so it's ignoring the part of networks in the project brownie-config. However if checking the config dict,

$brownie console config

...
   
        },
        'live': {
            'default_contract_owner': False,
            'gas_buffer': 1.1,
            'gas_limit': "auto",
            'gas_price': None,
            'max_fee': None,
            'priority_fee': "auto",
            'reverting_tx_gas_limit': False
        },
        'mainnet': {
            'host': "https://polygon-mainnet.g.alchemy.com/v2/dFChI7q5-QpOzf6oY6grd--wqPaiggMT"
        },
        'polygon': {
            'host': "https://eth-sepolia.g.alchemy.com/v2/vaUCnwgp0yj6Y94KLIqrpJwCVdVK2yl5"
        },
        'sepolia': {
            'host': "https://eth-sepolia.g.alchemy.com/v2/Ft6IARQMkXZujCVJ9V4qEOvVhVw0XfJK"
        }
    },
    'project_structure': {
...

so clearly the config dict variable is right. So.. how to successfully make that brownie-config.yaml get the project network info with alchemist? Any suggestion? Thanks. Regards.

Upvotes: 0

Views: 42

Answers (0)

Related Questions