Skip to content

Instantly share code, notes, and snippets.

@kennym
Last active May 25, 2023 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennym/e9607fbdcb11843d6a95de2534bb533c to your computer and use it in GitHub Desktop.
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
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