Skip to content

Commit 3727f01

Browse files
committed
Homogenise punctuation + delete personal notes and pointers
1 parent 958fc91 commit 3727f01

File tree

1 file changed

+30
-33
lines changed
  • pages/lessons/projects

1 file changed

+30
-33
lines changed

pages/lessons/projects/3.mdx

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ In the previous lesson, we talked about NFTs and their use cases. Unlike traditi
6363
- an IDE
6464
- optional decentralized storage accounts
6565
- a web3 wallet for testing
66-
- some test ETH
66+
- some test MATIC
6767
- an API key from an RPC provider.
6868

6969
We will guide you through each step, ensuring a fun and comprehensive learning experience. Let's get started on this exciting journey into the world of tiered NFTs, and unleash the endless possibilities they hold!
@@ -234,7 +234,7 @@ contract TierNFT is ERC721 {
234234
235235
### Add Tiers
236236
237-
Next, to make our code neat and easily readable, just before the contract declaration add the tier Name and Value state variables, and assign their values, where each one represents a service subscription. Note that we assign the `constant` keyword, which is what it sounds like, meaning the values won't change, which also cuts down a lot on gas costs. Always good to know, but we'll go into **gas optimisation** for you in a future lesson.
237+
Next, to make our code neat and easily readable, just before the contract declaration add the tier *NAME* and *VALUE* state variables, and assign their values, where each one represents a service subscription. Note that we assign the `constant` keyword, which is what it sounds like, meaning the values won't change, which also cuts down a lot on gas costs. Always good to know, but we'll go into **gas optimisation** for you in a future lesson.
238238
239239
```solidity
240240
// SPDX-License-Identifier: MIT
@@ -302,8 +302,8 @@ The mint function selects tiers based on the amount of native token it receives
302302

303303
The `require` statement is a simple and powerful built-in function of Solidity you'll be using a lot in the future. It checks if the 1st parameter is true or false. On true, it does nothing, allowing execution to continue normally, but on false it throws an exception that reverts everything we modified in the transaction. In our case, if we send the function zero token value, it will **revert** with a "Not enough value for the minimum Tier" message, and stop executing. Otherwise we can select the tier we want..... as long as we can afford it!
304304

305-
We already have two `uint256` variables declared. You might wonder which one is which inside the `tokenTier` mapping? See if you can track through the code and find out.
306-
{/* DEFO NEED A QUESTION OR TWO ON THIS - TO GET THAT ANSWER! AND ALSO TO CHECK ON STATE AND LOCAL VARIABLES e.g. `tierId` is declared with `0`. */}
305+
We already have two `uint256` variables declared. You might wonder which is the *key* and which the *value* inside the `tokenTier` mapping? See if you can track through the code and find out.
306+
307307

308308
<br/>
309309
<details>
@@ -372,11 +372,9 @@ import "@openzeppelin/contracts/utils/Base64.sol";
372372
import "@openzeppelin/contracts/utils/Strings.sol";
373373
````
374374
375-
Next, we import `Base64.sol` which encodes the tokenURI so it can return a JSON file needed for the tier NFTs.
376-
377-
Remember how we talked about this token ID at the end of the URI? `Strings.sol` will write it as a string inside the JSON file. Go ahead and import the magic of these two files to your contract.
375+
Next, we import `Base64.sol` which encodes the tokenURI so it can return a JSON file needed for the tier NFTs. And how do we add this token ID at the end of the URI? `Strings.sol` will write it as a string inside the JSON file. Go ahead and import the magic of these two files to your contract.
378376
379-
For this lesson we won’t be creating a separate JSON file. We will actually code it into the contract. Nifty, eh?
377+
For this lesson we won’t be creating a separate JSON file. We will actually code it into the contract! Nifty, eh?
380378
381379
```solidity
382380
// mint function part of the code...
@@ -421,7 +419,7 @@ Let’s stop to break it down and examine it a little.
421419
- `imageSVG` is a placeholder for our image, and we will deal with it a bit later.
422420
- `Base64.encode` is for encoding the JSON into Base64, so browsers can translate
423421
it into a file much in the same way as a file attached to an email.
424-
- `string( abi.encodePacked () )` concatenates (joins together) the string in a similar way to in our *Getting Started...* lesson.
422+
- `string( abi.encodePacked () )` concatenates the string.
425423

426424
This is the JSON format of our metadata:
427425

@@ -432,7 +430,7 @@ This is the JSON format of our metadata:
432430
'"}'
433431
```
434432

435-
The part `data:image/svg+xml;base64` tells the browser that the code after the comma is a string of text written in Base64, so the browser
433+
The `data:image/svg+xml;base64` part tells the browser that the code after the comma is a string of text written in Base64, so the browser
436434
can decode it back into our SVG file format. For example, if our
437435
collection `TierNFT`, and the TokenID were `3`, our JSON would end up look
438436
something like this:
@@ -550,7 +548,7 @@ string memory tierName = tokenTier[tokenId] == 2
550548
// string memory imageSVG = string(...
551549
```
552550

553-
- `tierName` will store the type of tierNFT we are getting.
551+
- `tierName` will store the type of tierNFT we are getting. Its variable declaration with the series of `?` and `:` following it is a *ternary operator*, another type of *conditional* to check and assign the appropriate tier name based on the value of `tokenTier[tokenId]`. Is it *2*? Assign *TIER_NAME_2*, etc.
554552
- `imageSVG` is to create an SVG image with the corresponding tier type inside it.
555553

556554
For marketplaces to recognize our NFT assets, we need to add some JSON attributes. We
@@ -850,7 +848,7 @@ main().catch((error) => {
850848
- With `const COLLECTION_NAME = "TierNFT"` and
851849
`const COLLECTION_SYMBOL = "Tier"` - we define the *name* and *symbol* to pass to the constructor for the deployment.
852850
- `hre.ethers.getContractFactory(CONTRACT_NAME)` - this asks Hardhat Runtime
853-
Environment to get us a contract factory for our contract specified by `CONTRACT_NAME`. A contract factory is a template that allows us to deploy instances of that contract.
851+
Environment to get us a contract factory for our contract specified by `CONTRACT_NAME`. A contract factory is a template that allows us to deploy instances of that contract, which allows many advantages.
854852
- `contractFactory.deploy` - we are asking the contract factory to deploy an instance of our
855853
contract. This is the deploy transaction!
856854
- `COLLECTION_NAME, COLLECTION_SYMBOL` - these are the parameters for our
@@ -884,7 +882,7 @@ module.exports = {
884882

885883

886884

887-
Do you remember in *Build a Basic NFT* we looked at Ethereum RPC (remote procedure call) node providers? What we are doing is adding the RPC and network configuration to the config file. This will let you, as the deployer, connect **your** wallet to the testnet. Now we need to add some testnet tokens, so we can actually **pay** for the deployment of the contract!
885+
Do you remember in *Build a Basic NFT* we looked at Ethereum RPC (remote procedure call) node providers? What we are doing is adding the RPC and network configuration to the *config file*. This will let you, as the deployer, connect **your** wallet to the testnet. Now we need to add some testnet tokens, so we can actually **pay** for the deployment of the contract!
888886

889887
### Adding the testnet network
890888

@@ -906,16 +904,14 @@ performance, fix bugs and other network failures without having to worry about b
906904
We get testnet tokens from faucets. A faucet is a website, which on request, will **drip** a small amount of testnet tokens onto your address, and sometimes require completion of small tasks before doing so.
907905
some testnet on the wallets.
908906
Note: Testnet and mainnet are separate networks. You can't for example send tokens from a testnet to a mainnet. Let's head over and get some on this
909-
[website](https://faucet.paradigm.xyz/).
907+
[website](https://faucet.paradigm.xyz/). If you complete the required tasks, you can get tokens for multiple testnets.
910908

911909
![3_faucet.png](/assets/lessons/3/3_faucet.png)
912910

913-
If you complete the required tasks, you can get tokens for multiple testnets.
914-
911+
### Personal Security
912+
Take your time to understand the *good practices* in this section. Before we deploy, we need to add a `.env` file to our root folder to make sure we are **not pushing and therefore exposing our private keys in public repositories**.
915913

916-
Before we deploy, we need to add a `.env` file to our root folder to make sure we are **not pushing and therefore exposing our private keys in public repositories**.
917-
918-
For your wallet's private key, the most sensitive data of the project, you need to open Metamask. Click on the three dots next to your Account Name, and then on Account Details, click on Export Private Key. It will ask for your Metamask password, the one you use to log in to your wallet each session, not your seed phrase. It also shows you a
914+
For your wallet's private key, the most sensitive data of the project, you need to open Metamask. Click on the three dots next to your *Account Name*, and then on *Account Details*, click on *Export Private Key*. It will ask for your Metamask password, the one you use to log in to your wallet each session, not your seed phrase. It also shows you a
919915
notice so you know that you are entering the *danger zone*. Confirm and you'll be able to copy your private key. Add your private key into the `.env` file like so:
920916

921917
```bash
@@ -939,9 +935,9 @@ This takes care of loading our environment variables from the `.env` file, so we
939935
don’t have to store sensitive information, such as private keys, to standard
940936
configuration files, which may need uploaded to a project's repo.
941937

942-
Remember to always **protect your private keys, and your recovery seed phrases** to keep your wallet safe and unwanted guests out.
938+
Remember to always **protect your private keys, and your recovery seed phrases** to keep your wallet safe and **unwanted guests out**.
943939

944-
### It’s Time
940+
### It’s Time . . . .
945941

946942
We will deploy our smart contract by using this command:
947943

@@ -953,7 +949,7 @@ We specify the network where we want the contract to be deployed using the --net
953949

954950
![4_deploy.png](/assets/lessons/3/4_deploy.png)
955951

956-
**Woohoo!** Finally we deployed our contract! And a contract address, which we will need in a bit.
952+
**Woohoo!** Finally we deployed our contract! And got a contract address, which we will need in a bit.
957953

958954
### Create a Script to Mint our tier NFTs
959955

@@ -1017,12 +1013,12 @@ main().catch((error) => {
10171013
Hardhat to use the contract addresss we just deployed to the testnet.
10181014
- `let txn = await contract.mint(...` is calling the mint function.
10191015
- `value: hre.ethers.utils.parseEther(VALUE_TIER_0)` - defines the value that we
1020-
want to send to the mint function. This defines which Tier we get.
1021-
- `ethers.utils.parseEther` - here we use Ethers to translate the value into wei i.e. multiply it with 10\*\*18
1016+
want to send to the mint function. This defines which *Tier* we get.
1017+
- `ethers.utils.parseEther` - here we use *Ethers* to translate the value into wei i.e. multiply it with 10\*\*18
10221018
- `let totalSupply = await contract.totalSupply()` - is calling the
10231019
`totalSupply()` function to check if the 3 NFTs minted correctly.
10241020

1025-
### Let’s MINT
1021+
### Let’s mint!
10261022

10271023
To mint our tier NFTs we will run the following command.
10281024

@@ -1036,26 +1032,27 @@ If we look at our terminal we will see something like this.
10361032

10371033
You have just minted 3 NFTs - with different Tiers!
10381034

1039-
Let’s go ahead and view them on the Opensea marketplace. This could take a few
1040-
minutes to appear, don't panic. You can search in
1035+
Let’s go ahead and view them on the Opensea marketplace. They could take a few
1036+
minutes to appear, no need to panic 😎 You can search in
10411037
[https://testnets.opensea.io/](https://testnets.opensea.io/) for your newly created collection
10421038
with your contract address, or with the name that you chose.
10431039
<br/>
10441040
![6_tierNFTs.png](/assets/lessons/3/6_tierNFTs.png)
10451041

10461042
Of course we already have a couple up there, but you will be able to
1047-
view the three NFTs of your own, which you so diligently minted. You're an artist!
1048-
Now let's see what you have learned along the way with a little quiz.
1043+
view the three NFTs of your own, which you so diligently minted, the artist that you are!
1044+
1045+
😊 Now let's see what you have learned along the way with a little quiz 😉
10491046
<br/><br/>
10501047

10511048
<Quiz quiz="quiz-lesson-3"/>
10521049

10531050
<br/><br/>
10541051
How did you enjoy that? We hope you had fun. And what's next? We're going to bring your
1055-
dev skills to the level - you ain't seen nothin' yet! We're **goin' a testin'** together. Building
1052+
dev skills to the level. You ain't seen nothin' yet - we're going testing together. Building
10561053
culture in web3 is the substrate for the infrastructure we create, and learning to test
1057-
what we build with real awareness is crucial for creating a safe and sustainable environment. We're
1058-
looking forward to seeing you in our *Write Automated Tests for your TierNFT* project next.
1054+
what we build with real awareness, just like anywhere else, is crucial for creating a safe and sustainable environment. So we're
1055+
looking forward to seeing you in our *Write Automated Tests for your TierNFT* project next!
10591056

10601057
In the mean time, jump into the forum and share your experiences with your peers!
10611058

@@ -1066,6 +1063,6 @@ import { ContributorFooter } from '../../../components/mdx/ContributorFooter'
10661063

10671064
<ContributorFooter
10681065
authors={['meowy', '_7i7o', 'piablo']}
1069-
reviewers={['georgemac510', 'piablo']}
1066+
reviewers={['georgemac510']}
10701067
contributors={['mveve']}
10711068
/>

0 commit comments

Comments
 (0)