Skip to content

Commit 8c8b8d1

Browse files
committed
feat: bundle some loose sentences into paragraphs for easier reading
1 parent 64c4872 commit 8c8b8d1

File tree

1 file changed

+7
-17
lines changed
  • src/pages/lessons/projects

1 file changed

+7
-17
lines changed

src/pages/lessons/projects/6.mdx

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ them to the `msg.sender`'s balance.
402402

403403
We now have a full structure, with a roof to shelter us from the weather. The
404404
only problem is that we didn't create any openings for anyone to enter or leave
405-
the house.
406-
407-
We can think of entering the house as `minting` new tokens or increasing the
405+
the house. We can think of entering the house as `minting` new tokens or increasing the
408406
total supply, and leaving the house as `burning` tokens or decreasing the total
409407
supply. But these doors don't exist in our contract just yet.
410408

@@ -441,9 +439,7 @@ contract MyToken is ERC20 {
441439
```
442440

443441
When we define our `mint` function, we decide who will be the receiver of said
444-
new tokens.
445-
446-
For the `burn` function on the other hand, we are **only** letting holders burn
442+
new tokens. For the `burn` function on the other hand, we are **only** letting holders burn
447443
their own tokens by using `msg.sender` as the address to call the internal
448444
`_burn` function.
449445

@@ -458,21 +454,15 @@ We have now created doors to our house, but we haven't put locks in them!
458454
## Lock the Door!
459455

460456
In our present state, our functions for minting and burning can be called by any
461-
address.
462-
463-
That's ok for `burn` since people can only burn their own tokens (or their
464-
approved allowances), but we don't want anyone to `mint` tokens and increase the
457+
address. That's ok for `burn` since people can only burn their own tokens, or their
458+
approved allowances. But we don't want anyone to `mint` tokens and increase the
465459
total supply of our new token.
466460

467461
To be able to limit the access to minting tokens, we are going to use a pattern
468462
that OpenZeppelin calls AccessControl to give granular access to functionality
469463
within our code. For that we will inherit yet another great contract from the OZ
470-
library.
471-
472-
We can basically define **roles** and assign or un-assign them to any address we
473-
need.
474-
475-
In our case, we will only create a `MINTER_ROLE` to allow access to our `mint`
464+
library. It basically lets us define **roles** and assign or un-assign them to any address we
465+
need. In our case, we will only create a `MINTER_ROLE` to allow access to our `mint`
476466
function:
477467

478468
```solidity
@@ -511,7 +501,7 @@ Let's break down our changes in the code:
511501
- Created a `bytes32 public constant` variable for the minter role
512502
- Inside our `constructor`:
513503
- Granted the `DEFAULT_ADMIN_ROLE` to contract deployer to be able to grant
514-
roles to others
504+
roles to others. Our contract inherits this by default from Access Control as the starting point for all admin roles.
515505
{/*is a part of Access control by default - i.e. it is inherited starting admim role for all roles */}
516506
- Granted the `MINTER_ROLE` to contract deployer to be able to mint tokens
517507
- Added the modifier `onlyRole(MINTER_ROLE)` to the `mint` function to restrict

0 commit comments

Comments
 (0)