Solidity ERC1155 hit an invalid opcode while deploying to truffle

24 views Asked by At

So im working on an ERC1155 contract, after running truffle migrate i get this error:

Error:  *** Deployment Failed ***

"clothing" hit an invalid opcode while deploying. Try:
   * Verifying that your constructor params satisfy all assert conditions.
   * Verifying your constructor code doesn't access an array out of bounds.
   * Adding reason strings to your assert statements.

this is my truffle-config.js

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*",
      networkCheckTimeout: 100000
    }
  },
  compilers: {
    solc: {
      version: "^0.8.0", 
    }
  }
};

and my clothing.sol ERC1155 contract:

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

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

contract clothing is ERC1155 {

    address ownerAdress;

    constructor() ERC1155("") {
        ownerAdress = msg.sender;
    }
}

and this is my migrations file called 2_deploy_contracts.js:

const clothing = artifacts.require("clothing.sol");

module.exports = async function(deployer) {
  await deployer.deploy(clothing);
};

I have tried different versions of pragma, but haven't gotten it working yet. I tried deploying my contract using the online remix IDE, and it did work there but I'd like to run it locally using Truffle and Ganache. Anybody know a fix for this?

0

There are 0 answers