1

I'm using the GuessGame:

https://github.com/input-output-hk/plutus/blob/a36af17fd38db591865679916c819079ad51fda2/plutus-playground-server/usecases/Game.hs

under the simulator, with this code

main = Simulator.runSimulationWith handlers $ do

     cid <- Simulator.activateContract (Wallet 1) GuessGame

     waitNSlots 3
     callEndpointOnInstance cid "lock" LockParams{secretWord="world", amount= Ada.adaValueOf 200}

     waitNSlots 3
     callEndpointOnInstance cid "guess" GuessParams{guessWord="world"}
  
  where
  handlers :: SimulatorEffectHandlers (Builtin TestContracts)
  handlers =
    Simulator.mkSimulatorHandlers def def
    $ interpret (contractHandler (Builtin.handleBuiltin @TestContracts))

The traces included in the GuessGame code, indicates that the transaction has been done, but how I can display the final balances of the the simulated accounts?

1

1 Answer 1

1

You need to include these lines at the end:

Simulator.logString @(Builtin TestContracts) "Balances at the end of the simulation"
b <- Simulator.currentBalances
Simulator.logBalances @(Builtin TestContracts) b
2
  • 1
    Thanks a lot. It works!
    – agocorona
    Oct 26, 2021 at 10:10
  • @agocorona Glad to help!
    – georgeos
    Oct 30, 2021 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.