ExUnits

scalus.cardano.ledger.ExUnits
See theExUnits companion object
case class ExUnits(memory: Long, steps: Long)

Represents execution units for Plutus scripts in Cardano

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def +(other: ExUnits): ExUnits
def exceeds(budget: ExUnits): Boolean

Checks that at least one component is over budget. Negation of fitsWithin.

Checks that at least one component is over budget. Negation of fitsWithin.

Attributes

def fee(prices: ExUnitPrices): Coin

Calculate fee for the execution units given explicit prices.

Calculate fee for the execution units given explicit prices.

Value parameters

prices

The execution unit prices (price per memory unit and price per CPU step)

Attributes

Returns

The calculated fee in Coin (lovelace)

def fee(using info: CardanoInfo): Coin

Calculate fee for the execution units using protocol parameters from implicit CardanoInfo.

Calculate fee for the execution units using protocol parameters from implicit CardanoInfo.

Value parameters

info

The CardanoInfo containing protocol parameters with execution unit prices

Attributes

Returns

The calculated fee in Coin (lovelace)

def fitsWithin(budget: ExUnits): Boolean

Checks that both components are within budget.

Checks that both components are within budget.

Execution units are only partially ordered: a value can be under budget on memory and over on steps at the same time. The ledger therefore compares each component independently (pointWiseExUnits (<=) in Alonzo), and so does this method. Do not use a total Ordering for budget checks.

Value parameters

budget

The maximum execution units allowed

Attributes

Returns

true if memory and steps are both less than or equal to those of budget

def showJson: String

Formats execution units as JSON string

Formats execution units as JSON string

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product