cyfrin / foundry-full-course-f23 Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
In Lesson 6,
cast wallet import your-account-name --interactive
Enter private key:
Enter password:
`your-account-name` keystore was saved successfully. Address: address-corresponding-to-private-key
After following the above steps, below step has to be followed
forge script <script> --rpc-url <rpc_url> --account <account_name> --sender <address> --broadcast
This step is missing.
Lesson 6
No response
Windows
when i try to call "retreive()" function this error appears
' ' '
(code: 3, message: execution reverted, data: Some(String("0x")))
' ' '
I will budget $5,000 to the top 20 promotions of this course ($250 in ETH each!).
The goal of this is to get developers up to speed on web3. If we are going to get web3 to retail, we need more developers like yourself taking courses like this. So this is your chance to join the fight and make some dope content!
Wait till the course launches. All entries posted here before the Video is up are disqualified.
Comment on this issue with a link to your
In the media (not the comment on this issue), you must include an ARBITRUM address, which I will send at the end of the Judging period. (Sometime in July or August).
I will NOT send money to smart contract-based accounts (It MUST be an EOA).
This issue will be closed July 6th, 2023. That will be the last day to post!
I will send the payments after the judging period in ETH on ARBITRUM. I will not be responsible for it you mess up sending the address. Sorry.
July 6th 2023 I'll start judging, and I will award prizes to the following different categories:
An entry can only win on one of the categories.
I will give out at least 2 awards to each of the following mediums:
So yes, if you have a banger tweet, that's eligible.
Sadly, I don't have time to coordinate a DAO around this, so judging will be 100% my discretion. If you don't like my judging, too bad ๐
Lesson 4
No response
None
Line 40 of the 4-Lesson.sol challenge code contains a typo in the "10e10" number:
actualPrice = actualPrice * 10e10;
Should be "1e10":
actualPrice = actualPrice * 1e10;
To pass the challenge, add an extra zero to your answer.
For examlpe, if getPrice() returns:
1637320000000000000000, you need to paste this number plus 0, like this:
16373200000000000000000
Lesson 12
https://youtu.be/wUjYK5gwNZs?t=8205
Windows
Everyone can call redeemCollateral and redeemCollateralForDsc with address that is not allowed. This vulnerability may result in a critical error, specifically: [FAIL. Reason: panic: arithmetic underflow or overflow (0x11)]
. This error occurs when attempting to subtract an amount from zero in the following code snippet: s_collateralDeposited[from][tokenCollateralAddress] -= amountCollateral;
Manual Review
Include isAllowedToken(tokenCollateralAddress) modifier. This will revert if invalid collateral address is passed.
function redeemCollateralForDsc(address tokenCollateralAddress, uint256 amountCollateral, uint256 amountDscToBurn)
external
moreThanZero(amountCollateral)
+ isAllowedToken(tokenCollateralAddress)
{
_burnDsc(amountDscToBurn, msg.sender, msg.sender);
_redeemCollateral(tokenCollateralAddress, amountCollateral, msg.sender, msg.sender);
revertIfHealthFactorIsBroken(msg.sender);
}
function redeemCollateral(address tokenCollateralAddress, uint256 amountCollateral)
external
moreThanZero(amountCollateral)
+ isAllowedToken(tokenCollateralAddress)
nonReentrant
{
_redeemCollateral(tokenCollateralAddress, amountCollateral, msg.sender, msg.sender);
revertIfHealthFactorIsBroken(msg.sender);
}
Lesson 7
No response
None
Hello,
I'm having a problem with the following line:
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
Source "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found: File not found. Searched the following locations: "".solidity(6275)
If I use forge build everything works as expected, but vscode "doesn't know" the remapping configuration hence I get the error.
VSCode doesn't show an error if I use:
import {AggregatorV3Interface} from "foundry-fund-me-f24/lib/chainlink-brownie-contracts/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
but then Foundy shows an error.
Is there a way to solve this?
I am trying to compile my code and i am getting this error message. Please, I need help with this.
ParserError: Expected primary expression.
--> FundMe.sol:25:2:
|
Originally posted by @Goodybag1 in #1210
It would be great if someone could:
.srt
fileThen I will add it to YouTube
When I type forge test --fork-url $SEPOLIA_RPC_URL
to test all the contract. It shows me this error message:
[FAIL. Reason: Setup failed: Custom Error d8a3fb52:(0x8f478e8C52EccD5012a0C8B112766bAD5d67C55F)]
I passed the deployerKey to vm.startBrodcast() than got this error. It seems that the RaffleTest doesn't setup, before testing !
"Seems like Windows and Ubuntu WSL have different opinions on 'forge --version'. On Windows, it's all 'I got this,' but in WSL, it's like 'What command?'. ๐ Any tips for syncing up these two worlds or should I just stick to the 'normal' terminal in VS Code? ๐ค
Lesson 6
https://www.youtube.com/watch?v=umepbfKp5rI&t=27765s
We can use interactive to enter private key when we are running scripts, instead of --interactive
/-i
, we can use --interactives <num>
/-i <num>
, and specify the sender address with --sender
For example :
forge script script/DeploySimpleStorage.s.sol --rpc-url http://127.0.0.1:8545 --broadcast --sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -i 1
I fixed some typos and improved the text in the README.md. Opening a PR for it!
I have a subtitles
folder where I will put the "raw" AI-generated subtitles. If someone would like to edit them, I will then upload them to YouTube so others can watch and understand easier!
When trying to follow along the video there's no AggregatorV3Interface.sol file in the chainlink repo. You can find it here (https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol) instead (not in v08 though) but I'm not sure if they're the same.
Interfaces
โจ๏ธ (4:37:08) | Interfaces
For reference - ChainLink Interface's Repo
Lesson 12
https://youtu.be/wUjYK5gwNZs?t=17213
In the end of Lesson 12 I don't see any QR codes for the usual challenge at the end of every Lesson. I thought that this was intentionally like this.
On the contrary, I found that there is a Challenge 12 on:
Sepolia: https://sepolia.etherscan.io/address/0xe5760847db2f10a74fc575b4803df5fe129811c1#code
Arbitrum: https://arbiscan.io/address/0x3dbbf2f9acfb9aac8e0b31563dd75a2d69148d64#code
So I understand that QR code is missing in the end of Lesson 12 and should be added in an update.
Lesson 3
https://youtu.be/yPzY4ifyGjY?t=8
^ from lesson 3
^ from lesson 2 (same intro)
its weird
hi i have issu whith this command in my terminal
forge create SimpleStorage --rpc-url http://127.0.0.1:7545
--interactive
when i want to run this command i got this error:
forge create SimpleStorage --rpc-url http://127.0.0.1:7545
--interactive
[โ ข] Compiling...
[โ ] Compiling 1 files with 0.8.19
[โ ฐ] Solc 0.8.19 finished in 81.31ms
Compiler run successful!
Error:
Error accessing local wallet. Did you set a private key, mnemonic or keystore?
Run `cast send --help` or `forge create --help` and use the corresponding CLI
flag to set your key via:
--private-key, --mnemonic-path, --aws, --interactive, --trezor or --ledger.
Alternatively, if you're using a local node with unlocked accounts,
use the --unlocked flag and either set the `ETH_FROM` environment variable to the address
of the unlocked account you want to use, or provide the --from flag with the address directly.
zsh: command not found: --interactive
how can i fix this? please help
Lesson 9
https://www.youtube.com/watch?v=sas02qSFZ74&t=14654s
In video, Lesson 9, Chapter Chainlink VRF Recap where you explain modulo (timestamp 4:04:27),
you mention some modulo calculations that are wrong:
2 % 3 = 1 // This is WRONG! Correct result is 2
2 % 6 = 0 // This is WRONG! Correct result is 2
2 % 7 = 1 // This is WRONG! Correct result is 2
I assume you wanted to say:
3 % 2 = 1
6 % 2 = 0
7 % 2 = 1
Originally posted by Meherabhossen January 4, 2024
im getting error on this
[โ ] Compiling...
No files changed, compilation skipped
Error:
error sending request for url (http://127.0.0.1:7545/): error trying to connect: tcp connect error: Connection refused (os error 111)
Context:
- Error #0: error trying to connect: tcp connect error: Connection refused (os error 111)
- Error #1: tcp connect error: Connection refused (os error 111)
- Error #2: Connection refused (os error 111)
this is my command
forge create SimpleStorage --rpc-url http://127.0.0.1:7545 --interactive
```</div>
Lesson 6
https://youtu.be/sas02qSFZ74?t=1640
Others have been using -mt and I have been using --match-test ... May want to inject a quick blurb in the video that it's now -mt for "match test".
mint:
@forge script script/Interactions.s.sol:MintBasicNft $(NETWORK_ARGS)
i was using this where
ifeq ($(findstring --network sepolia,$(ARGS)),--network sepolia)
NETWORK_ARGS := --rpc-url $(SEPOLIA_RPC_URL) --private-key $(PRIVATE_KEY) --broadcast --verify --etherscan-api-key $(ETHERSCAN_API_KEY) -vvvv
endif
but I was still getting an error
while running it maunally without using make mint
in the terminal it succeeded don't know why it was not working with make
Originally posted by @highHumann in #402 (reply in thread)
@guyInTheChair Did you save the file?
Originally posted by @alymurtazamemon in #82 (comment)
Mine gave a different error message:
Error:
Compiler run failed:
Error (7858): Expected pragma, import directive or contract/interface/library/struct/enum/constant/function/error definition.
--> script/DeploySimpleStorage.s.sol:16:1:
|
16 | }
| ^
ChatGPT tells me this:
"The error is caused by an incomplete import statement. It seems that the SimpleStorage contract is not being imported correctly.
Please make sure that the path to the SimpleStorage.sol file is correct. Double-check that the file is located in the correct directory relative to the DeploySimpleStorage.sol file.
Assuming that the SimpleStorage.sol file is in the ../src/ directory, you should update the import statement as follows:
solidity
Copy code
import {SimpleStorage} from "../src/SimpleStorage.sol";
Make sure the path is correct and try compiling the code again."
That was yesterday. Now I run the exact script (unchanged from yesterday) again, and it compiles successfully. This is the second time I had to quit the program and than continue the next day, and it suddenly works.
Any thoughts as to why?
Hey guys,
I'm having difficulties with the last part of video 1; deploying "SimpleStorage.sol" in foundry; where there is a script to deploy the smart contract.
here is the script from the first video of the course:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
// import {Script} from "../lib/forge-std/src/Script.sol";
import {Script} from "forge-std/Script.sol";
import {SimpleStorage} from "../src/SimpleStorage.sol";
contract DeploySimpleStorage is Script {
function run() external returns (SimpleStorage) {
vm.startBroadcast();
SimpleStorage simpleStorage = new SimpleStorage();
vm.stopBroadcast();
return simpleStorage;
}
}
then when I run "forge script scr/SimpleStorage.sol" in the command line. I get the following error:
[โ ] Compiling...
[โ ] Compiling 22 files with 0.8.21
[โ ฐ] Solc 0.8.21 finished in 4.80s
Compiler run successful!
Error:
Function `run()` is not implemented in your script.
I have tried the command with other test files but the issue still persists!
anyone has any ideas as to why it keeps referring to "run() " function while it has been defined within the script!
I am trying to execute a command $ source .env. Also I am in the folder : foundry-simple-storage-f23.Unfortunately it shows: "bash: .env: No such file or directory"
I have checked twice that the .env in the in the Gitignore folder under #Dotenv file
I have saved the .env in the test folder.
May be someone else also have got the same problem? PLease help. Thank you.
Lesson 1
https://www.youtube.com/watch?v=umepbfKp5rI&t=6155s
Thank you for creating the video! I noticed a small error in the caption in this screenshot - I believe it should say "on top of a Layer 1" rather than what's currently written.
It's not a major issue at all, I just wanted to provide the feedback in case it's helpful for improving the accuracy of the captions for future viewers.
Thank you again for the great work on these educational videos!
macOS (Apple Silicon)
Hi to the foundry course community :)
I noticed some unnecessary type castings in 2 contracts.
In MoodNft.sol : https://github.com/Cyfrin/foundry-nft-f23/blob/1e0cb4ed67e79f219889c3fac98fff0e766fd64b/src/MoodNft.sol#L95
casting the result of abi.encodePacked()
into a bytes
variable (array of bytes) is redondant as abi.encodePacked()
result is itself an array of bytes.
Same thing happens in DeployMoodNft.s.sol : https://github.com/Cyfrin/foundry-nft-f23/blob/1e0cb4ed67e79f219889c3fac98fff0e766fd64b/script/DeployMoodNft.s.sol#L41-L43
This time, abi.encodePacked()
result, which is of bytes types, is converted to string, and then back to bytes.
I removed these castings and everything compiles and works well.
I can make a PR in the MoodNft repo if you confirm this issue.
Thanks a lot to @PatrickAlphaC for this AMAZING content :) !!!!
Lesson 6
https://youtu.be/umepbfKp5rI?si=UOKIZgpCAJoqP_gP&t=28405
Windows
I have this issue when type "npx thirdweb deploy"
const raw = this.data.get(problem.where).raw?.[problem.from]
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/mnt/c/Users/admin/AppData/Roaming/nvm/v19.4.0/node_modules/npm/lib/utils/config/definition.js:33:5)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
When going to chain.link/education/defi
link in Lesson1 section = `
What have Smart Contracts done so far?` . It is showing that the link is bad, that is its showing error 406. Maybe you can update the link, or I can do so.
Make File Command From Chapter 7 Is not working for some users.
The Install Make Command for Users who have installed Ubantu as a VM in Windows was not working; hence, I wanted to add the alternative link, which is from the official documentation with a tutorial.
So when we were doing the conversion of user deposited collateral to USD we loop through each token supported by our contract and get the balance of the user for each of them and then went ahead to add it all up to the total collateral deposited , code below
function getTotalCollateralDepositedByUser(address _user) private view returns(uint256 _totalCollateralDeposited){
for(uint256 i; i < s_protocolSupportedCollateralToken.length; i++){
address[] memory copied_s_protocolSupportedCollateralToken = s_protocolSupportedCollateralToken;
address token = copied_s_protocolSupportedCollateralToken[i];
uint256 balanceOnToken = s_userToAmountDepositedOnVariousCollateralToken[_user][token];
_totalCollateralDeposited += balanceOnToken;
}
return _totalCollateralDeposited;
}
The above code seem very fine and okay , but lets assume the scenario where a user deposited 1 eth and 2 btc to our protocol, doing the above would help get the total deposited collateral but i think we would have problem when we want to convert the total collateral deposited to USD, the reason being which of the token USD price would we be using ?.
We never ran into that issue during the tutorial because we never deposited wbtc which makes everything turns out as expected.
So i think we are supposed to get the total collateral deposited by a user for each of the supported token store them separately and and then get the equivalent USD price for each of them separately and after getting the USD value for each of the deposited Collateral then we can sum them to have the total collateral deposited by each user in USD. like that we would be calculating the USD value for different token with their respective USD price.
Maybe i am not making sense but thats what i found and i think i should share as @PatrickAlphaC mentions the code would be going through an Audit. Thanks for all you do @PatrickAlphaC.
If this is confirmed to make sense then i would fork the repo and make the amendment, thanks ๐
In the video, the constructor takes a single argument: address _vrfCoordinator.
In the updated code of VRFV2WrapperConsumerBase.sol, it takes two.
Namely:
constructor(address _link, address _vrfV2Wrapper) { LINK = LinkTokenInterface(_link); VRF_V2_WRAPPER = VRFV2WrapperInterface(_vrfV2Wrapper); }
Stuck at this point.
Confused as to what it needs as the second argument.
We should split up sections into TikToks and YouTube shorts
Lesson 6
https://youtu.be/umepbfKp5rI?t=25596
The Better TOML extension is deprecated, and the Even Better TOML extension should be used.
Lesson 7
https://youtu.be/sas02qSFZ74?list=PL4Rj_WH6yLgWe7TxankiqkrkVKXIwOP42&t=1649
The -m regex
option to forge test
is deprecated. See --match-test
.
2(d11ts1)/1^-b^^-2/9 + ddx(Ass.V).dmb
R2 = rm^2 + 2/1 (oh^-eipi^n2-2mf.rsc
n^3x.u'/ r^2, 64pi rnt?d3/4.int
-L^2 = 0rc . g3/2pi / Am^-pu.u*.lk
z = r^2 v^2 - 2*.zip
3+1/2Nmf = -Aq' . 1/2hco.dnc
Trc . dt^2 = oH
OH = 5Tu' . 3/5q^2
dryHe = Frv^vu^2
10KT = / . 2/1 Api/-pu.ucc
DM = ds^5/4 - pu^-2mรป'. -hu!
arcsen^2 = Apu'-mf'/1
5/0- . Mo - ddt^2E = GEo . Q^nk . pEc - Ec2
dt = 3/2j - dc2 . t^h + KPR+-4/27
mu^2 = -t^2 + arcsen r^216pirsc^-2/1
s = -2/1 rsc^2 - TKqu' +DEc
o = -pmiEc't^3/2
a = d-pmu . QPRRct
q = +- -2/1dp (-R)
cos159 = ^8pi^KPR 24/7 + 2/3 pidrt^2ms / r^2arsen3/0
FRmo = Amu + KP445 -r^2h
gcr =dt^3 . -1/2dt
Lesson 9
https://youtu.be/sas02qSFZ74?t=14685
Love the videos, they have been very helpful. Just noticed a minor error when explaining modulo which might trip someone up if they haven't come across it before. Examples shown on remix in the demo are the wrong way around.
It shows on screen (line 11):
// 2 % 2 = 0. 2 % 3 = 1. 2 % 6 = 0. 2 % 7 = 1
What it should be:
// 2 % 2 = 0. 3 % 2 = 1. 6 % 2 = 0. 7 % 2 = 1
Lesson 9
https://youtu.be/sas02qSFZ74?t=18743
Windows
I am in Lesson 9. In the following test, I don't get why the test need to "emit RaffleEnter(PLAYER)"?
in test/unit/RaffleTest.s.sol
function testEmitsEventOnEntrance() public {
// Arrange
vm.prank(PLAYER);
// Act / Assert
vm.expectEmit(true, false, false, false, address(raffle));
emit RaffleEnter(PLAYER); // todo: shuoldn't the next call emit?
raffle.enterRaffle{value: raffleEntranceFee}();
}
I ask this because the next call "raffle.enterRaffle{value: raffleEntranceFee}()" will emit the event,
in src/Raffle.sol
function enterRaffle() public payable {
// require(msg.value >= i_entranceFee, "Not enough value sent");
// require(s_raffleState == RaffleState.OPEN, "Raffle is not open");
if (msg.value < i_entranceFee) {
revert Raffle__SendMoreToEnterRaffle();
}
if (s_raffleState != RaffleState.OPEN) {
revert Raffle__RaffleNotOpen();
}
s_players.push(payable(msg.sender));
// Emit an event when we update a dynamic array or mapping
// Named events with the function name reversed
emit RaffleEnter(msg.sender);
}
Lesson 1
https://youtu.be/umepbfKp5rI?t=25276
macOS (Intel)
Hi everyone,
I have ran forge init and I'm getting the following error message. Can't figure out how to get over this issue and would love help. Thanks.
jordanbishop@Jordans-MacBook-Pro foundry-simple-storage-f23 % forge init
โโโโโโโโโโโโโโ
โ 'init' is not a valid subcommand. See 'forge --help'
โโโโโโโโโโโโโโ
โน Did you mean this?
- forge join
- forge asset
- forge config
- forge help
- forge install
- forge logs
- forge ls
- forge ps
- forge start
- forge stop
- forge tx
- forge use
- forge web
I also ran forge which and got the following.
jordanbishop@Jordans-MacBook-Pro foundry-simple-storage-f23 % which forge
/usr/local/bin/forge
here is my integration script.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Script, console} from "forge-std/Script.sol";
import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol";
import {FundMe} from "../src/FundMe.sol";
contract FundFundMe is Script {
uint256 SEND_VALUE = .1 ether;
function fundFundMe(address mostrecentDeployment) public {
FundMe(payable(mostrecentDeployment)).fund{value: SEND_VALUE}();
console.log("EgtgGE%s", SEND_VALUE);
}
function run() external {
address mostrecentDeployment = DevOpsTools.get_most_recent_deployment(
"FundMe",
block.chainid
);
console.log("ugh9uq3r9grtgqegffuuuefbufueu");
vm.startBroadcast();
fundFundMe(mostrecentDeployment);
vm.stopBroadcast();
}
}
and trace are
[1139609] โ new DevOpsTools@0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496
โโ โ 5692 bytes of code
[277305] โ new FundFundMe@0x34A1D3fff3958843C43aD80F30b94c510645C316
โโ โ 1164 bytes of code
[57509] FundFundMe::run()
โโ [33494] DevOpsTools::get_most_recent_deployment("FundMe", 31337 [3.133e4]) [delegatecall]
โ โโ [0] VM::readDir("./broadcast", 3) [staticcall]
โ โ โโ โ [("IO error for operation on /home/kalmrigaya/hello_foundry/foundry-fund-me/broadcast: No such file or directory (os error 2)", "/home/kalmrigaya/hello_foundry/foundry-fund-me/broadcast", 0, false, false)]
โ โโ [0] VM::toString(31337 [3.133e4]) [staticcall]
โ โ โโ โ "31337"
โ โโ โ revert: No run-latest.json file found for specified chain
โโ โ revert: No run-latest.json file found for specified chain
Gas used: 57509
Error:
script failed: revert: No run-latest.json file found for specified chain
Our NFTs allow people to add their twitter handle, it would be awesome if we had a bot tweet to someone's handle whenever they minted an NFT!
Here is the contract:
https://arbiscan.io/address/0x39338138414Df90EC67dC2EE046ab78BcD4F56D9#code
Additionally, having a website that shows a real-time list of people minting would be awesome.
I'm down to pay someone to work on this as well!
Lesson 7
No response
Windows
here i am trying to run test using forge test.
fund me.sol
function fund() public payable {
if (msg.value.conversionRate(s_priceFeed) < MINIMUM_USD) {
revert Not_Sufficient_Amount();
}```
test.sol
``` function testFailWithoutEnoughEth() public {
// this test supposed to be passed when we don't have enough eth to
vm.expectRevert(); // the next line should revert
fundMe.fund(); // here we are trying to send the zero eth to
}```
this test should be passed as i am using vm.expectRevert() here why this test failing
The following question was raised in discussions:
Originally posted by Glow-in-the-dark July 8, 2023
in DecentralisedStableCoin.sol, it inherits the 1) ERC20Burnable, which inherits the ERC20, and also the 2) Ownable contract.
However, the constructor of the DecentralizedStableCoin contract, only seems to initiate the constructor of the ERC20() , but not the Ownable() contract, which also have a constructor.
contract DecentralizedStableCoin is ERC20Burnable, Ownable {
error DecentralizedStableCoin__MustBeMoreThanZero();
error DecentralizedStableCoin__BurnAmountExceedsBalance();
error DecentralizedStableCoin__NotZeroAddress();
constructor () ERC20 ("DecentralizedStableCoin","DSC") {
}
why is it not something like:
constructor () ERC20("DecentralizedStableCoin","DSC") Ownable(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266){
}
since under "Ownable.sol", there is a constructor, which is:
constructor(address initialOwner) {
_transferOwnership(initialOwner);
}
My underrstanding is that the child contract inheriting the parent contract, will need to also include the parent's constructor.
Whis is the example:
https://github.com/Cyfrin/foundry-defi-stablecoin-f23/blob/main/src/DecentralizedStableCoin.sol
it inherits both parents, but only instantiate the ERC20 token, and does not include the Ownable's constructor.
There was an update to OpenZeppelin's code two months ago that changed from the code that's used in the course, to what's shown above.
Since the update, address of the owner must be entered manually through the constructor parameter.
I suggest noting this change on YouTube, and I'll also note this in the Decentralized coin repo.
So on the Readme File for chapter 7 the link to chainking brownie Contract is not present would like to add that link in Readme.md file.
It will be used to import contracts.
timestamp for refernce https://youtu.be/sas02qSFZ74?t=467
Lesson 7
No response
Windows
i don't know why it's didn't revert!
here is part of test code:
contract FundMeTest is Test {
// constructor() {
// }
FundMe fundMe;
address SENDER = makeAddr("jaunepr");
uint256 constant SEND_VALUE = 1 ether;
uint256 constant SENDER_BALANCE = 10 ether;
// uint256 constant FUNDERS_INDEX = 0;
function setUp() external {
DeployFundMe deployFundMe = new DeployFundMe();
fundMe = deployFundMe.run();
vm.deal(SENDER, SENDER_BALANCE);
}
modifier funded() {
vm.prank(SENDER);
fundMe.Fund{value: SEND_VALUE}();
_;
}
function testOnlyOwnerCanWithdraw() public funded {
vm.prank(SENDER);
vm.expectRevert();
fundMe.Withdraw();
}
and i use forge test --match-test testOnlyOwnerCanWithdraw -vvv
then, here is ouput:
[FAIL. Reason: call did not revert as expected] testOnlyOwnerCanWithdraw() (gas: 108176)
Traces:
[108176] FundMeTest::testOnlyOwnerCanWithdraw()
โโ [0] VM::prank(jaunepr: [0xD32aC66b047b3Ba085a452E26814BD4F20A99929])
โ โโ โ ()
โโ [81354] FundMe::Fund{value: 1000000000000000000}()
โ โโ [8993] MockV3Aggregator::latestRoundData() [staticcall]
โ โ โโ โ 1, 200000000000 [2e11], 1, 1, 1
โ โโ โ ()
โโ [0] VM::prank(jaunepr: [0xD32aC66b047b3Ba085a452E26814BD4F20A99929])
โ โโ โ ()
โโ [0] VM::expectRevert(custom error f4844814:)
โ โโ โ ()
โโ [6788] FundMe::Withdraw()
โ โโ [0] jaunepr::fallback{value: 1000000000000000000}()
โ โ โโ โ ()
โ โโ โ ()
โโ โ call did not revert as expected
Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 1.75ms
Ran 1 test suites: 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:
Encountered 1 failing test in test/FundMeTest.t.sol:FundMeTest
[FAIL. Reason: call did not revert as expected] testOnlyOwnerCanWithdraw() (gas: 108176)
Encountered a total of 1 failing tests, 0 tests succeeded
I was going through readme file In lesson 9 in which we deploy our own Link Token contract for anvil chain ht direct link to the contract was not there. It would be better if its included in the readme file with the time stamp.
forge install transmissions11/solmate --no-commit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.