Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
This is the "Alonzo version" of the game, it uses features up to the Alonzo era.
Synopsis
- contract :: AsContractError e => Contract () GameSchema e ()
- data GameParam = GameParam {
- gameParamPayeePkh :: PaymentPubKeyHash
- gameParamStartTime :: POSIXTime
- type GameSchema = Endpoint "lock" LockArgs .\/ Endpoint "guess" GuessArgs
- data LockArgs = LockArgs {
- lockArgsGameParam :: GameParam
- lockArgsSecret :: String
- lockArgsValue :: Value
- 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.
GameParam | |
|
Instances
type GameSchema = Endpoint "lock" LockArgs .\/ Endpoint "guess" GuessArgs Source #
Arguments for the "lock"
endpoint
LockArgs | |
|
Instances
Show LockArgs Source # | |
Generic LockArgs Source # | |
FromJSON LockArgs Source # | |
Defined in Plutus.Contracts.Game.Alonzo parseJSON :: Value -> Parser LockArgs parseJSONList :: Value -> Parser [LockArgs] | |
ToJSON LockArgs Source # | |
Defined in Plutus.Contracts.Game.Alonzo toEncoding :: LockArgs -> Encoding toJSONList :: [LockArgs] -> Value toEncodingList :: [LockArgs] -> Encoding | |
type Rep LockArgs Source # | |
Defined in Plutus.Contracts.Game.Alonzo type Rep LockArgs = D1 ('MetaData "LockArgs" "Plutus.Contracts.Game.Alonzo" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" '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
GuessArgs | |
|
Instances
Show GuessArgs Source # | |
Generic GuessArgs Source # | |
FromJSON GuessArgs Source # | |
Defined in Plutus.Contracts.Game.Alonzo parseJSON :: Value -> Parser GuessArgs parseJSONList :: Value -> Parser [GuessArgs] | |
ToJSON GuessArgs Source # | |
Defined in Plutus.Contracts.Game.Alonzo toEncoding :: GuessArgs -> Encoding toJSONList :: [GuessArgs] -> Value toEncodingList :: [GuessArgs] -> Encoding | |
type Rep GuessArgs Source # | |
Defined in Plutus.Contracts.Game.Alonzo type Rep GuessArgs = D1 ('MetaData "GuessArgs" "Plutus.Contracts.Game.Alonzo" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" '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)