Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ repository cardano-haskell-packages
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

index-state: 2024-10-09T22:38:57Z

source-repository-package
type: git
--sha256: sha256-lU2JF9KYvzEPfVLHdLkrM1hTTuc9NYi2hQPFnLDm2d8=
location: https://github.com/Plutonomicon/plutarch-plutus.git
tag: v1.10.1
location: https://github.com/Plutonomicon/plutarch-plutus
tag: 0850d1c353f907e45da155215dbdd3123fa6e614
--sha256: 17wxdfavjzbq0cgwr7bs45ma1lzxab417jqnbnkzas2zpp6i1ig5
subdir:
.
plutarch-ledger-api
plutarch-orphanage
plutarch-testlib

index-state: 2025-09-22T06:47:49Z

write-ghc-environment-files: never

tests: true
Expand All @@ -35,7 +35,7 @@ test-show-details: direct

constraints:
, dependent-sum >= 0.7.1.0
, plutus-core ^>= 1.36.0.0
, plutus-core == 1.54.0.0

package nothunks
flags: +vector
3 changes: 2 additions & 1 deletion example/common/Example/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module Example.Type (MyParameter (..)) where

import GHC.Generics (Generic)

import PlutusLedgerApi.Data.V3 (TokenName, TxOutRef)
-- FIXME: import PlutusLedgerApi.Data.V3 (TokenName, TxOutRef)
import PlutusLedgerApi.V3 (TokenName, TxOutRef)
import PlutusTx.Blueprint (HasBlueprintDefinition, definitionRef)
import PlutusTx.Blueprint.TH (makeIsDataSchemaIndexed)
import Ply (PlyArg)
Expand Down
8 changes: 4 additions & 4 deletions example/compiler-app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import qualified Data.Text as Txt
import System.FilePath ((</>))

import qualified Cardano.Binary as CBOR
import Plutarch.Internal.Term (ClosedTerm, Config (Tracing), LogLevel (LogInfo), TracingMode (DoTracing), compile)
import Plutarch.Internal.Term (Config (Tracing), LogLevel (LogInfo), S, Term, TracingMode (DoTracing), compile)
import Plutarch.LedgerApi.V3 (scriptHash)
import Plutarch.Script (serialiseScript)
import PlutusLedgerApi.V3 (ScriptHash (ScriptHash))
Expand Down Expand Up @@ -78,13 +78,13 @@ main =
-- NOTE: Plutarch's scriptHash function is exported from V3 but hashes with V2 prefix. This is a bug.
ScriptHash hash = scriptHash script

versionOf :: forall ptype. ReifyVersion (VersionOf ptype) => ClosedTerm ptype -> PlutusVersion
versionOf :: forall ptype. (ReifyVersion (VersionOf ptype)) => (forall (s :: S). Term s ptype) -> PlutusVersion
versionOf _ = reifyVersion $ Proxy @(VersionOf ptype)

-- Note: We have to manually prepend datum/redeemer to the types because it does not exist on the Plutarch type.
scriptDefinitions :: forall redeemer ptype. HasDefinitions (redeemer : ParamsOf ptype) => ClosedTerm ptype -> Definitions (ReferencedTypesOf (redeemer : ParamsOf ptype))
scriptDefinitions :: forall redeemer ptype. (HasDefinitions (redeemer : ParamsOf ptype)) => (forall (s :: S). Term s ptype) -> Definitions (ReferencedTypesOf (redeemer : ParamsOf ptype))
scriptDefinitions _ = derivePDefinitions @(redeemer : ParamsOf ptype)

-- Note: When using 'mkParamSchemas', the second type argument should only contain the params (i.e from 'ParamsOf'), not the datum/redeemer.
scriptParamSchemas :: forall redeemer ptype. HasDefinitions (redeemer : ParamsOf ptype) => ClosedTerm ptype -> [Schema (ReferencedTypesOf (redeemer : ParamsOf ptype))]
scriptParamSchemas :: forall redeemer ptype. (HasDefinitions (redeemer : ParamsOf ptype)) => (forall (s :: S). Term s ptype) -> [Schema (ReferencedTypesOf (redeemer : ParamsOf ptype))]
scriptParamSchemas _ = mkParamSchemas @(ReferencedTypesOf (redeemer : ParamsOf ptype)) @(ParamsOf ptype)
2 changes: 1 addition & 1 deletion example/reader-app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ main = do
nftMp
#! MyParameter
{ myParameter'ref = TxOutRef {txOutRefId = "2be7c999fda3c9d4c3540bc9f4f28b78f8aacf9662b4489d8000bcdc18131268", txOutRefIdx = 0}
, myParameter'tn = "A"
, myParameter'tn = TokenName "A"
}

print policy
Expand Down
15 changes: 9 additions & 6 deletions example/src/Example/NftM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import qualified Generics.SOP as SOP
import Plutarch.LedgerApi.V3
import qualified Plutarch.LedgerApi.Value as PValue
import Plutarch.Prelude
import Plutarch.Repr.Data (DeriveAsDataStruct (DeriveAsDataStruct))
import Ply.Plutarch (PlyArgOf)

import Example.Type (MyParameter)
Expand All @@ -31,18 +30,22 @@ deriving via
type instance PlyArgOf PMyParameter = MyParameter

-- | An example minting policy.
nftMp :: ClosedTerm (PMyParameter :--> PScriptContext :--> POpaque)
nftMp :: forall (s :: S). Term s (PMyParameter :--> PScriptContext :--> POpaque)
nftMp = plam $ \param' ctx' -> popaque $
unTermCont $ do
ctx <- pmatchC ctx'
param <- pmatchC param'
PMintingScript ownSym <- tcont $ pmatch $ pscriptContext'scriptInfo ctx
txInfo <- pmatchC $ pscriptContext'txInfo ctx
pguardC "UTxO not consumed" $
pany
pguardC "UTxO not consumed"
$ pany
# plam (\x -> pmatch (pfromData x) $ \case x' -> ptxInInfo'outRef x' #== pmyParameter'ref param)
#$ pfromData
$ ptxInfo'inputs txInfo
$ ptxInfo'inputs txInfo
pguardC "Wrong NFT mint amount" $
PValue.pvalueOf # pfromData (ptxInfo'mint txInfo) # pfromData ownSym # pfromData (pmyParameter'tn param) #== 1
PValue.pvalueOf
# pto (pfromData (ptxInfo'mint txInfo))
# pfromData ownSym
# pfromData (pmyParameter'tn param)
#== 1
pure . popaque $ pconstant @PUnit ()
Loading