step01.hs

Home   »   step01.hs

import           Control.Monad             (void)
import qualified Data.ByteString.Char8     as C
import           Language.Plutus.Contract
import qualified Language.PlutusTx         as PlutusTx
import           Language.PlutusTx.Prelude hiding (pure, (<$>))
import           Ledger                    (Address, Validator, ValidatorCtx, Value, scriptAddress, pubKeyHash)
import qualified Ledger.Constraints        as Constraints
import qualified Ledger.Typed.Scripts      as Scripts
import           Playground.Contract
import qualified Prelude
import           Wallet.Emulator.Wallet    (Wallet, walletPubKey)

data LockParams = LockParams
    { amount :: Value}
    deriving stock (Prelude.Eq, Prelude.Show, Generic)
    deriving anyclass (FromJSON, ToJSON, IotsType, ToSchema, ToArgument)

lock :: AsContractError e => Contract GameSchema e ()
lock = do
    LockParams amount <- endpoint @"lock" @LockParams
    logInfo @String "Amount Locked"
    logInfo amount

type GameSchema =
    BlockchainActions
        .\/ Endpoint "lock" LockParams
        .\/ Endpoint "guess" ()

endpoints :: AsContractError e => Contract GameSchema e ()
endpoints = lock 

mkSchemaDefinitions ''GameSchema

$(mkKnownCurrencies [])

Leave a Reply

Your email address will not be published. Required fields are marked *