Created
November 5, 2021 19:16
-
-
Save davidkathoh/6a2cf7c2ce638e49568a1004843a4ec6 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.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