Skip to content

Commit 6afa8d1

Browse files
committed
build: add a command to show storage layout
1 parent 13f4ac5 commit 6afa8d1

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

hardhat.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ const config: HardhatUserConfig = {
9595
enabled: true,
9696
runs: 200,
9797
},
98+
outputSelection: {
99+
'*': {
100+
'*': ['storageLayout'],
101+
},
102+
},
98103
},
99104
},
100105
],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"hardhat-abi-exporter": "^2.2.0",
6262
"hardhat-contract-sizer": "^2.0.3",
6363
"hardhat-gas-reporter": "^1.0.4",
64+
"hardhat-storage-layout": "0.1.6",
6465
"husky": "^4.3.8",
6566
"inquirer": "^8.0.0",
6667
"ipfs-http-client": "47.0.1",

tasks/contracts/functions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Wallet } from 'ethers'
22
import { task } from 'hardhat/config'
33
import { HardhatRuntimeEnvironment } from 'hardhat/types'
44
import '@nomiclabs/hardhat-ethers'
5+
import 'hardhat-storage-layout'
56

67
import { loadEnv } from '../../cli/env'
78
import { cliOpts } from '../../cli/defaults'
@@ -20,3 +21,7 @@ task('contracts:functions', 'Print function hashes for contracts')
2021
}
2122
}
2223
})
24+
25+
task('contracts:layout', 'Display storage layout').setAction(async (_, hre) => {
26+
await hre.storageLayout.export()
27+
})

yarn.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,6 +3100,13 @@ concat-stream@^1.5.1, concat-stream@^1.6.0, concat-stream@^1.6.2:
31003100
readable-stream "^2.2.2"
31013101
typedarray "^0.0.6"
31023102

3103+
console-table-printer@^2.9.0:
3104+
version "2.9.0"
3105+
resolved "https://registry.yarnpkg.com/console-table-printer/-/console-table-printer-2.9.0.tgz#5d75374bc94ae57048587604829cb914b282a088"
3106+
integrity sha512-20o73riqnclLYJt5ggNqP2ZjtgL5OxJPWzTVi3LyVFVtubMH0XN+oOn9outL1XI5ldJgPcjdMAWc92vRscHAKA==
3107+
dependencies:
3108+
simple-wcswidth "^1.0.1"
3109+
31033110
31043111
version "0.5.3"
31053112
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
@@ -5594,6 +5601,13 @@ hardhat-gas-reporter@^1.0.4:
55945601
eth-gas-reporter "^0.2.20"
55955602
sha1 "^1.1.1"
55965603

5604+
5605+
version "0.1.6"
5606+
resolved "https://registry.yarnpkg.com/hardhat-storage-layout/-/hardhat-storage-layout-0.1.6.tgz#b6ae33d4c00f385dbc1ff67c86d67b0198cfbd91"
5607+
integrity sha512-urp9PUDJmRrFaTnMkyYGAlU0OF7Q+inWMWKHvuGRyvBDwVQKXfj5WoerTax4bBpXukJ4fBYyUTjAr0x+j2LcKQ==
5608+
dependencies:
5609+
console-table-printer "^2.9.0"
5610+
55975611
hardhat@^2.2.0:
55985612
version "2.3.0"
55995613
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.3.0.tgz#5c29f8b4d08155c3dc8c908af9713fd5079522d5"
@@ -10030,6 +10044,11 @@ simple-swizzle@^0.2.2:
1003010044
dependencies:
1003110045
is-arrayish "^0.3.1"
1003210046

10047+
simple-wcswidth@^1.0.1:
10048+
version "1.0.1"
10049+
resolved "https://registry.yarnpkg.com/simple-wcswidth/-/simple-wcswidth-1.0.1.tgz#8ab18ac0ae342f9d9b629604e54d2aa1ecb018b2"
10050+
integrity sha512-xMO/8eNREtaROt7tJvWJqHBDTMFN4eiQ5I4JRMuilwfnFcV5W9u7RUkueNkdw0jPqGMX36iCywelS5yilTuOxg==
10051+
1003310052
slash@^1.0.0:
1003410053
version "1.0.0"
1003510054
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"

0 commit comments

Comments
 (0)