2

I run this code in brownie: brownie run scripts/deploy.py --networks Rinkeby

deploy.py:

from brownie import network, config, accounts
from brownie import FundMe

def deploy_fund_me():
    account = get_account()
    fund_me = FundMe.deploy({"from": account},publish_source=True)
    print(f"contract deployed to {fund_me.address}")


def get_account():
    if network.show_active() == "development":
        return accounts[0]
    else:
        return accounts.add(config['wallets']['from_key'])



def main():
    deploy_fund_me()

.............................................................................. FundMe.sol:

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.6 ;

import "smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
//.......................................................................................................

contract FundMe {
   using SafeMathChainlink for uint256;

    mapping(address => uint256) public addressToAmountFunded;
    address[] public funders;
    address public owner;

    constructor() public {
        owner = msg.sender;
    }

    function fund() public payable {
        uint256 minimumUSD = 50 * 10 ** 18;
        require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH!");
        addressToAmountFunded[msg.sender] += msg.value;
        funders.push(msg.sender);
    }

    function getVersion() public view returns (uint256){
        AggregatorV3Interface priceFeed = AggregatorV3Interface(0xa7e39728bFF3b2da35F90E95c108Fcf2cb021D72);
        return priceFeed.version();
    }
    function getPrice() public view returns(uint256){
        AggregatorV3Interface priceFeed = AggregatorV3Interface(0xa7e39728bFF3b2da35F90E95c108Fcf2cb021D72);
        (,int256 answer,,,) = priceFeed.latestRoundData();
         return uint256(answer * 10000000000);
    }

    // 1000000000
    function getConversionRate(uint256 ethAmount) public view returns (uint256){
        uint256 ethPrice = getPrice();
        uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000;
        return ethAmountInUsd;
    }

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    function withdraw() payable onlyOwner public {
        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);
    }
}

//..............................................................................................

......................

3 Answers 3

1

It is not something related to your contract code, otherwise, it would not compile.

If your brownie-config.yaml setting names did not match you would get an error. then only thing it might be is publish_source=True

Remove publish_source=True. try without publishing. if you are on a development network, etherscan will not know about your development network

0

I ran into this issue as well. Any suggestions on help? My brownie-config.yaml file seems ok:

networks: default: development rinkeby: eth_usd_price_feed: '0x8A753747A1Fa494EC906cE90E9f37563A8AF630e'
verify: True mainnet-fork-dev: eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
verify: True development: verify: False ganache-local: verify: False

1
  • Figured it out. In my brownie-config.yaml i needed to set verify to false for the mainnet-fork-dev Jan 20, 2022 at 1:26
0

you need to set publish_source = False if on a mock network so that it does not try verify an API that does not really exist.

see this video 5h25! (its a long video) https://www.youtube.com/watch?v=M576WGiDBdQ

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.