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

Plutus.Contracts.PingPong

Description

A state machine with two states and two roles that take turns.

Documentation

data PingPongState Source #

Constructors

Pinged 
Ponged 
Stopped 

Instances

Instances details
Eq PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Show PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Generic PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Associated Types

type Rep PingPongState :: Type -> Type Source #

FromJSON PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

parseJSON :: Value -> Parser PingPongState

parseJSONList :: Value -> Parser [PingPongState]

ToJSON PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

toJSON :: PingPongState -> Value

toEncoding :: PingPongState -> Encoding

toJSONList :: [PingPongState] -> Value

toEncodingList :: [PingPongState] -> Encoding

ToData PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

toBuiltinData :: PingPongState -> BuiltinData

FromData PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

fromBuiltinData :: BuiltinData -> Maybe PingPongState

Eq PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

UnsafeFromData PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

unsafeFromBuiltinData :: BuiltinData -> PingPongState

Lift DefaultUni PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

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

Typeable DefaultUni PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

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

type Rep PingPongState Source # 
Instance details

Defined in Plutus.Contracts.PingPong

type Rep PingPongState = D1 ('MetaData "PingPongState" "Plutus.Contracts.PingPong" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "Pinged" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Ponged" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stopped" 'PrefixI 'False) (U1 :: Type -> Type)))

data Input Source #

Constructors

Ping 
Pong 
Stop 

Instances

Instances details
Show Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Generic Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Associated Types

type Rep Input :: Type -> Type Source #

Methods

from :: Input -> Rep Input x Source #

to :: Rep Input x -> Input Source #

FromJSON Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

parseJSON :: Value -> Parser Input

parseJSONList :: Value -> Parser [Input]

ToJSON Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

toJSON :: Input -> Value

toEncoding :: Input -> Encoding

toJSONList :: [Input] -> Value

toEncodingList :: [Input] -> Encoding

ToData Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

toBuiltinData :: Input -> BuiltinData

FromData Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

fromBuiltinData :: BuiltinData -> Maybe Input

UnsafeFromData Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

unsafeFromBuiltinData :: BuiltinData -> Input

Lift DefaultUni Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

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

Typeable DefaultUni Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

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

type Rep Input Source # 
Instance details

Defined in Plutus.Contracts.PingPong

type Rep Input = D1 ('MetaData "Input" "Plutus.Contracts.PingPong" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "Ping" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Pong" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stop" 'PrefixI 'False) (U1 :: Type -> Type)))

data PingPongError Source #

Constructors

PingPongContractError ContractError 
PingPongSMError SMContractError 
StoppedUnexpectedly 

Instances

Instances details
Show PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Generic PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Associated Types

type Rep PingPongError :: Type -> Type Source #

FromJSON PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

parseJSON :: Value -> Parser PingPongError

parseJSONList :: Value -> Parser [PingPongError]

ToJSON PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

toJSON :: PingPongError -> Value

toEncoding :: PingPongError -> Encoding

toJSONList :: [PingPongError] -> Value

toEncodingList :: [PingPongError] -> Encoding

AsContractError PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

_ContractError :: Prism' PingPongError ContractError

_WalletContractError :: Prism' PingPongError WalletAPIError

_ChainIndexContractError :: Prism' PingPongError (Text, ChainIndexResponse)

_ConstraintResolutionContractError :: Prism' PingPongError MkTxError

_ToCardanoConvertContractError :: Prism' PingPongError ToCardanoError

_ResumableContractError :: Prism' PingPongError MatchingError

_CCheckpointContractError :: Prism' PingPongError CheckpointError

_EndpointDecodeContractError :: Prism' PingPongError (EndpointDescription, EndpointValue Value, Text)

_OtherContractError :: Prism' PingPongError Text

AsSMContractError PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

Methods

_SMContractError :: Prism' PingPongError SMContractError

_ChooserError :: Prism' PingPongError Text

_UnableToExtractTransition :: Prism' PingPongError ()

_SMCContractError :: Prism' PingPongError ContractError

type Rep PingPongError Source # 
Instance details

Defined in Plutus.Contracts.PingPong

type Rep PingPongError = D1 ('MetaData "PingPongError" "Plutus.Contracts.PingPong" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "PingPongContractError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractError)) :+: (C1 ('MetaCons "PingPongSMError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SMContractError)) :+: C1 ('MetaCons "StoppedUnexpectedly" 'PrefixI 'False) (U1 :: Type -> Type)))

type PingPongSchema = (((Endpoint "initialise" () .\/ Endpoint "ping" ()) .\/ Endpoint "pong" ()) .\/ Endpoint "stop" ()) .\/ Endpoint "wait" () Source #

runPing :: forall w. Contract w PingPongSchema PingPongError () Source #

runPong :: forall w. Contract w PingPongSchema PingPongError () Source #

ping :: forall w. Promise w PingPongSchema PingPongError () Source #

pong :: forall w. Promise w PingPongSchema PingPongError () Source #

initialise :: forall w. Promise w PingPongSchema PingPongError () Source #

runStop :: forall w. Promise w PingPongSchema PingPongError () Source #