Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
constructor () public payable {
landlordAddress = msg.sender;
provable_setCustomGasPrice(100000000000);
OAR = OracleAddrResolverI(0xB7D2d92e74447535088A32AD65d459E97f692222);
}
function fetchUsdRate() internal {
require(provable_getPrice("URL") < address(this).balance, "Not enough Ether in contract, please add more");
bytes32 queryId = provable_query("URL", "json(https://api.pro.coinbase.com/products/ETH-USD/ticker).price");
validIds[queryId] = true;
}
function __callback(bytes32 myId, string memory result) public {
require(validIds[myId], "Provable query IDs do not match, no valid call was made to provable_query()");
require(msg.sender == provable_cbAddress(), "Calling address does match usingProvable contract address ");
validIds[myId] = false;
ETHUSD = parseInt(result);
if (workingState == State.payingLeaseDeposit) {
_payLeaseDeposit();
} else if (workingState == State.payingLease) {
_payLease();
} else if (workingState == State.collectingLeaseDeposit) {
_collectLeaseDeposit();
} else if (workingState == State.reclaimingLeaseDeposit) {
_reclaimLeaseDeposit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.