Skip to content

Instantly share code, notes, and snippets.

@Z-M-Huang
Last active June 1, 2022 00:58
Show Gist options
  • Save Z-M-Huang/3d36d4e48b0d340ac6e36ff7563028e6 to your computer and use it in GitHub Desktop.
Save Z-M-Huang/3d36d4e48b0d340ac6e36ff7563028e6 to your computer and use it in GitHub Desktop.
contract Random is RandomClient {
string public _serverSeed;
string public _clientSeed;
uint64 public _nonce;
uint64 public _value;
bool public verifiedResult;
constructor() RandomClient() {
_clientSeed = "123123123";
}
function getRandom() public {
getRandomNumber(_clientSeed);
}
function verifyRandom() public {
verifyRandomNumber(_serverSeed, _clientSeed, _nonce, _value);
}
function randomNumberReceivedCallback(bytes32, string memory serverSeed, string memory clientSeed,
uint64 nonce, uint64 value) internal override {
_serverSeed = serverSeed;
_clientSeed = clientSeed;
_nonce = nonce;
_value = value;
}
function verifyRandomReceivedCallback(bytes32, bool value) internal override {
verifiedResult = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment