Skip to content

Commit 218e058

Browse files
committed
feat: update Sol pragma + terminal output code + screenshot assets to sol 0.8.20
1 parent 53e2b4e commit 218e058

File tree

5 files changed

+76
-51
lines changed

5 files changed

+76
-51
lines changed
181 Bytes
Loading
853 Bytes
Loading
511 Bytes
Loading
13.7 KB
Loading

src/pages/lessons/projects/6.mdx

Lines changed: 76 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,10 @@ forge build
238238
My output:
239239

240240
```bash
241-
[⠊] Compiling...
242-
[⠑] Installing solc version 0.8.19
243-
[⠊] Successfully installed solc 0.8.19
244-
[⠒] Compiling 20 files with 0.8.19
245-
[⠑] Solc 0.8.19 finished in 6.08s
246-
Compiler run successful
241+
[⠒] Compiling...
242+
[⠔] Compiling 22 files with 0.8.20
243+
[⠃] Solc 0.8.20 finished in 4.35s
244+
Compiler run successful!
247245
```
248246

249247
And now we can test it:
@@ -255,13 +253,15 @@ forge test
255253
My output:
256254

257255
```bash
258-
[] Compiling...
256+
[] Compiling...
259257
No files changed, compilation skipped
260258

261259
Running 2 tests for test/Counter.t.sol:CounterTest
262-
[PASS] testIncrement() (gas: 28334)
263-
[PASS] testSetNumber(uint256) (runs: 256, μ: 27553, ~: 28409)
264-
Test result: ok. 2 passed; 0 failed; finished in 19.11ms
260+
[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 27631, ~: 28409)
261+
[PASS] test_Increment() (gas: 28379)
262+
Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 27.32ms
263+
264+
Ran 1 test suites: 2 tests passed, 0 failed, 0 skipped (2 total tests)
265265
```
266266

267267
As we mentioned earlier, we are going to use OpenZeppelin ERC20 implementation.
@@ -278,8 +278,9 @@ This looks for the repo called `openzeppelin-contracts` from the GitHub user
278278
This is the output I got:
279279

280280
```bash
281-
Installing openzeppelin-contracts in "/home/myuser/d_d_academy/my_token/lib/openzeppelin-contracts" (url: Some("https://github.com/OpenZeppelin/openzeppelin-contracts"), tag: None)
282-
Installed openzeppelin-contracts v4.8.0
281+
Installing openzeppelin-contracts in /home/myuser/d_d_academy/my_token/lib/openzeppelin-contracts (url: Some("https://github.com/OpenZeppelin/openzeppelin-contracts"), tag: None)
282+
...
283+
Installed openzeppelin-contracts v5.0.0
283284
```
284285

285286
This lets us import OpenZeppelin contracts in our smart contracts. We need to
@@ -303,10 +304,17 @@ rm test/*
303304
```
304305

305306
<SideDrawer
306-
buttonText="Checkpoint Questions will be here"
307-
title="">
307+
buttonText="Checkpoint Questions"
308+
title="Foundations of our contract with Foundry"
309+
>
310+
{/* <Question question="lesson-6/2-foundry/Q1" />
311+
<Question question="lesson-6/2-foundry/Q2" />
312+
<Question question="lesson-6/2-foundry/Q3" />
313+
<Question question="lesson-6/2-foundry/Q4" />
314+
<Question question="lesson-6/2-foundry/Q5" /> */}
308315
</SideDrawer>
309316

317+
310318
Everything's ready, so let's go ahead and start coding Solidity.
311319

312320
## Create the Framing and Walls
@@ -328,7 +336,7 @@ basics:
328336

329337
```solidity
330338
// SPDX-License-Identifier: MIT
331-
pragma solidity 0.8.19;
339+
pragma solidity 0.8.20;
332340
333341
contract MyToken {
334342
}
@@ -338,7 +346,7 @@ Once we have that, we can import and inherit OpenZeppelin ERC20:
338346

339347
```solidity
340348
// SPDX-License-Identifier: MIT
341-
pragma solidity 0.8.19;
349+
pragma solidity 0.8.20;
342350
343351
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
344352
@@ -354,7 +362,7 @@ contract's constructor:
354362

355363
```solidity
356364
// SPDX-License-Identifier: MIT
357-
pragma solidity 0.8.19;
365+
pragma solidity 0.8.20;
358366
359367
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
360368
@@ -375,7 +383,7 @@ contract on our constructor:
375383

376384
```solidity
377385
// SPDX-License-Identifier: MIT
378-
pragma solidity 0.8.19;
386+
pragma solidity 0.8.20;
379387
380388
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
381389
@@ -444,8 +452,14 @@ We have now created doors to our house, but we haven't put locks in them!
444452

445453

446454
<SideDrawer
447-
buttonText="Checkpoint Questions will be here"
448-
title="">
455+
buttonText="Checkpoint Questions"
456+
title="Laying out the basics of the contract"
457+
>
458+
{/* <Question question="lesson-6/3-create-contract/Q1" />
459+
<Question question="lesson-6/3-create-contract/Q2" />
460+
<Question question="lesson-6/3-create-contract/Q3" />
461+
<Question question="lesson-6/3-create-contract/Q4" />
462+
<Question question="lesson-6/3-create-contract/Q5" /> */}
449463
</SideDrawer>
450464

451465

@@ -522,7 +536,7 @@ Here we have our fully functioning house, I mean... token:
522536

523537
```solidity
524538
// SPDX-License-Identifier: MIT
525-
pragma solidity 0.8.19;
539+
pragma solidity 0.8.20;
526540
527541
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
528542
import "@openzeppelin/contracts/access/AccessControl.sol";
@@ -592,10 +606,10 @@ forge build
592606
Here's what I got in the console:
593607

594608
```bash
595-
[] Compiling...
596-
[] Compiling 11 files with 0.8.19
597-
[] Solc 0.8.19 finished in 1.29s
598-
Compiler run successful
609+
[] Compiling...
610+
[] Compiling 10 files with 0.8.20
611+
[] Solc 0.8.20 finished in 252.16ms
612+
Compiler run successful!
599613
```
600614

601615
Everything compiled successfully and is ready to deploy.
@@ -608,11 +622,17 @@ your configuration (OS, version, Foundry and Solidity version, etc.)
608622

609623

610624
<SideDrawer
611-
buttonText="Checkpoint Questions will be here"
612-
title="">
625+
buttonText="Checkpoint Questions"
626+
title="Defining permissions for use of our contract"
627+
>
628+
{/* <Question question="lesson-6/4-define-roles/Q1" />
629+
<Question question="lesson-6/4-define-roles/Q2" />
630+
<Question question="lesson-6/4-define-roles/Q3" />
631+
<Question question="lesson-6/4-define-roles/Q4" />
632+
<Question question="lesson-6/4-define-roles/Q5" /> */}
613633
</SideDrawer>
614634

615-
## Register your house in the Real Estate Register
635+
### Register your house in the Real Estate Register
616636

617637
Or... Let's deploy our contract!
618638

@@ -633,7 +653,7 @@ more if you search for Sepolia Faucet in any search engine.
633653
We are going to create an `.env` file, where we will store our _secrets_. And
634654
when we say _secrets_, we are specially referring to the private key to your
635655
wallet. Never, ever share this with anyone, not even us. Anyone who gets hold of
636-
your keys, can drain your wallet. This is why we strongly advise using a separate wallet for your development activities,
656+
your keys, can drain your wallet. This is why we strongly advise using a separate browser profile, and most definitely a separate wallet for your development activities,
637657
that should not hold anything with real value in it. It wouldn't be the first time,
638658
even for experienced developers, to accidentally upload the `.env` file to
639659
GitHub, and once it's on the internet we can consider it to be, yes, public.
@@ -751,22 +771,21 @@ the tool will return an error when trying to verify.
751771
This is the output I got:
752772

753773
```less
754-
[] Compiling...
774+
[] Compiling...
755775
No files changed, compilation skipped
756776
Deployer: 0xf4bAFA90241e808461653C17dB0f8669Fa4342a1
757-
Deployed to: 0xCE68eD7AEd9A1c6C185f2B8b576e7cBD7bf5dAAf
758-
Transaction hash: 0xeb420acc65f54fc3a564db28856e4496acb59615f837d784c75a9c00a0bb96d4
777+
Deployed to: 0xec870005029ED5595F146f6AAAe699b442065b72
778+
Transaction hash: 0x436120f627b1b56ac92ca1df408f1ec591cd578c4168aad4d89bc73c4141aa78
759779
Starting contract verification...
760780
Waiting for etherscan to detect contract deployment...
761-
Start verifying contract `0xCE68eD7AEd9A1c6C185f2B8b576e7cBD7bf5dAAf` deployed on sepolia
762-
763-
Submitting verification for [src/MyToken.sol:MyToken] "0xCE68eD7AEd9A1c6C185f2B8b576e7cBD7bf5dAAf".
781+
Start verifying contract `0xec870005029ED5595F146f6AAAe699b442065b72` deployed on sepolia
764782

783+
Submitting verification for [src/MyToken.sol:MyToken] "0xec870005029ED5595F146f6AAAe699b442065b72".
765784
Submitted contract for verification:
766785
Response: `OK`
767-
GUID: `fn91mxzy58kyjw5ps1tjid2jtulktj8zhdx583pxbfekthb5jm`
786+
GUID: `hzmpq14eeasu92sd1hgzgdhttdu7iscirjlbs9eb1vsezkn8vc`
768787
URL:
769-
https://sepolia.etherscan.io/address/0xce68ed7aed9a1c6c185f2b8b576e7cbd7bf5daaf
788+
https://sepolia.etherscan.io/address/0xec870005029ed5595f146f6aaae699b442065b72
770789
Contract verification status:
771790
Response: `NOTOK`
772791
Details: `Pending in queue`
@@ -775,30 +794,38 @@ Response: `OK`
775794
Details: `Pass - Verified`
776795
Contract successfully verified
777796
```
797+
If by chance you get a message saying Etherscan hasn't detected or verified the deployment,
798+
try running the command again.
778799

779-
If we filter out all information, we should pay attention to the second line, where
780-
the tool tells us what the address of the deployed contract is:
781-
`0xCE68eD7AEd9A1c6C185f2B8b576e7cBD7bf5dAAf`.
800+
By filtering through the information, we can pay attention to the second line, where
801+
the tool tells us the address of the deployed contract:
802+
`0xec870005029ED5595F146f6AAAe699b442065b72`.
782803

783804

784805
<SideDrawer
785-
buttonText="Checkpoint Questions will be here"
786-
title="">
806+
buttonText="Checkpoint Questions"
807+
title="Deploying with Foundry"
808+
>
809+
{/* <Question question="lesson-6/5-deployment/Q1" />
810+
<Question question="lesson-6/5-deployment/Q2" />
811+
<Question question="lesson-6/5-deployment/Q3" />
812+
<Question question="lesson-6/5-deployment/Q4" />
813+
<Question question="lesson-6/5-deployment/Q5" /> */}
787814
</SideDrawer>
788815

789816
## Querying the Block Explorer
790817

791818
You can go into [Sepolia Etherscan](https://sepolia.etherscan.io/) block
792-
explorer and search for this address that the command returned to check out your
819+
explorer and search for the address that the command returned to check out your
793820
very own newly deployed smart contract!
794821

795822
![ERC20-etherscan](/assets/lessons/6/ERC20-etherscan.png)
796823

797-
If you got to verify it, it also gives you a link to see your contract on the
798-
block explorer. In our case, it's the last line the _Submitted contract for
799-
verification_ section:
800-
[Sepolia Etherscan](https://sepolia.etherscan.io/address/0xce68ed7aed9a1c6c185f2b8b576e7cbd7bf5daaf)
801-
**and** you get to see the code for the contract and all its libraries right
824+
If you got to verify it, you will also get a link to see your contract on the
825+
block explorer. In our case, it's the last line of the _Submitted contract for
826+
verification_ section of the terminal output
827+
[Sepolia Etherscan](https://sepolia.etherscan.io/address/0xec870005029ed5595f146f6aaae699b442065b72).
828+
**And** you get to see the code for the contract and all its libraries right
802829
there in the tab named _Contract_ with the green checkmark.
803830

804831
If you scroll down, you'll see our code. It was the first file of the set for
@@ -815,15 +842,13 @@ searching for the `balanceOf` function:
815842
![ERC20-balanceOf](/assets/lessons/6/ERC20-balanceOf.png)
816843

817844
Copy and paste your wallet's address - the one you used to deploy the contract,
818-
and click Query. You should have as many wei as you passed to the constructor
845+
and click *Query*. You should have as many wei as you passed to the constructor
819846
when deploying. In my case it was 1000000000000000000000 wei and since we left
820847
our decimals in 18, that would be exactly 1000 MTK.
821848

822849
![ERC20-1000MTK](/assets/lessons/6/ERC20-1000MTK.png)
823850

824851

825-
### 😊 FINAL QUIZ 😊
826-
827852
## Invite your frens!
828853

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

0 commit comments

Comments
 (0)