CompiledPlutus

scalus.uplc.CompiledPlutus
sealed abstract class CompiledPlutus[A](val lazyCode: () => A, val sir: SIR, val options: Options, val optimizer: Optimizer)

Base implementation for compiled Plutus scripts of all versions.

This sealed abstract class provides the common implementation for compiling Scala code to Plutus scripts across all Plutus language versions (V1, V2, V3). Subclasses implement version-specific details such as program version numbers, script hash prefixes, and optimizer selection.

Type parameters

A

the Scala type of the compiled code

Value parameters

lazyCode

a thunk that evaluates to the original Scala code

optimizer

the UPLC optimizer to apply (version-specific)

options

compiler options controlling lowering and optimization

sir

the Scalus Intermediate Representation

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class PlutusV1[A]
class PlutusV2[A]
class PlutusV3[A]

Members list

Value members

Abstract methods

The Plutus language version (V1, V2, V3, etc.).

The Plutus language version (V1, V2, V3, etc.).

Attributes

protected def makeProgram(term: Term): Program

Creates the program with the appropriate version.

Creates the program with the appropriate version.

Attributes

protected def makeScript(program: Program): PlutusScript

Creates the script with the appropriate version.

Creates the script with the appropriate version.

Attributes

Returns a copy of this compiled script with error traces enabled.

Returns a copy of this compiled script with error traces enabled.

Error traces provide detailed error messages during script evaluation, useful for debugging. This increases script size and execution cost.

Attributes

Returns

a new CompiledPlutus with generateErrorTraces = true

Concrete methods

def address(network: Network): Address

Derives a Cardano address for this script on the specified network.

Derives a Cardano address for this script on the specified network.

Value parameters

network

the Cardano network (Mainnet or Testnet)

Attributes

Returns

the script address

def code: A

Evaluates and returns the original Scala code.

Evaluates and returns the original Scala code.

Attributes

protected def toUplc: Term

Lowers the SIR to UPLC using the configured backend and applies optimization if enabled.

Lowers the SIR to UPLC using the configured backend and applies optimization if enabled.

Attributes

Concrete fields

val lazyCode: () => A
lazy val program: Program

The compiled UPLC program. Lazily computed on first access.

The compiled UPLC program. Lazily computed on first access.

Attributes

lazy val script: PlutusScript

The Plutus script in its serialized form. Lazily computed on first access.

The Plutus script in its serialized form. Lazily computed on first access.

Attributes

val sir: SIR