Registry / devops / hardhat-storage-layout

hardhat-storage-layout

JSON →
library0.1.7jsnpmunverified

A Hardhat plugin (v0.1.7) that exports the Solidity contract storage layout as a table or programmatic export. It requires Hardhat ^2.0.3 and Solc >=0.5.13. Key differentiator: automates storage slot inspection for upgradeable contracts, avoiding manual errors when updating storage variables. The plugin integrates as a Hardhat task ('check') and provides a JavaScript API for pre-deployment export.

npm install hardhat-storage-layout
INSTALL
IMPORT
SIG · HARDHAT-STORAGE-LA
H
hardhat-storage-layout
devopsjavascriptv0.1.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

hre.storageLayout
const hre = require('hardhat'); await hre.storageLayout.export();
const { storageLayout } = require('hardhat');
storageLayout is not a top-level export; it's a property on the Hardhat Runtime Environment (hre).
hardhat-storage-layout plugin
require('hardhat-storage-layout'); // in hardhat.config.js
import 'hardhat-storage-layout'; // The plugin is loaded as a CommonJS require, not ESM import.
Hardhat plugins are loaded by side-effect; the require statement must appear in the config file before any tasks.
storage-layout task
npx hardhat check
yarn hardhat storage-layout
The plugin registers the 'check' task (not 'storage-layout'). Use 'yarn hardhat check' to print table.

Shows how to require the plugin in Hardhat config and use the check task or programmatic export API.

// hardhat.config.js require('hardhat-storage-layout'); module.exports = { solidity: '0.8.20' }; // Run in terminal: // npx hardhat check // Or programmatically: const hre = require('hardhat'); async function main() { await hre.storageLayout.export(); } main().catch(console.error);
Debug
Known issues
breakingHardhat v2 only. If using Hardhat v1, this plugin will not work.
fix
Upgrade to Hardhat v2 or later.
affects: >=0.1.0
gotchaThe plugin does not support Solc versions <0.5.13. Attempting to compile older Solidity will produce no output.
fix
Ensure your Solidity compiler version is >=0.5.13.
affects: >=0.1.0
gotchaThe plugin must be required in hardhat.config.js BEFORE any task calls that use it. Import order matters.
fix
Put 'require("hardhat-storage-layout");' at the top of your config.
affects: >=0.1.0
deprecatedThe export() method is currently undocumented for options. Future versions may change the API.
fix
Watch GitHub repo for updates.
affects: >=0.1.7
Errors
Common errors & fixes
Error: cannot find module 'hardhat-storage-layout'
Package not installed or not in node_modules.
fix
Run 'yarn add --dev hardhat-storage-layout' or 'npm install --save-dev hardhat-storage-layout'.
TypeError: hre.storageLayout is undefined
The plugin was not required in hardhat.config.js or it was imported after compilation.
fix
Add 'require("hardhat-storage-layout");' at the top of your hardhat.config.js.
Error: The hardhat-storage-layout plugin requires Hardhat version ^2.0.3
Installed Hardhat version is too old (<2).
fix
Upgrade Hardhat: yarn add --dev hardhat@^2.0.3
Upgrade
Version history
0.1.7latest on npm
Audit
Dependencies
hardhatrequiredpeer dependency - plugin requires Hardhat runtime
Agent activity
8 hits · last 30 days
node
8
Resources
hardhat-storage-layout — npm install hardhat-storage-layout · libregistry