How to Implement a Minimum Funding Requirement in a Solidity Smart Contract? #6595
Unanswered
KuldeepSonara
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently developing a Solidity smart contract named FundMe, where users can contribute funds in Ether (ETH). I'm aiming to enforce a minimum funding requirement of $50 USD equivalent. However, I'm encountering issues with the implementation, particularly with the conversion rate calculation and the enforcement of the minimum value.
Here's the relevant portion of my contract:
However, when I attempt to send a transaction with an amount of 0.02 ETH, which according to my calculations equals approximately $57.72, I receive the error message "Didn't Send Enough". Similarly, when inspecting the minimumUsd variable using a function call, it displays a value of 50 ETH equivalent to $143,875.00, which seems incorrect.
Could someone please assist me in correcting the conversion rate calculation and ensuring that the minimum funding requirement is accurately enforced in USD? Additionally, any guidance on how to correctly set the minimum value to $50 USD equivalent would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions