wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

Expand `DiamondOptions` to have a optional `defaultLoupeFacet` or `loupeFacet` field to allow for custom EIP-165 implementations #468

Open the-real-astro opened 11 months ago

the-real-astro commented 11 months ago

Currently diamond.deploy only allows use of the loupe facet /solc_0.8/diamond/facets/DiamondLoupeFacet.sol, which implements supportsInterface . The only way to expand the supported interfaces with this facet is by toggling supportedInterfaces mapping on the diamond storage: LibDiamond.diamondStorage().supportedInterfaces[_myFacetInterfaceId] = true;.

Since two facets cannot be cut to the same diamond, this prevents implementing a custom supportsInterface method. Additionally, prevents use of common diamond contract packages like @gnus.ai/contracts-upgradeable-diamond, which declare supportsInterface on most contracts.

I see that there's a file /solc_0.8/diamond/facets/DiamondLoupeFacetWithoutSupportsInterface.sol which could be utilized if the diamond options were expanded.