From e979b938623e7be1b97f930cde342960b82bc097 Mon Sep 17 00:00:00 2001 From: JulissaDantes Date: Fri, 10 Dec 2021 13:47:49 -0400 Subject: [PATCH] Add documentation for 2981 implementation --- CHANGELOG.md | 1 + .../token/ERC721/extensions/draft-ERC721Royalty.sol | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0733af7cb91..57f9c761350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased + * `ERC2891`: add a new extension of `ERC721` to handle royalty information.([]()) * `GovernorTimelockControl`: improve the `state()` function to have it reflect cases where a proposal has been canceled directly on the timelock. ([#2977](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2977)) * `Math`: add a `abs(int256)` method that returns the unsigned absolute value of a signed value. ([#2984](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2984)) * Preset contracts are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com). ([#2986](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2986)) diff --git a/contracts/token/ERC721/extensions/draft-ERC721Royalty.sol b/contracts/token/ERC721/extensions/draft-ERC721Royalty.sol index e9f88c1e191..7289e26dfcd 100644 --- a/contracts/token/ERC721/extensions/draft-ERC721Royalty.sol +++ b/contracts/token/ERC721/extensions/draft-ERC721Royalty.sol @@ -8,7 +8,11 @@ import "../../../utils/introspection/ERC165Storage.sol"; import "hardhat/console.sol"; /** - * @dev TBD + * @dev Implementation of the ERC721 Royalty extension allowing royalty information to be stored and retrieved, as defined in + * https://eips.ethereum.org/EIPS/eip-2981[EIP-2981]. + * + * Adds the {_setTokenRoyalty} methods to set the token royalty information, and {_setRoyalty} method to set a global + * royalty information. * * _Available since v4.5._ */ @@ -21,7 +25,8 @@ abstract contract ERC721Royalty is IERC721Royalty, ERC165Storage { RoyaltyInfo private _royaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyalty; - /*@dev Sets tokens royalties + /* + * @dev Sets tokens royalties * * Requirements: * - `tokenId` must be already mined. @@ -39,7 +44,9 @@ abstract contract ERC721Royalty is IERC721Royalty, ERC165Storage { _tokenRoyalty[tokenId] = RoyaltyInfo(recipient, value); } - /*@dev Sets global royalty + /* + * + * @dev Sets global royalty * * Requirements: * - `recipient` cannot be the zero address.