I'm using oraclize in my contract.

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

When I go to verify and publish on etherscan I get this error

myc:4:1: ParserError: Source "github.com/oraclize/ethereum-api/oraclizeAPI.sol" not found: File import callback not supported
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"

Any idea how too fix this?

  • The contract works fine and it's on solidity 5.4 – CryptoPuff Feb 26 '19 at 2:45

In several Oraclize Truffle Examples, such as Diesel-Price, the Oraclize API code is copied and pasted in a smart contract and then imported as follow:

import "./oraclizeAPI.sol";

Please, note that you have to use ./ just when yourContract.sol and the oraclizeApi.sol are in the same path.

The oraclizeAPI.sol is the whole API provided by Oraclize: oraclizeAPI.sol

  • 1
    I copied the code from oraclizeAPI.sol and pasted it in my solidity code. above my contract declaration but below pragma solidity ^0.5.4; commented out //pragma solidity >= 0.5.0; // Incompatible compiler version - please select a compiler within the stated pragma range, or use a different version of the oraclizeAPI! Everything worked fine! Thanks Guys! – CryptoPuff Feb 26 '19 at 23:21

To add to Riccardo's answer:

Importing from GitHub is a Remix-specific function, and is not standard Solidity code. Instead, you can download the oraclizeAPI.sol from the source repository, and add it to your project.

Then you can import it, like Riccardo said in the other answer.

import "./oraclizeAPI.sol";
  • 1
    You're missing "; from the end of your import string. Otherwise, the answer is good. – gskapka Feb 26 '19 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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