NOME
Docs/Environments

Scenarios

Describe a situation once and replay it against any compatible environment.

A scenario is a versioned sequence of operations and assertions. Scenarios encode the situations you care about — an unusual ordering of transactions, a sudden change in network conditions, a permission escalation — in a form that can be replayed, shared, and checked in CI.

scenarios/liquidity-shock.yamlyaml
name: liquidity-shock
version: 3
requires:
  assets: [USDX, WETH]
  contracts: [Vault, Router]
steps:
  - call: { to: Router, fn: swap, from: user_2, args: [WETH, USDX, 400 ether] }
  - advance: { blocks: 12 }
  - network: { baseFee: 90 gwei }
  - call: { to: Vault, fn: withdraw, from: user_1, args: [250] }
  - assert:
      state: Vault.totalAssets >= 0
      event: Withdrawn(user_1, 250)
      noRevert: true

Running a scenario

terminalbash
nome scenario run liquidity-shock --env env_7f3a2c --reset

With --reset, the environment is returned to its pre-run snapshot after the scenario completes, leaving the run record for inspection. Scenarios can also be run as a matrix across multiple environments or network configurations.

Assertions

  • state — compare storage values, balances, or derived quantities.
  • event — require that a decoded event was (or was not) emitted.
  • noRevert / revert — require an operation to succeed or fail with a given error.
  • gas — bound the gas used by a step or the whole scenario.