PlutusV2

scalus.uplc.PlutusV2
See thePlutusV2 companion object
final case class PlutusV2[A] extends CompiledPlutus[A]

A compiled Plutus V2 script.

Plutus V2 was introduced in the Vasil hard fork. It adds reference inputs, inline datums, reference scripts, and the SerialiseData builtin.

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 (if optimization is enabled)

options

compiler options controlling lowering and optimization

sir

the Scalus Intermediate Representation

Attributes

Example
 given scalus.compiler.Options = scalus.compiler.Options.release
 val validator = PlutusV2.compile((datum: Data, redeemer: Data, ctx: Data) => ...)
 val scriptHash = validator.script.scriptHash
Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class CompiledPlutus[A]
trait Compiled[A]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def apply: PlutusV2[B]
Extension method from PlutusV2

Applies an argument to a compiled function, producing a new compiled script.

Applies an argument to a compiled function, producing a new compiled script.

Value parameters

arg

the argument to apply, must have a Constant.LiftValue instance

Attributes

Returns

a new PlutusV2 with the argument applied

Returns scalus.cardano.ledger.Language.PlutusV2.

Returns scalus.cardano.ledger.Language.PlutusV2.

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 PlutusV2 with generateErrorTraces = true

Inherited 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

Inherited from:
Compiled
def code: A

Evaluates and returns the original Scala code.

Evaluates and returns the original Scala code.

Attributes

Inherited from:
CompiledPlutus
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
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

Inherited from:
CompiledPlutus

Concrete fields

lazy override val script: PlutusV2

The serialized Plutus V2 script. Lazily computed on first access.

The serialized Plutus V2 script. Lazily computed on first access.

Attributes

Inherited fields

lazy val program: Program

The compiled UPLC program. Lazily computed on first access.

The compiled UPLC program. Lazily computed on first access.

Attributes

Inherited from:
CompiledPlutus