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

Plutus.Contracts.GameStateMachine

Description

A guessing game that

  • Uses a state machine to keep track of the current secret word
  • Uses a token to keep track of who is allowed to make a guess
Synopsis

Documentation

contract :: Contract () GameStateMachineSchema GameError () Source #

Top-level contract, exposing both endpoints.

data GameParam Source #

Datatype for creating a parameterized validator.

Constructors

GameParam 

Fields

Instances

Instances details
Show GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Generic GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Associated Types

type Rep GameParam :: Type -> Type Source #

ToJSON GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

FromJSON GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

ToSchema GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Lift DefaultUni GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Typeable DefaultUni GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep GameParam Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep GameParam = D1 ('MetaData "GameParam" "Plutus.Contracts.GameStateMachine" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "GameParam" 'PrefixI 'True) (S1 ('MetaSel ('Just "gameParamPayeePkh") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKeyHash) :*: S1 ('MetaSel ('Just "gameParamStartTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime)))

mkValidator :: GameParam -> ValidatorType GameStateMachine Source #

data LockArgs Source #

Arguments for the "lock" endpoint

Constructors

LockArgs 

Fields

Instances

Instances details
Show LockArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Generic LockArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Associated Types

type Rep LockArgs :: Type -> Type Source #

ToJSON LockArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

FromJSON LockArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

ToSchema LockArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep LockArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep LockArgs = D1 ('MetaData "LockArgs" "Plutus.Contracts.GameStateMachine" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "LockArgs" 'PrefixI 'True) (S1 ('MetaSel ('Just "lockArgsGameParam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 GameParam) :*: (S1 ('MetaSel ('Just "lockArgsSecret") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SecretArgument String)) :*: S1 ('MetaSel ('Just "lockArgsValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))

data GuessArgs Source #

Arguments for the "guess" endpoint

Constructors

GuessArgs 

Fields

Instances

Instances details
Show GuessArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Generic GuessArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Associated Types

type Rep GuessArgs :: Type -> Type Source #

ToJSON GuessArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

FromJSON GuessArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

ToSchema GuessArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep GuessArgs Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep GuessArgs = D1 ('MetaData "GuessArgs" "Plutus.Contracts.GameStateMachine" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "GuessArgs" 'PrefixI 'True) ((S1 ('MetaSel ('Just "guessArgsGameParam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 GameParam) :*: S1 ('MetaSel ('Just "guessArgsOldSecret") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "guessArgsNewSecret") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SecretArgument String)) :*: S1 ('MetaSel ('Just "guessArgsValueTakenOut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))

type GameStateMachineSchema = Endpoint "lock" LockArgs .\/ Endpoint "guess" GuessArgs Source #

The schema of the contract. It consists of the two endpoints "lock" and "guess" with their respective argument types.

data GameError Source #

Instances

Instances details
Show GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Generic GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

Associated Types

type Rep GameError :: Type -> Type Source #

ToJSON GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

FromJSON GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

AsContractError GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

AsSMContractError GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep GameError Source # 
Instance details

Defined in Plutus.Contracts.GameStateMachine

type Rep GameError = D1 ('MetaData "GameError" "Plutus.Contracts.GameStateMachine" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "GameContractError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractError)) :+: C1 ('MetaCons "GameSMError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SMContractError)))