Broke something in fundmetest.s.sol when creating testWithDrawFromMultipleFundersCheaper #325
Replies: 1 comment 1 reply
-
Your testFundUpdatesFundeddataStructure() is calling the getAddressToAmountFunded function with the wrong address it should be as follows: uint256 amountFunded = fundMe.getAddressToAmountFunded(USER); As for why the testWithDrawFromMultipleFundersCheaper() is failing, upon tracing back to you cheaperWithdraw() function , the call is missing and it should be okay once you add the following line: (bool callSuccess, ) = payable(msg.sender).call{value: address(this).balance}("");
require(callSuccess, "Call failed"); Similar to our previous withdraw() function. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was following the course in Lesson 7 and around 1:53:26 Patrick says to copy testWithDrawFromMultipleFunders and paste it and convert it to testWithDrawFromMultipleFundersCheaper. Then within testWithDrawFromMultipleFundersCheaper only change fundMe.withdraw to fundMe.cheaperWithdraw. Then run forge snapshot. Unfortunately, even in this simple step, I managed to break something :( .
Here is my error code when i run forge snapshot -
i tried to narrow down the problem but i dont understand what the problem is here-
here is fundme.sol-
here is fundmetest.s.sol-
Can anyone help me solve this problem on why I have 2 failing tests? thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions