1

I'm having issues with Brownie not appending the deployed contracts to the ContractContainer as when attempting to index the ContractContainer for my SimpleStorage contract I get the following error:

IndexError: list index out of range

I have a deploy.py script which deploys the contract which I can confirm executes fine and deploys the contract(which is viewable in the explorer):

from brownie import accounts, SimpleStorage

def main():
  account = accounts.load("my-account")
  SimpleStorage.deploy({"from": account})

And another interact.py script to access and interact with a given deployed SimpleStorage contract deployed with the above script.

from brownie import SimpleStorage

def main():
  simple_storage_zero = SimpleStorage[0] # indexing error

Could someone please assist me? if not with the exact issue I'm having at least with another way of interacting with a given SimpleStorage contract by for example instantiating it using the contract's address.

3 Answers 3

1

I'm not sure how this fixes it but simply deleting the contents of the ./build/deployments directory and redeploying the contract solved it for me.

0

Alternatively you can change the default network to the testnet you are deploying on. If I'm not mistaken brownie will launch and connect to ganache-cli by default. You can refer to the documentation here https://eth-brownie.readthedocs.io/en/stable/network-management.html#live-networks, or refer to the picture belowenter image description here

0

Are you adding the network parameter in your brownie script call? If not, try doing so. Example...

brownie scripts/interact.py --network rinkeby

The ContractContainer will contain your deployments on the network that is specified in the parameter. If this parameter is left empty, then it will use the ganache-cli network. Since local network deployments are not stored in the deployments folder, your container will be empty.

Your Answer

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

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