Lesson 4 Recap - cogeorg/teaching GitHub Wiki
In this lesson, you mainly practice concepts that have been introduced in one of the previous lessons.
-
Chapter 1 + 2: introduces the
payable
modifier- allows contracts to receive ether through a function call
function buySomething() external payable { // do something }
- there needs to be a special function for the owner of the contract to withdraw the money
-
Chapter 3: practice
-
Chapter 4: explains why a Solidity random number generator in insecure
- a hostile user could decide to only publish/mine a transaction when she wins a random game
-
Chapter 5: practice
-
Chapter 6 + 7: refactoring code by outsourcing to modifiers
-
Chapter 8 + 9 + 10: practice
-
Chapter 11: explains if/else syntax
if (<condition>){
// do something
} else if (<other condition>){
// do something else
} else {
// do something completely else
}