# ERC-2981 Contract

By [Primrose](https://paragraph.com/@primrose) · 2023-06-07

---

Royalty
=======

NFT 시장에서는 Royalty 라는 개념이 있다.

쉽게 설명하면, 내가 만든 NFT(나의 창작물)에 대해서, 모든 2차판매가 일어나는 경우 원 창작자(나)에게 일정 금액을 지불하는 것이다.

저작권료라고 생각하면 이해가 쉽다.

기존 NFT를 발행하기 위해서 수많은 사람들이 `ERC-721` 컨트랙트를 배포해 사용하고 있었는데, Royalty 시스템을 구현한 것은 각 마켓플레이스나 프로젝트 별로 달랐다.

그 표준을 정립한 것이 바로 오늘 소개할 `ERC-2981` 컨트랙트이다.

### Royalty Info

    /// @notice Called with the sale price to determine how much royalty
        //          is owed and to whom.
        /// @param _tokenId - the NFT asset queried for royalty information
        /// @param _salePrice - the sale price of the NFT asset specified by _tokenId
        /// @return receiver - address of who should be sent the royalty payment
        /// @return royaltyAmount - the royalty payment amount for _salePrice
        function royaltyInfo(
            uint256 _tokenId,
            uint256 _salePrice
        ) external view returns (
            address receiver,
            uint256 royaltyAmount
        );
    

EIP 문서에서 살펴보면, 위와 같이 Royalty Info를 조회하는 함수가 있다.

`receiver`가 원 창작자가 될 것이고, `royaltyAmount`는 `salePrice`를 기반으로 계산된 가격을 리턴하게 될 것이다.

### EIP 2981

EIP 링크

[https://eips.ethereum.org/EIPS/eip-2981](https://eips.ethereum.org/EIPS/eip-2981)

### Openzeppelin ERC 2981 Contract

Openzeppelin에서 내놓은 ERC 2981 컨트랙트이니 참고하면 좋을 것 같다.

[https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)

---

*Originally published on [Primrose](https://paragraph.com/@primrose/erc-2981-contract)*
