Skip to content

Instantly share code, notes, and snippets.

@davidkathoh
Created November 5, 2021 19:16
Show Gist options
  • Save davidkathoh/6a2cf7c2ce638e49568a1004843a4ec6 to your computer and use it in GitHub Desktop.
Save davidkathoh/6a2cf7c2ce638e49568a1004843a4ec6 to your computer and use it in GitHub Desktop.
pragma solidity ^0.8.0;
contract SlitherDemo{
address public king;
uint public balance;
function claimThrone() external payable {
require(msg.value > balance, "Need to pay more to become the king");
(bool sent, ) = king.call{value: balance}("");
require(sent, "Failed to send Ether");
balance = msg.value;
king = msg.sender;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment