problem with reverted when testing fundMe in lession 7 #6379
Replies: 4 comments 6 replies
-
I am facing the same problem... could anyone help pleasee??? @PatrickAlphaC |
Beta Was this translation helpful? Give feedback.
-
i checked your repo @Vinhnv0901 . i know this is not related to the question but you commited your .env file to your repo . you should always git ignore your .env file because it contains sensitive information. have a nice day. |
Beta Was this translation helpful? Give feedback.
-
What happens when you all clone this repo and try the code that is here? |
Beta Was this translation helpful? Give feedback.
-
Hi @Vinhnv0901, I went through the code in the repository you provided, and it seems there's an error in the Your code: function getPrice(
AggregatorV3Interface priceFeed
) internal view returns (uint256) {
(, int256 answer, , , ) = priceFeed.latestRoundData();
return uint256(answer * 10000000000);
} The correct code should be: function getPrice(
AggregatorV3Interface priceFeed
) internal view returns (uint256) {
(, int256 answer, , , ) = priceFeed.latestRoundData();
return uint256(answer * 1e18);
} There should be 18 zeros (0) instead of 10. Feel free to adjust as needed! Happy learning! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In my smart contract there is a function:
when I test fund() with is code:
I run
yarn hardhat test
then I get :this is code on github
I hope to receive everyone's help and opinions.
Beta Was this translation helpful? Give feedback.
All reactions