After initializing with $ npx hardhat
I am having trouble when deploying using hardhat.
HardhatError: HH700: Artifact for contract "<contract_name>" not found.
I can compile my contract with no errors
$ npx hardhat compile
, however when I try to deploy it using the deploy script I get the error:
$nnpx hardhat run scripts/deploy.js --network rinkeb
HardhatError: HH700: Artifact for contract "<contract_name>" not found.
In my hardhat.config.js
I have the paths:
sources: "./contracts",
artifacts: "./artifacts",
cache: "./cache"
},
and in the deploy script deploy.js
I have
const NFT = await hre.ethers.getContractFactory("contract");
const nft = await NFT.deploy();
await nft.deployed();
and I have te contract saved in contracts/contract.sol
.
I don't know which is the problem.
Best Answer
Well, I managed to find out what was wrong. The contract filename and the contract definition were different. I don't know if the filename of the contract and the contract definition has to be the same.
In
contracts/contract.sol
I have:After renaming
contracts/contract.sol --> contracts/NTFContract.sol
I don't have this problem anymore and I am able to deploy it correctly.I still wonder which is the convention in general for solidity and for hardhat.