Skip to content

Commit

Permalink
update 00-overview
Browse files Browse the repository at this point in the history
  • Loading branch information
antododo committed Feb 2, 2018
1 parent bf6c666 commit 4e87395
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 41 deletions.
11 changes: 5 additions & 6 deletions fr/2/00-overview.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: Zombies Attack Their Victims
header: So, you've made it to Lesson 2!
title: Les Zombies Attaquent Leurs Victimes
header: Alors, vous êtes arrivé à la Leçon 2 !
roadmap: roadmap2.jpg
---

Impressive, human! You're a better coder than I thought.
Vous m'impressionnez humain ! Vous êtes un meilleur codeur que j'aurais pensé.

Lesson 2 will teach you how to **multiply your zombie army by feeding on other lifeforms**.
La Leçon 2 va vous apprendre à **multiplier votre armée de zombie en les nourrissant avec d'autres formes de vie**.

In this lesson we will cover some more advanced Solidity concepts, so it's highly
recommended that you complete Lesson 1 before starting.
Nous allons voir des concepts Solidity plus avancé, nous vous recommandons fortement d'avoir fini la Leçon 1 avant de commencer.
4 changes: 2 additions & 2 deletions fr/2/1-overview.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Lesson 2 Overview
actions: ['checkAnswer', 'hints']
title: Aperçu de la Leçon 2
actions: ['vérifierLaRéponse', 'indice']
material:
saveZombie: false
zombieBattle:
Expand Down
4 changes: 2 additions & 2 deletions fr/2/10-interactingcontracts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: What Do Zombies Eat?
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -129,7 +129,7 @@ contract LuckyNumber {

This would be a simple contract where anyone could store their lucky number, and it will be associated with their Ethereum address. Then anyone else could look up that person's lucky number using their address.

Now let's say we had an external contract that wanted to read the data in this contract using the `getNum` function.
Now let's say we had an external contract that wanted to read the data in this contract using the `getNum` function.

First we'd have to define an **_interface_** of the `LuckyNumber` contract:

Expand Down
4 changes: 2 additions & 2 deletions fr/2/11-interactingcontracts2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Using an Interface
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -126,7 +126,7 @@ We can use it in a contract as follows:

```
contract MyContract {
address NumberInterfaceAddress = 0xab38...
address NumberInterfaceAddress = 0xab38...
// ^ The address of the FavoriteNumber contract on Ethereum
NumberInterface numberContract = NumberInterface(NumberInterfaceAddress)
// Now `numberContract` is pointing to the other contract
Expand Down
2 changes: 1 addition & 1 deletion fr/2/12-multiplereturns.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Handling Multiple Return Values
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down
4 changes: 2 additions & 2 deletions fr/2/13-kittygenes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Bonus: Kitty Genes"
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -139,7 +139,7 @@ Let's make it so zombies made from kitties have some unique feature that shows t

To do this, we can add some special kitty code in the zombie's DNA.

If you recall from lesson 1, we're currently only using the first 12 digits of our 16 digit DNA to determine the zombie's appearance. So let's use the last 2 unused digits to handle "special" characteristics.
If you recall from lesson 1, we're currently only using the first 12 digits of our 16 digit DNA to determine the zombie's appearance. So let's use the last 2 unused digits to handle "special" characteristics.

We'll say that cat-zombies have `99` as their last two digits of DNA (since cats have 9 lives). So in our code, we'll say `if` a zombie comes from a cat, then set the last two digits of DNA to `99`.

Expand Down
4 changes: 2 additions & 2 deletions fr/2/14-wrappingitup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Wrapping It Up
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
saveZombie: true
zombieBattle:
Expand Down Expand Up @@ -34,7 +34,7 @@ let kittyId = 1;
// To get the CryptoKitty's image, we need to query their web API. This
// information isn't stored on the blockchain, just their webserver.
// If everything was stored on a blockchain, we wouldn't have to worry
// about the server going down, them changing their API, or the company
// about the server going down, them changing their API, or the company
// blocking us from loading their assets if they don't like our zombie game ;)
let apiUrl = "https://api.cryptokitties.co/kitties/" + kittyId
$.get(apiUrl, function(data) {
Expand Down
3 changes: 1 addition & 2 deletions fr/2/15-lessoncomplete.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: Lesson 2 Complete!
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
lessonComplete:
answer: 1
---

6 changes: 3 additions & 3 deletions fr/2/2-mappings.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Mappings and Addresses
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand All @@ -26,7 +26,7 @@ material:
function _createZombie(string _name, uint _dna) private {
uint id = zombies.push(Zombie(_name, _dna)) - 1;
NewZombie(id, _name, _dna);
}
}
function _generateRandomDna(string _str) private view returns (uint) {
uint rand = uint(keccak256(_str));
Expand Down Expand Up @@ -63,7 +63,7 @@ material:
function _createZombie(string _name, uint _dna) private {
uint id = zombies.push(Zombie(_name, _dna)) - 1;
NewZombie(id, _name, _dna);
}
}
function _generateRandomDna(string _str) private view returns (uint) {
uint rand = uint(keccak256(_str));
Expand Down
4 changes: 2 additions & 2 deletions fr/2/3-msgsender.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Msg.sender
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -120,7 +120,7 @@ Let's update our `_createZombie` method from lesson 1 to assign ownership of the

1. First, after we get back the new zombie's `id`, let's update our `zombieToOwner` mapping to store `msg.sender` under that `id`.

2. Second, let's increase `ownerZombieCount` for this `msg.sender`.
2. Second, let's increase `ownerZombieCount` for this `msg.sender`.

In Solidity, you can increase a `uint` with `++`, just like in javascript:

Expand Down
4 changes: 2 additions & 2 deletions fr/2/4-require.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Require
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -89,7 +89,7 @@ In lesson 1, we made it so users can create new zombies by calling `createRandom

Let's make it so each player can only call this function once. That way new players will call it when they first start the game in order to create the initial zombie in their army.

How can we make it so this function can only be called once per player?
How can we make it so this function can only be called once per player?

For that we use `require`. `require` makes it so that the function will throw an error and stop executing if some condition is not true:

Expand Down
2 changes: 1 addition & 1 deletion fr/2/5-inheritance.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Inheritance
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down
4 changes: 2 additions & 2 deletions fr/2/6-importfiles.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Import
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -83,4 +83,4 @@ So if we had a file named `someothercontract.sol` in the same directory as this

Now that we've set up a multi-file structure, we need to use `import` to read the contents of the other file:

1. Import `zombiefactory.sol` into our new file, `zombiefeeding.sol`.
1. Import `zombiefactory.sol` into our new file, `zombiefeeding.sol`.
8 changes: 4 additions & 4 deletions fr/2/7-storage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Storage vs Memory
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -101,10 +101,10 @@ contract SandwichFactory {
// If you just want a copy, you can use `memory`:
Sandwich memory anotherSandwich = sandwiches[_index + 1];
// ...in which case `anotherSandwich` will simply be a copy of the
// ...in which case `anotherSandwich` will simply be a copy of the
// data in memory, and...
anotherSandwich.status = "Eaten!";
// ...will just modify the temporary variable and have no effect
// ...will just modify the temporary variable and have no effect
// on `sandwiches[_index + 1]`. But you can do this:
sandwiches[_index + 1] = anotherSandwich;
// ...if you want to copy the changes back into blockchain storage.
Expand All @@ -130,6 +130,6 @@ When a zombie feeds on some other lifeform, its DNA will combine with the other
3. We're going to need to get this zombie's DNA. So the next thing our function should do is declare a local `Zombie` named `myZombie` (which will be a `storage` pointer). Set this variable to be equal to index `_zombieId` in our `zombies` array.

You should have 4 lines of code so far, including the line with the closing `}`.
You should have 4 lines of code so far, including the line with the closing `}`.

We'll continue fleshing out this function in the next chapter!
4 changes: 2 additions & 2 deletions fr/2/8-feedandmultiply2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Zombie DNA
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down Expand Up @@ -78,7 +78,7 @@ material:

Let's finish writing the `feedAndMultiply` function.

The formula for calculating a new zombie's DNA is simple: It's simply that average between the feeding zombie's DNA and the target's DNA.
The formula for calculating a new zombie's DNA is simple: It's simply that average between the feeding zombie's DNA and the target's DNA.

For example:

Expand Down
2 changes: 1 addition & 1 deletion fr/2/9-internalfunctions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: More on Function Visibility
actions: ['checkAnswer', 'hints']
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
Expand Down
9 changes: 4 additions & 5 deletions fr/2/template.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
---
title: Data Types
actions: ['checkAnswer', 'hints']
title: TYpes de Données
actions: ['vérifierLaRéponse', 'indice']
material:
editor:
language: sol
startingCode: |
answer: >
---

Solidity's code is encapsulated in contracts. A contract is basically...
Le code Solidity est encapsulé dans des contrats. Un exemple de contrat...

```
contract HelloWorld
```

# Put it to the test

# A votre tour

0 comments on commit 4e87395

Please sign in to comment.