GitXplorerGitXplorer
I

hardhat-storage-layout-diff

public
7 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
0ba2168fa3e1e4c89f0feed80b0a931016858afd

fix pre-commit-hook

IItsNickBarry committed 6 months ago
Verified
51ea136da270af22e524fd9d230eb0e493269d1a

Merge pull request #4 from ItsNickBarry/extend-config

IItsNickBarry committed 7 months ago
Unverified
9f18198b9fe27c6259e1741d7d3a2d609f876940

remove hre reference

IItsNickBarry committed 7 months ago
Unverified
2c485eb4675ced5ae9baa7c62af320427e13d5de

update readme with config information

IItsNickBarry committed 7 months ago
Unverified
246bd5460d6dd05ea68ba90f0c398e94e42cbe88

add missing config entries

IItsNickBarry committed 7 months ago
Unverified
96dd4a581b7b0cc8eb6cee9a05aac7494da9f523

define config types

IItsNickBarry committed 7 months ago

README

The README file for this repository.

Hardhat Storage Layout Diff

Inspect and compare Solidity smart contract storage layouts.

Installation

npm install --save-dev hardhat-storage-layout-diff
# or
yarn add --dev hardhat-storage-layout-diff

Usage

Load plugin in Hardhat config:

require('hardhat-storage-layout-diff');

Add configuration under the storageLayoutDiff key:

option description default
path path to HTML export directory (relative to Hardhat root) './storage_layout'
clear whether to delete old output in path on output generation false
flat whether to flatten output directory (may cause name collisions) false
only Array of String matchers used to select included contracts, defaults to all contracts if length is 0 ['^contracts/'] (dependent on Hardhat paths configuration)
except Array of String matchers used to exclude contracts []
spacing number of spaces per indentation level of formatted output 2

Export storage layouts:

npx hardhat export-storage-layout
# or
yarn run hardhat export-storage-layout

Compare two contracts:

npx hardhat storage-layout-compare --a [CONTRACT_A_FULLY_QUALIFIED_NAME] --b [CONTRACT_B_FULLY_QUALIFIED_NAME]
# or
yarn run hardhat storage-layout-compare --a [CONTRACT_A_FULLY_QUALIFIED_NAME] --b [CONTRACT_B_FULLY_QUALIFIED_NAME]

Include the optional --a-ref and/or --b-ref arguments to specify the git reference where contracts a and b are defined, respectively.

Compare a contract to an exported JSON layout:

npx hardhat storage-layout-check --source [PATH_TO_LAYOUT_JSON] --b [CONTRACT_B_FULLY_QUALIFIED_NAME]
# or
yarn run hardhat storage-layout-check --source [PATH_TO_LAYOUT_JSON] --b [CONTRACT_B_FULLY_QUALIFIED_NAME]

Development

Install dependencies via Yarn:

yarn install

Setup Husky to format code on commit:

yarn prepare