Created
July 2, 2024 23:50
-
-
Save jaxrtech/a6857d7b80178b5efe26673c8a178f23 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.8.19; | |
/** | |
* @notice Game of chicken | |
*/ | |
interface IChicken { | |
// ----------- state vars | |
function lastGuesser() external returns (address); | |
function winner() external returns (address); | |
// function owner() external returns (address); | |
function score() external returns (uint256); | |
function max() external returns (uint256); | |
function isPaused() external returns (bool); | |
// ----------- functions | |
/** | |
* @notice make a guess. If paused, revert. | |
* If score < max, | |
* If keccak(timestamp + guess) is even, set lastGuesser to msg.sender | |
* If it's odd, double score | |
* If score > max, | |
* set winner to LastGuesser | |
*/ | |
function playChicken(uint256 guess) external; | |
/** | |
* Disable playing the game. Only callable by owner | |
*/ | |
function pause(bool paused) external; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment