Solidity

錯誤 HH700:未找到合約“@uniswap/lib/contracts/Babyl………….”的工件

  • July 26, 2022

我正在使用Hardhat來編譯 Solidity 合約。

在契約中,我正在導入 Uniswap 的契約 SDK 以使用它們。但是當我跑步時

yarn hardhat compile 

在終端它說

Error HH700: Artifact for contract "@uniswap/lib/contracts/libraries/Babylonian.sol:Babylonian" not found. 

For more info go to https://hardhat.org/HH700 or run Hardhat with --show-stack-traces
error Command failed with exit code 1.

這是我導入 Uniswap 的方式

pragma solidity 0.6.6;

import '@uniswap/v2-periphery/contracts/UniswapV2Router02.sol';

contract THE_CONTRACT {
 string public name = "SOME PROPERTY";

這是安全帽配置

import "@nomicfoundation/hardhat-toolbox";
import { INFURA } from "./src/config";

const config = {
 solidity: "0.6.6",
 paths: {
   artifacts: "./src/artifects",
 },
 networks: {
   goerli: {
     chainID: 5,
     url: INFURA,
     accounts: [
       "0xTHEACCOUNT",
     ],
     timeout: 60000,
   },
 },
 settings: {
   optimizer: {
     enabled: true,
     runs: 1,
   },
   evmVersion: "byzantium",
 },
};

export default config;
  1. 你試過安裝 npm i @uniswap/v2-periphery 嗎?或者在你的情況下“紗線添加”?
  2. 你的安全帽配置中有編譯器版本 0.6.6 嗎?
  3. 嘗試刪除cacheartifects文件夾並再次編譯契約

可能是其中之一…

引用自:https://ethereum.stackexchange.com/questions/132446