Proxies Storage
Note: If you are new to understanding how smart contract storage slots work, review an entry level guide first, like the solidity docs.
Storing state variables is important for any smart contract, but especially so for proxies. Checking the values stored at specific storage slots in a contract is a useful way to check if the proxy is working as expected. Once the storage slot for a variable is known, a tool like seth, cast, or your favorite web3 JS/Python library (ethersJS, etc.) can pull the data at that location directly from the blockchain. These tools can help identify the storage slot of the variables found in the deployed contract.
Storage Slot Analysis for Verified Contracts
- slither-read-storage: A slither tool to retrieve storage slots for verified contracts. A blog post was published with more examples.
- sol2uml: A visualizer of storage slot usage for a verified contract
- forge inspect: Lists the storage slots for variables in a contract. If the code is verified on-chain, it can be downloaded to your local system using ethereum-sources-downloader.
- hardhat-storage-layout: A hardhat plugin to view storage slots of variables.
- solc --storage-layout: Similar to foundry, can output the storage slot and offset for each state variable.
- MetaDock Chrome Extension enhances etherscan and other blockchain scanners to show the values of private variables that normally cannot be accessed on etherscan.
Storage Slot Analysis for Unverified Contracts (and Verified Contracts)
- Contract Library: When viewing a contract, can navigate to the “Read/Write” tab and choose “Storage dump” to see all values stored in all storage slots. Doesn’t require a verified contract. The decompiler is also very helpful.
- smart-contract-storage-viewer: Useful tool from tintinweb to view what a contract has stored in specific storage slots. This tool is only useful if you already know the storage slot value locations to view or want to view a range of many sequential storage slot values.
- Etherscan: The “Switch to Opcodes View” button next to the contract creation code and review all the SLOAD operations to identify storage slots that hold (or held) values.