| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Plutus.Contracts.Game
Description
A guessing game. A simplified version of GameStateMachine
not using StateMachine and using yieldUnbalancedTx for
balancing, signing and submitting transactions.
Currently, remote wallets (anything other than WBE) can only handles
yieldUnbalancedTx requests, and not balanceTx, signTx and submitTx
requests.
Synopsis
- contract :: AsContractError e => Contract () GameSchema e ()
- data GameParam = GameParam {}
- type GameSchema = Endpoint "lock" LockArgs .\/ Endpoint "guess" GuessArgs
- data LockArgs = LockArgs {}
- data GuessArgs = GuessArgs {}
- gameInstance :: GameParam -> TypedValidator Game
- mkValidator :: GameParam -> HashedString -> ClearString -> ScriptContext -> Bool
- gameAddress :: GameParam -> CardanoAddress
- covIdx :: GameParam -> CoverageIndex
Documentation
contract :: AsContractError e => Contract () GameSchema e () Source #
Datatype for creating a parameterized validator.
Constructors
| GameParam | |
Fields
| |
Instances
| Show GameParam Source # | |
| Generic GameParam Source # | |
| ToJSON GameParam Source # | |
| FromJSON GameParam Source # | |
| ToSchema GameParam Source # | |
Defined in Plutus.Contracts.Game Methods | |
| Lift DefaultUni GameParam Source # | |
Defined in Plutus.Contracts.Game Methods lift :: GameParam -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ()) Source # | |
| Typeable DefaultUni GameParam Source # | |
Defined in Plutus.Contracts.Game Methods typeRep :: Proxy GameParam -> RTCompile DefaultUni fun (Type TyName DefaultUni ()) Source # | |
| type Rep GameParam Source # | |
Defined in Plutus.Contracts.Game type Rep GameParam = D1 ('MetaData "GameParam" "Plutus.Contracts.Game" "plutus-use-cases-1.1.0.0-9kk4ZO09YVFKU77qwQaRsf" 'False) (C1 ('MetaCons "GameParam" 'PrefixI 'True) (S1 ('MetaSel ('Just "gameParamPayeePkh") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKeyHash) :*: S1 ('MetaSel ('Just "gameParamStartTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime))) | |
Arguments for the "lock" endpoint
Constructors
| LockArgs | |
Fields
| |
Instances
| Show LockArgs Source # | |
| Generic LockArgs Source # | |
| ToJSON LockArgs Source # | |
| FromJSON LockArgs Source # | |
| ToSchema LockArgs Source # | |
Defined in Plutus.Contracts.Game Methods | |
| type Rep LockArgs Source # | |
Defined in Plutus.Contracts.Game type Rep LockArgs = D1 ('MetaData "LockArgs" "Plutus.Contracts.Game" "plutus-use-cases-1.1.0.0-9kk4ZO09YVFKU77qwQaRsf" 'False) (C1 ('MetaCons "LockArgs" 'PrefixI 'True) (S1 ('MetaSel ('Just "lockArgsGameParam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 GameParam) :*: (S1 ('MetaSel ('Just "lockArgsSecret") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "lockArgsValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)))) | |
Arguments for the "guess" endpoint
Constructors
| GuessArgs | |
Fields
| |
Instances
| Show GuessArgs Source # | |
| Generic GuessArgs Source # | |
| ToJSON GuessArgs Source # | |
| FromJSON GuessArgs Source # | |
| ToSchema GuessArgs Source # | |
Defined in Plutus.Contracts.Game Methods | |
| type Rep GuessArgs Source # | |
Defined in Plutus.Contracts.Game type Rep GuessArgs = D1 ('MetaData "GuessArgs" "Plutus.Contracts.Game" "plutus-use-cases-1.1.0.0-9kk4ZO09YVFKU77qwQaRsf" 'False) (C1 ('MetaCons "GuessArgs" 'PrefixI 'True) (S1 ('MetaSel ('Just "guessArgsGameParam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 GameParam) :*: S1 ('MetaSel ('Just "guessArgsSecret") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) | |
Scripts
gameInstance :: GameParam -> TypedValidator Game Source #
mkValidator :: GameParam -> HashedString -> ClearString -> ScriptContext -> Bool Source #
The validation function (Datum -> Redeemer -> ScriptContext -> Bool)
The GameParam parameter is not used in the validation. It is meant to
parameterize the script address depending based on the value of GaramParam.
Address
gameAddress :: GameParam -> CardanoAddress Source #
The address of the game (the hash of its validator script)
covIdx :: GameParam -> CoverageIndex Source #