0.0.12 • Published 10 months ago

@solidity-audit-llm/hardhat-plugin v0.0.12

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Hardhat Smart Contract Auditor Plugin

Hardhat插件,用于在Hardhat项目中使用Smart Contract Auditor进行智能合约代码审查。该插件支持自动化的代码审查流程,可以生成中文审计报告。

功能特点

  • 支持单个合约文件的审查
  • 支持合约文件的自动展平(flatten)
  • 生成详细的中文审计报告
  • 支持自定义OpenAI配置
  • 审计报告自动保存

安装

使用npm或yarn安装插件:

npm install @solidity-audit-llm/hardhat-plugin
# or
yarn add @solidity-audit-llm/hardhat-plugin

配置

在你的Hardhat配置文件(hardhat.config.ts/js)中添加以下配置:

import "@solidity-audit-llm/hardhat-plugin";

const config: HardhatUserConfig = {
  // ... 其他配置
  llmCodeReview: {
    openai: {
      apiKey: "your-api-key", // OpenAI API密钥
      module: "gpt-4", // 可选,默认使用gpt-4
      baseUrl: "https://api.openai.com/v1", // 可选,OpenAI API基础URL
      multiLanguage: ["chinese"],
    }
  }
};

export default config;

使用方法

插件提供了run-review-llm任务,可以通过以下命令使用:

# 审查单个合约文件
npx hardhat run-review-llm --file contracts/YourContract.sol

# 审查并自动展平合约文件(包含所有依赖)
npx hardhat run-review-llm --file contracts/YourContract.sol --flatten

参数说明

  • --file: 要审查的合约文件路径(必需)
  • --flatten: 是否在审查前展平合约文件(可选)

输出

审计报告将自动生成并保存在项目根目录的audit-report文件夹中。

依赖要求

  • Hardhat: ^2.12.7
  • Node.js: >=14.0.0

许可证

MIT

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago