Skip to content

Implement ERC165 interface support and initializers#25

Merged
dadadave80 merged 4 commits into
devfrom
feat/register-interface-fn
Apr 21, 2026
Merged

Implement ERC165 interface support and initializers#25
dadadave80 merged 4 commits into
devfrom
feat/register-interface-fn

Conversation

@dadadave80

Copy link
Copy Markdown
Owner

Add support for the ERC165 interface by implementing storage management and registration functions. Introduce initializers for diamond contract setup, ensuring all necessary interfaces are registered during deployment. Update tests to validate the interface registration process.

- Add ERC165Storage struct for managing interface support mappings
- Implement registerInterface() to mark ERC165 interface as supported
- Fix supportsInterface() to correctly compute storage keys for interface lookups
- Use proper storage slot computation: keccak256(abi.encode(interfaceId, ERC165_STORAGE_LOCATION))
- Add ERC165 interface constants to DiamondLib for IDiamondCut and IDiamondLoupe
- Implement registerInterface() in DiamondLib to register Diamond-specific interfaces
- Implement registerInterface() in OwnableLib to register ERC173 (Ownership) interface
- Update constants to use proper ERC7201 storage location computation
- Create DiamondInit to register IDiamondCut and IDiamondLoupe interfaces
- Create ERC165Init to register ERC165 interface support
- Update OwnableInit to use init() signature (calls registerInterface via OwnableLib)
- Maintain consistency across all initializers for interface registration
- Update DeployDiamond to use MultiInit with DiamondInit, ERC165Init, and OwnableInit
- Ensure all required interfaces are registered during diamond initialization
- Update InitializableTester to deploy all initializers and test interface registration
- Fix testMultiInitSetsOwnerAndInterfaces to properly verify all interface support
@dadadave80
dadadave80 merged commit d33ce9d into dev Apr 21, 2026
2 checks passed
@dadadave80
dadadave80 deleted the feat/register-interface-fn branch April 21, 2026 01:41
@dadadave80 dadadave80 added the enhancement New feature or request label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant