Skip to content

Commit 0cfcaa6

Browse files
committed
feat: fulfill @wolovim's review suggestions
1 parent 53e2b4e commit 0cfcaa6

File tree

3 files changed

+33
-36
lines changed

3 files changed

+33
-36
lines changed

src/pages/lessons/projects/6.mdx

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
i18n: "erc20"
33
title: Your own Token with Foundry
44
description:
5-
Create and deploy an ERC20 Token (UNI, MKR, DAI, etc.) using the Foundry
5+
Create and deploy an ERC-20 Token (UNI, MKR, DAI, etc.) using the Foundry
66
toolkit.
77
icons: ["solidity", "foundry", "openzeppelin", "ethereum", "etherscan"]
88
---
@@ -12,7 +12,7 @@ import { LessonHeader } from "../../../components/mdx/LessonHeader";
1212

1313
<Layout
1414
title="Your own Token with Foundry"
15-
description="Create and deploy an ERC20 Token (UNI, MKR, DAI, etc.) using the Foundry
15+
description="Create and deploy an ERC-20 Token (UNI, MKR, DAI, etc.) using the Foundry
1616
toolkit."
1717
>
1818
<LessonHeader
@@ -21,8 +21,8 @@ import { LessonHeader } from "../../../components/mdx/LessonHeader";
2121

2222
## About this lesson
2323

24-
If you're eager to learn how to create your first ERC20 token, you're in the right place. There are
25-
a multitude of uses for the ERC20, and we'll introduce you to some of them.
24+
If you're eager to learn how to create your first ERC-20 token, you're in the right place. There are
25+
a multitude of uses for the ERC-20, and we'll introduce you to some of them.
2626
We'll be building a smart contract with a range of developer tools, including the use of Foundry.
2727
If you are new to coding, we suggest that you first complete our _Getting Started with Smart Contract
2828
Development_ project, to get to grips with the basics of Solidity you'll need in
@@ -43,7 +43,7 @@ source of much of our well-being. 🌱
4343

4444
## What are we creating?
4545

46-
By the end of this lesson you will have created your own ERC20 token, and
46+
By the end of this lesson you will have created your own ERC-20 token, and
4747
you will be able to change its properties in any way you need.
4848
But before we go any further, let's check-in and see what building blocks you have already.
4949

@@ -62,7 +62,7 @@ We hope that was a little eye-opener for what's to come!
6262

6363

6464

65-
### Tokens, crypto, coins, ERC20. Is it all the same?
65+
### Tokens, crypto, coins, ERC-20. Is it all the same?
6666

6767
Let's begin with some context, so we all speak the same language. The Ethereum blockchain, and most EVM-compatible blockchains, have a native token that is used to pay for transaction costs, and also to reward validators in
6868
Proof of Stake (previously miners in Proof of Work). In Ethereum that native
@@ -72,7 +72,7 @@ Every _other_ token or 'crypto' you see, use or interact with on Ethereum is
7272
basically a smart contract that lets you send these tokens, receive them and
7373
check your balance. Stablecoins like **DAI**, Tether (**USDT**), USD Coin (**USDC**), or tokens from
7474
projects like Uniswap (**UNI**), MakerDAO (**MKR**), Basic Attention Token
75-
(**BAT**) are all smart contracts that follow a standard. The ERC20 standard.
75+
(**BAT**) are all smart contracts that follow a standard. The ERC-20 standard.
7676

7777
### Why would we want to create yet another Token?
7878

@@ -89,12 +89,12 @@ Some basic functionality that our tokens need to provide are:
8989
account
9090

9191

92-
Has someone created a battle-tested library for the standard? Yes. OpenZeppelin, among others, has created an implementation we can inherit to create our own tokens easily. Here is a quick overview of what a contract needs in order to be called an ERC20 Token
92+
Has someone created a battle-tested library for the standard? Yes. OpenZeppelin, among others, has created an implementation we can inherit to create our own tokens easily. Here is a quick overview of what a contract needs in order to be called an ERC-20 Token
9393
contract:
9494

95-
<SideDrawer buttonText="More info on the ERC20 Standard">
95+
<SideDrawer buttonText="More info on the ERC-20 Standard">
9696

97-
To achive the functionality needed for an ERC20 token, the standard requires us
97+
To achive the functionality needed for an ERC-20 token, the standard requires us
9898
to implement 9 methods and 2 events.
9999

100100

@@ -146,7 +146,7 @@ mkdir d_d_academy
146146
cd d_d_academy
147147
```
148148

149-
You can use whatever tools you feel confident with, or accustumed to. For this example
149+
You can use whatever tools you feel confident with, or accustomed to. For this example
150150
we will be creating a Foundry project, but feel free to use Hardhat, or Truffle
151151
if that's your favourite flavor. The main focus of Foundry is that you don't
152152
need to use Javascript at all, if you don't want to. All the tools are CLI
@@ -264,7 +264,7 @@ Running 2 tests for test/Counter.t.sol:CounterTest
264264
Test result: ok. 2 passed; 0 failed; finished in 19.11ms
265265
```
266266

267-
As we mentioned earlier, we are going to use OpenZeppelin ERC20 implementation.
267+
As we mentioned earlier, we are going to use OpenZeppelin ERC-20 implementation.
268268
To use it, we need to install OpenZeppelin as a dependency in our project. To
269269
install dependencies in Foundry, we use:
270270

@@ -302,18 +302,18 @@ rm src/*
302302
rm test/*
303303
```
304304

305-
<SideDrawer
305+
{/* <SideDrawer
306306
buttonText="Checkpoint Questions will be here"
307307
title="">
308-
</SideDrawer>
308+
</SideDrawer> */}
309309

310310
Everything's ready, so let's go ahead and start coding Solidity.
311311

312312
## Create the Framing and Walls
313313

314314
We need our house to have a structure and a floor plan with walls dividing the
315315
rooms. Let's think of that setting as the 9 methods and 2 events that we saw
316-
earlier for our code to be ERC20 compliant.
316+
earlier for our code to be ERC-20 compliant.
317317

318318
It's a great exercise to try and implement them from scratch, and we ecourage
319319
you to do that once you start diving deeper into Solidity. It is also a great
@@ -334,7 +334,7 @@ contract MyToken {
334334
}
335335
```
336336

337-
Once we have that, we can import and inherit OpenZeppelin ERC20:
337+
Once we have that, we can import and inherit OpenZeppelin ERC-20:
338338

339339
```solidity
340340
// SPDX-License-Identifier: MIT
@@ -347,7 +347,7 @@ contract MyToken is ERC20 {
347347
```
348348

349349
Now that we have the full implementation inherited, we still have to specify a
350-
few more things before compiling, because the ERC20 constructor **needs** to
350+
few more things before compiling, because the ERC-20 constructor **needs** to
351351
receive 2 parameters, i.e. the token's name and symbol, or it will raise an error. In
352352
order to do that, we define our constructor and call our inherited
353353
contract's constructor:
@@ -432,21 +432,21 @@ contract MyToken is ERC20 {
432432
When we define our `mint` function, we decide who will be the receiver of said
433433
new tokens. For the `burn` function on the other hand, we are only letting holders burn
434434
their **own** tokens by using `msg.sender` as the address to call the internal
435-
`_burn` function in the OpenZeppelin ERC20 implementation.
435+
`_burn` function in the OpenZeppelin ERC-20 implementation.
436436

437437
In a special case where someone approves operating on an amount of *their* tokens,
438438
we create a `burnFrom` function to be able to burn within that approved
439439
allowance from the other address. If we try to burn, or transfer, more than the
440-
approved allowance, the ERC20 implementation from OZ will revert the transaction
441-
because that's required by the ERC20 standard.
440+
approved allowance, the ERC-20 implementation from OZ will revert the transaction
441+
because that's required by the ERC-20 standard.
442442

443443
We have now created doors to our house, but we haven't put locks in them!
444444

445445

446-
<SideDrawer
446+
{/* <SideDrawer
447447
buttonText="Checkpoint Questions will be here"
448448
title="">
449-
</SideDrawer>
449+
</SideDrawer> */}
450450

451451

452452
## Lock the Door!
@@ -565,7 +565,7 @@ A few examples could be:
565565

566566
- A token that accrues or drips more tokens, depending on how long have you been
567567
hodling. Tip: you can override functions like `balanceOf` and
568-
`_beforeTokenTransfer` / `_afterTokenTransfer` from the inherited ERC20
568+
`_beforeTokenTransfer` / `_afterTokenTransfer` from the inherited ERC-20
569569
- A token that can only be transferred or received if you hold another specific
570570
token, i.e. an NFT from a specific collection
571571
- A token that loses the balance if you don't transact or transfer it regularly
@@ -607,10 +607,10 @@ to ask our community for help by explaining your error, the console output and
607607
your configuration (OS, version, Foundry and Solidity version, etc.)
608608

609609

610-
<SideDrawer
610+
{/* <SideDrawer
611611
buttonText="Checkpoint Questions will be here"
612612
title="">
613-
</SideDrawer>
613+
</SideDrawer> */}
614614

615615
## Register your house in the Real Estate Register
616616

@@ -781,10 +781,10 @@ the tool tells us what the address of the deployed contract is:
781781
`0xCE68eD7AEd9A1c6C185f2B8b576e7cBD7bf5dAAf`.
782782

783783

784-
<SideDrawer
784+
{/* <SideDrawer
785785
buttonText="Checkpoint Questions will be here"
786786
title="">
787-
</SideDrawer>
787+
</SideDrawer> */}
788788

789789
## Querying the Block Explorer
790790

@@ -822,8 +822,6 @@ our decimals in 18, that would be exactly 1000 MTK.
822822
![ERC20-1000MTK](/assets/lessons/6/ERC20-1000MTK.png)
823823

824824

825-
### 😊 FINAL QUIZ 😊
826-
827825
## Invite your frens!
828826

829827
That's it! We deployed our contract on the Sepolia testnet, and our token should

src/utils/questions/lesson-6/1-intro/Q2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"answer": "ERC-20"
1010
},
1111
{
12-
"answer": "ERC-1155"
12+
"answer": "ERC-1559"
1313
},
1414
{
1515
"answer": "ERC-10"

src/utils/questions/lesson-6/1-intro/Q3.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
"question": "What are some common use cases for creating ERC-20 tokens?",
33
"options": [
44
{
5-
"answer": "Supporting a project"
6-
},
7-
{
8-
"answer": "Governance for DAOs"
5+
"answer": "Supporting a project",
6+
"correct": true
97
},
108
{
11-
"answer": "Learning and experimentation"
9+
"answer": "Governance for DAOs",
10+
"correct": true
1211
},
1312
{
14-
"answer": "All of the above",
13+
"answer": "Learning and experimentation",
1514
"correct": true
1615
}
1716
]

0 commit comments

Comments
 (0)