0

I changed transition function in Lecture 7 and added constraint for minting Constraints.mustMintValue:

transition ts s r = case (stateValue s, stateData s, r) of
    (v, _, SetPrice p)   | p >= 0           -> Just ( Constraints.mustBeSignedBy (tsSeller ts) <>
                                                      Constraints.mustMintValue (assetClassValue (tsToken ts) 100)
                                                    , State p v
                                                    )

When I start emulator trace monad I am getting error in log:

Slot 00007: *** CONTRACT LOG: "SMCContractError (ConstraintResolutionError (MintingPolicyNotFound aa))"

I tried also with a different currencyPolicy than "aa", the real one that I got from Lecture 5 - Free.hs but I am getting the same result.

What is the proper way to do minting from State Machine?

2
  • HI , Did you solve this issue.? I am Facing the same issue
    – Dawar Ejaz
    Commented Feb 7, 2022 at 9:09
  • Try adding a lookup specifying a minting policy. Not sure how to do it in the StateMachine context, but elsewhere I did something like: let lookups = Constraints.mintingPolicy (policy oref). Commented Apr 6, 2022 at 10:35

1 Answer 1

1

I had this exact same issue with a StateMachine. I solved it by using runStepWith instead of runStep, which allows you to also supply the minting policy.

See the haddock documentation for details on how to use runStepWith

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.