Improve natspec documentation and comments (#4581)

Co-authored-by: Francisco Giordano <fg@frang.io>
This commit is contained in:
Hadrien Croubois
2023-09-08 03:10:28 +02:00
committed by GitHub
parent d54f4ac4b7
commit 6f80048ce9
12 changed files with 58 additions and 52 deletions

View File

@ -184,8 +184,8 @@ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Er
* @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
* particular (ignoring whether it is owned by `owner`).
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not
* verify this assumption.
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
return
@ -195,10 +195,11 @@ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Er
/**
* @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
* Reverts if `spender` has not approval for all assets of the provided `owner` nor the actual owner approved the `spender` for the specific `tokenId`.
* Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
* the `spender` for the specific `tokenId`.
*
* WARNING: This function relies on {_isAuthorized}, so it doesn't check whether `owner` is the
* actual owner of `tokenId`.
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
if (!_isAuthorized(owner, spender, tokenId)) {

View File

@ -19,12 +19,12 @@ import {Checkpoints} from "../../../utils/structs/Checkpoints.sol";
* Using this extension removes the ability to mint single tokens during contract construction. This ability is
* regained after construction. During construction, only batch minting is allowed.
*
* IMPORTANT: This extension bypasses the hooks {_beforeTokenTransfer} and {_afterTokenTransfer} for tokens minted in
* batch. The hooks will be only called once per batch, so you should take `batchSize` parameter into consideration
* when relying on hooks.
* IMPORTANT: This extension does not call the {_update} function for tokens minted in batch. Any logic added to this
* function through overrides will not be triggered when token are minted in batch. You may want to also override
* {_increaseBalance} or {_mintConsecutive} to account for these mints.
*
* IMPORTANT: When overriding {_afterTokenTransfer}, be careful about call ordering. {ownerOf} may return invalid
* values during the {_afterTokenTransfer} execution if the super call is not called first. To be safe, execute the
* IMPORTANT: When overriding {_mintConsecutive}, be careful about call ordering. {ownerOf} may return invalid
* values during the {_mintConsecutive} execution if the super call is not called first. To be safe, execute the
* super call before your custom logic.
*/
abstract contract ERC721Consecutive is IERC2309, ERC721 {