I have deployed the contract and I'm trying to get the address at each storage slot
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
log("----------------------------------------------------")
log("Deploying FunWithStorage and waiting for confirmations...")
const funWithStorage = await deploy("FunWithStorage", {
from: deployer,
args: [],
log: true,
// we need to wait if on a live network so we can verify properly
waitConfirmations: network.config.blockConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
await verify(funWithStorage.address, [])
}
log("Logging storage...")
for (let i = 0; i < 10; i++) {
log(
`Location ${i}: ${await ethers.provider.getStorageAt(
funWithStorage.address,
i
)}`
)
}
Best Answer
In Ethers V6 it's now getStorage
Check out this documentation for reference https://docs.ethers.org/v6/api/providers/#Provider-getStorage