Excellent solution to this assignment @dcota
You can remove the payable
keyword from the withdraw function, though, because you only need to make a function payable if it is receiving ether.
You’ve also made a good job of the additional event for the transfer
Just a couple of other observations:
-
It’s a good idea to indent your code in the function bodies. This makes it clearer and easier to read.
-
Maybe it’s just a copy-and-paste error but you are missing a few lines of code in your transferTo function:
- 2nd require statement (You can’t transfer tokens to yourself).
-uint previousSenderBalance = balance[msg.sender];
- assert statement: you also need to think carefully about the positioning of your emit statement (for your transfer event) in relation to assert()
Keep up the great work!