plutus-contract-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

Plutus.Contract.StateMachine.ThreadToken

Description

Thread token data type definition and minting policy. Thread tokens are used to identify the contract instance on the blockchain, and ensuring that the state was produced by running the state machine from its initial state.

Synopsis

Documentation

data ThreadToken Source #

Constructors

ThreadToken 

Fields

Instances

Instances details
Eq ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Ord ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Show ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Generic ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Associated Types

type Rep ThreadToken :: Type -> Type Source #

FromJSON ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

parseJSON :: Value -> Parser ThreadToken

parseJSONList :: Value -> Parser [ThreadToken]

ToJSON ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

toJSON :: ThreadToken -> Value

toEncoding :: ThreadToken -> Encoding

toJSONList :: [ThreadToken] -> Value

toEncodingList :: [ThreadToken] -> Encoding

FromData ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

fromBuiltinData :: BuiltinData -> Maybe ThreadToken

ToData ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

toBuiltinData :: ThreadToken -> BuiltinData

UnsafeFromData ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

unsafeFromBuiltinData :: BuiltinData -> ThreadToken

Lift DefaultUni ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

lift :: ThreadToken -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ())

Typeable DefaultUni ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

Methods

typeRep :: Proxy ThreadToken -> RTCompile DefaultUni fun (Type TyName DefaultUni ())

type Rep ThreadToken Source # 
Instance details

Defined in Plutus.Contract.StateMachine.ThreadToken

type Rep ThreadToken = D1 ('MetaData "ThreadToken" "Plutus.Contract.StateMachine.ThreadToken" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "ThreadToken" 'PrefixI 'True) (S1 ('MetaSel ('Just "ttOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOutRef) :*: S1 ('MetaSel ('Just "ttCurrencySymbol") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CurrencySymbol)))

checkPolicy :: TxOutRef -> (ValidatorHash, MintingPolarity) -> ScriptContext -> Bool Source #

curPolicy :: TxOutRef -> MintingPolicy Source #

threadTokenValue :: CurrencySymbol -> ValidatorHash -> Value Source #

The Value containing exactly the thread token.

checkThreadTokenInner Source #

Arguments

:: CurrencySymbol

The currency symbol of the thread token.

-> ValidatorHash

The hash of the (state machine) validator script using this thread token. This is used as the TokenName of the thread token.

-> Value

The value to check.

-> Integer

The expected number of thread tokens in the given value, n.

-> Bool

True if and only if exactly n thread tokens (and no other tokens) with the given CurrencySymbol are in the given Value.

Check exactly n thread tokens and no other tokens with the given CurrencySymbol are in the given Value.

checkThreadToken :: Maybe ThreadToken -> ValidatorHash -> Value -> Integer -> Bool Source #