Skip to content

Instantly share code, notes, and snippets.

@Jesserc
Last active January 3, 2023 07:09
Show Gist options
  • Select an option

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

Select an option

Save Jesserc/2d3fd07eecf78ce4b363453ac484416b 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");
 payable(account).transfer(address(this).balance);
 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment