Contract-level metadata

Provide metadata for a token contract

Implement contractURI on an ERC-20, ERC-721, or ERC-1155 contract to return contract-level metadata, as specified by ERC-7572.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract MyToken {
    function contractURI() external pure returns (string memory) {
        return "ipfs://QmTNgv3jx2HHfBjQX9RnKtxj2xv2xQDtbVXoRi5rJ3a46e";
        // or e.g. https://external-link-url.com/my-contract-metadata.json
    }
}

Return JSON in this format:

{
  "name": "OpenSea Creatures",
  "description": "OpenSea Creatures are adorable aquatic beings primarily for demonstrating what can be done using the OpenSea platform. Adopt one today to try out all the OpenSea buying, selling, and bidding feature set.",
  "image": "https://external-link-url.com/image.png",
  "banner_image": "https://external-link-url.com/banner-image.png",
  "featured_image": "https://external-link-url.com/featured-image.png",
  "external_link": "https://external-link-url.com",
  "collaborators": ["0x0000000000000000000000000000000000000000"]
}

You can also return the JSON from the contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract MyToken {
    function contractURI() external pure returns (string memory) {
        string memory json = '{"name": "Opensea Creatures","description":"..."}';
        return string.concat("data:application/json;utf8,", json);
    }
}

Emit ContractURIUpdated() when contractURI() changes.

Set creator earnings in the Royalty Registry, which OpenSea uses.

Contract Creator Attribution

OpenSea uses ERC-173: Contract Ownership Standard for contract creator attribution.