0

I'm learning ERC-1155 Multi Token Standard, and I found great OpenZeppelin tutorial. However, I'm not sure if I can use that OpenZeppelin contract when I deploy my contract to the testnet or mainnet.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract GameItems is ERC1155 {
    uint256 public constant GOLD = 0;
    uint256 public constant SILVER = 1;
    uint256 public constant THORS_HAMMER = 2;
    uint256 public constant SWORD = 3;
    uint256 public constant SHIELD = 4;

    constructor() ERC1155("https://game.example/api/item/{id}.json") {
        _mint(msg.sender, GOLD, 10**18, "");
        _mint(msg.sender, SILVER, 10**27, "");
        _mint(msg.sender, THORS_HAMMER, 1, "");
        _mint(msg.sender, SWORD, 10**9, "");
        _mint(msg.sender, SHIELD, 10**9, "");
    }
}
2
  • 1
    If you follow the MIT license terms you should be fine. – Ismael Apr 1 at 4:55
  • Thanks! @Ismael – Div Apr 1 at 7:53
2

The point of testnets is that they should function (almost) identically to the mainnet. So they are suited for testing things before launching to the mainnet.

So, as long as your contract doesn't require other already-deployed contracts (which may not exist in that network), you can deploy all the same contracts to any network.

1

Yes you can use the OZ's contract for deployment on testnet and on mainnet too. In fact, using off-the-shelf OZ contract is good cause all of them are well audited before released for using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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