0

I tried to run the code in http://dapps.oraclize.it/browser-solidity/#version=soljson-v0.4.24+commit.e67f0147.js but I get the error VM: out of gas when I try to run the updatePrice function. I set the value of 0.05 ether when running the function and deploying the contract.

I have tried running it in injected web3(rinkeby testnet) in remix, the updatePrice function runs but the __callback is not called. Did it according to https://medium.com/coinmonks/simple-oraclize-example-with-solidity-68b6811902da.

Tried running the dieselPrice.sol from the oraclize site in remix.ethereum.com with JavaScript VM. But this yields:

transact to ExampleContract.updatePrice errored: VM error: revert 
revert The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value. Debug the transaction to get more information.

when running updatePrice with 0.05 ether as the set value.

1 Answer 1

0

One of the Oraclize experts can correct me, but I can see a few things wrong with what you're trying...


Firstly, and most importantly, the most recent versions of Solidity don't play well with Oraclize. (See this GitHub discussion.)

You'll need to use an older version of the compiler - 0.4.20+commit.3155dd80 should work. You'll also need to make adjustments to your code if any of it is only supported by later versions of Solidity.


I have tried running it in injected web3(rinkby testnet) in remix , the updatePrice function runs but the __callback is not called.

This is almost certainly due to a lack of gas to make the call, or ether in the contract to pay for the callback. Testing on http://dapps.oraclize.it/browser-solidity/ would allow you to check this and tune the amounts required.


Tried running the dieselPrice.sol from the oraclize site in remix.ethereum.com with JavaScript VM it gives

This won't work because the "normal" Remix interface (i.e. not Oraclize's own patched version) isn't able to simulate the Oraclize functionality.


So to get any further, my suggestion would be to continue to use http://dapps.oraclize.it/browser-solidity/, with the Javascript VM, but with the compiler version set to 0.4.20. (I've just checked this by running the DieselPrice.sol contract, and it works as expected.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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