-
-
Save Beatz748/0c721617ce0817224dd523a5440dad5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.6.0; | |
import "https://github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol"; | |
contract RandomExample is usingProvable | |
{ | |
bytes public result; | |
bytes32 public queryId; | |
constructor() public | |
{ | |
provable_setProof(proofType_Ledger); | |
} | |
function __callback(bytes32 _queryId, string memory _result, bytes memory _proof) override public | |
{ | |
require(msg.sender == provable_cbAddress()); | |
if (provable_randomDS_proofVerify__returnCode(_queryId,_result,_proof)== 0) | |
result = bytes(_result); | |
else | |
result = "Error"; | |
} | |
function GetRandom(uint8 nrbytes) public payable | |
{ | |
queryId=provable_newRandomDSQuery( | |
0, | |
nrbytes, | |
200000 | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment