Remix Fund Me - false Transaction mined but execution failed #51
-
Always getting this error in this section. What should I do?
This is my code: // get funds, withdraw funds, set minimum funding value to USD
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; //Import from Github directly (better than copy past
contract FundMe {
uint256 public minimumUsd = 50 * 1e18;
function fund() public payable{
//1. how to send etherium to account?
// set minimum usd sending value
require(getConversionRate(msg.value) >= minimumUsd, "Didn't send enough");
//1e18 == 1*10 ** 18 == 100000000000000000
}
function getPrice() public view returns(uint256){
//ABI
//Address 0x8A753747A1Fa494EC906cE90E9f37563A8AF630e
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
(,int256 price,,,) = priceFeed.latestRoundData();
return uint256(price * 1e10); //1**10 = 10000000000
}
function getVersion() public view returns(uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
function getConversionRate(uint256 ethAmount) public view returns(uint256) {
uint256 ethPrice = getPrice();
uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1e18;
return ethAmountInUsd;
}
//function withdraw(){}
}
//payable function needed to send money, require and msg.value for minimum sending value |
Beta Was this translation helpful? Give feedback.
Answered by
dibakarsutradhar
May 31, 2022
Replies: 2 comments 7 replies
-
try setting the
|
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
LordReya
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try setting the
minimumUSD
to50 * 10**18
uint256 minimumUSD = 50 * 10**18;