Skip to content

Instantly share code, notes, and snippets.

@bartubozkurt
Created February 2, 2023 11:55
Show Gist options
  • Save bartubozkurt/af113a0e2dabc4244708b8e6d02ec789 to your computer and use it in GitHub Desktop.
Save bartubozkurt/af113a0e2dabc4244708b8e6d02ec789 to your computer and use it in GitHub Desktop.
/* Bad */
modifier isNotContract(address _a){
uint len;
assembly { len := extcodesize(_a) }
require(len == 0);
_;
}
/* Better */
modifier isNotContract(address _a){
(tx.origin == msg.sender,"No Contract");
_;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment