Deploy and call a contract
Create a contract in memory and call it in the same REPL session.
Solidity 0.8.36REPL 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 deploy and call a contract so its input, result, and state changes stay easy to compare.
Solidity to run
contract MathBox {
function double(uint256 x) external pure returns (uint256) {
return x * 2;
}
}
MathBox box = new MathBox()
box.double(21)What to expect
The MathBox instance is deployed locally and double(21) returns 42 in the same run.
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