3

So in week 3 of the Plutus Pioneers program, the Plutus build changed which meant code in weeks 1 and 2 would no longer work. From what I can find, no one has published an updated set of code for weeks 1 and 2 that work with the latest build. I had a go myself and made some progress but I'm stumped by these two errors:

Compilation Error, Line 169, Column 13 (jump)
 error:
    Not in scope: data constructor ‘PayToPubKey’
    |
169 |             PayToPubKey   -> traceError "wrong output type"
    |             ^^^^^^^^^^^
Compilation Error, Line 170, Column 13 (jump)
 error:
    Not in scope: data constructor ‘PayToScript’

Any suggestions on how to fix?

1 Answer 1

1

The updated code for this looks like this:

ownOutput   :: TxOut
outputDatum :: AuctionDatum
(ownOutput, outputDatum) = case getContinuingOutputs ctx of
    [o] -> case txOutDatumHash o of
        Nothing   -> traceError "wrong output type"
        Just h -> case findDatum h info of
            Nothing        -> traceError "datum not found"
            Just (Datum d) ->  case PlutusTx.fromData d of
                Just ad' -> (o, ad')
                Nothing  -> traceError "error decoding data"
    _   -> traceError "expected exactly one continuing output"

The TxOutInfo type has now been replaced with TxOut which combines the data for a public key address and a script address. A public key address will not have a Datum, hence the Maybe.

data TxOut = TxOut {
  txOutAddress   :: Address,
  txOutValue     :: Value,
  txOutDatumHash :: Maybe DatumHash
}

The updated code for week 1 is now available in iteration 2 of the program, currently in the main branch of the Plutus Pioneer Program repo.

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.