In lesson 4 when I deployed a basic code for price converstion #308
Answered
by
vishvjeet-thakur
vishvjeet-thakur
asked this question in
Q&A
-
When I deploy this with 0 ether it is getting deployed successfully but with a non zero ether even with 1 wei it is not getting deployed what could be the reason and insufficient fund is not a reason here. // SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract FundMe {
uint256 minimumUsd = 5e18;
function fund() public payable{
require(priceConversion(msg.value)>minimumUsd, "not enough fund to donate, it should be greater than $5");
}
function getPrice() public view returns(uint256) {
AggregatorV3Interface pricefeed = AggregatorV3Interface(0x694AA1769357215DE4FAC081bf1f309aDC325306);
(,int256 answer,,,)= pricefeed.latestRoundData();
return uint256(answer*1e10);
}
function priceConversion(uint256 eth) public view returns(uint256)
{
uint256 price = getPrice();
return (price*eth)/1e18;
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
vishvjeet-thakur
Jul 11, 2023
Replies: 1 comment 6 replies
-
Hello @vishvjeet-thakur
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thankyou guys @cromewar @DevSwayam just because of you guys learning something new is very easy.
Actually after looking again it turned out that I was doing a mistake in deploying like I was unaware that we have to fill value after deployment but I was doing it before that so that why it was giving that error.
But thank alot again.