1

I'm having difficulty deploying my contract to the Rinkeby TestNet.

I made a local copy of the Oraclize API and saved it here:n//Users/simon/Documents/usingOraclize.sol

In the Ethereum Wallet application I've gone to Contracts->Deploy new Contract. Pasted my contract code which begins:

pragma solidity ^0.4.0;

import "usingOraclize.sol";

contract Voyager2 is usingOraclize {

And I receive the error Source "UsingOraclize.sol" not found. Can someone explain what path I need to provide to get the import working? I've tried many different variants of the above path.

Also, I came across this: oraclize_setNetwork(networkID_testNet). Is it necessary to call this in the contract before deploying?

2

The wallet is not that smart to be a linker as well. You need to provide the code of usingOraclize.sol before your Voyager2 contract and it will be compiled correctly.

pragma solidity ^0.4.18;

contract ContractA {
    function one() public pure returns(uint) {
        return 1;
    }
}

contract ContractB is ContractA {
    function two() public pure returns(uint) {
        return 2;
    }
}

something like this more or less would be ok. Consider then that for you is necessary select ContactB, which is Voyager2 in your case and you'll have the definition merged as expected.

  • So I followed your suggestion and copied the Oraclize source code: github.com/oraclize/ethereum-api/blob/master/… and put it above my contract. However there are many compilation errors resulting from oraclize! (e,g, no visibility declared defaulting to public, "throw" is deprecated..., etc.). I was able to use the API in remix but now it's breaking in the Ethereum Wallet app. Do you know a way around this? – Simon Rubin Apr 5 '18 at 4:10
  • Just deploy it using truffle, would be easier. These are just warnings, if I'm not wrong the wallet should avoid you to deploy even if it's only a warning (but I'm not sure since I don't use it that to deploy contracts). Ever tried to use the new version? github.com/oraclize/ethereum-api/blob/master/… it might have some differences tho – mirg Apr 5 '18 at 4:16
  • As @mirg mentioned, they are just compiler warnings, and should not cause issues, however, it is still recommended and a good idea to use Oraclize's update api, which suppresses most of these warnings: github.com/oraclize/ethereum-api/blob/master/… The 0.4 version has those warnings, because it's fully 0.4.x compliant and compatible, while there have been breaking changes with SolC since. The updated API requires 0.4.18 or higher, generally using what it was targetted for is the best idea, unless there's some big bug in the compiler in between those versions. – DenisM Apr 13 '18 at 15:49

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.