oliviera9 on v0.7.0
oliviera9 on bump-minor
oliviera9 on master
chore(package.json): bump minor… Merge pull request #117 from pr… (compare)
oliviera9 on bump-minor
chore(package.json): bump minor… (compare)
oliviera9 on add-sepolia
oliviera9 on master
feat: add Sepolia testnet OAR Merge pull request #116 from pr… (compare)
oliviera9 on add-sepolia
feat: add Sepolia testnet OAR (compare)
oliviera9 on add-sepolia
feat: add Sepolia testnet OAR (compare)
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "github.com/provable-things/ethereum-api/provableAPI_0.6.sol";
// example of calling an API
contract Example is usingProvable {
struct ApiResult {
string clientSeed;
string serverSeed;
string hash;
}
string public lastResult;
mapping (bytes32 => bool) private validIds;
event LogMessage(string description);
constructor() public {}
function __callback(bytes32 requestId, string memory result) override public {
require(validIds[requestId], "query id is invalid!!!");
require(msg.sender == provable_cbAddress(), "invalid sender detected!!!");
lastResult = result;
}
function getRamdon(string memory clientSeed) public {
require(bytes(clientSeed).length > 0, "client seed is required!!!");
if (provable_getPrice("URL") > address(this).balance) {
emit LogMessage("Contract out of gas!");
} else {
bytes32 requestId = provable_query("URL", string(abi.encodePacked("json(https://oracles.azurewebsites.net/Random/GetRandomHash/", clientSeed, ").path.to[\"clientSeed\", \"serverSeed\", \"hash\"]")));
validIds[requestId] = true;
}
}
}
Hi @oraclize-support , I'm relatively new to smart contract development so I was wondering if you could give me a hand here. I've setup a wallet on the Ropsten Test Network and tried to use your API, but for some reason even though my event logging shows that provable_query was called, the __callback method is never executed. Here's the contract: https://ropsten.etherscan.io/address/0xB303D6E13d2a61C59D95A7E0DF07fac3bAd141Ce#events
And the source code: https://pastebin.com/G03L2ykN
Thanks for clarifying, but I think I didn't get my point accross:
Tuesday, 2pm, a provable_query is scheduled to run 1 hour from now.
Tuesday, 2.30pm, a service interruption like you described happens.
Tueday, 4pm, the service returns to normal and the callback gets executed.
Would this callback contain the result from the query as if it was executed at 3pm (as was expected), 4pm (when service resumed working), or some other time?
I believe it should be 21ab5f73bb028b55c1b98ff451796646d94c137dd38397cd8990ffa694567d70
It's logged in the top event for https://ropsten.etherscan.io/address/0x139e1fDaF9FfF5B8909a116858E12D25f107CFd0#events
I looked for it in Provable's Check Query status page, but nothing shows up. Guessing it's because that only works for Mainnet Id's though.