Created
December 7, 2021 03:06
-
-
Save dhananjayhegde/3b62978ab70660e4ea8bda73685a90d6 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: MIT | |
pragma solidity >=0.6.0 <0.9.0; | |
// to get latest price data | |
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; | |
contract FundMe { | |
mapping(address => uint256) public addressToAmountFunded; | |
// "payable" function -> accespts payment | |
// Every transaction has some inbuilt variables | |
// "msg" | |
// msg.sender => Sender of the transaction | |
// msg.value => amount of the transaction | |
function fund() public payable { | |
addressToAmountFunded[msg.sender] += msg.value; | |
// Get the conversion rate of ETH -> USD | |
// Need to solve the Oracle problem | |
// -> avoid having a central place to get information from | |
} | |
/** | |
* get the ETH -> USD price feed smart contract address for Rinkebey testnet from -> https://docs.chain.link/docs/ethereum-addresses/ | |
* This smart contract implements the interface AggregatorV3Interface. | |
* Therefore, we can call the method of this interface by using a | |
* reference variable "priceFeed" defined below | |
*/ | |
function getVersion() public view returns (uint256) { | |
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e); | |
return priceFeed.version(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment