Create2Deployer 项目使用教程

Create2Deployer 项目使用教程

create2deployerHelper smart contract to make easier and safer usage of the `CREATE2` EVM opcode.项目地址:https://gitcode.com/gh_mirrors/cr/create2deployer

1. 项目的目录结构及介绍

Create2Deployer 项目的目录结构如下:

create2deployer/
├── abis/
│   └── contracts/
├── assets/
│   └── img/
├── contracts/
├── deploy/
├── flattened/
├── scripts/
├── test/
├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solcover.js
├── .solhint.json
├── .solhintignore
├── LICENSE
├── README.md
├── SECURITY.md
├── .eslintrc.js
├── hardhat.config.ts
├── package.json
├── pnpm-lock.yaml
├── renovate.json
├── slither.config.json
└── tsconfig.json

目录介绍

  • abis/: 包含智能合约的 ABI 文件。
  • assets/: 包含项目资源文件,如图片。
  • contracts/: 包含智能合约的 Solidity 源代码。
  • deploy/: 包含部署脚本。
  • flattened/: 包含扁平化的合约文件。
  • scripts/: 包含各种脚本文件。
  • test/: 包含测试文件。
  • .editorconfig: 编辑器配置文件。
  • .gitignore: Git 忽略文件配置。
  • .prettierignore: Prettier 忽略文件配置。
  • .prettierrc.yml: Prettier 配置文件。
  • .solcover.js: Solidity 代码覆盖率配置文件。
  • .solhint.json: Solidity 代码风格检查配置文件。
  • .solhintignore: Solidity 代码风格检查忽略文件配置。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • SECURITY.md: 安全相关文档。
  • .eslintrc.js: ESLint 配置文件。
  • hardhat.config.ts: Hardhat 配置文件。
  • package.json: 项目依赖和脚本配置文件。
  • pnpm-lock.yaml: pnpm 锁定文件。
  • renovate.json: Renovate 配置文件。
  • slither.config.json: Slither 静态分析配置文件。
  • tsconfig.json: TypeScript 配置文件。

2. 项目的启动文件介绍

Create2Deployer 项目的启动文件主要是 hardhat.config.ts,它是 Hardhat 框架的配置文件。该文件定义了项目的编译、部署、测试等配置。

// hardhat.config.ts
import { HardhatUserConfig } from "hardhat/config";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-ethers";
import "hardhat-gas-reporter";
import "solidity-coverage";

const config: HardhatUserConfig = {
  solidity: "0.8.4",
  networks: {
    // 网络配置
  },
  gasReporter: {
    enabled: process.env.REPORT_GAS !== undefined,
    currency: "USD",
  },
  etherscan: {
    apiKey: process.env.ETHERSCAN_API_KEY,
  },
};

export default config;

3. 项目的配置文件介绍

.prettierrc.yml

Prettier 配置文件,用于代码格式化。

# .prettierrc.yml
printWidth: 80
tabWidth: 2
useTabs: false
semi: true
singleQuote: true
quoteProps: "as-needed"
jsxSingleQuote: false
trailingComma: "es5"
bracketSpacing: true
jsxBracketSameLine: false
arrowParens: "always"
rangeStart: 0
rangeEnd: Infinity

.solhint.json

Solidity 代码风格检查配置文件。

{
  "extends": "solhint:recommended",
  "rules": {
    "avoid-suicide": "error",
    "avoid-sha3": "warn"
  }
}

tsconfig.json

TypeScript 配置文件。

{
  "compilerOptions": {
    "target": "

create2deployerHelper smart contract to make easier and safer usage of the `CREATE2` EVM opcode.项目地址:https://gitcode.com/gh_mirrors/cr/create2deployer

  • 7
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卓禄嘉Ernestine

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值