---
eip: 7085
label: ERC-7085
title: NFT Relationship Enhancement
status: Draft
type: Standards Track
category: ERC
created: 2023-05-02
requires: 721, 1155
official: https://eips.ethereum.org/EIPS/eip-7085
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7085.md
canonical: https://eips.huatuo.xyz/ko/eip-7085/
lang: ko
tldr: "NFT 컨트랙트가 토큰 간의 가중치 있는 '원본-파생' 링크와 각 토큰의 이름 붙은 숫자 속성을 기록할 수 있게 하는 확장 초안. 컬렉션을 질의 가능한 그래프로 만든다."
tags: [nft, erc721, erc1155, metadata, graph]
---

# ERC-7085: NFT Relationship Enhancement

> Establish relationships between NFTs and setting quantifiable attributes for those relationships.

**TL;DR:** NFT 컨트랙트가 토큰 간의 가중치 있는 '원본-파생' 링크와 각 토큰의 이름 붙은 숫자 속성을 기록할 수 있게 하는 확장 초안. 컬렉션을 질의 가능한 그래프로 만든다.

## 어떤 문제를 해결하나요?

[ERC-721](/eip-721/)과 [ERC-1155](/eip-1155/)는 각 토큰을 서로 고립된 것으로 다룹니다. "토큰 7은 토큰 3의 파생이고 가중치는 50"이라거나 "토큰 9는 `power = 12`를 가진다"는 것을 온체인에서 표현할 방법이 없습니다. 리믹스, 가계도, 제작 레시피, 게임 능력치가 필요한 프로젝트는 각자 저장소와 함수를 만들어 내기 때문에 도구가 이를 범용적으로 읽을 수 없습니다.

ERC-7085는 이런 **관계**와 **수치화할 수 있는 속성**을 위한 작은 공통 인터페이스를 제안해, NFT 묶음을 그래프로 다룰 수 있게 합니다.

## 어떻게 동작하나요?

NFT 컨트랙트에 함수 다섯 개가 추가됩니다.

| 함수 | 역할 |
| --- | --- |
| `setRelationship(originalID, derivativeID, attribute)` | 파생을 원본에 숫자 값과 함께 연결(기본값 1) |
| `getRelationship(originalID, derivativeID)` | 그 값(`uint256`)을 읽기 |
| `setAttribute(id, name, value)` | 토큰에 이름 붙은 숫자 속성 하나를 설정 |
| `getAttribute(id, name)` | 속성을 읽기(`bytes32`로 반환) |
| `getAttributeNames(id)` | 토큰의 속성 이름을 나열 |

명세의 설계 선택: 특정 토큰 쌍 사이에는 관계가 **하나만** 존재할 수 있어 그래프를 단순하게 유지하고, 속성은 한 번에 하나씩 설정해 호출 비용을 낮춥니다. 이 인터페이스(`INFTGraph`)는 [ERC-165](/eip-165/)로 확인할 수 있습니다.

누가 관계나 속성을 설정할 수 있는지는 정의되어 있지 않습니다. 명세는 구현자가 접근 제어를 추가하고, 관계가 관련 당사자의 승인을 받았는지 검증해야 한다고 경고할 뿐입니다.

## 샘플 코드

쓰기를 소유자로 제한한, 컴파일 가능한 최소 구현:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

contract NFTGraph {
    address public immutable admin = msg.sender;

    mapping(uint256 => mapping(uint256 => uint256)) private _rel;
    mapping(uint256 => mapping(bytes32 => bytes32)) private _attr;
    mapping(uint256 => bytes32[]) private _names;

    modifier onlyAdmin() { require(msg.sender == admin, "not admin"); _; }

    function setRelationship(uint256 original, uint256 derivative, uint256 value) external onlyAdmin {
        require(original != derivative, "same token");
        _rel[original][derivative] = value == 0 ? 1 : value;
    }

    function getRelationship(uint256 original, uint256 derivative) external view returns (uint256) {
        return _rel[original][derivative];
    }

    function setAttribute(uint256 id, string calldata name, uint256 value) external onlyAdmin {
        bytes32 key = keccak256(bytes(name));
        if (_attr[id][key] == 0) _names[id].push(key);
        _attr[id][key] = bytes32(value);
    }

    function getAttribute(uint256 id, string calldata name) external view returns (bytes32) {
        return _attr[id][keccak256(bytes(name))];
    }

    function getAttributeNames(uint256 id) external view returns (bytes32[] memory) {
        return _names[id]; // hashed keys in this sketch
    }
}
```

## 알아둘 점

- 상태는 **Draft**이며 본문이 내부적으로 일관되지 않습니다. `setAttribute`는 `uint256` 값을 받는데 `getAttribute`는 `bytes32`를 반환하고, `getAttributeNames`는 문자열 이름에 대해 `bytes32[]`를 반환하며, 레퍼런스 컨트랙트는 쓰인 그대로는 컴파일되지 않습니다. 구현마다 차이가 날 것으로 예상하세요.
- 명세에는 `type(INFTGraph).interfaceId` 외에 고정된 ERC-165 인터페이스 ID가 없으며, 이는 최종 시그니처에 따라 달라집니다.
- 관계 값은 그저 숫자입니다. 그 의미(로열티 지분, 유사도, 수량 등)는 각 애플리케이션이 정합니다.
- 엄격한 접근 제어가 없으면 누구나 무관한 토큰을 연결하거나 속성을 덮어쓸 수 있으며, 이것이 명세가 꼽은 주요 보안 우려입니다.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7085
