-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Closed
Description
I was wondering if it makes sense to have a utility function that can determine if an address is an EOA. With EIP-7702 we have now also (0xef0100 || address) as code for an EOA. So the function could check if the code length is either zero or the first 3 bytes is ef_01_00. I haven't thought this completely through, but dropping this as an idea here for now.
bytes3 internal constant _DELEGATION_PREFIX = 0xef0100;
function isEOA(address target) internal view returns (bool) {
bytes memory code = target.code;
// Add here a comment addressing the normal disclaimers around
// construction-time issues and zero-length contracts.
return (code.length == 0 || bytes3(code) == _DELEGATION_PREFIX);
}The reason why I don't check for the length of 23 bytes is that you cannot deploy a contract starting with 0xef according to EIP-3541.
gonzaotc, EricForgy, wiasliaw, HappyFeet07, Skyge and 2 more
Metadata
Metadata
Assignees
Labels
No labels