Created
August 1, 2022 17:52
-
-
Save casweeney/cb9b3019eacc4d3c377afe2a0a219fee to your computer and use it in GitHub Desktop.
Using custom errors with NATSPEC
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.4; | |
/// ogbeni | |
error Unauthorized(); | |
/// @custom:experimental This is an experimental contract. | |
contract VendingMachine { | |
address payable owner = payable(msg.sender); | |
function withdraw() public { | |
if (msg.sender != owner) | |
revert Unauthorized(); | |
owner.transfer(address(this).balance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment