-
Notifications
You must be signed in to change notification settings - Fork 214
Uniswap Local Cluster Example Error #451
Comments
I remember having this issue and I think I traced it to the point where Although, it was possible to obtain desired |
@mikekeke Thanks for the help! Did you have something like this mind? mintContract' ::
forall w s e.
( AsCurrencyError e
) =>
[(TokenName, Integer)] ->
Contract w s e OneShotCurrency
mintContract' amounts = mapError (review _CurrencyError) $ do
txOutRef <- getUnspentOutput
-- instead of utxos <- utxosAt (pubKeyHashAddress pk Nothing)
mUtxos <- txOutFromRef txOutRef
-- get rid of Maybe
utxos <- case mUtxos of
Nothing ->
throwError $
review _OtherContractError $
"Unspent transaction not found from ref" <> T.pack (show txOutRef)
Just ux -> pure ux
-- Make a map with our ref and transaction. The rest is the same as mintContract
let utxosMap = Map.singleton txOutRef utxos
theCurrency = mkCurrency txOutRef amounts
curVali = curPolicy theCurrency
lookups =
Constraints.mintingPolicy curVali
<> Constraints.unspentOutputs utxosMap
mintTx =
Constraints.mustSpendPubKeyOutput txOutRef
<> Constraints.mustMintValue (mintedValue theCurrency)
tx <- submitTxConstraintsWith @Scripts.Any lookups mintTx
_ <- awaitTxConfirmed (getCardanoTxId tx)
pure theCurrency Unfortunately, I still receive what appears to be the same error. This is true whether I use [pab:Info:1691] [2022-05-12 03:57:05.24 UTC] Initialising contract UniswapInit with ID a4239039-d413-4181-b690-f4b07c141066
[pab:Info:1691] [2022-05-12 03:57:05.28 UTC] Activated instance a4239039-d413-4181-b690-f4b07c141066 on W2d4cc31
[pab:Info:1693] [2022-05-12 03:57:05.31 UTC] a4239039-d413-4181-b690-f4b07c141066: "*** Before mint"
[chain-index:Warning:1707] [2022-05-12 03:57:05.60 UTC] TxOut not found with: d3e4ff652ffb1bdda69bd60ca331cf2444cd49149255f1aad50564593c830bbf!0
[pab:Error:1693] [2022-05-12 03:57:05.60 UTC] a4239039-d413-4181-b690-f4b07c141066: {
"contents": "Unspent transaction not found from refTxOutRef {txOutRefId = d3e4ff652ffb1bdda69bd60ca331cf2444cd49149255f1aad50564593c830bbf, txOutRefIdx = 0}",
"tag": "OtherContractError" I have this on a fork here: https://github.com/input-output-hk/plutus-apps/compare/tbidne:alt-mint |
@tbidne |
Hello, I am attempting to test the Uniswap example via its local cluster, and I'm running into an error. Steps to reproduce:
Run the local cluster
$ export SHELLEY_TEST_DATA=plutus-pab/local-cluster/cluster-data/cardano-node-shelley/ $ cabal run plutus-pab-local-cluster
From another terminal, activate the contract.
In the cluster's console logs, observe:
Am I doing something wrong? I've confirmed it's the
Currency.mintContract
line inPlutus.Contracts.Uniswap.Trace
:This is the output from the status endpoint:
curl localhost:9080/api/contract/instance/2e4a9f5b-e258-4087-9355-15f8983c8c70/status/ | jq
Expand JSON
Thanks!
The text was updated successfully, but these errors were encountered: