npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hardhat-storage-vault

v1.3.0

Published

Hardhat plugin to check and lock the storage layout of contracts

Downloads

14

Readme

hardhat-storage-vault

Hardhat plugin to check and lock the storage layout of contracts.

What

This plugin will help you avoid possible errors by checking and locking your storage layout.

Installation

I recommend using npm 7 or later. If you do that, then you just need to install the plugin itself:

npm install hardhat-storage-vault

If you are using an older version of npm, you'll also need to install all the packages used by hardhat-storage-vault.

npm install hardhat-storage-vault hardhat-finder

That's also the case if you are using yarn.

yarn add hardhat-storage-vault hardhat-finder

Import hardhat-storage-vault in your Hardhat config. This will make import of hardhat-finder redundant, so you can remove it if you want:

Import the plugin in your hardhat.config.js:

require("hardhat-storage-vault");
require("hardhat-finder"); // you can remove this line

Or if you are using TypeScript, in your hardhat.config.ts:

import "hardhat-storage-vault";
import "hardhat-finder"; // you can remove this line

Tasks

This plugin adds storage-check and storage-lock tasks to Hardhat:

Usage: hardhat [GLOBAL OPTIONS] storage-lock [--overwrite] [--prettify] [--store-file <STRING>] [...excludeContracts]
$ hardhat storage-lock --prettify --overwrite

Success in plugin hardhat-storage-vault:
Created storage-store-lock.json file.


Usage: hardhat [GLOBAL OPTIONS] storage-check [--store-file <INPUTFILE>]
$ hardhat storage-check --store-file custom-storage-store-lock.json

Error in plugin hardhat-storage-vault:
Invalid slot value!
  Contract path: contracts/Example.sol
  Contract name: Example
    Slot name: foo
    Slot (Expected): 1
    Slot (Actual): 0

Configuration

This plugin extends the HardhatUserConfig's StorageVaultConfig object with the storageVault field.

This is an example of how to set it:

module.exports = {
  storageVault: {
    check: {
      storeFile: "storage-store-lock.json",
    },
    lock: {
      excludeContracts: [
        "^contracts-exposed/", // exclude by directory
        "^contracts/Example.sol", // exclude by file
        "Example$", // exclude by contract name
        "^contracts/Example.sol:Example$", // exclude by fully qualified name
        "Example.+\\.sol", // regex search (exclude ExampleTwo.sol, ExampleThree.sol but not Example.sol)
        "Example.*\\.sol", // regex search (exclude Example.sol, ExampleTwo.sol, ExampleThree.sol)
      ],
      storeFile: "storage-store-lock.json",
      prettify: false,
      overwrite: false,
    },
  },
};

| Task | Option | Type | Default | Description | | ----- | ---------------- | ---------- | ----------------------- | ---------------------------------------------------------------- | | Check | storeFile | String | storage-store-lock.json | Use a specific JSON file as a storage store. | | Vault | excludeContracts | String[] | [] | Regex string to ignore contracts. | | Vault | storeFile | String | storage-store-lock.json | Create or update a specific JSON file to save the storage store. | | Vault | prettify | Boolean | false | Save the file by formatting. | | Vault | overwrite | Boolean | false | Overwrite if there is a store file with the same name. |