Etherscan
raise ValueError(‘Explorer API not set for this network’) ValueError: Explorer API not set for this network
我在 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); } } //..............................................................................................
………………….
它與您的合約程式碼無關,否則將無法編譯。
如果您的 brownie-config.yaml 設置名稱不匹配,您將收到錯誤消息。那麼唯一的可能就是
publish_source=True
刪除
publish_source=True
. 嘗試不發布。如果您在開發網路上,etherscan 將不知道您的開發網路
我也遇到了這個問題。關於幫助的任何建議?我的 brownie-config.yaml 文件似乎沒問題:
網路:預設:開發 rinkeby:eth_usd_price_feed:‘0x8A753747A1Fa494EC906cE90E9f37563A8AF630e’
驗證:真 mainnet-fork-dev:eth_usd_price_feed:‘0x5f4eC3Df9cbd43714FE2740f5E3616155c5b841
驗證:真驗證:本地驗證:假驗證: