Some contents of this article are based on Cryptozombies’s source code, based on GPL-3.0

Lesson 4

Chapter 1: Payable

  • Visibility modifiers
    • private: only callable from other functions inside the contract
    • internal: also callable by other contracts that inherit the contract
    • external: only callable from outside the contract
    • public: callable from anywhere
  • State modifiers
    • view: running the function, but read only
    • pure: running the function, but does not read

Chapter 2: Withdraws

  • modifier, contract, condition check

Chapter 3: Zombie Battles

  • exercise for pragma version, import, contract assignment

Chapter 4: Random Numbers

  • keccak256
  • Broadcasting has vulnerability to attack by a dishonest node

Chapter 5: Zombie Fightin’

Chapter 6: Refactoring Common Logic

  • modifier 선언할 때 인자 넣었으면 사용할 때도 인자 건네줘야 한다!
    • 이런 조건을 지켰을 때만 실행해 줘! 라고 해놓고 조건을 안 준 셈이다

Chapter 7: More Refactoring

  • modifier 2개 이상 있을 때는 그냥 병렬로 띄어쓰기 해서 인자랑 같이 적으면 된다
    • 어렵게 생각하지 말자

Chapter 8: Back to Attack!

  • Basic Logic of the battle
  • 배열을 바탕으로 하는 사고방식이 아직 익숙하지 않다. 선언된 배열 이름이 어떤 의미를 지니는지 잘 생각해보자!

Chapter 9: Zomibe Wins and Losses

Chapter 10: Zombie Victory

  • 협업하다가 메커니즘 이해가 안되면 물어보자

Chapter 11: Zombie Loss

Chapter 12: Wrapping it Up