0

I get the error: "ParserError: Expected '(' but got 'public' --> contracts/FundMe.sol:10:25: | 10 | function getVersion public view returns (uint256) { | ^^^^^^

function getVersion () public view" in the code: "// SPDX-License-Identifier: MIT pragma solidity >=0.6.6 <0.9.0; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract FundMe { mapping(address => uint256) public addressToAmountFunded; function fund() public payable { addressToAmountFunded[msg.sender] += msg.value; //what the ETH -> USD conversion rate } function getVersion public view returns (uint256) { AggregatorV3Interface priceFeed = AggregatorV3Interface(); } }" the error is in public on the function: "function getVersion public view returns (uint256)"

1 Answer 1

0

You are missing parenthesis in our getVersion function.

function getVersion() public view returns (uint256) {
        AggregatorV3Interface priceFeed = AggregatorV3Interface();
    }
2
  • Hello. I am following a YouTube tutorial and the tutorial comes without a parenthesis. I have tried with the parenthesis and it creates another problem. It gives me the error "Estimated execution cost: 320 gas function getVersion () public view returns (uint256 internal ) contracts/FundMe.sol 9:4 Warning: Function state mutability can be restricted to pure --> contracts/FundMe.sol:10:5: | 10 | function getVersion () public view returns (uint256) { | ^ (Relevant source part starts here and spans across multiple lines)."
    – DJ Quimoso
    Commented Nov 29, 2022 at 13:14
  • The problem is fixed, later in the tutorial, he does add the parenthesis. Thank you.
    – DJ Quimoso
    Commented Nov 29, 2022 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.