input-output-hk / plutus-pioneer-program

This repository hosts the lectures of the Plutus Pioneers Program. This program is a training course that the IOG Education Team provides to recruit and train software developers in Plutus, the native smart contract language for the Cardano ecosystem.
1.39k stars 987 forks source link

Week01 compilation errors #48

Closed juxtin closed 3 years ago

juxtin commented 3 years ago

I'm getting a number of compilation errors after pasting the contents of this file into my local playground instance. I was able to build the week01 directory locally using cabal within nix-shell, but no such luck in the playground. Any help would be much appreciated.

Compilation Error, Line 162, Column 59 (jump)
 error:
    • Couldn't match expected type ‘PlutusTx.Data’
                  with actual type ‘BuiltinData’
    • In the first argument of ‘PlutusTx.fromData’, namely ‘d’
      In the expression: PlutusTx.fromData d
      In the expression:
        case PlutusTx.fromData d of
          Just ad' -> (o, ad')
          Nothing -> traceError "error decoding data"
    |
162 |                 Just (Datum d) ->  case PlutusTx.fromData d of
    |                                                           ^
Compilation Error, Line 272, Column 25 (jump)
 error:
    • Couldn't match expected type ‘BuiltinData’
                  with actual type ‘PlutusTx.Data’
    • In the second argument of ‘($)’, namely
        ‘PlutusTx.toData $ MkBid b’
      In the expression: Redeemer $ PlutusTx.toData $ MkBid b
      In an equation for ‘r’: r = Redeemer $ PlutusTx.toData $ MkBid b
    |
272 |         r  = Redeemer $ PlutusTx.toData $ MkBid b
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation Error, Line 276, Column 47 (jump)
 error:
    • Couldn't match type ‘TxOutTx’ with ‘ChainIndexTxOut’
      Expected type: Map TxOutRef ChainIndexTxOut
        Actual type: Map TxOutRef TxOutTx
    • In the first argument of ‘Constraints.unspentOutputs’, namely
        ‘(Map.singleton oref o)’
      In the second argument of ‘(<>)’, namely
        ‘Constraints.unspentOutputs (Map.singleton oref o)’
      In the second argument of ‘(<>)’, namely
        ‘otherScript auctionValidator
           <> Constraints.unspentOutputs (Map.singleton oref o)’
    |
276 |                   Constraints.unspentOutputs (Map.singleton oref o)
    |                                               ^^^^^^^^^^^^^^^^^^^^
Compilation Error, Line 299, Column 29 (jump)
 error:
    • Couldn't match expected type ‘BuiltinData’
                  with actual type ‘PlutusTx.Data’
    • In the second argument of ‘($)’, namely ‘PlutusTx.toData Close’
      In the expression: Redeemer $ PlutusTx.toData Close
      In an equation for ‘r’: r = Redeemer $ PlutusTx.toData Close
    |
299 |         r      = Redeemer $ PlutusTx.toData Close
    |                             ^^^^^^^^^^^^^^^^^^^^^
Compilation Error, Line 304, Column 47 (jump)
 error:
    • Couldn't match type ‘TxOutTx’ with ‘ChainIndexTxOut’
      Expected type: Map TxOutRef ChainIndexTxOut
        Actual type: Map TxOutRef TxOutTx
    • In the first argument of ‘Constraints.unspentOutputs’, namely
        ‘(Map.singleton oref o)’
      In the second argument of ‘(<>)’, namely
        ‘Constraints.unspentOutputs (Map.singleton oref o)’
      In the second argument of ‘(<>)’, namely
        ‘otherScript auctionValidator
           <> Constraints.unspentOutputs (Map.singleton oref o)’
    |
304 |                   Constraints.unspentOutputs (Map.singleton oref o)
    |                                               ^^^^^^^^^^^^^^^^^^^^
Compilation Error, Line 322, Column 14 (jump)
 error:
    • Variable not in scope:
        utxoAt :: Address -> Contract w s Text (Map TxOutRef TxOutTx)
    • Perhaps you meant ‘utxosAt’ (imported from Plutus.Contract)
    |
322 |     utxos <- utxoAt $ scriptAddress auctionValidator
    |              ^^^^^^
Compilation Error, Line 340, Column 13 (jump)
 error:
    • Couldn't match type ‘Promise w3 s3 e1’
                     with ‘Contract () AuctionSchema Text’
      Expected type: Contract () AuctionSchema Text ()
        Actual type: Promise w3 s3 e1 ()
    • In the expression:
        (start' `select` bid' `select` close') >> endpoints
      In an equation for ‘endpoints’:
          endpoints
            = (start' `select` bid' `select` close') >> endpoints
            where
                start' = endpoint @"start" >>= start
                bid' = endpoint @"bid" >>= bid
                close' = endpoint @"close" >>= close
    |
340 | endpoints = (start' `select` bid' `select` close') >> endpoints
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation Error, Line 340, Column 14 (jump)
 error:
    • Couldn't match expected type ‘Promise w3 s3 e1 a0’
                  with actual type ‘Contract w0 s0 e0 ()’
    • In the first argument of ‘select’, namely ‘start'’
      In the first argument of ‘select’, namely ‘start' `select` bid'’
      In the first argument of ‘(>>)’, namely
        ‘(start' `select` bid' `select` close')’
    |
340 | endpoints = (start' `select` bid' `select` close') >> endpoints
    |              ^^^^^^
Compilation Error, Line 340, Column 30 (jump)
 error:
    • Couldn't match expected type ‘Promise w3 s3 e1 a0’
                  with actual type ‘Contract w1 s1 Text ()’
    • In the second argument of ‘select’, namely ‘bid'’
      In the first argument of ‘select’, namely ‘start' `select` bid'’
      In the first argument of ‘(>>)’, namely
        ‘(start' `select` bid' `select` close')’
    |
340 | endpoints = (start' `select` bid' `select` close') >> endpoints
    |                              ^^^^
Compilation Error, Line 340, Column 44 (jump)
 error:
    • Couldn't match expected type ‘Promise w3 s3 e1 a0’
                  with actual type ‘Contract w2 s2 Text ()’
    • In the second argument of ‘select’, namely ‘close'’
      In the first argument of ‘(>>)’, namely
        ‘(start' `select` bid' `select` close')’
      In the expression:
        (start' `select` bid' `select` close') >> endpoints
    |
340 | endpoints = (start' `select` bid' `select` close') >> endpoints
    |                                            ^^^^^^
Compilation Error, Line 340, Column 55 (jump)
 error:
    • Couldn't match type ‘Contract () AuctionSchema Text’
                     with ‘Promise w3 s3 e1’
      Expected type: Promise w3 s3 e1 ()
        Actual type: Contract () AuctionSchema Text ()
    • In the second argument of ‘(>>)’, namely ‘endpoints’
      In the expression:
        (start' `select` bid' `select` close') >> endpoints
      In an equation for ‘endpoints’:
          endpoints
            = (start' `select` bid' `select` close') >> endpoints
            where
                start' = endpoint @"start" >>= start
                bid' = endpoint @"bid" >>= bid
                close' = endpoint @"close" >>= close
    |
340 | endpoints = (start' `select` bid' `select` close') >> endpoints
    |                                                       ^^^^^^^^^
Compilation Error, Line 342, Column 14 (jump)
 error:
    • Couldn't match expected type ‘Contract w s e StartParams’
                  with actual type ‘(a3 -> Contract w6 s6 e4 b2)
                                    -> Promise w6 s6 e4 b2’
    • Probable cause: ‘endpoint’ is applied to too few arguments
      In the first argument of ‘(>>=)’, namely ‘endpoint @"start"’
      In the expression: endpoint @"start" >>= start
      In an equation for ‘start'’: start' = endpoint @"start" >>= start
    • Relevant bindings include
        start' :: Contract w s e ()
          (bound at /private/tmp/web-ghc-work-3f1fa098d9ec0bee/Main.hs:342:5)
    |
342 |     start' = endpoint @"start" >>= start
    |              ^^^^^^^^^^^^^^^^^
Compilation Error, Line 343, Column 14 (jump)
 error:
    • Couldn't match expected type ‘Contract w s Text BidParams’
                  with actual type ‘(a2 -> Contract w5 s5 e3 b1)
                                    -> Promise w5 s5 e3 b1’
    • Probable cause: ‘endpoint’ is applied to too few arguments
      In the first argument of ‘(>>=)’, namely ‘endpoint @"bid"’
      In the expression: endpoint @"bid" >>= bid
      In an equation for ‘bid'’: bid' = endpoint @"bid" >>= bid
    • Relevant bindings include
        bid' :: Contract w s Text ()
          (bound at /private/tmp/web-ghc-work-3f1fa098d9ec0bee/Main.hs:343:5)
    |
343 |     bid'   = endpoint @"bid"   >>= bid
    |              ^^^^^^^^^^^^^^^
Compilation Error, Line 344, Column 14 (jump)
 error:
    • Couldn't match expected type ‘Contract w s Text CloseParams’
                  with actual type ‘(a1 -> Contract w4 s4 e2 b0)
                                    -> Promise w4 s4 e2 b0’
    • Probable cause: ‘endpoint’ is applied to too few arguments
      In the first argument of ‘(>>=)’, namely ‘endpoint @"close"’
      In the expression: endpoint @"close" >>= close
      In an equation for ‘close'’: close' = endpoint @"close" >>= close
    • Relevant bindings include
        close' :: Contract w s Text ()
          (bound at /private/tmp/web-ghc-work-3f1fa098d9ec0bee/Main.hs:344:5)
    |
344 |     close' = endpoint @"close" >>= close
    |              ^^^^^^^^^^^^^^^^^
juxtin commented 3 years ago

A few more details:

juxtin commented 3 years ago

In all likelihood this is because I failed to check out the correct commit in plutus. I should have used this instead of master.