from brownie import Lottery, accounts, config, network
from web3 import Web3

def test_get_entrance_fee():
    account = accounts[0]
    lottery = Lottery.deploy(
        {"from": account},
    assert lottery.getEntranceFee() > Web3.toWei(0.012, "ether")
    assert lottery.getEntranceFee() < Web3.toWei(0.015, "ether")
  • Trying to test if my contract is getting the correct entrance fee. Contract compiled without errors. It seems the error is in the test function but i cant find it. Brownie config as follows: dependencies: - smartcontractkit/[email protected] compiler: solc: remappings: - "@chainlink=smartcontractkit/[email protected]" networks: eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
    – PinkyZane
    Dec 13, 2021 at 10:12
  • test summary info: FAILED tests/test_lottery.py::test_get_entrance_fee - KeyError: 'eth_usd_price_feed'
    – PinkyZane
    Dec 13, 2021 at 10:14

1 Answer 1


I think the error is in your brownie config file. The networks: branch should look something like this:

    eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
    eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
    eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'

i.e. there should be a network name in between networks and eth-usd-price-feed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.