5

I am trying to follow an Oraclize example, with this source code and compile it using Mist:

/*
   Kraken-based ETH/XBT price ticker

   This contract keeps in storage an updated ETH/XBT price,
   which is updated every ~60 seconds.
*/

import "dev.oraclize.it/api.sol";

contract KrakenPriceTicker is usingOraclize {

    address owner;
    string public ETHXBT;


    function KrakenPriceTicker() {
        owner = msg.sender;
        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
        update();
    }

    function __callback(bytes32 myid, string result, bytes proof) {
        if (msg.sender != oraclize_cbAddress()) throw;
        ETHXBT = result;
        update();
    }

    function update() {
        oraclize_query(60, "URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHXBT).result.XETHXXBT.c.0");
    }

    function kill(){
        if (msg.sender == owner) suicide(msg.sender);
    }

} 

However, it is throwing an error:

Error: :8:1: Error: Source not found: File not supplied initially.
import "dev.oraclize.it/api.sol";
^-------------------------------^

How can I make that module available? I can't find anything in the documentation.

3

You can only import via that url when using Oraclize's custom browser IDE. In Mist or any other environment, you need to download the file at dev.oraclize.it/api.sol. I don't think Mist supports importing files, but you can use the browser compiler, just paste your code into one pane, the Oraclize code into another, rename the tabs and import by name.

Alternatively, you can just copy the code and paste it directly above your code.

  • Okay cool thanks for the answer I will give this a whirl today and report back on if I got it to work. – Antoine Jun 24 '16 at 16:30

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.