@1hive/deployments-aragon-shared 中文文档教程
Boilerplate for ethereum solidity smart contract development
INSTALL
yarn
TEST
yarn test
SCRIPTS
以下是您可以执行的 npm 脚本列表:
其中一些依赖于 ./scripts.js 以允许通过命令行参数对其进行参数化(查看内部如果你需要修改)
yarn prepare
作为标准的生命周期 npm 脚本,它会在安装时自动执行。 它生成配置文件和类型链,让您开始类型安全的合约交互
yarn lint
、yarn lint:fix
、yarn format
和 yarn format:fix
这些将 lint 和格式检查您的代码。 :fix
版本将修改文件以匹配 .eslintrc
和 .prettierrc.
中指定的要求
yarn compile
这些将编译你的合约
yarn void:deploy
这将在内存安全帽网络上部署您的合约并退出,不留痕迹。 确保部署按预期工作而不会产生任何后果的快速方法
yarn test [mocha args...]
这些将使用 mocha 执行您的测试。 你可以将额外的参数传递给 mocha
yarn coverage
这些将在 coverage/
文件夹中生成覆盖率报告
yarn gas
这些将为测试中使用的函数生成气体报告
yarn dev
这些将在 localhost:8545
上运行本地 hardhat 网络并在其上部署您的合约。 此外,它会监视任何更改并重新部署它们。
yarn local:dev
这假定它在 localhost:8545
上运行的本地节点。 它将在其上部署您的合同。 此外,它会监视任何更改并重新部署它们。
yarn 执行
这将针对指定的网络执行脚本
yarn deploy
这将在指定网络上部署合约。
它在后台使用 hardhat deploy
命令,因此您可以为其附加任何参数
yarn export <网络>;
这会将已部署合约的abi+地址导出到
yarn fork:execute <网络>; [--blockNumber
这将针对指定网络的临时分支执行脚本
如果使用 --deploy
, ,部署脚本将被执行
yarn fork:deploy <网络>; [--blockNumber
这将针对指定网络的临时分叉部署合约。
它在后台使用 hardhat deploy
命令,因此您可以为其附加任何参数
yarn fork:test
这将针对指定网络的临时分叉测试合约。
yarn fork:dev
这将针对指定网络的分支部署合约,并将继续作为节点运行。
它在后台使用 hardhat node
命令,因此您可以为其附加任何参数
Boilerplate for ethereum solidity smart contract development
INSTALL
yarn
TEST
yarn test
SCRIPTS
Here is the list of npm scripts you can execute:
Some of them relies on ./scripts.js to allow parameterizing it via command line argument (have a look inside if you need modifications)
yarn prepare
As a standard lifecycle npm script, it is executed automatically upon install. It generate config file and typechain to get you started with type safe contract interactions
yarn lint
, yarn lint:fix
, yarn format
and yarn format:fix
These will lint and format check your code. the :fix
version will modifiy the files to match the requirement specified in .eslintrc
and .prettierrc.
yarn compile
These will compile your contracts
yarn void:deploy
This will deploy your contracts on the in-memory hardhat network and exit, leaving no trace. quick way to ensure deployments work as intended without consequences
yarn test [mocha args...]
These will execute your tests using mocha. you can pass extra arguments to mocha
yarn coverage
These will produce a coverage report in the coverage/
folder
yarn gas
These will produce a gas report for function used in the tests
yarn dev
These will run a local hardhat network on localhost:8545
and deploy your contracts on it. Plus it will watch for any changes and redeploy them.
yarn local:dev
This assumes a local node it running on localhost:8545
. It will deploy your contracts on it. Plus it will watch for any changes and redeploy them.
yarn execute <network> <file.ts> [args...]
This will execute the script <file.ts>
against the specified network
yarn deploy <network> [args...]
This will deploy the contract on the specified network.
Behind the scene it uses hardhat deploy
command so you can append any argument for it
yarn export <network> <file.json>
This will export the abi+address of deployed contract to <file.json>
yarn fork:execute <network> [--blockNumber <blockNumber>] [--deploy] <file.ts> [args...]
This will execute the script <file.ts>
against a temporary fork of the specified network
if --deploy
is used, deploy scripts will be executed
yarn fork:deploy <network> [--blockNumber <blockNumber>] [args...]
This will deploy the contract against a temporary fork of the specified network.
Behind the scene it uses hardhat deploy
command so you can append any argument for it
yarn fork:test <network> [--blockNumber <blockNumber>] [mocha args...]
This will test the contract against a temporary fork of the specified network.
yarn fork:dev <network> [--blockNumber <blockNumber>] [args...]
This will deploy the contract against a fork of the specified network and it will keep running as a node.
Behind the scene it uses hardhat node
command so you can append any argument for it