0

I have the following minting script:

{-# INLINABLE verify_mint #-}
script :: () -> V2.ScriptContext  -> Bool
script () _ = (3::Integer) == 2+1

and the following off-chain code to mint a token:

trace :: Trace.EmulatorTrace ()
        trace = do 
            Extras.logInfo @Haskell.String "Starting..."
            handle <- Trace.activateContractWallet Test.w1 contract

            Trace.callEndpoint @"mint" handle ()
            Functor.void $ Trace.waitNSlots 5

        contract :: Contract () Schema Text ()
        contract = do
            Contract.logInfo @Haskell.String "Waiting..."
            Contract.selectList [ mint ] >> contract

        mint :: Promise () Schema Text ()
        mint  = Contract.endpoint @"mint" $ \() -> do
            let constraint = Constraints.mustMintCurrency (Scripts.mintingPolicyHash policy) "ABC" 1
            tx <- Contract.submitTxConstraintsWith @TScripts.Any (Constraints.plutusV2MintingPolicy policy) constraint
            Functor.void $ Contract.awaitTxConfirmed (Ledger.getCardanoTxId tx)
            Contract.logInfo @Haskell.String "Minted!"

However when I run writeToScript as follows:

let cmd = Scripts UnappliedValidators
    let config = ScriptsConfig "keystore-stats" cmd
    Haskell.print =<< writeScriptsTo config "x" trace Default.def

I get the following result:

(Sum {getSum = 0},ExBudget {exBudgetCPU = ExCPU 0, exBudgetMemory = ExMemory 0})

How can this be? Shouldn't minting require some resources?

1 Answer 1

0

It should. writeScriptsTo is buggy at the moment (not sure why, probably a placeholder has been set while we were working on it and we forgot to change it afterwards).

I'm creating a ticket to fix it.

3
  • Is there any other way to find out how much resources my script is taking in the meantime?
    – Eric
    Apr 19, 2023 at 8:55
  • I didn't try it but you can use plutus profiling directly.
    – Nicolas
    Apr 19, 2023 at 9:42
  • But how do I obtain the uplc executable? Running "cabal build" in the plutus-apps directory results in an error.
    – Eric
    Apr 19, 2023 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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