Search code examples
pythonchainlink

ContractNotFound: No contract deployed at


I have been involved in the chainlink bootcamp and trying to finishing the final 'Exercise 3: Putting it all together'.

However, I am stuck running:

brownie run scripts/price_exercise_scripts/01_deploy_price_exercise.py --network kovan

ContractNotFound: No contract deployed at 0xF4030086511a5bEEa4966F8cA5B36dbC97BeE88c

Printed contract_type._name is a mock address returned from `MockV3Aggregator which also doesn't make sense, why the code calls this logic.

def get_contract(contract_name):

contract_type = contract_to_mock[contract_name]
if network.show_active() in NON_FORKED_LOCAL_BLOCKCHAIN_ENVIRONMENTS:
    if len(contract_type) <= 0:
        deploy_mocks()
    contract = contract_type[-1]
else:
    try:
        contract_address = config["networks"][network.show_active()][contract_name]

        contract = Contract.from_abi(
            contract_type._name, contract_address, contract_type.abi
        )
    except KeyError:
        print(
            f"{network.show_active()} address not found, perhaps you should add it to 
       the config or deploy mocks?")
        print(
            f"brownie run scripts/deploy_mocks.py --network {network.show_active()}"
        )
return contract

I am struggling to understand this error message, should this command not be deploying contracts? I.e they should already already exist on the kovan network?

Any insights welcome!


Solution

  • Problem - I was using the ethereum mainnet address instead of the correct kovan network address for btc / usd price.

    Changing the btc_usd_price_feed value to 0x6135b13325bfC4B00278B4abC5e20bbce2D6580e in the config.yml fixed this issue for me.

    price feed addresses