@zoroprotocol/hardhat-addresses
v1.0.2
Published
Hardhat plugin that extends the Hardhat Runtime Environment with functions to manage contract addresses
Downloads
5
Maintainers
Readme
hardhat-addresses
Hardhat plugin that extends the Hardhat Runtime Environment with functions to manage contract addresses.
Installation
npm install @zoroprotocol/hardhat-addresses hardhat
Import the plugin in your hardhat.config.js
:
require("@zoroprotocol/hardhat-addresses");
Or if you are using TypeScript, in your hardhat.config.ts
:
import "@zoroprotocol/hardhat-addresses";
Environment extensions
This plugin extends the Hardhat Runtime Environment by adding:
recordAddress(file, name, address)
to record an addressgetAddress(file, name)
to retrieve a recorded address
Configuration
This plugin extends the HardhatUserConfig
's ProjectPathsUserConfig
object with an optional
addresses
field.
This is an example of how to set it:
const config: HardhatUserConfig = {
paths: {
addresses: "deploy/addresses"
}
};
This will be the path in the root directory where addresses will be stored. If the field is not set, it will default to "addresses".
Usage
There are no additional steps you need to take for this plugin to work.
The address functions will operate on files stored in the directory specified by the paths
configuration.
The file used in the directory is specified when calling one of the address functions. This file can be formatted as a filename with no extension or as an absolute path to a file.
Examples:
getAddress("main", "project-token");
getAddress("main.json", "project-token");
getAddress("/home/enzo/zoro-addresses/main.json", "project-token");