Skip to content

Instantly share code, notes, and snippets.

@jaxrtech
Created July 2, 2024 23:50
Show Gist options
  • Save jaxrtech/a6857d7b80178b5efe26673c8a178f23 to your computer and use it in GitHub Desktop.
Save jaxrtech/a6857d7b80178b5efe26673c8a178f23 to your computer and use it in GitHub Desktop.
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