<p>The updated code for this looks like this:</p>
<pre><code>ownOutput   :: TxOut
outputDatum :: AuctionDatum
(ownOutput, outputDatum) = case getContinuingOutputs ctx of
    [o] -&gt; case txOutDatumHash o of
        Nothing   -&gt; traceError &quot;wrong output type&quot;
        Just h -&gt; case findDatum h info of
            Nothing        -&gt; traceError &quot;datum not found&quot;
            Just (Datum d) -&gt;  case PlutusTx.fromData d of
                Just ad' -&gt; (o, ad')
                Nothing  -&gt; traceError &quot;error decoding data&quot;
    _   -&gt; traceError &quot;expected exactly one continuing output&quot;
</code></pre>
<p>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.</p>
<pre><code>data TxOut = TxOut {
  txOutAddress   :: Address,
  txOutValue     :: Value,
  txOutDatumHash :: Maybe DatumHash
}
</code></pre>
<p>The updated code for week 1 is now available in iteration 2 of the program, currently in the <a href="https://github.com/input-output-hk/plutus-pioneer-program" rel="nofollow noreferrer">main branch of the Plutus Pioneer Program repo</a>.</p>

CC BY-SA 4.0
2021-07-09T15:59:16.833Z
2021-07-09T15:59:16.833Z
Chrismo
<p>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 <a href="https://github.com/BadrulAlom/learningplutus/blob/main/wk01/EnglishAuction.hs" rel="nofollow noreferrer">myself</a> and made some progress but I'm stumped by these two errors:</p>
<pre><code>Compilation Error, Line 169, Column 13 (jump)
 error:
    Not in scope: data constructor ‘PayToPubKey’
    |
169 |             PayToPubKey   -&gt; traceError &quot;wrong output type&quot;
    |             ^^^^^^^^^^^
Compilation Error, Line 170, Column 13 (jump)
 error:
    Not in scope: data constructor ‘PayToScript’
</code></pre>
<p>Any suggestions on how to fix?</p>

<plutus-pioneer-program>
Not in scope: data constructor ‘PayToPubKey’ - Fixing the Week 1 Pioneers Exercise
# Not in scope: data constructor ‘PayToPubKey’ - Fixing the Week 1 Pioneers Exercise

(Asked by: username_0 on 2021-05-26)

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?

**Tags:** plutus-pioneer-program

---

## 1 answers

### Answer by username_1 on 2021-07-09. Score: 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.


---

