provable-things / ethereum-api

Provable API for Ethereum smart contracts
https://docs.provable.xyz/#ethereum
MIT License
801 stars 428 forks source link

Error when importing the library oraclizeAPI.sol #70

Closed fanglei80 closed 5 years ago

fanglei80 commented 5 years ago

Hello, if anyone can help me out on this error when importing oraclizeAPI , very much appreciated! the Remix version :Current version:0.4.19-nightly.2017.11.30+commit.f5a2508e.Emscripten.clang

pragma solidity ^0.4.19; import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

Error: github.com/oraclize/ethereum-api/oraclizeAPI.sol:39:53: ParserError: Expected token Comma got 'Identifier' function query(uint _timestamp, string calldata _datasource, string calldata _arg) external payable returns (bytes32 _id); ^

D-Nice commented 5 years ago

Hello,

The current oraclizeAPI.sol now targets solc 0.5, and that is why you are getting that error.

We still do support 0.4.x solc, but you will need to explicitly import one of those versions now. Seeing your pragma, you should use oraclizeAPI_0.4.sol. What this entails is replacing your current import statement from:

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

to

import "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol";

Or use the 0.4.25 version if targetting 0.4.22 solc or above (as per the API mentions).

Tomorrow, we'll see to add a 0.4.18 targetted version as well, which would seem to fit your pragma best.

D-Nice commented 5 years ago

the api has been updated to give a more clear indicator of why the error is happening, mentioning incompatible solc now, since https://github.com/oraclize/ethereum-api/commit/37ed083a2f795dcf3f7f5c89206937a61902ffe6 and telling user to import 0.4 instead.

D-Nice commented 5 years ago

I assume this has been solved for you, reopen if needed.

fanglei80 commented 5 years ago

hi D-Nice, Thanks a lot for your carefully written guidance and comments!