LESSON 3: FUND ME #1011
Answered
by
n4n0b1t3
Tundekuzco
asked this question in
Q&A
LESSON 3: FUND ME
#1011
-
//SPDX-License-identifier:MIT
pragma solidity >=0.6.0 <0.9.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract FundMe{
// mapping between addresses and value
mapping(address => uint256) public addressToAmountFunded;
function fund() public payable{
//used to keep track of all the addresses that sent us value
addressToAmountFunded[msg.sender] += msg.value;
// what ETH -> USD Conversion Rate
}
function getversion() public view returns (uint256){
// this line is saying we have a contract that has the aggregator functions defined on the interface located at this address
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
function getPrice() public view returns (uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
(,int256 answer,,,) = priceFeed.latestRoundData();
return uint256(answer);
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
n4n0b1t3
Feb 10, 2022
Replies: 1 comment 3 replies
-
in remix under "deploy and run transactions" which environment did you select? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
cromewar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in remix under "deploy and run transactions" which environment did you select?
This needs to be injected and connected to a testnet metamask account. On local the call won't reach the chainlink service.