Solidity REPL
Contracts & calls

Transient storage

Set and clear transaction-scoped state with a transient variable.

Solidity 0.8.28REPL 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 transient storage so its input, result, and state changes stay easy to compare.

Solidity to run

contract TransientGuard {
  bool transient locked;
  function inspect() external returns (bool beforeValue, bool afterValue) {
    beforeValue = locked;
    locked = true;
    afterValue = locked;
    locked = false;
  }
}

TransientGuard guard = new TransientGuard()
guard.inspect()

Official Solidity reference

Compare this focused investigation with the complete language definition in the Solidity documentation.

Transient storage

What to expect

The external call reads false, sets the transient guard to true, reports both values, and clears it before returning.

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