plutus-ledger-api-1.0.0.1: Interface to the Plutus ledger for the Cardano ledger.
Safe Haskell None
Language Haskell2010

Plutus.V1.Ledger.Scripts

Description

Functions for working with scripts on the ledger.

Synopsis

Scripts

newtype Script Source #

A script on the chain. This is an opaque type as far as the chain is concerned.

Instances

Instances details
Eq Script Source #

Note [Using Flat inside CBOR instance of Script] `plutus-ledger` uses CBOR for data serialisation and `plutus-core` uses Flat. The choice to use Flat was made to have a more efficient (most wins are in uncompressed size) data serialisation format and use less space on-chain.

To make `plutus-ledger` work with scripts serialised with Flat, and keep the CBOR format otherwise we have defined a Serialise instance for Script, which is a wrapper over Programs serialised with Flat. The instance will see programs as an opaque ByteString, which is the result of encoding programs using Flat.

Because Flat is not self-describing and it gets used in the encoding of Programs, data structures that include scripts (for example, transactions) no-longer benefit for CBOR's ability to self-describe it's format.

Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord Script Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show Script Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic Script Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData Script Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Serialise Script Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Script Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Script = D1 (' MetaData "Script" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "Script" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unScript") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Program DeBruijn DefaultUni DefaultFun ()))))

scriptSize :: Script -> Integer Source #

The size of a Script . No particular interpretation is given to this, other than that it is proportional to the serialized size of the script.

fromCompiledCode :: CompiledCode a -> Script Source #

Turn a CompiledCode (usually produced by compile ) into a Script for use with this package.

data ScriptError Source #

Constructors

EvaluationError [ Text ] String

Expected behavior of the engine (e.g. user-provided error)

EvaluationException String String

Unexpected behavior of the engine (a bug)

Instances

Instances details
Eq ScriptError Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show ScriptError Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic ScriptError Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData ScriptError Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep ScriptError Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

evaluateScript :: forall m. MonadError ScriptError m => Script -> m ( ExBudget , [ Text ]) Source #

Evaluate a script, returning the trace log.

Script wrappers

newtype Validator Source #

Validator is a wrapper around Script s which are used as validators in transaction outputs.

Instances

Instances details
Eq Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Serialise Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Validator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Validator = D1 (' MetaData "Validator" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "Validator" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getValidator") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Script )))

newtype Redeemer Source #

Redeemer is a wrapper around Data values that are used as redeemers in transaction inputs.

Instances

Instances details
Eq Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Redeemer Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Redeemer = D1 (' MetaData "Redeemer" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "Redeemer" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getRedeemer") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinData )))

newtype Datum Source #

Datum is a wrapper around Data values which are used as data in transaction outputs.

Constructors

Datum

Instances

Instances details
Eq Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Datum Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Datum = D1 (' MetaData "Datum" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "Datum" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getDatum") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinData )))

newtype MintingPolicy Source #

MintingPolicy is a wrapper around Script s which are used as validators for minting constraints.

Instances

Instances details
Eq MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Serialise MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep MintingPolicy Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep MintingPolicy = D1 (' MetaData "MintingPolicy" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "MintingPolicy" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getMintingPolicy") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Script )))

newtype StakeValidator Source #

StakeValidator is a wrapper around Script s which are used as validators for withdrawals and stake address certificates.

Instances

Instances details
Eq StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Serialise StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep StakeValidator Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep StakeValidator = D1 (' MetaData "StakeValidator" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "StakeValidator" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getStakeValidator") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Script )))

newtype Context Source #

Information about the state of the blockchain and about the transaction that is currently being validated, represented as a value in Data .

Hashes

newtype DatumHash Source #

Script runtime representation of a Digest SHA256 .

Instances

Instances details
Eq DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep DatumHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep DatumHash = D1 (' MetaData "DatumHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "DatumHash" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinByteString )))

newtype RedeemerHash Source #

Script runtime representation of a Digest SHA256 .

Instances

Instances details
Eq RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep RedeemerHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep RedeemerHash = D1 (' MetaData "RedeemerHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "RedeemerHash" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinByteString )))

newtype ScriptHash Source #

Script runtime representation of a Digest SHA256 .

Instances

Instances details
Eq ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep ScriptHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep ScriptHash = D1 (' MetaData "ScriptHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "ScriptHash" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getScriptHash") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinByteString )))

newtype ValidatorHash Source #

Script runtime representation of a Digest SHA256 .

Instances

Instances details
Eq ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep ValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep ValidatorHash = D1 (' MetaData "ValidatorHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "ValidatorHash" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinByteString )))

newtype MintingPolicyHash Source #

Script runtime representation of a Digest SHA256 .

Instances

Instances details
Eq MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep MintingPolicyHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep MintingPolicyHash = D1 (' MetaData "MintingPolicyHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "MintingPolicyHash" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinByteString )))

newtype StakeValidatorHash Source #

Script runtime representation of a Digest SHA256 .

Instances

Instances details
Eq StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

NFData StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

ToData StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

UnsafeFromData StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Eq StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Lift DefaultUni StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

Typeable DefaultUni StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep StakeValidatorHash Source #
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep StakeValidatorHash = D1 (' MetaData "StakeValidatorHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" ' True ) ( C1 (' MetaCons "StakeValidatorHash" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 BuiltinByteString )))

Example scripts