Created
August 30, 2022 00:33
-
-
Save casweeney/7fad7c9d66b95242a6d1ba111c80cf56 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: MIT | |
| pragma solidity ^0.8.4; | |
| contract EthereumWallet { | |
| address owner; | |
| constructor() { | |
| owner = msg.sender; | |
| } | |
| modifier onlyOwner() { | |
| require(msg.sender == owner, "requires only owner"); | |
| _; | |
| } | |
| function deposit() external payable { | |
| require(msg.value > 0, "can't send zero value"); | |
| } | |
| function withdraw(uint _amount) external onlyOwner { | |
| require(address(this).balance >= _amount, "insufficient fund"); | |
| payable(msg.sender).transfer(_amount); | |
| } | |
| function getWalletBalance() external view returns (uint bal) { | |
| bal = address(this).balance; | |
| } | |
| receive() external payable {} | |
| fallback() external payable {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment