// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { IERC721A } from "erc721a/contracts/IERC721A.sol"; import { ERC721A } from "erc721a/contracts/ERC721A.sol"; import { ERC4907A } from "erc721a/contracts/extensions/ERC4907A.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; interface IERC721Metadata { function tokenURI(uint256 tokenId) external view returns (string memory); } contract ERC4907 is ERC4907A, Ownable { struct AssetInfo { address tokenAddress; uint256 tokenId; } mapping(uint256 => AssetInfo) internal _assets; constructor() ERC721A("BNPL", "BNPL") {} function mint(address to, address tokenAddress, uint256 tokenId) external onlyOwner returns (uint256 tid) { _mint(to, 1); tid = _nextTokenId() - 1; _assets[tid] = AssetInfo(tokenAddress, tokenId); } function burn(uint256 tokenId) external onlyOwner { setUser(tokenId, address(0), 0); _burn(tokenId); } function tokenURI(uint256 tokenId) public view override (ERC721A, IERC721A) returns (string memory) { AssetInfo memory asset = _assets[tokenId]; try IERC721Metadata(asset.tokenAddress).tokenURI(asset.tokenId) returns (string memory uri) { return uri; } catch { return super.tokenURI(tokenId); } } }