How to create an ERC1155 factory?

Hello, I'm building an upgradeable ERC 1155 contract and I want to have a factory. I see from Openzeppelin docs v.1 that is possible to create instances of a contract (which end up being not upgradeable):

token = new ERC20("Test", "TST");

But v.4 uses an example in which the initializer function does it:

function initialize() initializer public {
+        __ERC721_init("MyCollectible", "MCO");
     }

I was wondering if the following pattern will be good:
My questions are the following:

  1. What is the proper way to proceed if I build a dapp from which the users have the ability to mint/mintBatch by using the ERC 1155 standard with upgradeability?. Also I see the EIP-1155 standard and it says: "onERC1155Received and onERC1155BatchReceived MUST NOT be called on an EOA (Externally Owned Account).".
  2. Does this mean this standard is only allowed to transfer between contracts?
  3. If I want the parent token contract to be upgradeable I'm a bit confused and would appreciate your help a lot...

:1234: Code to reproduce

import "./MyERC1155.sol";
import "../node_modules/@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";
// import './interface/IMyERC1155.sol';

import "../node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "../node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "../node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract ERC1155Producer is Initializable, ERC1155HolderUpgradeable, OwnableUpgradeable {
    constructor() initializer {}

    function initialize() initializer public {
        __ERC1155Holder_init();
    }

   function createTokens(address _to, uint256 id, uint256 _amount, bytes memory data) public {
        MyERC1155 _myERC1155 = new MyERC1155(); //No need for initialization values right?
        _myERC1155.mint(msg.sender, id, _amount, data); // Is this allowed from any wallet?
    }

    function burn(address _from, uint256 _amount) public {
        LomTicket.burn(_from, _amount);
    }    
}

I hope am being clear enough. Cheers!

:computer: Environment

As of now, I'm just designing the contract and I use Hardhat mostly as I see remix don't work very well with upgradeability.

Hi @nicolas.guasca, here are a few things to consider:

  • ERC1155Holder doesn't look necessary for this contract. It is only needed if you want to be able to transfer ERC1155 tokens to another contract (e.g. with SafeTransferFrom), and in that case ERC1155Holder would be used in that other contract.
  • Consider whether you really need multiple ERC1155 instances, or a single ERC1155 instance.