Inspect and compare Solidity smart contract storage layouts.
yarn add --dev hardhat-storage-layout-diff
Load plugin in Hardhat config:
require('hardhat-storage-layout-diff');
Export storage layouts:
yarn run hardhat export-storage-layout
Compare two contracts:
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:
yarn run hardhat storage-layout-check --source [PATH_TO_LAYOUT_JSON] --b [CONTRACT_B_FULLY_QUALIFIED_NAME]