Inspect Contract Storage Layout
evm_inspect_storage_layoutInspect the storage layout of a Solidity contract to verify proxy-upgrade safety and analyze storage packing for gas efficiency.
Instructions
Run forge inspect storage-layout and return the resolved storage slot assignment for every state variable.
Essential for proxy-upgrade safety checks (storage-layout collisions) and storage-packing gas analysis.
Args:
projectPath (string): Absolute path to the Foundry project root
contractName (string): Contract name (e.g. "Token") or fully qualified name (e.g. "src/Token.sol:Token")
Returns: JSON object: { "entries": [ { "label": string, // State variable name "slot": number, // Storage slot index "offset": number, // Byte offset within the slot "type": string, // Human-readable type (e.g. "address", "mapping(address => uint256)") "bytes": number // Size of the variable in bytes } ] }
Examples:
"Check storage layout of my proxy implementation" → contractName = "TokenV2"
"Will upgrading V1 to V2 corrupt storage?" → call once per contract, compare entries
Error Handling:
Returns isError=true if forge is not installed, the project path is invalid, or the contract is not found
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Absolute path to the Foundry project root | |
| contractName | Yes | Contract name (e.g. 'Token') or fully qualified name (e.g. 'src/Token.sol:Token') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entries | Yes |