full-blockchain-solidity-course-py
full-blockchain-solidity-course-py copied to clipboard
Lesson 6: TypeError: argument of type 'None Type' is not iterable
Hello,
I am trying to complete lesson 6 and am about 5 hrs 15 min into the video: https://www.youtube.com/watch?v=M576WGiDBdQ&t=362s.
I am running this command prompt: brownie run scripts/deploy.py --network rinkeby (I have also tried brownie run scripts/deploy.py) BUT I am getting this error:
File "brownie/_cli/main.py", line 64, in main importlib.import_module(f"brownie._cli.{cmd}").main() File "brownie/_cli/run.py", line 42, in main active_project.load_config() File "brownie/project/main.py", line 462, in load_config _load_project_config(self._path) File "brownie/_config.py", line 222, in _load_project_config and "cmd_settings" in values TypeError: argument of type 'NoneType' is not iterable
Here is my FundMe.sol contract: // SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; //import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
// using SafeMathChainlink for uint256;
mapping(address => uint256) public addressToAmountFunded;
address[] public funders;
address public owner;
AggregatorV3Interface public priceFeed;
constructor(address _priceFeed) public {
priceFeed = AggregatorV3Interface(_priceFeed);
owner = msg.sender;
}
function fund() public payable {
uint256 minimumUSD = 50* 10**18; //minimum 0.01 usd in wei
require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH!");
addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
//what is ETH -> USD conversion rate?
}
function getVersion() public view returns (uint256) {
//AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
function getPrice() public view returns (uint256) {
//AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
(, int256 answer,,,) = priceFeed.latestRoundData();
return uint256(answer*10000000000);
}
function getConversionRate(uint256 ethAmount) public view returns (uint256) {
uint256 ethPrice = getPrice();
uint256 ethAmountInUSD = (ethPrice * ethAmount) / (10**18);
return ethAmountInUSD;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function withdraw() payable onlyOwner public {
//require msg.sender = owner;
payable(msg.sender).transfer(address(this).balance);
for (uint256 funderIndex = 0; funderIndex < funders.length; funderIndex++) {
address funder = funders[funderIndex];
addressToAmountFunded[funder] = 0;
}
funders = new address[](0);
}
}
Here is my deploy.py:
from brownie import FundMe from helpful_scripts import get_account
def deploy_fund_me(): account = get_account() fund_me = FundMe.deploy({"from":account}) print(f"Contract deployed to {fund_me.address}")
def main(): deploy_fund_me()
And my brownie-config.yaml:
Can someone help me understand what I might be doing wrong here, or where the issue lies? Thank #you!
Why is there a backslash in your file path: scripts\deploy.py
? Shouldn't it be scripts/deploy.py
?
Hey sorry, to confirm I've tried both ways. But you're right, it should be the latter. Either way - doesn't work :( Any other thoughts or suggestions?
Brownie parses the networks
part in brownie-config.yaml
in a certain way that you cannot put an existing network id (in brownie networks list
) and let it empty.
networks:
rinkeby:
-> error
networks:
rinkeby:
test:
-> no error
But I think the best would be not to put the networks you don't use yet
I'm having this error too
7xAquarius, you were right, TYSM