PlutusV3

scalus.uplc.PlutusV3
See thePlutusV3 companion object
final case class PlutusV3[A] extends CompiledPlutus[A]

A compiled Plutus V3 script.

This is the primary type for working with compiled Cardano smart contracts in Scalus. It holds the intermediate representation (SIR), compilation options, and lazily computes the final UPLC program and script.

Plutus V3 was introduced in the Conway hard fork. It adds BLS12-381 elliptic curve operations, bitwise primitives, and more efficient case/constr optimization.

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 = PlutusV3.compile((datum: Data) => ...)
 val scriptHash = validator.script.scriptHash
 val address = validator.address(Network.Testnet)
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: PlutusV3[B]
Extension method from PlutusV3

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

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

The argument is converted to a UPLC constant and applied to the SIR representation, resulting in a specialized script with the parameter baked in.

Value parameters

arg

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

Attributes

Returns

a new PlutusV3 with the argument applied

Returns scalus.cardano.ledger.Language.PlutusV3.

Returns scalus.cardano.ledger.Language.PlutusV3.

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 PlutusV3 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: PlutusV3

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

The serialized Plutus V3 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