This is part of my attempt at solving the first homework assignment of week 5 in the plutus pioneer program. The rest of the unmodified file can be found here.

{-# INLINABLE mkPolicy #-}
-- This policy should only allow minting (or burning) of tokens if the owner of the specified PubKeyHash
-- has signed the transaction and if the specified deadline has not passed.
mkPolicy :: PubKeyHash -> Slot -> ScriptContext -> Bool
mkPolicy pkh deadline ctx = traceIfFalse "Valid signature missing" signed &&
                            traceIfFalse "Deadline has passed" stillTime
    info :: TxInfo
    info = scriptContextTxInfo ctx

    signed :: Bool
    signed = txSignedBy info pkh

    stillTime :: Bool
    stillTime = to deadline `contains` txInfoValidRange info

policy :: PubKeyHash -> Slot -> Scripts.MonetaryPolicy
policy pkh deadline = mkMonetaryPolicyScript $
    $$(PlutusTx.compile [|| \pkh' deadline' -> Scripts.wrapMonetaryPolicy $ mkPolicy pkh' deadline' ||])
    PlutusTx.liftCode pkh
    PlutusTx.liftCode deadline

curSymbol :: PubKeyHash -> Slot -> CurrencySymbol
curSymbol pkh deadline = scriptCurrencySymbol $ policy pkh deadline

I tested the code by loading the file into the repl and running the test. The output confirms that this seems to be the right solution.

However, when compiling the code in the playground, I get this message:

It looks like you have not made any functions available, use `$(mkFunctions ['functionA, 'functionB])` to be able to use `functionA` and `functionB`

Since endpoints is defined, the contract is made available in the simulator and I can confirm the test manually in the simulator as well.

I am just very confused by this message. Did my code introduce an uncaptured error? I compiled some of the previous files without this message. What am I missing?


The Playground needs some boilerplate added to a module:

mkSchemaDefinitions ''NAMEOFYOURSCHEMA
mkKnownCurrencies []

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.