ERC721R 项目使用教程
ERC721R项目地址:https://gitcode.com/gh_mirrors/er/ERC721R
1. 项目的目录结构及介绍
ERC721R/
├── contracts/
│ ├── ERC721R.sol
│ └── MyFunNFT.sol
├── scripts/
│ └── deploy.js
├── test/
│ └── ERC721R.test.js
├── .gitignore
├── .prettierrc
├── LICENSE.txt
├── README.md
├── hardhat.config.js
├── package-lock.json
└── package.json
目录结构介绍
- contracts/: 包含智能合约文件,其中
ERC721R.sol
是核心合约,MyFunNFT.sol
是一个示例合约。 - scripts/: 包含部署脚本,例如
deploy.js
。 - test/: 包含测试文件,例如
ERC721R.test.js
。 - .gitignore: 指定 Git 版本控制系统忽略的文件和目录。
- .prettierrc: 配置代码格式化工具 Prettier。
- LICENSE.txt: 项目的许可证文件。
- README.md: 项目的说明文档。
- hardhat.config.js: Hardhat 配置文件,用于配置开发环境。
- package-lock.json: 锁定项目依赖的版本。
- package.json: 项目的 npm 配置文件,包含项目依赖和脚本。
2. 项目的启动文件介绍
hardhat.config.js
这是 Hardhat 的配置文件,用于配置开发环境。以下是文件的基本内容:
require("@nomiclabs/hardhat-waffle");
module.exports = {
solidity: "0.8.4",
networks: {
// 配置网络
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts"
},
mocha: {
timeout: 20000
}
};
package.json
这是项目的 npm 配置文件,包含项目依赖和脚本。以下是文件的基本内容:
{
"name": "ERC721R",
"version": "1.0.0",
"description": "An ERC721 base contract that mints tokens in a pseudo-random order",
"main": "hardhat.config.js",
"scripts": {
"test": "npx hardhat test",
"compile": "npx hardhat compile",
"deploy": "npx hardhat run scripts/deploy.js"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.4.1",
"hardhat": "^2.4.1"
}
}
3. 项目的配置文件介绍
.prettierrc
这是 Prettier 的配置文件,用于格式化代码。以下是文件的基本内容:
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80
}
hardhat.config.js
如前所述,这是 Hardhat 的配置文件,用于配置开发环境。
package.json
如前所述,这是项目的 npm 配置文件,包含项目依赖和脚本。
通过以上介绍,您可以更好地理解和使用 ERC721R 项目。希望这份教程对您有所帮助!