Skip to content

Instantly share code, notes, and snippets.

@Jesserc
Created January 3, 2023 07:11
Show Gist options
  • Select an option

  • Save Jesserc/cd760e4097c6103056526cb8b32de5e3 to your computer and use it in GitHub Desktop.

Select an option

Save Jesserc/cd760e4097c6103056526cb8b32de5e3 to your computer and use it in GitHub Desktop.
// 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