You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation says the default is proofType_NONE
However when I call oraclize.getPrice() from browser-solidity then it returns with "VM Exception: invalid opcode" when I don't have proof set.
If I add oraclize_setProof(proofType_NONE); to constructor then it works fine.
Solidity version: 0.4.12-nightly.2017.5.4+commit.025b32d9.Emscripten.clang
Code to reproduce:
/*
Oraclize.it decrypt datasource test
*/
pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract CryptTest is usingOraclize {
string public callBackResult;
bytes32 public qId;
bytes32 public resId;
event newOraclizeQuery(string description);
event newResult(string result);
function CryptTest() payable {
// oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
// setProof not called causing invalid opcode for getDecryptPrice
// but If you uncomment the following line then it works
// oraclize_setProof(proofType_NONE);
}
function __callback(bytes32 myid, string result) {
if (msg.sender != oraclize_cbAddress()) throw;
resId = myid;
callBackResult = result;
newResult(callBackResult);
}
function getDecryptPrice() constant returns (uint){
return oraclize.getPrice("decrypt") ;
}
function decrypt(string inp) payable {
uint requiredBal = getDecryptPrice() ;
if ( requiredBal> this.balance) {
newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee" );
} else {
newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
qId = oraclize_query( "decrypt", inp);
}
}
}
Just a minor annoyance, documenting if someone else happens to bump into it.
The text was updated successfully, but these errors were encountered:
Hello @szerintedmi , the problem is caused by the fact that you are using oraclize.getPrice instead of oraclize_getPrice.
The former is acting at a lower level and gives for granted that the OraclizeAddressResolver has already been detected by the contract (auto network detection), which is not the case in your contract, hence causing it to throw! The reason why it works after an oraclize_setProof is that any oraclize_-prefixed function is higher level and ensures internally that the OraclizeAddressResolver has been correctly resolved already. oraclize_setProof is completely optional, but I would suggest to always go with oraclize_* functions instead of oraclize.* ones.
The documentation says the default is proofType_NONE
However when I call oraclize.getPrice() from browser-solidity then it returns with "VM Exception: invalid opcode" when I don't have proof set.
If I add oraclize_setProof(proofType_NONE); to constructor then it works fine.
Solidity version: 0.4.12-nightly.2017.5.4+commit.025b32d9.Emscripten.clang
Code to reproduce:
Just a minor annoyance, documenting if someone else happens to bump into it.
The text was updated successfully, but these errors were encountered: