--- title: Walk Through of [Marigold Training 2](https://github.com/marigold-dev/training-dapp-2) author: Michael Kernaghan --- # Walk Through of [Marigold Training 2](https://github.com/marigold-dev/training-dapp-2) # Training dapp n°2 - Poke game (enhanced) ## Smart contract ### Step 1 : Reuse the project from previous session ✅ taq compile pokeGame.jsligo ``` ┌────────────────────────────┬───────────────────────────────────────────────────┐ │ Contract │ Artifact │ ├────────────────────────────┼───────────────────────────────────────────────────┤ │ pokeGame.jsligo │ artifacts/pokeGame.tz │ ├────────────────────────────┼───────────────────────────────────────────────────┤ │ pokeGame.storages.jsligo │ artifacts/pokeGame.default_storage.tz │ ├────────────────────────────┼───────────────────────────────────────────────────┤ │ pokeGame.parameters.jsligo │ artifacts/pokeGame.parameter.default_parameter.tz │ └────────────────────────────┴───────────────────────────────────────────────────┘ ``` ### Step 2 : Write unit tests ✅ taq create contract unit_pokeGame.jsligo ✅ taq test unit_pokeGame.jsligo ``` ┌──────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Contract │ Test Results │ ├──────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ unit_pokeGame.jsligo │ "Sender 1 has balance : " │ │ │ 3800000000000mutez │ │ │ "contract deployed with values : " │ │ │ KT1AsT6VXYCHe5f3Ksm7D9dLgySDY7DUMaB5(None) │ │ │ Success (2127n) │ │ │ {feedback = "kiss" ; pokeTraces = [tz1TDZG4vFoA2xutZMYauUnS4HVucnAGQSpZ -> {feedback = "" ; receiver = KT1AsT6VXYCHe5f3Ksm7D9dLgySDY7DUMaB5}]} │ │ │ Everything at the top-level was executed. │ │ │ - testSender1Poke exited with value (). │ │ │ │ │ │ 🎉 All tests passed 🎉 │ └──────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ``` Could not find a VSCode exension for taq test. ### Step 3 : do an inter contract call ✅ taq compile pokeGame.jsligo 👉 (Optional) Write a unit test for this new function pokeAndGetFeedback ### Step 4 : Use views instead of inter-contract call ✅ taq compile pokeGame.jsligo ### Step 5 : Write mutation tests 👾 ✅ taq create contract mutation_pokeGame.jsligo ✅ taq test mutation_pokeGame.jsligo The solution and the docs are different here. In the solution export is not prefixed to const pokeAndGetFeedback, but in the docs it is. for me the mutation tests all pass, i can't get that mutant as decribed in the demo. Can't even get it in the published solution. When compiling, taq seems unhappy with export let main ... ## Dapp ### Step 1 : Reuse dapp from previous session ### Step 2 : Redeploy new smart contract code ✅ taq compile pokeGame.jsligo ✅ taq generate types ./app/src ✅ taq deploy pokeGame.tz -e "testing" ``` ┌─────────────┬──────────────────────────────────────┬──────────┬─────────────┐ │ Contract │ Address │ Alias │ Destination │ ├─────────────┼──────────────────────────────────────┼──────────┼─────────────┤ │ pokeGame.tz │ KT1SE8hpmo38MBgUbjPscxD6JhDqofz9tfe5 │ pokeGame │ ghostnet │ └─────────────┴──────────────────────────────────────┴──────────┴─────────────┘ ``` With VSCode extension when taq generate types it does not require a parameter for directory ### Step 3 : Adapt the application code Here the linter complains about app.tsx ![](https://i.imgur.com/CbHFOoU.png) but everything compiles and works anyway ![](https://i.imgur.com/hmpuo2o.png) You can see the feedback "kick" that i changed from "kiss" ☝️ Poke other developer's contract to discover their contract hidden feedback when you poke them # END [Next](https://hackmd.io/MdfQ9MkuSUy92PNQq4fkyQ)