0.3.6 • Published 2 years ago
hardhat-deployed-records v0.3.6
Hardhat Deployed Records
Recording deployed contracts address.
1. Install
$ npm install --save-dev hardhat-deployed-records
# or
$ yarn add --dev hardhat-deployed-records2. Included Commands
npx hardhat deployed-init [--netwrok <network>]: Initializes the deployed folder,--netwrokparameter is optional, default value ishardhatfrom Hardhat framework.npx hardhat deployed-add [--netwrok <network>]: Generating new boring code for deploying to new chain specified by--netwrokparameter.npx hardhat deployed-migrate: Migrate the deployed foldernpx hardhat deployed-list [--netwrok <network>]: Listing contracts deployed address of the chain specified by--netwrokparameter.
Commonly, you need execute npx hardhat deployed-init [--netwrok <network>] task first, and then:
- when you want to deploy contracts to a new network, you need to execute
npx hardhat deployed-add --netwrok <network>task - when you add new contracts or delete contracts you need to execute
npx hardhat deployed-migratetask to keep deployed folder is the latest.
3. Usage
Load plugin in Hardhat config:
require('hardhat-deployed-records');
# or
import 'hardhat-deployed-records';Add configuration under deployedRecords key:
| option | description | optional | default |
|---|---|---|---|
deployedDir | path to generated deployed directory (relative to Hardhat root) | true | scripts/deployed |
ignoreContracts | which contracts wants to igonre | true | [] |
example:
deployedRecords: {
deployedDir: "scripts/deployed",
ignoreContracts: ["MockERC20", "Foo"],
}4. The scripts/deployed directory's structure and how to use generated functions
when you execute npx hardhat deployed-init [--netwrok <network>] task, it will generate default scripts/deployed directory(if you not set a different deployedDir value in hardhat.config.ts config file).
following is a scripts/deployed directory example:

so, in your deploy scripts, you can use getXxxContract() function to get contract's address; and use setXxxContract(addr) function to set contract's address.
5. Version History
v0.3.6 (2023/12/08)
- fix typo
deploydtodeployed
- fix typo
v0.3.3 (2023/10/13)
- beautify
deployed-listcommand's output
- beautify
v0.3.2 (2023/10/13)
- add
deployed-listcommand
- add
v0.3.1 (2023/09/15)
- auto skip solidity
librarycontract
- auto skip solidity
v0.3.0 (2023/08/18)
- auto skip
interfacetype contract - support multiple contracts in one solidity file
- auto skip