1

I keep getting this error with my code, I've referred to another article about a similar issue with 'Greeter.sol' but that doesn't seem to be my problem.

This is my code for the .sol file:

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

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Btc is ERC20, Ownable {
    constructor() ERC20("Dogecoin", "DOGE"){}

    function mint(address to, uint256 amount) public payable{
        _mint(to, amount);
    }

    receive() external payable{}
}

and the following is the error that I keep getting :

HardhatError: HH700: Artifact for contract "Dogecoin" not found. at Artifacts._handleWrongArtifactForContractName (/home/muskaan/moti-milo/smart-contract/node_modules/hardhat/src/internal/artifacts.ts:478:11) at Artifacts._getArtifactPathFromFiles (/home/muskaan/moti-milo/smart-contract/node_modules/hardhat/src/internal/artifacts.ts:593:19) at Artifacts._getArtifactPath (/home/muskaan/moti-milo/smart-contract/node_modules/hardhat/src/internal/artifacts.ts:275:17) at Artifacts.readArtifact (/home/muskaan/moti-milo/smart-contract/node_modules/hardhat/src/internal/artifacts.ts:58:26) at getContractFactory (/home/muskaan/moti-milo/smart-contract/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:99:22) at main (/home/muskaan/moti-milo/smart-contract/scripts/deploy.js:4:25) at /home/muskaan/moti-milo/smart-contract/scripts/deploy.js:31:9

Please help, I have been stuck for a while now.

This is my deploy.js file:

const { ethers } = require('hardhat')

const main = async() => {
    const dogeFactory = await ethers.getContractFactory('Dogecoin')
    const dogeContract = await dogeFactory.deploy()
    await dogeContract.deployed()
    console.log('Dogecoin deployed to:', dogeContract.address)

    const bitcoinFactory = await ethers.getContractFactory('Btc')
    const bitcoinContract = await bitcoinFactory.deploy()
    await bitcoinContract.deployed()
    console.log('Bitcoin deployed to:', bitcoinContract.address)


    const solanaFactory = await ethers.getContractFactory('Solana')
    const solanaContract = await solanaFactory.deploy()
    await solanaContract.deployed()
    console.log('Solana deployed to:', solanaContract.address)


    const usdcFactory = await ethers.getContractFactory('Usdc')
    const usdcContract = await usdcFactory.deploy()
    await usdcContract.deployed()
    console.log('USDC deployed to:', usdcContract.address)

}


;(async ()=>{
    try{
        await main()
        process.exit(0)
    } catch(error){
        console.error(error)
        process.exit(1)
    }
})()

I deploy using $ npx hardhat run scripts/deploy.js --network rinkeby

1 Answer 1

2

since you named your contract 'Btc' the name should be sync on your getContractFactory as well.

on your Dogecoin.sol don't use:

contract Btc is ERC20, Ownable { ...

instead use:

contract Dogecoin is ERC20, Ownable { ...

then, don't change your deploy.js. then run:

npx hardhat clean
npx hardhat deploy scripts/deploy.js --network rinkeby

it should work just fine.

14
  • Yes, I have already tried doing that, kept getting the same error. Aug 19, 2022 at 4:01
  • is this an error upon deployment? what kind of scripts are you running?
    – Lonewarp
    Aug 19, 2022 at 4:08
  • Yes, this error comes up when I deploy using 'npx hardhat run scripts/deploy.js --network rinkeby', this is my deploy.js file: Aug 19, 2022 at 4:14
  • Sorry, see below: Aug 19, 2022 at 4:15
  • can I see your deploy.js file? I mean the actual code
    – Lonewarp
    Aug 19, 2022 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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