Skip to content

Commit

Permalink
Rename to match EIP number and fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0xGh committed Jun 10, 2023
1 parent 3529975 commit 086a59c
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions EIPS/erc-multimetadata.md → EIPS/eip-7160.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
eip: 7160
title: ERC721 Multi-Metadata Extension
description: "This EIP proposes an extension to the ERC721 standards to support multiple metadata URIs per token via a new tokenURIs method that returns the pinned metadata index and a list of metadata URIs."
title: ERC-721 Multi-Metadata Extension
description: "This EIP proposes an extension to the ERC-721 to support multiple metadata URIs per token."
author: 0xG (@0xGh)
discussions-to: https://ethereum-magicians.org/t/erc721-multi-metadata-extension/14629
status: Draft
type: Standards Track
category: ERC
created: 2023-06-09
requires: EIP-165, EIP-721
requires: 165, 721
---

## Abstract

This EIP proposes an extension to the ERC721 standards to support multiple metadata URIs per token. It introduces a new interface, IERC721MultiMetadata, which provides methods for accessing the metadata URIs associated with a token, including a pinned URI index and a list of all metadata URIs. The extension is designed to be backward compatible with existing ERC721Metadata implementations.
This EIP proposes an extension to the [ERC-721](./eip-721.md) standards to support multiple metadata URIs per token. It introduces a new interface, `IERC721MultiMetadata`, which provides methods for accessing the metadata URIs associated with a token, including a pinned URI index and a list of all metadata URIs. The extension is designed to be backward compatible with existing `ERC721Metadata` implementations.

## Motivation

The current ERC721 standards allow for a single metadata URI per token. However, there are use cases where multiple metadata URIs are desirable, such as when a token represents a collection of (cycling) assets with individual metadata, historic token metadata, collaborative and multi-artist tokens, evolving tokens. This extension enables such use cases by introducing the concept of multi-metadata support.
The current [ERC-721](./eip-721.md) standards allow for a single metadata URI per token. However, there are use cases where multiple metadata URIs are desirable, such as when a token represents a collection of (cycling) assets with individual metadata, historic token metadata, collaborative and multi-artist tokens, evolving tokens. This extension enables such use cases by introducing the concept of multi-metadata support.

## Specification

The IERC721MultiMetadata interface extends the existing IERC721 interface and introduces two additional methods:
The `IERC721MultiMetadata` interface extends the existing `IERC721` interface and introduces two additional methods:

```solidity
interface IERC721MultiMetadata is IERC721 {
Expand All @@ -34,31 +34,23 @@ interface IERC721MultiMetadata is IERC721 {

The `tokenURIs` function returns a tuple containing the pinned URI index and a list of all metadata URIs associated with the specified token. The `pinTokenURI` function allows the contract owner to designate a specific metadata URI as the pinned URI for a token.

The `tokenURI` function defined in the ERC721 standard can be modified to return the pinned URI or the last URI in the list returned by `tokenURIs` when there is not pinned URI. This ensures backward compatibility with existing contracts and applications that rely on the single metadata URI.
The `tokenURI` function defined in the ERC-721 standard can be modified to return the pinned URI or the last URI in the list returned by `tokenURIs` when there is not pinned URI. This ensures backward compatibility with existing contracts and applications that rely on the single metadata URI.

See the [Implementation](#Implementation) section for an example.
See the [Implementation](#reference-implementation) section for an example.

## Rationale

The `tokenURIs` function returns both the pinned URI index and the list of all metadata URIs to provide flexibility in accessing the metadata. The pinned URI can be used as a default or primary URI for the token, while the list of metadata URIs can be used to access individual assets' metadata within the token. Marketplaces could present these as a gallery or media carousels.

Depending on the implementation, the `pinTokenURI` function allows the contract owner or token owner to specify a particular metadata URI index for a token. This enables the selection of a preferred URI by index from the list of available metadata.

## Backward Compatibility
## Backwards Compatibility

This extension is designed to be backward compatible with existing ERC721 contracts. The modified `tokenURI` function can either return the last URI in the list returned by tokenURIs or the pinned URI, depending on the implementation.
This extension is designed to be backward compatible with existing [ERC-721](./eip-721.md) contracts. The modified `tokenURI` function can either return the last URI in the list returned by tokenURIs or the pinned URI, depending on the implementation.

## Security Considerations

Care should be taken when implementing the extension to ensure that the metadata URIs are properly handled and validated. It is crucial to prevent malicious actors from manipulating or injecting harmful metadata.

## Test Cases

Test cases should be provided to cover the functionality of the IERC721MultiMetadata interface, including retrieving the pinned URI, retrieving the list of metadata URIs, and pinning/unpinning a specific metadata URI for a token. Additionally, tests should be performed to validate the backward compatibility of existing ERC721 contracts.
## Reference Implementation

## Implementation

An open-source reference implementation of the IERC721MultiMetadata interface can be provided, demonstrating how to extend an existing ERC721 contract to support multi-metadata functionality. This reference implementation can serve as a guide for developers looking to implement the extension in their own contracts.
An open-source reference implementation of the `IERC721MultiMetadata` interface can be provided, demonstrating how to extend an existing [ERC-721](./eip-721.md) contract to support multi-metadata functionality. This reference implementation can serve as a guide for developers looking to implement the extension in their own contracts.

```solidity
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
Expand Down Expand Up @@ -132,6 +124,10 @@ contract MultiMetadata is Ownable, ERC721, IERC721MultiMetadata {
}
```

## Security Considerations

Care should be taken when implementing the extension to ensure that the metadata URIs are properly handled and validated. It is crucial to prevent malicious actors from manipulating or injecting harmful metadata.

## Copyright

This work is licensed under the MIT License.

0 comments on commit 086a59c

Please sign in to comment.