which compiler version should i use? #1470
Answered
by
cromewar
Hitesh-jadhav
asked this question in
Q&A
-
code = // SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract fundme {
using SafeMathChainlink for uint256;
mapping(address => uint256) public addtofunded;
function fund() public payable {
uint256 minusd = 50 * 10 * 18;
require(convert(msg.value) >= minusd, "you need to spent more eth");
addtofunded[msg.sender] += msg.value;
}
function get_version() public view returns (uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
function get_price() public view returns(uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
(,int256 answer,,,) = priceFeed.latestRoundData();
return uint256(answer * 10000000000);
}
function convert(uint256 ethamt) public view returns(uint256){
uint256 ethprice = get_price();
uint256 ethamttousd = (ethprice * ethamt) / 1000000000000000000;
return ethamttousd;
}
error =
|
Beta Was this translation helpful? Give feedback.
Answered by
cromewar
May 9, 2022
Replies: 1 comment 1 reply
-
Hello @hjxman Cheers. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cromewar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @hjxman
The problem is you are trying to use SafeMath, since solidity version 0.8.0 the safe math lib is not needed, so if you are going to use a 0.8.0 version or above, please delete the safe math import ;)
Cheers.