<p><code>Plutus</code> is still in active development, so changes in the API can occur every week.</p>
<p>For your case, go look at <a href="https://github.com/input-output-hk/plutus/blob/2f11c28bd8f6d630daab582255e16d8408075bd7/plutus-pab/examples/ContractExample.hs" rel="nofollow noreferrer">a similar example in the PAB</a>.</p>
<p>In your specific case, you'll need to change your <code>handlers</code> function to :</p>
<pre><code>handlers :: SimulatorEffectHandlers (Builtin StarterContracts)
handlers =
    Simulator.mkSimulatorHandlers def def 
    $ interpret (contractHandler Builtin.handleBuiltin)
</code></pre>
<p>Then you'll need to implement the <code>HasDefinitions</code> and the <code>HasPSTypes</code> typeclasses for your <code>StarterContracts</code>. For the <code>HasPSTypes</code>, you can just use the default implementation which is:</p>
<pre><code>instance HasPSTypes StarterContracts where
    psTypes _ = []
</code></pre>
<p>Hope that helps.</p>

CC BY-SA 4.0
2021-08-24T11:22:09.967Z
Yes, this is very helpful, thank you!
I also got another error after applying the new changes. it was about `def` not being defined anywhere, I fixed it by adding the following import statement: `import Data.Default (Default (..))`
abdelkrimdev
CC BY-SA 4.0
2021-08-23T14:35:47.763Z
2021-08-23T19:26:03.670Z
2021-08-23T19:26:03.670Z
kolam
<p>I upgraded the Plutus version used by my project to: <code>2f11c28bd8f6d630daab582255e16d8408075bd7</code></p>
<p>PS: It is the same version Lars used in his latest lecture (<a href="https://www.youtube.com/watch?v=zW3D2iM5uVg" rel="noreferrer">Iteration #2 - Lecture #8</a>)</p>
<p>Here is the <strong>code</strong> I'm using to define the endpoints:</p>
<pre><code>data StarterContracts =
    MarketContract
    deriving (Eq, Ord, Show, Generic, FromJSON, ToJSON)

instance Pretty StarterContracts where
    pretty = viaShow

handleStarterContract ::
    ( Member (Error PABError) effs
    , Member (LogMsg (PABMultiAgentMsg (Builtin StarterContracts))) effs
    )
    =&gt; ContractEffect (Builtin StarterContracts)
    ~&gt; Eff effs
handleStarterContract = handleBuiltin getSchema getContract where
    getSchema = \case
        MarketContract -&gt; endpointsToSchemas @Market.MarketSchema
    getContract = \case
        MarketContract -&gt; SomeBuiltin Market.endpoints

handlers :: SimulatorEffectHandlers (Builtin StarterContracts)
handlers =
    Simulator.mkSimulatorHandlers @(Builtin StarterContracts) [MarketContract]
    $ interpret handleStarterContract
</code></pre>
<p>And this is the <strong>error</strong> I'm getting when trying to compile it:</p>
<pre><code>app/Main.hs:62:25: error:
    • Couldn't match expected type ‘(StarterContracts
                                     -&gt; [playground-common-0.1.0.0:Playground.Types.FunctionSchema
                                           playground-common-0.1.0.0:Schema.FormSchema])
                                    -&gt; (StarterContracts -&gt; SomeBuiltin)
                                    -&gt; ContractEffect (Builtin StarterContracts) x
                                    -&gt; Eff effs x’
                  with actual type ‘Plutus.PAB.Effects.Contract.Builtin.BuiltinHandler
                                      a0’
    • The function ‘handleBuiltin’ is applied to two arguments,
      but its type ‘Plutus.PAB.Effects.Contract.Builtin.BuiltinHandler
                      a0’
      has none
      In the expression: handleBuiltin getSchema getContract
      In an equation for ‘handleStarterContract’:
          handleStarterContract
            = handleBuiltin getSchema getContract
            where
                getSchema
                  = \case MarketContract -&gt; endpointsToSchemas @MarketSchema
                getContract = \case MarketContract -&gt; SomeBuiltin endpoints
    • Relevant bindings include
        handleStarterContract :: ContractEffect (Builtin StarterContracts)
                                 ~&gt; Eff effs
          (bound at app/Main.hs:62:1)
   |
62 | handleStarterContract = handleBuiltin getSchema getContract where
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

app/Main.hs:70:5: error:
    • Couldn't match type ‘Simulator.SimulatorContractHandler
                             (Builtin StarterContracts)
                           -&gt; SimulatorEffectHandlers (Builtin StarterContracts)’
                     with ‘Plutus.PAB.Core.EffectHandlers
                             (Builtin StarterContracts)
                             (Simulator.SimulatorState (Builtin StarterContracts))’
      Expected type: SimulatorEffectHandlers (Builtin StarterContracts)
        Actual type: Simulator.SimulatorContractHandler
                       (Builtin StarterContracts)
                     -&gt; SimulatorEffectHandlers (Builtin StarterContracts)
    • In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
          $ interpret handleStarterContract
      In an equation for ‘handlers’:
          handlers
            = Simulator.mkSimulatorHandlers
                @(Builtin StarterContracts) [MarketContract]
                $ interpret handleStarterContract
   |
70 |     Simulator.mkSimulatorHandlers @(Builtin StarterContracts) [MarketContract]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

app/Main.hs:70:63: error:
    • Couldn't match expected type ‘Ledger.Fee.FeeConfig’
                  with actual type ‘[StarterContracts]’
    • In the second argument of ‘Simulator.mkSimulatorHandlers’, namely
        ‘[MarketContract]’
      In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
      In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
          $ interpret handleStarterContract
   |
70 |     Simulator.mkSimulatorHandlers @(Builtin StarterContracts) [MarketContract]
   |                                                               ^^^^^^^^^^^^^^^^

app/Main.hs:71:7: error:
    • Couldn't match expected type ‘Ledger.TimeSlot.SlotConfig’
                  with actual type ‘Eff
                                      (ContractEffect (Builtin StarterContracts) : effs0) x0
                                    -&gt; Eff effs0 x0’
    • Probable cause: ‘interpret’ is applied to too few arguments
      In the second argument of ‘($)’, namely
        ‘interpret handleStarterContract’
      In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
          $ interpret handleStarterContract
      In an equation for ‘handlers’:
          handlers
            = Simulator.mkSimulatorHandlers
                @(Builtin StarterContracts) [MarketContract]
                $ interpret handleStarterContract
   |
71 |     $ interpret handleStarterContract
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</code></pre>

<plutus><haskell><simulator>
The PAB is no longer working after upgrading the Plutus version
# The PAB is no longer working after upgrading the Plutus version

(Asked by: username_0 on 2021-08-15)

I upgraded the Plutus version used by my project to: 2f11c28bd8f6d630daab582255e16d8408075bd7
PS: It is the same version Lars used in his latest lecture (Iteration #2 - Lecture #8)
Here is the code I'm using to define the endpoints:
data StarterContracts =
    MarketContract
    deriving (Eq, Ord, Show, Generic, FromJSON, ToJSON)

instance Pretty StarterContracts where
    pretty = viaShow

handleStarterContract ::
    ( Member (Error PABError) effs
    , Member (LogMsg (PABMultiAgentMsg (Builtin StarterContracts))) effs
    )
    => ContractEffect (Builtin StarterContracts)
    ~> Eff effs
handleStarterContract = handleBuiltin getSchema getContract where
    getSchema = \case
        MarketContract -> endpointsToSchemas @Market.MarketSchema
    getContract = \case
        MarketContract -> SomeBuiltin Market.endpoints

handlers :: SimulatorEffectHandlers (Builtin StarterContracts)
handlers =
    Simulator.mkSimulatorHandlers @(Builtin StarterContracts) [MarketContract]
    $ interpret handleStarterContract

And this is the error I'm getting when trying to compile it:
app/Main.hs:62:25: error:
    • Couldn't match expected type ‘(StarterContracts
                                     -> [playground-common-0.1.0.0:Playground.Types.FunctionSchema
                                           playground-common-0.1.0.0:Schema.FormSchema])
                                    -> (StarterContracts -> SomeBuiltin)
                                    -> ContractEffect (Builtin StarterContracts) x
                                    -> Eff effs x’
                  with actual type ‘Plutus.PAB.Effects.Contract.Builtin.BuiltinHandler
                                      a0’
    • The function ‘handleBuiltin’ is applied to two arguments,
      but its type ‘Plutus.PAB.Effects.Contract.Builtin.BuiltinHandler
                      a0’
      has none
      In the expression: handleBuiltin getSchema getContract
      In an equation for ‘handleStarterContract’:
          handleStarterContract
            = handleBuiltin getSchema getContract
            where
                getSchema
                  = \case MarketContract -> endpointsToSchemas @MarketSchema
                getContract = \case MarketContract -> SomeBuiltin endpoints
    • Relevant bindings include
        handleStarterContract :: ContractEffect (Builtin StarterContracts)
                                 ~> Eff effs
          (bound at app/Main.hs:62:1)
   |
62 | handleStarterContract = handleBuiltin getSchema getContract where
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

app/Main.hs:70:5: error:
    • Couldn't match type ‘Simulator.SimulatorContractHandler
                             (Builtin StarterContracts)
                           -> SimulatorEffectHandlers (Builtin StarterContracts)’
                     with ‘Plutus.PAB.Core.EffectHandlers
                             (Builtin StarterContracts)
                             (Simulator.SimulatorState (Builtin StarterContracts))’
      Expected type: SimulatorEffectHandlers (Builtin StarterContracts)
        Actual type: Simulator.SimulatorContractHandler
                       (Builtin StarterContracts)
                     -> SimulatorEffectHandlers (Builtin StarterContracts)
    • In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
          $ interpret handleStarterContract
      In an equation for ‘handlers’:
          handlers
            = Simulator.mkSimulatorHandlers
                @(Builtin StarterContracts) [MarketContract]
                $ interpret handleStarterContract
   |
70 |     Simulator.mkSimulatorHandlers @(Builtin StarterContracts) [MarketContract]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

app/Main.hs:70:63: error:
    • Couldn't match expected type ‘Ledger.Fee.FeeConfig’
                  with actual type ‘[StarterContracts]’
    • In the second argument of ‘Simulator.mkSimulatorHandlers’, namely
        ‘[MarketContract]’
      In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
      In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
          $ interpret handleStarterContract
   |
70 |     Simulator.mkSimulatorHandlers @(Builtin StarterContracts) [MarketContract]
   |                                                               ^^^^^^^^^^^^^^^^

app/Main.hs:71:7: error:
    • Couldn't match expected type ‘Ledger.TimeSlot.SlotConfig’
                  with actual type ‘Eff
                                      (ContractEffect (Builtin StarterContracts) : effs0) x0
                                    -> Eff effs0 x0’
    • Probable cause: ‘interpret’ is applied to too few arguments
      In the second argument of ‘($)’, namely
        ‘interpret handleStarterContract’
      In the expression:
        Simulator.mkSimulatorHandlers
          @(Builtin StarterContracts) [MarketContract]
          $ interpret handleStarterContract
      In an equation for ‘handlers’:
          handlers
            = Simulator.mkSimulatorHandlers
                @(Builtin StarterContracts) [MarketContract]
                $ interpret handleStarterContract
   |
71 |     $ interpret handleStarterContract
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Tags:** plutus, haskell, simulator

---

## 1 answers

### Answer by username_1 on 2021-08-23. Score: 3 | Accepted answer

Plutus is still in active development, so changes in the API can occur every week.
For your case, go look at a similar example in the PAB.
In your specific case, you'll need to change your handlers function to :
handlers :: SimulatorEffectHandlers (Builtin StarterContracts)
handlers =
    Simulator.mkSimulatorHandlers def def 
    $ interpret (contractHandler Builtin.handleBuiltin)

Then you'll need to implement the HasDefinitions and the HasPSTypes typeclasses for your StarterContracts. For the HasPSTypes, you can just use the default implementation which is:
instance HasPSTypes StarterContracts where
    psTypes _ = []

Hope that helps.

> **Comments:**
> **username_0**: Yes, this is very helpful, thank you! I also got another error after applying the new changes. it was about `def` not being defined anywhere, I fixed it by adding the following import statement: `import Data.Default (Default (..))`  

---

