0

I'm stuck trying to compile my minting policy - getting the following error message:

    • Couldn't match type ‘Colony’ with ‘BuiltinData’
      Expected type: template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.Q
                       (template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.TExp
                          (PlutusTx.CompiledCode (BuiltinData -> BuiltinData -> ())))
        Actual type: th-compat-0.1.4:Language.Haskell.TH.Syntax.Compat.SpliceQ
                       (PlutusTx.CompiledCode (Colony -> UntypedMintingPolicy))
    • In the expression: PlutusTx.compile [|| wrap ||]
      In the Template Haskell splice $$(PlutusTx.compile [|| wrap ||])
      In the first argument of ‘V2.mkMintingPolicyScript’, namely
        ‘$$(PlutusTx.compile [|| wrap ||])’

I'm making of CHaP in my cabal.project file.

When I tried compiling without CHaP, I got the following:

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: cardano-streaming-1.0.0.0 (user goal)
[__1] unknown package: cardano-api (dependency of cardano-streaming)
[__1] fail (backjumping, conflict set: cardano-api, cardano-streaming)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-streaming, cardano-api

Any help would be appreciated.

1 Answer 1

0

Can you try the following?

import           Cardano.Api                          (PlutusScriptV2,
                                                       writeFileTextEnvelope)
import           Cardano.Api.Shelley                  (PlutusScript (..))
import           Codec.Serialise
import qualified Data.ByteString.Lazy                 as LBS
import qualified Data.ByteString.Short                as SBS
import           Data.Functor                         (void)
import qualified Ledger.Typed.Scripts                 as Scripts
import           Plutus.V1.Ledger.Api                 as PlutusV1
import           Plutus.V1.Ledger.Value               as PlutusV1
import qualified Plutus.V2.Ledger.Api                 as PlutusV2
import qualified Plutus.V2.Ledger.Contexts            as PlutusV2
import qualified PlutusTx
import           PlutusTx.Prelude                     as P 
import           Prelude                              (IO, print) 

PlutusTx.makeIsDataIndexed ''MyRedeemer [ ('MyRedeemer, 0)]
PlutusTx.makeLift ''MyRedeemer

{-# INLINEABLE mintingValidator #-}
mintingValidator :: MyRedeemer -> ScriptContext -> Bool
mintingValidator red ctx = True

Policy :: Scripts.MintingPolicy
Policy = PlutusV2.MintingPolicy $ PlutusV2.fromCompiledCode ($$(PlutusTx.compile [|| wrap ||]))
    where
        wrap = Scripts.mkUntypedMintingPolicy $ mintingValidator

Here the custom data type MyRedeemer is lifted, something that your custom datatype colony did not have (Couldn't match type ‘Colony’ with).‘BuiltinData’).

1
  • Thanks for the suggestion. Colony is actually lifted using unstableMakeIsData. Changing it to makeIsDataIndexed got me Couldn't match type ‘[(template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.Name, Int)] -> template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.Q [template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.Dec]’ with ‘template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.Q [template-haskell-2.16.0.0:Language.Haskell.TH.Syntax.Dec]’
    – Aoaddeola
    Dec 12, 2022 at 11:40

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.