ERC1155MetadataExtension imports IERC1155

The ERC1155 contract imports two interfaces:
IERC1155, IERC1155MetadataURI.

However, IERC1155MetadataURI also inherits IERC1155.

This seems redundant and unnecessary. It caused me a bit of trouble trying to figure out where IERC1155 was being pulled in from @openzepplin/contracts in a modified ERC1155 I was making.

Is there a reason this design choice was made that I am missing?

Hello @ssolson

We make IERC1155MetadataURI inherit IERC1155 because we believe it doesn't make sens for a contract to implement the metadata without also implementing the base ERC. This also means that if you write a contract A that know another contract B and that call function from both interfaces on B, you don't need to cast B

contract A {
    IERC1155MetadataURI public B;

    function someFunction() external {
        // here you can call b.uri(...) but also b.balanceOf(...);

Then there is the question of "why does ERC1155 inherit both?". It definitely doesn't need to. Inheriting IERC1155MetadataURI would be enough. Yet we find it clearer to explicitly specific the inheritance. We don't expect it to cause any issue.

Thanks Amxx for explaining the design thought to me.

I am probably an edge case but for my purpose, it caused a bit of an issue and was very unclear.

I did not expect that the ERC1155 interface was inherited twice and it took me quite a long time to figure out where IERC1155 was coming from.

If you are interested I needed to modify the location of the events to work with Alejandro Santander's static router design.