diff --git a/contracts/BEBase.sol b/contracts/BEBase.sol index a243b9c..2cbafd0 100644 --- a/contracts/BEBase.sol +++ b/contracts/BEBase.sol @@ -1,11 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; abstract contract BEBase is ERC721, AccessControlEnumerable, ERC721Enumerable, Ownable { + using Strings for uint256; + mapping(address => bool) public approvalWhitelists; mapping(uint256 => bool) public lockedTokens; string private _baseTokenURI; @@ -19,6 +22,14 @@ abstract contract BEBase is ERC721, AccessControlEnumerable, ERC721Enumerable, O return _baseTokenURI; } + function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { + require(_exists(tokenId), "BEBase: URI query for nonexistent token"); + + string memory baseURI = _baseURI(); + uint256 tokenSub = tokenId % 1000; + return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenSub.toString())) : ""; + } + /** * @dev Creates a new token for `to`. Its token ID will be automatically * assigned (and available on the emitted {IERC721-Transfer} event), and the token