I’ve tried extension ERC721URIStorage from the latest preview (4.0.0-beta1) and everything seems to be working just fine!
@AnkerFaster I leave here a minimalistic code to try the extension, in case it helps:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.0/contracts/token/ERC721/extensions/ERC721URIStorage.sol';
contract Test is ERC721URIStorage {
string baseURI;
constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {}
function mint(
address account,
uint256 tokenId
) external {
_mint(account, tokenId);
}
function setTokenURI(
uint256 tokenId,
string memory tokenURI
) external {
_setTokenURI(tokenId, tokenURI);
}
function setBaseURI(string memory baseURI_) external {
baseURI = baseURI_;
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
}