0
// 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 SILVER = 1;
    uint256 public constant SWORD = 2;
    uint256 public constant SHIELD = 3;
    uint256 public constant CROWN = 4;

    constructor() ERC1155("https://awesomegame.com/assets/{id}.json") {
        _mint(msg.sender, GOLD, 10**18, "");
        _mint(msg.sender, SILVER, 10**18, "");
        _mint(msg.sender, SWORD, 1000, "");
        _mint(msg.sender, SHIELD, 1000, "");
        _mint(msg.sender, CROWN, 1, "");
    }
}

This is the example from alchemy. So Gold here can be fungible ERC-20 where the quantity is 10**18.

Questions

  1. Majority of coins/currencies listed on exchanges is ERC-20 type and not 1155? Can GOLD be used as ERC-20 and have monetary value?
  2. Isn't the quantity for GOLD should be something like supply * 10**18? i.e. 100000000 * 10**18

1 Answer 1

0
  1. The majority of coins/currencies listed on exchanges is ERC-20 type, not ERC-1155. GOLD can be used as ERC-20 and have monetary value as ERC-1155 can perform the function of ERC-20 and ERC-721 and even both simultaneously.

  2. The quantity of GOLD has a maximum value of 2**(256)-1 (uint256). As long as the supply doesn't exceed that, it's allowed.

1
  • #1 can erc1155 GOLD token be listed on exchanges then? #2 alright but 10**18 is just decimals meaning only 1 token. so _mint(msg.sender, GOLD, 10**18, ""); this is just minting only 1 GOLD token. so i'm assuming it should have minted more tokens?
    – bbusdriver
    Oct 2, 2022 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.