Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typos #282

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ contract OurTokenTest is StdCheats, Test {

I'll caution you against blindly copying and pasting AI responses and to use what's generated intelligently. Some things will make more sense for your situation that others.

When you've implemented your AI suggestsion, run `forge test -vvvv` and see what happens!
When you've implemented your AI suggestion, run `forge test -vvvv` and see what happens!

### Wrap Up

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Let's look at how we can create our own simple SVG, right in our IDE. Create the
```

> ❗ **IMPORTANT**
> You will likely need to download a SVG preview extention to view the SVG in your IDE. I recommend trying [**SVG Preview**](https://marketplace.visualstudio.com/items?itemName=SimonSiefke.svg-preview).
> You will likely need to download a SVG preview extension to view the SVG in your IDE. I recommend trying [**SVG Preview**](https://marketplace.visualstudio.com/items?itemName=SimonSiefke.svg-preview).

::image{src='/foundry-nfts/11-what-is-svg/what-is-svg2.png' style='width: 100%; height: auto;'}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Follow along the course with this video._

### SVG NFT Deploy Script

In this lesson, we'll jump right into creating the script to deploy our MoodNFT collection. We'll look at how this can be used to upgrade our tests, making them more dynamic and we'll discuss the value of integration tesing.
In this lesson, we'll jump right into creating the script to deploy our MoodNFT collection. We'll look at how this can be used to upgrade our tests, making them more dynamic and we'll discuss the value of integration testing.

To begin, we'll need to create the file `script/DeployMoodNft.s.sol` and fill it with our script boilerplate.

Expand All @@ -24,7 +24,7 @@ contract DeployMoodNft is Script {
}
```

Looks great! Now we should consider how we're mention to deploy MoodNft.sol. We know that the constructor arguments for this contract take a sadSvgImagUri and a happySvgImageUri, so much like we did in `MoodNftTest.t.sol`, we _could_ hardcode these values. A better approach however may be to write our deploy script to read this data itself from our workspace. Our script can even do all the encoding for us.
Looks great! Now we should consider how we're mention to deploy MoodNft.sol. We know that the constructor arguments for this contract take a sadSvgImageUri and a happySvgImageUri, so much like we did in `MoodNftTest.t.sol`, we _could_ hardcode these values. A better approach however may be to write our deploy script to read this data itself from our workspace. Our script can even do all the encoding for us.

Let's start with creating this encoding function.

Expand Down Expand Up @@ -56,7 +56,7 @@ contract DeployMoodNft is Script {
}
```

The above function is taking the svg string parameter, encoding it with the OpenZeppeling Base64.encode function, and then prepends the encoded value with our baseURL. Great job!
The above function is taking the svg string parameter, encoding it with the OpenZeppelin Base64.encode function, and then prepends the encoded value with our baseURL. Great job!

> ❗ **PROTIP**
> You can replace `abi.encodePacked` with the more up-to-date `string.concat`!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ To get started with Filecoin, try deploying a smart contract to FVM, or use the

With this brief aside complete, we have one major concept I want to add context to in this lesson. Repeatedly we've been using `abi.encode` and `abi.encodePacked` to concatenate strings basically. It's about time we learnt what's actually going on under-the-hood.

In the next lesson we're gunna get a little more low-level. I'm sure you're ready for it.
In the next lesson we're gonna get a little more low-level. I'm sure you're ready for it.

See you soon!
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Fungible tokens, like ERC20s are similar to a dollar. Any single dollar can be s

### What's an NFT do?

Because of their unique nature, NFTs have been widely adopted as a medium for art and a means to trade and collect digital art. Sometimes this gets a bad rap, but NFTs are only a standard on which a tonne of use case functionality can be built. Some protocol turn them into representations of game assets, or into tradeble metaverse items, sometimes they're used as means to keep record, or grant access to services or events.
Because of their unique nature, NFTs have been widely adopted as a medium for art and a means to trade and collect digital art. Sometimes this gets a bad rap, but NFTs are only a standard on which a tonne of use case functionality can be built. Some protocol turn them into representations of game assets, or into tradable metaverse items, sometimes they're used as means to keep record, or grant access to services or events.

The use cases of NFTs grow each day, but the easiest way to think of them currently is as unique digital assets, or unique digital art.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ contract CallAnything {
}
```

One last thing I want to point out is that we're not limited to this kind of interaction. Through this low-level calling method, two contracts are able to interact without possessing all the information associated with eachother. Consider this second contract `CallFunctionWithoutContract`.
One last thing I want to point out is that we're not limited to this kind of interaction. Through this low-level calling method, two contracts are able to interact without possessing all the information associated with each other. Consider this second contract `CallFunctionWithoutContract`.

CallFunctionWithoutContract

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ In a [**previous lesson**](https://updraft.cyfrin.io/courses/advanced-foundry/ho
"value": "Headband"
}
],
"description": "A collection 8888 Cute Chubby Pudgy Penquins sliding around on the freezing ETH blockchain.",
"description": "A collection 8888 Cute Chubby Pudgy Penguins sliding around on the freezing ETH blockchain.",
"image": "ipfs://QmNf1UsmdGaMbpatQ6toXSkzDpizaGmC9zfunCyoz1enD5/penguin/420.png",
"name": "Pudgy Penguin #420"
}
Expand All @@ -49,9 +49,9 @@ When this course was originally filmed, the Pudgy Penguins collection had been u
"https://ipfs.io/ipfs/QmNf1UsmdGaMbpatQ6toXSkzDpizaGmC9zfunCyoz1enD5/penguin/420.png";
```

This works, and is often leveraged due to browser compatibily with IPFS, but it's worth noting that this is pointing to a centralized server. If that server goes down, the image data will be unretrievable via the tokenURI call!
This works, and is often leveraged due to browser compatibility with IPFS, but it's worth noting that this is pointing to a centralized server. If that server goes down, the image data will be unretrievable via the tokenURI call!

A more decentralized way to retrieve the image data is by pointing to the IPFS netwok itself.
A more decentralized way to retrieve the image data is by pointing to the IPFS network itself.

```js
"ipfs://QmNf1UsmdGaMbpatQ6toXSkzDpizaGmC9zfunCyoz1enD5/penguin/420.png";
Expand Down Expand Up @@ -84,7 +84,7 @@ If you view this in your browser or through the IPFS Desktop App, you should see
}
```

Now, we could just paste the about tokenURI as a return value of our tokenUri function, but this would mint every Doggie identical to eachother. Let's spice things up a little bit and allow the user to choose what their NFT looks like. We'll do this by allowing the user to pass a tokenUri to the mint function and mapping this URI to their minted tokenId.
Now, we could just paste the about tokenURI as a return value of our tokenUri function, but this would mint every Doggie identical to each other. Let's spice things up a little bit and allow the user to choose what their NFT looks like. We'll do this by allowing the user to pass a tokenUri to the mint function and mapping this URI to their minted tokenId.

```js
contract BasicNFT is ERC721 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ contract BasicNftTest is Test {
basicNft.mintNft(PUG);

assert(basicNft.balanceOf(USER) == 1);
assert(keccask256(abi.encodePacked(PUG)) == keccak256(abi.encodePacked(basicNft.tokenURI(0))));
assert(keccak256(abi.encodePacked(PUG)) == keccak256(abi.encodePacked(basicNft.tokenURI(0))));
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Alright, with our tests passing we're going to want a way to interact with our c
```js
// SPDX-License-Identifier: MIT

pragme solidity ^0.8.18;
pragma solidity ^0.8.18;

import {Script} from "forge-std/Script.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ So let's do that.

Before we get started, I'll mention you don't _have_ to do this yourself. This process will cost testnet funds, so it's fine to just follow along if needed. An alternative way to view your NFT would be to import your Anvil chain into Metamask and continue to use your local blockchain. If that works for you, great! Otherwise, let's continue with deploying this on an actual testnet.

We'll be leveraging a Makefile for this again, I'll just be copying mine from the GitHub repo associated with this course, I've also provided it below for your conveninence.
We'll be leveraging a Makefile for this again, I'll just be copying mine from the GitHub repo associated with this course, I've also provided it below for your convenience.

Makefile:

Expand Down Expand Up @@ -83,7 +83,7 @@ Assuming our `.env` is ready to go, we should be able to run the following...
> Remember to add the required environment variables if necessary. You should need a `sepolia RPC-URL`, an `account private key` and an `etherscan api key`.

```bash
make deploy ARGS="--netwok sepolia"
make deploy ARGS="--network sepolia"
```

After a brief wait...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ contract DSCEngine is ReentrancyGuard {
return ((uint256(price) * ADDITIONAL_FEED_PRECISION) * amount) / PRECISION;
}

function depositCollaterAndMintDsc() external {}
function depositCollateralAndMintDsc() external {}

function redeemCollateralForDsc() external {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ Alternatively to this, we have static analysis as a tool available to us. In sta
function withdraw() external {
uint256 balance = balances[msg.sender];
require(balance > 0);
(bool successs, ) = msg.sender.call{value:balance}("");
(bool success, ) = msg.sender.call{value:balance}("");
require(success, "Failed to send Ether");
balances[msg.sender] = 0;
}
```

The above withdraw function has a classic reentrancy attack. We know an issue like this arrises from not following the CEI pattern! A static analysis tool like Slither will be able to pick up on this quite easily.
The above withdraw function has a classic reentrancy attack. We know an issue like this arises from not following the CEI pattern! A static analysis tool like Slither will be able to pick up on this quite easily.

::image{src='/foundry-defi/16-defi-leveling-up-testing/defi-leveling-up-testing3.png' style='width: 100%; height: auto;'}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ That's really it, at the end of the day. More accurately put:

::image{src='/foundry-defi/3-defi-stablecoins-but-actually/defi-stablecoins-but-actually1.png' style='width: 100%; height: auto;'}

[**Investopedia**](https://www.investopedia.com/terms/s/stablecoin.asp) describes `stablecoins` as - Cryptocurriencies the value of which is pegged, or tied, to that of another currency, commondity or financial instrument.
[**Investopedia**](https://www.investopedia.com/terms/s/stablecoin.asp) describes `stablecoins` as - Cryptocurrencies the value of which is pegged, or tied, to that of another currency, commodity or financial instrument.

Aaand this is the first place I diverge from conventional media.

Expand Down Expand Up @@ -178,7 +178,7 @@ DAI is:

DAI is one of the most influential DeFi projects ever created.

Effectively how DAI works is, a user deposits some form of crypto collateral, such as ETH, and based on the currect value of that collateral in US Dollars, some value of DAI is minted the user. It's only possible to mint _less_ DAI than the value of collateral a user has deposited. In this way the stablecoin is said to be over-collateralized.
Effectively how DAI works is, a user deposits some form of crypto collateral, such as ETH, and based on the current value of that collateral in US Dollars, some value of DAI is minted the user. It's only possible to mint _less_ DAI than the value of collateral a user has deposited. In this way the stablecoin is said to be over-collateralized.

> ❗ **NOTE**
> DAI also has an annual stability fee on deposited collateral ~2%
Expand Down Expand Up @@ -285,7 +285,7 @@ So, to summarize a bit:

**_Why are stablecoins minted?_**

- Investers like to make leveraged bets.
- Investors like to make leveraged bets.

### Wrap Up

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Alright, with things scoped out a bit, let's dive into writing some code. Start
```js
// SPDX-License-Identifier: MIT

// This is considered an Exogenous, Decentralized, Anchored (pegged), Crypto Collateralized low volitility coin
// This is considered an Exogenous, Decentralized, Anchored (pegged), Crypto Collateralized low volatility coin

// Layout of Contract:
// version
Expand Down Expand Up @@ -115,7 +115,7 @@ libs = ["lib"]
remappings = ["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts"]
```

Rather than importing a standard ERC20 contract, we'll be leveraging the ERC20Burnable extention of this standard. ERC20Burnable includes `burn` functionality for our tokens which will be important when we need to take the asset out of circulation to support stability.
Rather than importing a standard ERC20 contract, we'll be leveraging the ERC20Burnable extension of this standard. ERC20Burnable includes `burn` functionality for our tokens which will be important when we need to take the asset out of circulation to support stability.

```js
// SPDX-License-Identifier: MIT
Expand All @@ -138,7 +138,7 @@ contract DecentralizedStableCoin is ERC20Burnable {
}
```

Because we're inheriting ERC20Burnable, and it inherits ERC20, we needs to satify the standard ERC20 constructor parameters within our contracts constructor. We've set the name `DecentralizedStableCoin` and the symbol `DSC`.
Because we're inheriting ERC20Burnable, and it inherits ERC20, we need to satisfy the standard ERC20 constructor parameters within our contracts constructor. We've set the name `DecentralizedStableCoin` and the symbol `DSC`.

All of the properties of our protocol are going to be governed ultimately by the DSCEngine.sol contract. Functionality like the stability mechanism, including minting and burning, need to be controlled by the DSCEngine to maintain the integrity of the stablecoin.

Expand All @@ -149,7 +149,7 @@ In order to accomplish this, we're going to also inherit `Ownable` with Decentra
> in the constructor. We have to modify our code to account for this when
> running `forge build` so that our project will not error. Like this:
> `constructor(address initialOwner) ERC20("DecentralizedStableCoin", "DSC")
Ownerable(initialOwner) {}`
Ownable(initialOwner) {}`

```js
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Begin with creating a new file, `src/DSCEngine.sol`. I'll bring over my contract
```js
// SPDX-License-Identifier: MIT

// This is considered an Exogenous, Decentralized, Anchored (pegged), Crypto Collateralized low volitility coin
// This is considered an Exogenous, Decentralized, Anchored (pegged), Crypto Collateralized low volatility coin

// Layout of Contract:
// version
Expand Down Expand Up @@ -111,7 +111,7 @@ contract DSCEngine {
///////////////////////////
// External Functions //
///////////////////////////
function depositCollaterAndMintDsc() external {}
function depositCollateralAndMintDsc() external {}

function depositCollateral() external {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ contract DSCEngine is ReentrancyGuard {
}
}

function depositCollaterAndMintDsc() external {}
function depositCollateralAndMintDsc() external {}

function redeemCollateralForDsc() external {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _Follow along the course with this video._

Now that we've a way to deposit collateral, the next logical step would be to mint DSC.

The `mintDsc` function is likely going to be surprisely complex. There are a number of things we'll need to accomplish when minting our stablecoin. Primarily we'll need to check if the account's collateral value supports the amount of `DSC` being minted. To do this we'll need to engage `Chainlink` price feeds, do value conversions and more. Let's get started.
The `mintDsc` function is likely going to be surprisingly complex. There are a number of things we'll need to accomplish when minting our stablecoin. Primarily we'll need to check if the account's collateral value supports the amount of `DSC` being minted. To do this we'll need to engage `Chainlink` price feeds, do value conversions and more. Let's get started.

```js
///////////////////////////
Expand Down Expand Up @@ -475,7 +475,7 @@ contract DSCEngine is ReentrancyGuard {
return ((uint256(price) * ADDITIONAL_FEED_PRECISION) * amount) / PRECISION;
}

function depositCollaterAndMintDsc() external {}
function depositCollateralAndMintDsc() external {}

function redeemCollateralForDsc() external {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ uint256 private constant LIQUIDATION_PRECISION = 100;
uint256 private constant MIN_HEALTH_FACTOR = 1e18;
```

We're ready to put our `_healthFactor` function and our `MIN_HEALTH_FACTOR` constant to work. We can use these to declare a conditional statemment within `_revertIfHealthFactorIsBroken`, which will revert with a custom error if the conditional fails to pass.
We're ready to put our `_healthFactor` function and our `MIN_HEALTH_FACTOR` constant to work. We can use these to declare a conditional statement within `_revertIfHealthFactorIsBroken`, which will revert with a custom error if the conditional fails to pass.

```js
function _revertIfHealthFactorIsBroken(address user) internal view {
Expand Down Expand Up @@ -342,7 +342,7 @@ contract DSCEngine is ReentrancyGuard {
return ((uint256(price) * ADDITIONAL_FEED_PRECISION) * amount) / PRECISION;
}

function depositCollaterAndMintDsc() external {}
function depositCollateralAndMintDsc() external {}

function redeemCollateralForDsc() external {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ contract DSCEngine is ReentrancyGuard {
return ((uint256(price) * ADDITIONAL_FEED_PRECISION) * amount) / PRECISION;
}

function depositCollaterAndMintDsc() external {}
function depositCollateralAndMintDsc() external {}

function redeemCollateralForDsc() external {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Create Claming Script
title: Create Claiming Script
---

_Follow along with the video_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function claim(address account) external {
}
```

However, looping through an array that can grow indefinately can lead to **performance issues** and calling this function. If there are for example, hundreds of claimers, will become cost prohibitive and will cause a Denial Of Service (DOS). Merkle trees will help solving this issue.
However, looping through an array that can grow indefinitely can lead to **performance issues** and calling this function. If there are for example, hundreds of claimers, will become cost prohibitive and will cause a Denial Of Service (DOS). Merkle trees will help solving this issue.

### Merkle Trees and Proofs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ This virtual function is returning the implementation address and showcases the

[**Ethereum Improvement Proposal (now ERC)-1967**](https://eips.ethereum.org/EIPS/eip-1967).

The need to regularly utilize storage to reference things in implementation (specifically the implementation address) led to the desire for EIP-1967: Standard Proxy Storage Slots. This proposal would allocate standardardized slots in storage specifically for use by proxies.
The need to regularly utilize storage to reference things in implementation (specifically the implementation address) led to the desire for EIP-1967: Standard Proxy Storage Slots. This proposal would allocate standardized slots in storage specifically for use by proxies.

In our minimalistic example, we're assigning our \_IMPLEMENTATION_SLOT to a constant value for this purpose.

Expand Down
Loading