Solidity REPL
Contracts & calls

Function modifier

Run a function body through a reusable access-control modifier.

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 function modifier so its input, result, and state changes stay easy to compare.

Solidity to run

contract OwnedValue {
  address public owner;
  uint256 public value;
  constructor() { owner = msg.sender; }
  modifier onlyOwner() {
    require(msg.sender == owner, "not owner");
    _;
  }
  function set(uint256 next) external onlyOwner { value = next; }
}

OwnedValue owned = new OwnedValue()
owned.set(42)
owned.value()

Official Solidity reference

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

Function modifiers

What to expect

The wrapper that deployed the contract satisfies onlyOwner, and the protected setter stores 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