Function

“函式 getVersion 公共視圖返回 (uint256)”錯誤

  • November 29, 2022

我收到錯誤:“ParserError: Expected ‘(’ but got ‘public’ –> contracts/FundMe.sol:10:25: | 10 | function getVersion public view returns (uint256) { | ^^^^^^

function getVersion () public view”中的程式碼:“// SPDX-License-Identifier: MIT pragma solidity >=0.6.6 <0.9.0; 導入“@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol”;contract FundMe { mapping(address => uint256) public addressToAmountFunded; function fund() public payable { addressToAmountFunded

$$ msg.sender $$+= 味精值;//ETH -> 美元轉換率是多少 } function getVersion public view returns (uint256) { AggregatorV3Interface priceFeed = AggregatorV3Interface(); } }”錯誤在函式上公開:“函式 getVersion 公共視圖返回 (uint256)”

您在我們的getVersion函式中缺少括號。

function getVersion() public view returns (uint256) {
       AggregatorV3Interface priceFeed = AggregatorV3Interface();
   }

引用自:https://ethereum.stackexchange.com/questions/140195