Created
February 9, 2018 14:34
-
-
Save chebykin/26d283ab677e97eeef5809deb02ea6e7 to your computer and use it in GitHub Desktop.
Check whether ethereum address is a contract or not
This file contains 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
pragma solidity ^0.4.18; | |
// https://stackoverflow.com/a/40939341/3380173 | |
contract Check { | |
function isContract(address addr) view public returns (bool) { | |
uint size; | |
assembly { size := extcodesize(addr) } | |
return size > 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment