Brownie Eth - Changing networks does not change the network.chain.id

Viewed 18

I am trying to programatically deploy a Smart Contract via Brownie to multiple test networks.

The following code works, however when I switch networks the network.chain.id renames the same as the first one. I need this chain_id so I can store the contract addresses that have been deployed for each network.

for name in ["fuji-testnet", "polygon-test", "goerli"]:
    network.disconnect()
    network.connect(network_name, launch_rpc=False)
    print(network.show_active(), network.is_connected(), network.chain.id)

The above code will output:

fuji-testnet True 43113 polygon-test True 43113 goerli True 43113

Which is not what I need.

0 Answers
Related