[英]Getting an error in smart contract Fundme, The error is "VM execution error. Reverted to 0x"
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6 <0.9.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract FundMe {
mapping(address => uint256) public addressToAmountFunded;
function fund() public payable {
addressToAmountFunded[msg.sender] += msg.value;
}
function getVersion() public view returns (uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
function getPrice() public view returns (uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
priceFeed.latestRoundData();
}
}
Your code is correct.你的代码是正确的。 I googled
0x8A753747A1Fa494EC906cE90E9f37563A8AF630e
and got this website:我用谷歌搜索了
0x8A753747A1Fa494EC906cE90E9f37563A8AF630e
并得到了这个网站:
https://docs.chain.link/docs/ethereum-addresses/ https://docs.chain.link/docs/ethereum-addresses/
So the contract address that you are passing is deployed on Rinkeby test network.因此,您传递的合约地址部署在 Rinkeby 测试网络上。 connect to Rinkeby account on metamask wallet, chooce injected web3 in remix environment:
连接到 metamask 钱包上的 Rinkeby 帐户,在混音环境中选择注入 web3:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.