Skip to Content
Scalus Club is now open! Join us to get an early access to new features 🎉

Builtin Functions

Cardano Plutus provides a set of built-in functions that can be used in the scripts. Scalus implements them in the Builtins  object.

Here are some examples of using built-in functions.

import scalus.builtin.* import scalus.builtin.ByteString.* import scalus.prelude.{*, given} compile { // See scalus.builtin.Builtins for what is available val data = Builtins.iData(123) val eqData = data == Builtins.iData(123) || data != Builtins.iData(123) val eq = Builtins.equalsByteString(hex"deadbeef", ByteString.empty) val byteStringEq = hex"deadbeef" == ByteString.empty || hex"deadbeef" != ByteString.empty val stringEq = "deadbeef" == "" || "deadbeef" != "" val a = BigInt(1) val sum = a + 1 - a * 3 / 4 // arithmetic operators val intEquality = a == sum || a != sum val bool = !true || (false == true) != false && true // boolean operators val equals = a === sum // comparison operators }
Last updated on