{"eip":7572,"title":"Contract-level metadata via `contractURI()`","description":"Specifying and updating contract-level metadata","authors":["Devin Finzer (@dfinzer)","Alex Atallah (@alexanderatallah)","Ryan Ghods (@ryanio)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2023-12-06","discussionsTo":"https://ethereum-magicians.org/t/erc-contract-level-metadata-via-contracturi/17157","repo":"ERCs","label":"ERC-7572","officialUrl":"https://eips.ethereum.org/EIPS/eip-7572","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7572.md","url":"https://eips.huatuo.xyz/eip-7572/","tldr":{"en":"Standardises the long-used contractURI() function and a ContractURIUpdated event so dapps and indexers can show a contract's name, description, images and links from one JSON document.","ja":"長く使われてきた contractURI() 関数と ContractURIUpdated イベントを標準化し、dApp やインデクサーが 1 つの JSON ドキュメントからコントラクトの名前、説明、画像、リンクを表示できるようにする。","ko":"오랫동안 쓰여 온 contractURI() 함수와 ContractURIUpdated 이벤트를 표준화해, dapp과 인덱서가 JSON 문서 하나로 컨트랙트의 이름, 설명, 이미지, 링크를 보여줄 수 있게 한다.","zh":"把长期使用的 contractURI() 函数和 ContractURIUpdated 事件标准化，让 dApp 和索引器可以通过一份 JSON 文档展示合约的名称、描述、图片和链接。"},"tags":["metadata","nft","marketplaces","json"],"explainers":{"en":{"lang":"en","tldr":"Standardises the long-used contractURI() function and a ContractURIUpdated event so dapps and indexers can show a contract's name, description, images and links from one JSON document.","tags":["metadata","nft","marketplaces","json"],"related":[721,1155,1046],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7572/","markdown":"## What problem does it solve?\n\nToken-level metadata already has a home: `tokenURI` for [ERC-721](/eip-721/) and `uri` for [ERC-1155](/eip-1155/). But a collection or token contract as a whole also needs a profile: a display name, description, logo, banner and website. Marketplaces have read a `contractURI()` function for years, yet there was no ERC defining it, and no reliable way to tell indexers that the data had changed.\n\nERC-7572 writes down the de facto function, a JSON schema for what it returns, and an event to signal updates.\n\n## How it works\n\nThe contract implements:\n\n```solidity\ninterface IERC7572 {\n    function contractURI() external view returns (string memory);\n    event ContractURIUpdated();\n}\n```\n\n- `contractURI()` returns either a link to an off-chain document (`ipfs://`, `https://`, ...) or inline JSON as a `data:application/json;utf8,{...}` string.\n- The JSON must be an object with at least `name`. Optional fields: `symbol`, `description`, `image` (profile picture), `banner_image`, `featured_image`, `external_link`, and `collaborators` (addresses allowed to edit the contract's info on dapps).\n- Emit `ContractURIUpdated()` whenever the metadata changes so indexers know to refetch.\n- If the contract also has `name()` or `symbol()`, the values in `contractURI` are recommended to take precedence, which lets creators rename a collection without redeploying.\n\nHow the URI is set is up to the contract; a simple owner-only setter is typical.\n\n## Sample code\n\nA collection with updatable contract metadata:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport {ERC721} from \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract MyCollection is ERC721, Ownable {\n    event ContractURIUpdated();\n\n    string private _contractURI;\n\n    constructor(string memory uri_) ERC721(\"My Collection\", \"MYC\") Ownable(msg.sender) {\n        _contractURI = uri_;\n    }\n\n    function contractURI() external view returns (string memory) {\n        return _contractURI;\n    }\n\n    function setContractURI(string calldata newURI) external onlyOwner {\n        _contractURI = newURI;\n        emit ContractURIUpdated();\n    }\n}\n```\n\nThe JSON it points to:\n\n```json\n{\n  \"name\": \"My Collection\",\n  \"symbol\": \"MYC\",\n  \"description\": \"Hand-drawn landscapes, one per day.\",\n  \"image\": \"ipfs://\u003ccid\u003e/logo.png\",\n  \"banner_image\": \"ipfs://\u003ccid\u003e/banner.png\",\n  \"external_link\": \"https://example.com\",\n  \"collaborators\": []\n}\n```\n\n## Things to know\n\n- **Status: Draft**, even though many marketplaces already read `contractURI()`. Details of the schema could still change.\n- Addresses listed in `collaborators` may be given admin-level editing rights on dapps that honour this standard; only list addresses you trust.\n- The function is not limited to NFTs; any contract (including fungible tokens) can expose it.\n- Future ERCs may extend the schema with more fields.\n"},"ja":{"lang":"ja","tldr":"長く使われてきた contractURI() 関数と ContractURIUpdated イベントを標準化し、dApp やインデクサーが 1 つの JSON ドキュメントからコントラクトの名前、説明、画像、リンクを表示できるようにする。","tags":["metadata","nft","marketplaces","json"],"related":[721,1155,1046],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7572/","markdown":"## 何を解決するのか\n\nトークン単位のメタデータには、すでに置き場所があります。[ERC-721](/eip-721/) には `tokenURI`、[ERC-1155](/eip-1155/) には `uri` です。しかし、コレクションやトークンコントラクト全体にも、表示名、説明、ロゴ、バナー、ウェブサイトといったプロフィールが必要です。マーケットプレイスは何年も前から `contractURI()` 関数を読んでいましたが、それを定義する ERC はなく、データが変更されたことをインデクサーに確実に知らせる方法もありませんでした。\n\nERC-7572 は、この事実上の関数、その戻り値の JSON スキーマ、更新を知らせるイベントを文書化します。\n\n## 仕組み\n\nコントラクトは次を実装します。\n\n```solidity\ninterface IERC7572 {\n    function contractURI() external view returns (string memory);\n    event ContractURIUpdated();\n}\n```\n\n- `contractURI()` は、オフチェーンのドキュメントへのリンク（`ipfs://`、`https://` など）、または `data:application/json;utf8,{...}` 形式の文字列としてインライン JSON を返します。\n- JSON は、少なくとも `name` を持つオブジェクトでなければなりません。任意のフィールドは `symbol`、`description`、`image`（プロフィール画像）、`banner_image`、`featured_image`、`external_link`、`collaborators`（dApp でコントラクトの情報を編集できるアドレス）です。\n- メタデータが変わるたびに `ContractURIUpdated()` を emit し、インデクサーに再取得が必要だと知らせます。\n- コントラクトが `name()` や `symbol()` も持つ場合は、`contractURI` の値を優先することが推奨されます。これにより、作成者は再デプロイせずにコレクションの名前を変更できます。\n\nURI をどう設定するかはコントラクト次第で、オーナー専用の単純なセッターが一般的です。\n\n## サンプルコード\n\nコントラクトのメタデータを更新できるコレクション:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport {ERC721} from \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract MyCollection is ERC721, Ownable {\n    event ContractURIUpdated();\n\n    string private _contractURI;\n\n    constructor(string memory uri_) ERC721(\"My Collection\", \"MYC\") Ownable(msg.sender) {\n        _contractURI = uri_;\n    }\n\n    function contractURI() external view returns (string memory) {\n        return _contractURI;\n    }\n\n    function setContractURI(string calldata newURI) external onlyOwner {\n        _contractURI = newURI;\n        emit ContractURIUpdated();\n    }\n}\n```\n\nそれが指す JSON:\n\n```json\n{\n  \"name\": \"My Collection\",\n  \"symbol\": \"MYC\",\n  \"description\": \"Hand-drawn landscapes, one per day.\",\n  \"image\": \"ipfs://\u003ccid\u003e/logo.png\",\n  \"banner_image\": \"ipfs://\u003ccid\u003e/banner.png\",\n  \"external_link\": \"https://example.com\",\n  \"collaborators\": []\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft**。多くのマーケットプレイスがすでに `contractURI()` を読んでいるにもかかわらずです。スキーマの詳細は変わる可能性があります。\n- `collaborators` に挙げられたアドレスには、この標準に対応する dApp で管理者レベルの編集権限が与えられることがあります。信頼できるアドレスだけを挙げてください。\n- この関数は NFT に限定されません。どのコントラクト（代替可能トークンを含む）でも公開できます。\n- 将来の ERC が、スキーマにフィールドを追加して拡張する可能性があります。\n"},"ko":{"lang":"ko","tldr":"오랫동안 쓰여 온 contractURI() 함수와 ContractURIUpdated 이벤트를 표준화해, dapp과 인덱서가 JSON 문서 하나로 컨트랙트의 이름, 설명, 이미지, 링크를 보여줄 수 있게 한다.","tags":["metadata","nft","marketplaces","json"],"related":[721,1155,1046],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7572/","markdown":"## 어떤 문제를 해결하나요?\n\n토큰 수준의 메타데이터는 이미 자리가 있습니다. [ERC-721](/eip-721/)에는 `tokenURI`, [ERC-1155](/eip-1155/)에는 `uri`가 있습니다. 하지만 컬렉션이나 토큰 컨트랙트 전체에도 표시 이름, 설명, 로고, 배너, 웹사이트 같은 프로필이 필요합니다. 마켓플레이스는 수년간 `contractURI()` 함수를 읽어 왔지만 이를 정의한 ERC는 없었고, 데이터가 바뀌었음을 인덱서에 신뢰성 있게 알릴 방법도 없었습니다.\n\nERC-7572는 이 사실상의 함수, 그 반환값의 JSON 스키마, 업데이트를 알리는 이벤트를 문서화합니다.\n\n## 어떻게 동작하나요?\n\n컨트랙트는 다음을 구현합니다.\n\n```solidity\ninterface IERC7572 {\n    function contractURI() external view returns (string memory);\n    event ContractURIUpdated();\n}\n```\n\n- `contractURI()`는 오프체인 문서로의 링크(`ipfs://`, `https://` 등) 또는 `data:application/json;utf8,{...}` 문자열 형태의 인라인 JSON을 반환합니다.\n- JSON은 최소한 `name`이 있는 객체여야 합니다. 선택 필드는 `symbol`, `description`, `image`(프로필 사진), `banner_image`, `featured_image`, `external_link`, `collaborators`(dapp에서 컨트랙트 정보를 편집할 수 있는 주소)입니다.\n- 메타데이터가 바뀔 때마다 `ContractURIUpdated()`를 emit해 인덱서가 다시 가져와야 함을 알립니다.\n- 컨트랙트에 `name()`이나 `symbol()`도 있다면 `contractURI`의 값이 우선하도록 권장하며, 이를 통해 제작자가 재배포 없이 컬렉션 이름을 바꿀 수 있습니다.\n\nURI를 어떻게 설정할지는 컨트랙트에 달려 있으며, 소유자 전용의 간단한 setter가 일반적입니다.\n\n## 샘플 코드\n\n컨트랙트 메타데이터를 업데이트할 수 있는 컬렉션:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport {ERC721} from \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract MyCollection is ERC721, Ownable {\n    event ContractURIUpdated();\n\n    string private _contractURI;\n\n    constructor(string memory uri_) ERC721(\"My Collection\", \"MYC\") Ownable(msg.sender) {\n        _contractURI = uri_;\n    }\n\n    function contractURI() external view returns (string memory) {\n        return _contractURI;\n    }\n\n    function setContractURI(string calldata newURI) external onlyOwner {\n        _contractURI = newURI;\n        emit ContractURIUpdated();\n    }\n}\n```\n\n이 코드가 가리키는 JSON:\n\n```json\n{\n  \"name\": \"My Collection\",\n  \"symbol\": \"MYC\",\n  \"description\": \"Hand-drawn landscapes, one per day.\",\n  \"image\": \"ipfs://\u003ccid\u003e/logo.png\",\n  \"banner_image\": \"ipfs://\u003ccid\u003e/banner.png\",\n  \"external_link\": \"https://example.com\",\n  \"collaborators\": []\n}\n```\n\n## 알아둘 점\n\n- **상태: Draft**. 많은 마켓플레이스가 이미 `contractURI()`를 읽고 있는데도 그렇습니다. 스키마의 세부 사항은 바뀔 수 있습니다.\n- `collaborators`에 나열된 주소는 이 표준을 따르는 dapp에서 관리자 수준의 편집 권한을 받을 수 있으므로, 신뢰하는 주소만 나열하세요.\n- 이 함수는 NFT에 국한되지 않으며, 어떤 컨트랙트(대체 가능 토큰 포함)든 노출할 수 있습니다.\n- 향후 ERC가 스키마에 더 많은 필드를 추가해 확장할 수 있습니다.\n"},"zh":{"lang":"zh","tldr":"把长期使用的 contractURI() 函数和 ContractURIUpdated 事件标准化，让 dApp 和索引器可以通过一份 JSON 文档展示合约的名称、描述、图片和链接。","tags":["metadata","nft","marketplaces","json"],"related":[721,1155,1046],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7572/","markdown":"## 它解决什么问题？\n\n代币级别的元数据已经有了归处：[ERC-721](/eip-721/) 的 `tokenURI` 和 [ERC-1155](/eip-1155/) 的 `uri`。但一个合集或代币合约作为整体也需要一份简介：显示名称、描述、logo、横幅和网站。市场多年来一直在读取 `contractURI()` 函数，但没有任何 ERC 定义它，也没有可靠的方式通知索引器数据已经变化。\n\nERC-7572 把这个事实上的函数、它返回内容的 JSON schema，以及用于通知更新的事件写成了标准。\n\n## 它如何运作\n\n合约实现：\n\n```solidity\ninterface IERC7572 {\n    function contractURI() external view returns (string memory);\n    event ContractURIUpdated();\n}\n```\n\n- `contractURI()` 返回指向链下文档的链接（`ipfs://`、`https://` 等），或以 `data:application/json;utf8,{...}` 字符串形式内联的 JSON。\n- JSON 必须是至少包含 `name` 的对象。可选字段有：`symbol`、`description`、`image`（头像）、`banner_image`、`featured_image`、`external_link` 以及 `collaborators`（允许在 dApp 上编辑合约信息的地址）。\n- 每当元数据变化时触发 `ContractURIUpdated()`，让索引器知道需要重新获取。\n- 如果合约同时有 `name()` 或 `symbol()`，建议以 `contractURI` 中的值为准，这让创作者无需重新部署就能给合集改名。\n\nURI 如何设置由合约自行决定；通常是一个仅限所有者调用的简单 setter。\n\n## 示例代码\n\n一个元数据可更新的合集：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport {ERC721} from \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract MyCollection is ERC721, Ownable {\n    event ContractURIUpdated();\n\n    string private _contractURI;\n\n    constructor(string memory uri_) ERC721(\"My Collection\", \"MYC\") Ownable(msg.sender) {\n        _contractURI = uri_;\n    }\n\n    function contractURI() external view returns (string memory) {\n        return _contractURI;\n    }\n\n    function setContractURI(string calldata newURI) external onlyOwner {\n        _contractURI = newURI;\n        emit ContractURIUpdated();\n    }\n}\n```\n\n它所指向的 JSON：\n\n```json\n{\n  \"name\": \"My Collection\",\n  \"symbol\": \"MYC\",\n  \"description\": \"Hand-drawn landscapes, one per day.\",\n  \"image\": \"ipfs://\u003ccid\u003e/logo.png\",\n  \"banner_image\": \"ipfs://\u003ccid\u003e/banner.png\",\n  \"external_link\": \"https://example.com\",\n  \"collaborators\": []\n}\n```\n\n## 需要注意\n\n- **状态：Draft**，尽管许多市场已经在读取 `contractURI()`。schema 的细节仍可能变化。\n- 列在 `collaborators` 中的地址，可能在遵循该标准的 dApp 上被授予管理员级别的编辑权限；只列出你信任的地址。\n- 该函数不限于 NFT；任何合约（包括同质化代币）都可以提供它。\n- 未来的 ERC 可能会为 schema 增加更多字段。\n"}},"requiredBy":[8041]}
