Solidity REPL
VM helpers

Read a storage slot

Read the raw value behind a normal Solidity state variable.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern to shape local EVM state directly while keeping the setup and its visible effect in the same investigation. The entry isolates read a storage slot so its input, result, and state changes stay easy to compare.

Solidity to run

uint256 public answer
answer = 42
vm.load(address(this), bytes32(uint256(0)))

What to expect

After answer is set to 42, vm.load reads its raw 32-byte representation from storage slot 0.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about VM helpers Execution diagnosis