I think what the 721 can do, the 1155 can do either, and 1155 is more powerful .
I have deploied to goerli 0xaCA8E8D4982424048e2d0A446ffC5761a356fbf6
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract MyToken is ERC1155, Ownable {
string public name;
string public symbol;
mapping(uint256 => string) public tokenURI;
constructor() ERC1155("") {
name = "Crosschain Rally";
symbol = "XCARS";
}
function setURI(string memory newuri) public onlyOwner {
_setURI(newuri);
}
function mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) public onlyOwner {
_mint(account, id, amount, data);
}
function mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public onlyOwner {
_mintBatch(to, ids, amounts, data);
}
function setTokenURI(uint256 _id, string memory newuri) external {
tokenURI[_id] = newuri;
emit URI(newuri, _id);
}
function uri(uint256 _id) public view override returns (string memory) {
return string(abi.encodePacked(tokenURI[_id],Strings.toString(_id), ".json"));
}
}