ContractStepVariations

scalus.testing.ContractStepVariations

Bundles contract step state extraction, base template building, and variations.

ContractStepVariations represents a single step in a contract interaction (e.g., "bid on auction", "claim HTLC"). It combines:

  • State extraction from blockchain UTxOs
  • Base template construction (builder + sponsor + signer)
  • Transaction variations for testing

Use with ScenarioExplorer for exhaustive testing.

Type parameters

S

the contract state type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def extractState(reader: BlockchainReader)(using ExecutionContext): Future[S]

Extract contract state from the blockchain.

Extract contract state from the blockchain.

Typically queries UTxOs at the contract address and parses datums.

Attributes

def makeBaseTx(reader: BlockchainReader, state: S)(using ExecutionContext): Future[TxTemplate]

Build the base transaction template for this step.

Build the base transaction template for this step.

The template includes the base TxBuilder (the "correct" transaction), sponsor (who pays fees), and signer. Variations will modify or replace the builder while using the same sponsor/signer.

Attributes

Transaction variations to test.

Transaction variations to test.

Variations receive the base template from makeBaseTx and produce transaction variations.

Attributes

Concrete methods

def allActions(reader: BlockchainReader, state: S)(using ExecutionContext): Future[Seq[StepAction]]

All actions (submits + waits) for this step.

All actions (submits + waits) for this step.

Combines transaction variations (as StepAction.Submit) with slot delays (as StepAction.Wait).

Attributes

def allVariations(reader: BlockchainReader, state: S)(using ExecutionContext): Future[Seq[Transaction]]

Generate all transaction variations for the given state.

Generate all transaction variations for the given state.

Convenience method that builds the template and delegates to variations.enumerate.

Attributes

def slotDelays(state: S): Seq[Long]

Slot delays to explore at this step. Default: none.

Slot delays to explore at this step. Default: none.

Override to include StepAction.Wait actions in allActions. Each delay creates a separate branch that advances the slot before the next step.

Attributes