input-output-hk / plutus-pioneer-program

This repository hosts the lectures of the Plutus Pioneers Program. This program is a training course that the IOG Education Team provides to recruit and train software developers in Plutus, the native smart contract language for the Cardano ecosystem.
1.39k stars 986 forks source link

Reference to a name which is not a local, a builtin, or an external INLINABLE function #79

Closed HarmonicPool closed 1 year ago

HarmonicPool commented 2 years ago

Trying to build a very simple minting policy for an NFT I get the following error; this happens also for the code of Week05.NFT module; what can be a cause?

Program error: GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
            No unfolding
Context: Compiling expr: Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
Context: Compiling expr: Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
                           @ ()
Context: Compiling expr: Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
                           @ () PlutusTx.IsData.Instances.$fUnsafeFromData()
Context: Compiling expr: Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
                           @ ()
                           PlutusTx.IsData.Instances.$fUnsafeFromData()
                           (Week05.NFT.mkPolicy oref'_a1nzX tn'_a1nzY)
Context: Compiling expr: \ (tn'_a1nzY
                              :: Plutus.V1.Ledger.Value.TokenName) ->
                           Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
                             @ ()
                             PlutusTx.IsData.Instances.$fUnsafeFromData()
                             (Week05.NFT.mkPolicy oref'_a1nzX tn'_a1nzY)
Context: Compiling expr: \ (oref'_a1nzX :: Plutus.V1.Ledger.Tx.TxOutRef)
                           (tn'_a1nzY :: Plutus.V1.Ledger.Value.TokenName) ->
                           Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
                             @ ()
                             PlutusTx.IsData.Instances.$fUnsafeFromData()
                             (Week05.NFT.mkPolicy oref'_a1nzX tn'_a1nzY)
Context: Compiling expr at "main:Week05.NFT:(51,8)-(51,93)"compile
rober-m commented 1 year ago

Hi, @HarmonicPool! I'm sure by now you know that the problem most likely was that you were trying to compile a function that didn't have the INLINABLE pragma (either created by you or imported from somewhere else). Closing the issue. Sorry no one answered earlier.