Shared Storage Architecture

Facets and Modules Working Together

Both facets and modules access the same storage in your diamond. Your custom facets can extend Compose functionality without inheritance.

GameNFTFacet.sol
// Your custom facet uses the ERC721 module
import { ERC721Mod } from "compose/ERC721Mod.sol";

contract GameNFTFacet {
    function mintWithGameLogic(
        address player,
        uint256 tokenId
    ) external {
        // Your custom game logic
        require(
            playerHasEnoughPoints(player),
            "Not enough points"
        );

        // Use ERC721Mod - same storage
        ERC721Mod.mint(player, tokenId);

        // Standard ERC721Facet functions work seamlessly
        updatePlayerStats(player);
    }
}