Giter VIP home page Giter VIP logo

Comments (5)

ChefAharoni avatar ChefAharoni commented on September 14, 2024

Problems and bugs should be opened in the discussion part; this section is for issues in the course / repo / etc..

In any case, have you tried prompting ChatGPT or any other AI for this problem?
This is the prompt I got when copied your issue to it, this might help:

If your test is failing, it's possible that the fundMe.fund() method is not actually triggering the revert Not_Sufficient_Amount(); as expected.

There could be several reasons why your test is failing:

  1. There is a sufficient amount of Ether: As per the condition in your contract, if msg.value.conversionRate(s_priceFeed) is greater than or equal to MINIMUM_USD, then the contract will not revert. Please ensure that when you call fundMe.fund() in your test, you are not sending any Ether or the conversion rate results in a value that is less than MINIMUM_USD.

  2. Price feed data issue: If s_priceFeed doesn't return the expected value, the condition may not evaluate as expected. Make sure the oracle data feed is providing the correct value.

  3. Error in expectRevert usage: Ensure you're using the expectRevert correctly. The correct syntax as per OpenZeppelin test helpers is await expectRevert.unspecified(yourFunctionCall). It could look like:

await expectRevert.unspecified(fundMe.fund());
  1. Mismatch in revert reason: If the revert reason in your test doesn't match the revert reason in your smart contract, the test will fail. If the contract code is using a custom error type like revert Not_Sufficient_Amount(); then you should specify this in your test code as follows:
await expectRevert(fundMe.fund(), "Not_Sufficient_Amount");

Without knowing more details about your fundMe.fund() implementation and the context, it's hard to give a more accurate answer. Ensure to check the aforementioned points in order to troubleshoot the issue.

from foundry-full-course-cu.

deep0072 avatar deep0072 commented on September 14, 2024

msg.value.conversionRate(s_priceFeed) here msg.value is zero then how can be it greater than zero
i have used phind.com as well. but still issue not resolved

from foundry-full-course-cu.

deep0072 avatar deep0072 commented on September 14, 2024

fix the issue by changing function name
function testFailWithoutEnoughEth() to function testFundFailsWithoutEnoughETH()

but dont know why it fixed. anyone can explain

from foundry-full-course-cu.

DevSwayam avatar DevSwayam commented on September 14, 2024

Could you please provide the whole contract with snapshot of error?. Additionally when your using

 function testFundFailsWithoutEnoughETH() 

i guess test is not able to find function cause solidity is case sensitive hence it is passing idk. But could you share this in Discussion tab + and provide source code?

from foundry-full-course-cu.

DCVglobalnetwork avatar DCVglobalnetwork commented on September 14, 2024

Hi
Could you help me with this

image

from foundry-full-course-cu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.