Skip to content

ohone/KotH

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

king of the hill

Simple EVM smart contract 'game'.

A player can deposit in the contract a larger amount of the target ERC20 than the previous, to claim the previous player's deposit (player becomes the king of the hill).

If the king isn't usurped for a defined amount of time, he can retrieve his locked tokens, and the game restarts.

flow describing capturing of the hill flow describing victory over the hill

Functions (write)

capture(uint256 amount)

Deposits amount ERC20 into the contract to attempt to claim the hill. Sender recieves the current deposit.

revert:

  • amount isn't greater than the contract's current bounty.
  • msg.sender doesn't have the specified amount.

claimVictory()

Claims victory over the hill for msg.sender. Transfers the deposit back to msg.sender and resets the contract.

revert:

  • msg.sender isn't currently the king.
  • block.timestamp < expiry - the hill is still in play.

Build + Test

Requies foundry. See https://github.com/foundry-rs/foundry.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published