0

Source

https://github.com/tomazvila/plutus_minting_test

Problem

Running smart contract with simple minting use case fails to mint.

Error

Slot 00001: *** CONTRACT STOPPED WITH ERROR: "\"WalletContractError (ValidationError (ScriptFailure (EvaluationError [] \\\"BuiltinEvaluationFailure of UnIData\\\")))\""

Setup

cardano_node@demoserver:~/coreapp_testing/new_repo$ uname -a
Linux demoserver 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
cardano_node@demoserver:~/coreapp_testing/new_repo$ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library
cardano_node@demoserver:~/coreapp_testing/new_repo$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7

How to run

cardano run trace

1 Answer 1

0

Problem was that Minting script is expecting Integer as a redeemer:

mkPolicy :: TxOutRef -> Integer -> ScriptContext -> Bool
mkPolicy utxo _ ctx = validate

And off-chain code with:

TxConstraints.mustMintValueWithRedeemer unitRedeemer val

call passes unitRedeemer. Validator tries to deconstruct unitRedeemer to Integer and throws an error.

Bonus: Constraint.mustMintValue passes unitRedeemer by default

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.