ERC1155 custom mint function

so im working on a ERC1155 token. as you may know openzeppelin has a presetMinter for it, but I want to mint my token with more complex things.

i see 3 methods to do it:

1- without using presetMinter from openzeppelin. right a minter funtion by myself in MyToken.sol

2- import presetMinter from openzeppelin to MyToken.sol and override that minter funtion with my custom one in MyToken.sol

3- import presetMinter from openzeppelin to MyToken.sol and declare a MyMint function that do all the things and passes the variables to presetMinter from openzeppelin. and try to call MyMint funtion for minting my token.

which is the best method? i mean which is more standard to do?
any other comments for doing this would be appreciated!

1 Like

Hi, welcome!

I think you can use the first way, just like:

YourERC1155 is ERC1155 {
    function YOUR_MINT(address to, uint256 id, uint256 amount, bytes memory data) public {
        YOUR_COMPLEX_LOGIC;
        _mint(to, id, amount, data);
    }
}
2 Likes