User-defined value type
Wrap and unwrap a custom numeric Solidity type.
Solidity 0.8.36REPL mode
Why use this example
Use this pattern to explore how Solidity represents typed values and how state-changing expressions affect storage. The entry isolates user-defined value type so its input, result, and state changes stay easy to compare.
Solidity to run
type Wad is uint256
Wad value = Wad.wrap(2 ether)
Wad.unwrap(value)What to expect
Unwrapping the custom Wad value returns the underlying uint256 representation of 2 ether.
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 state and storage Reproducible investigation