this is my main contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract ERFANERC1155 is ERC1155 ,Ownable
{
uint256 tokenCount;
string private _name;
string private _symbol;
constructor (string memory uri_,string memory name_,string memory symbol_) ERC1155 (uri_) Ownable()
{
_name=name_;
_symbol=symbol_;
}
function mint(uint256 amount) public onlyOwner
{
tokenCount ++;
_mint(_msgSender(),tokenCount,amount,"");
}
function mintBatch (uint256 [] memory ids,uint256 [] memory amounts,bytes memory data) public onlyOwner
{
_mintBatch(_msgSender(), ids, amounts, data);
}
}
and this is my deploy file:
async function main() {
const nft = await ethers.deployContract("https://ipfs.io/ipfs/QmSW4c8J7iXoC4Q8yvNDwC9eGdXEntMxWJJbLek912YMYM","ERFANERC1155",["ENF"]);
await nft.waitForDeployment();
console.log("SimpleStorage Contract Address:", await nft.getAddress());
await nft.mint(12);
console.log("NFT Success mint!");
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
When I deploy my file it gives me the following error:
PS C:\Users\D-W\Desktop\Erfan's NFT> npx hardhat run scripts/dnftSolidity.js
ReferenceError: ERFANERC1155 is not defined
at main (C:\Users\D-W\Desktop\Erfan's NFT\scripts\dnftSolidity.js:3:126)
at Object.<anonymous> (C:\Users\D-W\Desktop\Erfan's NFT\scripts\dnftSolidity.js:13:3)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Function.Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
This error is related to the following line of code:
const nft = await ethers.deployContract("https://ipfs.io/ipfs/QmSW4c8J7iXoC4Q8yvNDwC9eGdXEntMxWJJbLek912YMYM","ERFANERC1155",["ENF"]);
what's the solution؟