plutus-use-cases-1.2.0.0: Collection of smart contracts to develop the plutus/wallet interface
Safe HaskellNone
LanguageHaskell2010

Plutus.Contracts.Prism.StateMachine

Description

State machine that manages credential tokens

Synopsis

Documentation

data IDState Source #

Constructors

Active

The credential is active and can be used in transactions

Revoked

The credential has been revoked and can't be used anymore.

Instances

Instances details
Eq IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Show IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Generic IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Associated Types

type Rep IDState :: Type -> Type Source #

FromJSON IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

parseJSON :: Value -> Parser IDState

parseJSONList :: Value -> Parser [IDState]

ToJSON IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

toJSON :: IDState -> Value

toEncoding :: IDState -> Encoding

toJSONList :: [IDState] -> Value

toEncodingList :: [IDState] -> Encoding

ToData IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

toBuiltinData :: IDState -> BuiltinData

FromData IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

fromBuiltinData :: BuiltinData -> Maybe IDState

UnsafeFromData IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

unsafeFromBuiltinData :: BuiltinData -> IDState

Lift DefaultUni IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

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

Typeable DefaultUni IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

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

type Rep IDState Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

type Rep IDState = D1 ('MetaData "IDState" "Plutus.Contracts.Prism.StateMachine" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "Active" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Revoked" 'PrefixI 'False) (U1 :: Type -> Type))

data IDAction Source #

Constructors

PresentCredential

Present the credential in a transaction

RevokeCredential

Revoke the credential

Instances

Instances details
Eq IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Show IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Generic IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Associated Types

type Rep IDAction :: Type -> Type Source #

FromJSON IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

parseJSON :: Value -> Parser IDAction

parseJSONList :: Value -> Parser [IDAction]

ToJSON IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

toJSON :: IDAction -> Value

toEncoding :: IDAction -> Encoding

toJSONList :: [IDAction] -> Value

toEncodingList :: [IDAction] -> Encoding

ToData IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

toBuiltinData :: IDAction -> BuiltinData

FromData IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

fromBuiltinData :: BuiltinData -> Maybe IDAction

UnsafeFromData IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

unsafeFromBuiltinData :: BuiltinData -> IDAction

Lift DefaultUni IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

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

Typeable DefaultUni IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

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

type Rep IDAction Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

type Rep IDAction = D1 ('MetaData "IDAction" "Plutus.Contracts.Prism.StateMachine" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "PresentCredential" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RevokeCredential" 'PrefixI 'False) (U1 :: Type -> Type))

data UserCredential Source #

A Credential issued to a user (public key address)

Constructors

UserCredential 

Fields

  • ucAddress :: PaymentPubKeyHash

    Address of the credential holder

  • ucCredential :: Credential

    The credential

  • ucToken :: Value

    The Value containing a token of the credential (this needs to be included here because token is not available in on-chain code)

Instances

Instances details
Eq UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Show UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Generic UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Associated Types

type Rep UserCredential :: Type -> Type Source #

FromJSON UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

parseJSON :: Value -> Parser UserCredential

parseJSONList :: Value -> Parser [UserCredential]

ToJSON UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

toJSON :: UserCredential -> Value

toEncoding :: UserCredential -> Encoding

toJSONList :: [UserCredential] -> Value

toEncodingList :: [UserCredential] -> Encoding

Hashable UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Lift DefaultUni UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

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

Typeable DefaultUni UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

Methods

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

type Rep UserCredential Source # 
Instance details

Defined in Plutus.Contracts.Prism.StateMachine

type Rep UserCredential = D1 ('MetaData "UserCredential" "Plutus.Contracts.Prism.StateMachine" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "UserCredential" 'PrefixI 'True) (S1 ('MetaSel ('Just "ucAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKeyHash) :*: (S1 ('MetaSel ('Just "ucCredential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Credential) :*: S1 ('MetaSel ('Just "ucToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))

typedValidator :: UserCredential -> TypedValidator (StateMachine IDState IDAction) Source #

machineClient :: TypedValidator (StateMachine IDState IDAction) -> UserCredential -> StateMachineClient IDState IDAction Source #

mkMachineClient :: CredentialAuthority -> PaymentPubKeyHash -> TokenName -> StateMachineClient IDState IDAction Source #