contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "onlyOwner");
_;
}
function changeOwner(address newOwner) public onlyOwner {
owner = newOwner;
}
}
contract HoldFunds is Ownable {
function withdrawFunds() public onlyOwner {
(bool ok, ) = owner.call{value: address(this).balance}("");
require(ok, "transfer failed");
}
receive() external payable {
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter