Who called my contract?

function isContract(address _addr) private returns (bool isContract){
uint32 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
Taken from: https://ethereum.stackexchange.com/questions/15641/how-does-a-contract-find-out-if-another-address-is-a-contract

--

--

A software engineer passionate about blockchain and 5G, experienced in leading many projects including Virtuwind and a well known Blockchain advisor.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ali Azam

Ali Azam

A software engineer passionate about blockchain and 5G, experienced in leading many projects including Virtuwind and a well known Blockchain advisor.