【问题标题】:HardhatError: HH700: Artifact for contract "HelloWorld" not foundHardhatError:HH700:未找到合同“HelloWorld”的工件
【发布时间】:2022-12-10 06:12:40
【问题描述】:

所以当我想部署我的合同并在我的终端中写入“npx hardhat run scripts/deploy.js --network goerli”时,它给出了一个错误:

HardhatError:HH700:未找到合同“HelloWorld”的工件。 在 Artifacts._handleWrongArtifactForContractName (/Users//hello- world/node_modules/hardhat/src/internal/artifacts.ts:702:11) at Artifacts._getArtifactPathFromFiles (/Users//hello- world/node_modules/hardhat/src/internal/artifacts.ts:827:19) at Artifacts._getArtifactPath (/Users//hello-world/node_modules/hardhat /src/internal/artifacts.ts:507:21) at Artifacts.readArtifact (/Users//hello-world/node_modules/hardhat /src/internal/artifacts.ts:71:26) at getContractFactory (/Users/**/hello-world/node_modules/@nomiclabs /hardhat-ethers/src/internal/helpers.ts:99:22)

这是我的deploy.js代码:

async function main() {
    const HelloWorld = await ethers.getContractFactory("HelloWorld");
 
    const hello_world = await HelloWorld.deploy("Hello World!");
    console.log("Contract deployed to address:", hello_world.address);
}

我什至试图把:

const HelloWorld = await ethers.getContractFactory("HelloWorld.sol");

它通常应该显示:

合约部署地址:0x ...

有人能帮助我吗?谢谢 !

【问题讨论】:

    标签: javascript terminal solidity smartcontracts hardhat


    【解决方案1】:

    你忘了编译你的合同。

    npx hardhat compile
    

    【讨论】:

      猜你喜欢
      • 2022-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-12
      • 1970-01-01
      • 1970-01-01
      • 2019-10-08
      • 1970-01-01
      相关资源
      最近更新 更多