Custom storage layout base
Move a contract’s first storage slot to a chosen base position.
Solidity 0.8.29REPL mode
Why use this example
Use this pattern to test contract composition, external calls, events, and return values inside one reproducible run. The entry isolates custom storage layout base so its input, result, and state changes stay easy to compare.
Solidity to run
contract Positioned layout at 42 {
uint256 public value;
function set(uint256 next) external { value = next; }
}
Positioned positioned = new Positioned()
positioned.set(7)
positioned.value()
vm.load(address(positioned), bytes32(uint256(42)))Official Solidity reference
Compare this focused investigation with the complete language definition in the Solidity documentation.
Custom storage layoutWhat to expect
The getter returns 7 and vm.load confirms that the same value occupies the custom base slot 42.
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 calls and logs Reproducible investigation