Skip to content

Instantly share code, notes, and snippets.

@camharris
Created August 11, 2021 07:15
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 camharris/dd7e507b73a5c695bf11fba6ef4f4d91 to your computer and use it in GitHub Desktop.
Save camharris/dd7e507b73a5c695bf11fba6ef4f4d91 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=true&runs=200&gist=
pragma solidity ^0.6.0;
contract MyWallet {
address payable private owner;
constructor() public {
owner = msg.sender;
}
receive() external payable {
}
function sendEther(address payable _to, uint _amount) public {
require(msg.sender == owner, "Must own this wallet to send Ether from it");
require(address(this).balance >= _amount, "Cannot send more than this wallet holds");
_to.transfer(_amount);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment