This is ERC721URIStorage contract:

abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));

        return super.tokenURI(tokenId);
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    function _burn(uint256 tokenId) internal virtual override {

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];

As far as I know, an abstract contract can have both implemented and unimplemented functions but there must be at least one of its functions that lacks an implementation. But as you see, all the functions inside the contract are implemented.

1 Answer 1


From the v0.8.13 Solidity Docs on Abstract Contracts (emphasis added):

Contracts need to be marked as abstract when at least one of their functions is not implemented. Contracts may be marked as abstract even though all functions are implemented.

This contract doesn't need to be abstract but the compiler won't complain if it is. Whether or not it should be is probably a design question relevant to the codebase itself (looks like this is consistent with the rest of the extensions in the ERC721/extensions folder in the OpenZeppelin contracts repo).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.