smartcontractkit / full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
MIT License
10.67k stars 2.89k forks source link

!!! NOTE I FOUND THE ANSWER CHECK THE ANSWER: TypeError: argument of type 'bool' is not iterable on brownie run scripts/deploy.py command #1817

Closed Stmbisa closed 1 year ago

Stmbisa commented 1 year ago

Hey i am having difficulties running deploy, in the first times it was working fine and afterwards even the code that was running stopped running, what could be the error. Please help me. Note that the same code had run before it simply stoped on my revision or maybe I removed something accidentally

here is the whole error `INFO: Could not find files for the given pattern(s). Brownie v1.19.2 - Python development framework for Ethereum

File "C:\Users\JC\Desktop\deveth\pythondemos\lib\site-packages\brownie_cli__main__.py", line 64, in main importlib.import_module(f"brownie._cli.{cmd}").main() File "C:\Users\JC\Desktop\deveth\pythondemos\lib\site-packages\brownie_cli\run.py", line 42, in main active_project.load_config() File "C:\Users\JC\Desktop\deveth\pythondemos\lib\site-packages\brownie\project\main.py", line 474, in load_config _load_project_config(self._path) File "C:\Users\JC\Desktop\deveth\pythondemos\lib\site-packages\brownie_config.py", line 222, in _load_project_config and "cmd_settings" in values TypeError: argument of type 'bool' is not iterable`

here is my deploy.py file

`from brownie import FundMe, MockV3Aggregator, network, config from scripts.helpful_scripts import ( get_account, deploy_mocks, LOCAL_BLOCKCHAIN_ENVIRONMENTS, )

def deploy_fund_me(): account = get_account() if network.show_active() not in LOCAL_BLOCKCHAIN_ENVIRONMENTS: price_feed_address = config["networks"][network.show_active()][ "eth_usd_price_feed" #fetching addresses from brownie-config file ] else: deploy_mocks() # imported function from helpful scripts price_feed_address = MockV3Aggregator[-1].address # just in case we have many addresses we take the most recent/last

`fund_me = FundMe.deploy(
    price_feed_address, 
    {"from": account},
    publish_source=config["networks"][network.show_active()].get("verify"),`
)
print(f"Contract deployed to {fund_me.address}")
return fund_me

def main(): deploy_fund_me() `

and here is my helpful_scripts.py

` from brownie import network, config, accounts, MockV3Aggregator from web3 import Web3

FORKED_LOCAL_ENVIRONMENTS = ["mainnet-fork", "mainnet-fork-dev"] LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["development", "ganache-local"]

DECIMALS = 8 STARTING_PRICE = 200000000000

def get_account(): if ( network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS or network.show_active() in FORKED_LOCAL_ENVIRONMENTS ): return accounts[0] else: return accounts.add(config["wallets"]["from_key"]) #fetching the key from brownie-config

def deploy_mocks(): print(f"The active network is {network.show_active()}") print("Deploying Mocks...") if len(MockV3Aggregator) <= 0: # Mocks are similated interfaces for local networks, and here we check if there is no contract that is already deployed

    MockV3Aggregator.deploy(DECIMALS, STARTING_PRICE, {"from": get_account()}) 
   print("Mocks Deployed!")

`

and here is my config file ` dependencies:

- organisation/repo>@<version this is a schema to tell brownie where to download the interfaces on github

compiler: solc: remappings:

dotenv: .env networks: goerli: eth_usd_price_feed: "0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e" verify: True development: verify: False

we can add any netwok we want or we may want to work with here

ganache-local: False wallets: from_key: ${PRIVATE_KEY} # from .env file `

.env file `export PRIVATE_KEY ='0x98a1f8269ebb99a59948b7c09079cf0a75c04bcbea3b6881e3c5d7658261ce35' export WEB3_INFURA_PROJECT_ID = a6bd5268a2b0432cbbefe4f634f9e789 export ETHERSCAN_TOKEN = TAD6VC3ERIX1RMPK4URRJ3U3IPWQSNAAZK

this is a api token to verify a contract on etherscan otherwise you would need to manually do it`

FundMe and Mock3aggregator I used the ones Patrick used

Stmbisa commented 1 year ago

Hey had forgotten an indentation in the config file on ganache-local

ganache-local: 
    verify:    False