Crypto Zombies Lesson 1, Ch13 Events, Solidity Events

Lesson Summary

In this chapter of Crypto Zombies we finally look at events in Solidity. Events allow us to listen to our code. First an event is declared then somewhere in our code we fire the event when a specific thing happens. Once our even is fired we then can run another piece of code as result of the event being fired. In our Chapter 13 challenge we are asked to first declare an event called NewZombie. We are asked to modify what happens after we create a zombie. We grab the integer that is returned from using the .push method(which is the length of the array) and subtract 1 from that number to grab the correct index of the zombie we create and assign it to a uint variable named id. We then go into our _createZombie function and fire our event whenever our _createZombie function is called. Once it is called we can then fire some other piece of code.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required