SHARE
TWEET

Untitled

a guest Sep 17th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function __callback( bytes32 _queryId, string memory _result, bytes memory _proof ) public {
  2.         require(msg.sender == provable_cbAddress());
  3.         require(ongoingBets[_queryId].sender != address(0x0) , 'query does not exist');
  4.         if(provable_randomDS_proofVerify__returnCode( _queryId, _result, _proof) != 0){
  5.             revert();
  6.         } else {
  7.             uint ceiling = (MAX_INT_FROM_BYTE ** NUM_RANDOM_BYTES_REQUESTED) - 1;
  8.             uint randomNumber = uint(keccak256(abi.encodePacked(_result))) % ceiling;
  9.             uint spin = (randomNumber % 100) + 1;
  10.             Bet memory bet = ongoingBets[_queryId];
  11.             if(spin < bet.spinUnder){
  12.                 addAmountToUser(bet.sender, bet.prize);
  13.             }
  14.             emit logBetSuccess(bet.sender, spin, bet.spinUnder, bet.stake, bet.prize, bet.payout, balances[bet.sender]);
  15.             delete ongoingBets[_queryId];
  16.         }
  17.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top