Last active
May 25, 2023 06:50
-
-
Save kennym/e9607fbdcb11843d6a95de2534bb533c to your computer and use it in GitHub Desktop.
A simple smart contract that acts like a wallet - it stores and sends funds
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 EtherWallet { | |
address public owner; | |
constructor(address _owner) { | |
owner = _owner; | |
} | |
function deposit() payable public { | |
} | |
function send(address payable to, uint amount) public { | |
if (msg.sender == owner) { | |
to.transfer(amount); | |
return; | |
} | |
revert('Sender is not allowed'); | |
} | |
function balanceOf() view public returns(uint) { | |
return address(this).balance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment