An example from Alchemy,
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract AwesomeGame is ERC1155 {
uint256 public constant GOLD = 0;
uint256 public constant SWORD = 1;
uint256 public constant CROWN = 2;
constructor() ERC1155("https://awesomegame.com/assets/{id}.json") {
_mint(msg.sender, GOLD, 10**18, "");
_mint(msg.sender, SWORD, 1000, "");
_mint(msg.sender, CROWN, 1, "");
}
}
Here, GOLD
is an erc20 type and just wondering if it can have some monetary value like erc20 and be listed on uniswap or exchanges? and two side questions,
_mint(msg.sender, GOLD, 10**18, "");
SWORD
still NFT? I think it's fungible with 1k quantity and it should not be non-fungible token (NFT)First of all, you have to understand why ERC-1155 was introduced in the first place. In short, it was introduced to cater to the need for in-game currency and items.
and to answer your main question No you can't add it. You can see more detail discussion on forum.openzeppelin.