Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving walletOfOwner efficiency #233

Merged
merged 2 commits into from
Apr 12, 2022
Merged

Improving walletOfOwner efficiency #233

merged 2 commits into from
Apr 12, 2022

Conversation

liarco
Copy link
Member

@liarco liarco commented Apr 12, 2022

From the ERC721A implementation:

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
    }

In our case _startTokenId() <= tokenId && tokenId < _currentIndex are implicitly true when we get to the following line:

This means that the function can be replaced by !_ownerships[tokenId].burned only.

@liarco liarco added the enhancement New feature or request label Apr 12, 2022
@liarco liarco merged commit 6b2d789 into main Apr 12, 2022
@liarco liarco deleted the improving-wallet-of-owner branch April 12, 2022 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant