scalus.prelude
Members list
Packages
Type members
Classlikes
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Validator, parametrized by Data. Keep
Validator, parametrized by Data. Keep
Needed for compatibility with solutions which use existing uplc scripts and apply Data as parameter on UPLC level.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
This is used to provide a string representation of values, which can be useful for debugging, logging, or displaying information about the value.
- A typeclass for converting values of type
Ato aString.
This is used to provide a string representation of values, which can be useful for debugging, logging, or displaying information about the value.
Type parameters
- A
-
the type of the value to be shown
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ShowByteString.type
Alternative to scala.collection.immutable.SortedMap in onchain code.
Alternative to scala.collection.immutable.SortedMap in onchain code.
Type parameters
- A
-
the type of keys, must be an instance of
Ord - B
-
the type of values
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait ArbitraryInstancestrait ScalaCheckPropertyCheckstrait ScalaCheckDrivenPropertyCheckstrait Configurationtrait TableDrivenPropertyCheckstrait Tablestrait Wheneverclass AnyFunSuitetrait AnyFunSuiteLiketrait Documentingtrait Alertingtrait Notifyingtrait Informingtrait TestRegistrationtrait TestSuitetrait Suitetrait Serializabletrait Assertionstrait TripleEqualstrait TripleEqualsSupportclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Types
Value members
Concrete methods
??? can be used for marking methods that remain to be implemented.
??? can be used for marking methods that remain to be implemented.
Attributes
- Throws
-
NotImplementedError
when
???is invoked.
Fails the onchain evaluation with an ERROR term and a specific error message.
Fails the onchain evaluation with an ERROR term and a specific error message.
This is used to indicate a failure in the on-chain logic with a specific error message.
Value parameters
- message
-
The error message to include in the failure.
Attributes
- Throws
-
OnchainError
when invoked off-chain.
Fails the onchain evaluation with an ERROR term.
Fails the onchain evaluation with an ERROR term.
This is used to indicate a failure in the on-chain logic without providing a specific error message.
Attributes
- Throws
-
OnchainError
when invoked off-chain.
Fails the onchain evaluation with an ERROR term indicating an impossible situation.
Fails the onchain evaluation with an ERROR term indicating an impossible situation.
This is used to indicate an impossible situation in the on-chain logic.
Attributes
- Throws
-
ImpossibleLedgerStateError
when invoked off-chain.
Tests an expression, throwing an RequirementError if false.
Tests an expression, throwing an RequirementError if false.
Value parameters
- requirement
-
the expression to test
Attributes
- Throws
-
RequirementError
when invoked off-chain.
- Note
-
we do not use scala.Predef.require because it's not an
inlinemethod and it's not expanded before Scalus compiler plugin phase. - Example
-
require(value > 1000, "Not enough")
Tests an expression, throwing a RequirementError if false.
Tests an expression, throwing a RequirementError if false.
This is used to enforce preconditions in on-chain logic.
Value parameters
- requirement
-
The boolean expression to test.
Attributes
- Throws
-
RequirementError
when invoked off-chain.
- Example
-
require(value > 1000)
Extensions
Extensions
Converts a scala.Seq to a List.
Converts a scala.Seq to a List.
This method is only available offchain.
Attributes
- Returns
-
A
List[A]containing all the elements from this sequence in the same order. - Example
-
scala.Seq.empty[BigInt].asScalus === List.empty[BigInt] val seq: scala.Seq[BigInt] = scala.Seq(BigInt(1), BigInt(2), BigInt(3)) seq.asScalus === Cons(BigInt(1), Cons(BigInt(2), Cons(BigInt(3), Nil)))
Calculate the absolute value of the integer.
Calculate the absolute value of the integer.
Value parameters
- other
-
The other number to compute ABS with.
Attributes
- See also
Restrict the value of this integer between two bounds
Restrict the value of this integer between two bounds
Value parameters
- max
-
highest allowed value.
- min
-
lowest allowed value.
Attributes
- See also
Calculates the power of 2 for this exponent.
The greatest common factor aka divisor of this and another integer.
The greatest common factor aka divisor of this and another integer.
Value parameters
- other
-
The other integer to compute GCD with.
Attributes
- See also
Checks if this integer has a given integer square root x.
Checks if this integer has a given integer square root x.
Value parameters
- x
-
square root to check.
Attributes
- See also
The integer logarithm in base 2.
Computes the logarithm in a given base using integer divisions.
Computes the logarithm in a given base using integer divisions.
Value parameters
- base
-
Base of logarithm.
Attributes
- See also
Returns the larger of this and another integer.
Returns the larger of this and another integer.
Value parameters
- other
-
The other number to compute MAX with.
Attributes
- See also
-
scalus.prelude.Math.maximum
Returns the smaller of this and another integer.
Returns the smaller of this and another integer.
Value parameters
- other
-
The other number to compute MIN with.
Attributes
- See also
Raises this integer to a power using the exponentiation by squaring method.
Raises this integer to a power using the exponentiation by squaring method.
Value parameters
- exp
-
The exponent of power to raise.
Attributes
- See also
Calculates the square root of this integer using the babylonian method.
Calculates the square root of this integer using the babylonian method.
Attributes
- See also
Deprecated extensions
Trace the expression only if it evaluates to false. This is useful to trace an entire evaluation path that led to a final expression being false.
Trace the expression only if it evaluates to false. This is useful to trace an entire evaluation path that led to a final expression being false.
Attributes
- Returns
-
the value of the expression
- Example
-
mustBeAfter.? && mustSpendToken.?will trace "mustSpendToken ? False" if
mustBeAfteristrueandmustSpendTokenisfalse.
Attributes
- Deprecated
-
[Since version 0.13.0]Use prelude.require() instead