Skip to content

Commit 0b79dec

Browse files
committed
feat: add 3/4 and 4/4 of checkpoint question sets
1 parent c2d7cc5 commit 0b79dec

File tree

11 files changed

+167
-5
lines changed

11 files changed

+167
-5
lines changed

src/pages/lessons/projects/6.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ Let's break down our changes in the code:
510510

511511
- Added an `import` before our contract definition
512512
- Inherited `AccessControl` in our contract definition
513-
- Created a `bytes32 public constant` variable for the minter role
513+
- Created a `bytes32 public constant` variable for the minter role. The irreversible `keccak256` hash ensures security and prevents unintended changes to the role. As a fixed-size of 32 bytes, it is efficiently storable, and will incur minimal gas consumption.
514514
- Inside our `constructor`:
515515
- Granted the `DEFAULT_ADMIN_ROLE` to the contract deployer to be able to grant
516516
roles to others. Our contract inherits this by default from Access Control as the starting point for all admin roles.
@@ -621,7 +621,7 @@ to ask our community for help by explaining your error, the console output and
621621
your configuration (OS, version, Foundry and Solidity version, etc.)
622622

623623

624-
{/* <SideDrawer
624+
<SideDrawer
625625
buttonText="Checkpoint Questions"
626626
title="Defining permissions for use of our contract"
627627
>
@@ -630,7 +630,7 @@ your configuration (OS, version, Foundry and Solidity version, etc.)
630630
<Question question="lesson-6/4-define-roles/Q3" />
631631
<Question question="lesson-6/4-define-roles/Q4" />
632632
<Question question="lesson-6/4-define-roles/Q5" />
633-
</SideDrawer> */}
633+
</SideDrawer>
634634

635635
### Register your house in the Real Estate Register
636636

@@ -802,7 +802,7 @@ the tool tells us the address of the deployed contract:
802802
`0xec870005029ED5595F146f6AAAe699b442065b72`.
803803

804804

805-
{/* <SideDrawer
805+
<SideDrawer
806806
buttonText="Checkpoint Questions"
807807
title="Deploying with Foundry"
808808
>
@@ -811,7 +811,7 @@ the tool tells us the address of the deployed contract:
811811
<Question question="lesson-6/5-deployment/Q3" />
812812
<Question question="lesson-6/5-deployment/Q4" />
813813
<Question question="lesson-6/5-deployment/Q5" />
814-
</SideDrawer> */}
814+
</SideDrawer>
815815

816816
## Querying the Block Explorer
817817

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"question": "We created an `address` variable to store our `MINTER_ROLE`.",
3+
"options": [
4+
{
5+
"answer": "False",
6+
"correct": true
7+
},
8+
{
9+
"answer": "True"
10+
}
11+
]
12+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "In the constructor, which role is granted to give the contract deployer operational control?",
3+
"options": [
4+
{
5+
"answer": "`DEPLOYER_ROLE`"
6+
},
7+
{
8+
"answer": "`DEFAULT_ADMIN_ROLE`",
9+
"correct": true
10+
},
11+
{
12+
"answer": "`TOKEN_ADMIN_ROLE`"
13+
},
14+
{
15+
"answer": "`CONTRACT_OWNER_ADMIN`"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "What happens if an address without the `MINTER_ROLE` tries to call the `mint()` function?",
3+
"options": [
4+
{
5+
"answer": "The function will execute without any issue"
6+
},
7+
{
8+
"answer": "The contract will self-destruct"
9+
},
10+
{
11+
"answer": "The contract will mint tokens to that address"
12+
},
13+
{
14+
"answer": "The transaction will revert, and the function will not execute",
15+
"correct": true
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "Why do we use the keccak256 hash for the MINTER_ROLE variable?",
3+
"options": [
4+
{
5+
"answer": "To fetch and display gas consumption for the role"
6+
},
7+
{
8+
"answer": "To fetch the total supply of tokens minted"
9+
},
10+
{
11+
"answer": " To prevent unintended changes to the role",
12+
"correct": true
13+
},
14+
{
15+
"answer": "To allow burning tokens"
16+
}
17+
]
18+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"question": "After running `forge build` on our coded contract for the first time, the compiler will compile:",
3+
"options": [
4+
{
5+
"answer": "MyToken.sol"
6+
},
7+
{
8+
"answer": "multiple files",
9+
"correct": true
10+
}
11+
]
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"question": "What is the purpose of the `cast` command?",
3+
"options": [
4+
{
5+
"answer": "To deploy the contract"
6+
},
7+
{
8+
"answer": "To audition for a web3 AMA"
9+
},
10+
{
11+
"answer": "To convert values to wei",
12+
"correct": true
13+
}
14+
]
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"question": "Where can you find the address of the deployed contract after deployment?",
3+
"options": [
4+
{
5+
"answer": "In the `.env` file"
6+
},
7+
{
8+
"answer": "In the `cast` output"
9+
},
10+
{
11+
"answer": "In the deployment command",
12+
"correct": true
13+
}
14+
]
15+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "What does the `.env` file in our project contain?",
3+
"options": [
4+
{
5+
"answer": "Solidity code snippets"
6+
},
7+
{
8+
"answer": "URL for Etherscan"
9+
},
10+
{
11+
"answer": "Environment variables",
12+
"correct": true
13+
},
14+
{
15+
"answer": "All of the above"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "How can you load values from the `.env` file into environment variables in a bash-compatible shell?",
3+
"options": [
4+
{
5+
"answer": "`loadenv`"
6+
},
7+
{
8+
"answer": "You can't"
9+
},
10+
{
11+
"answer": "`export $(grep -v '^#' .env | xargs)`",
12+
"correct": true
13+
},
14+
{
15+
"answer": "`source.env`"
16+
}
17+
]
18+
}

0 commit comments

Comments
 (0)