Created
January 3, 2023 07:11
-
-
Save Jesserc/cd760e4097c6103056526cb8b32de5e3 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.0; | |
| contract rejectContracts { | |
| function isContract(address account) public view returns (bool) { | |
| uint256 size; | |
| assembly { | |
| size := extcodesize(account) | |
| } | |
| return size > 0; | |
| } | |
| function TakeAllTheMoney(address account) public { | |
| require(!isContract(account), "Error: no contract allowed"); | |
| //check if the transaction origin address == the current function caller | |
| require(msg.sender == tx.origin, "Error: no contract allowed"); | |
| payable(account).transfer(address(this).balance); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment